[GTK] Use XDamage to simplify RedirectedXCompositeWindow
https://bugs.webkit.org/show_bug.cgi?id=97267

Reviewed by Alejandro G. Castro.

Use XDamage to queue redraws of the widget when redirecting accelerated compositing
to an offscreen window. This allows removing a finicky timer-based approach, improves
performance, and allows simplifying things greatly.

.:

* configure.ac: Add support for finding XDamage via pkg-config.

Source/WebCore:

No new tests. This is covered by existing tests.

* GNUmakefile.am: Add the XDamage CFLAGS in the appropriate place.
* platform/gtk/RedirectedXCompositeWindow.cpp:
(WebCore::getWindowHashMap): Added.
(WebCore::filterXDamageEvent): Added.
(WebCore::supportsXDamageAndXComposite): Added.
(WebCore::RedirectedXCompositeWindow::create): Fail to create the window if
the XServer doesn't support XDamage and XComposite.
(WebCore::RedirectedXCompositeWindow::RedirectedXCompositeWindow): Add XDamage support and
remove the m_usable size distinction. Add the window the window HashMap now.
(WebCore::RedirectedXCompositeWindow::~RedirectedXCompositeWindow): Remove the window
from the window HashMap.
(WebCore::RedirectedXCompositeWindow::resize): Now just immediately update the size.
(WebCore::RedirectedXCompositeWindow::callDamageNotifyCallback): Added.
* platform/gtk/RedirectedXCompositeWindow.h:
(WebCore::RedirectedXCompositeWindow::setDamageNotifyCallback): Added.

Source/WebKit/gtk:

* GNUmakefile.am: Add the XDamage CFLAGS and LIBS.
* WebCoreSupport/AcceleratedCompositingContext.h:
(AcceleratedCompositingContext): Change the signature of compositeLayersToContext
to accept an enum that explains the composite purpose.
* WebCoreSupport/AcceleratedCompositingContextGL.cpp:
(WebKit::redirectedWindowDamagedCallback): Added.
(WebKit::AcceleratedCompositingContext::initialize): Handle the situation where
the RedirectedXCompositeWindow returns a null pointer.
(WebKit::AcceleratedCompositingContext::enabled): Ditto.
(WebKit::AcceleratedCompositingContext::renderLayersToWindow): Remove the code handling
the usable size of the RedirectedXCompositeWindow. The usable size is now always equal
to the size.
(WebKit::AcceleratedCompositingContext::compositeLayersToContext): When drawing for a
resize, first clear the entire context. Remove the double swap-buffer, as it's no
longer necessary.
(WebKit::AcceleratedCompositingContext::setRootCompositingLayer): Handle the case that
the redirected window is null.
(WebKit::AcceleratedCompositingContext::resizeRootLayer): Instead of doing another
immediate layer flush, just recomposite the current layer state and schedule a new
flush. This should make resizing faster.
(WebKit::AcceleratedCompositingContext::flushAndRenderLayers): We no longer need to
queue a redraw, unless we want to force one.

Source/WebKit2:

* GNUmakefile.am: Add the XDamage CFLAGS and LIBS to the appropriate places.
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(_WebKitWebViewBasePrivate): Remove readyToRenderAcceleratedCompositingResults as
it's no longer necessary.
(webkit_web_view_base_init): Handle the situation where the RedirectedXCompositeWindow
is null.
(webkitWebViewRenderAcceleratedCompositingResults): Ditto.
(resizeWebKitWebViewBaseFromAllocation): Ditto.
(webkitWebViewBaseCreateWebPage): Ditto.
(redirectedWindowDamagedCallback): Added.
* UIProcess/WebPageProxy.h: Remove InvalidateWidget message.
* UIProcess/WebPageProxy.messages.in: Ditto.
* UIProcess/gtk/WebPageProxyGtk.cpp: Ditto.
* WebProcess/WebPage/WebPage.h: Ditto.
* WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
(WebKit::LayerTreeHostGtk::compositeLayersToContext): No longer need to
trigger the invalidateWindow message.
* WebProcess/WebPage/gtk/WebPageGtk.cpp: Ditto.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129651 268f45cc-cd09-0410-ab3c-d52691b4dbfc
(Threaded scrolling) WebKit not scrolling to the correct location upon going back on macsurfer.com
<rdar://problem/12039913> and https://bugs.webkit.org/show_bug.cgi?id=97617

Reviewed by Anders Carlsson.

In the asynchronous land of threaded scrolling we lose the information about whether or not a scroll
is programmatic.

This caused all scrolls to be treated as user scrolls and to generated scroll events.

We can fix this by passing the programmatic bit to the scrolling thread and re-applying it back in the main thread.

Unable to test threaded scrolling at this time.

Include the "Is programmatic scroll" bit in the scroll state:
* page/scrolling/ScrollingTreeState.cpp:
(WebCore::ScrollingTreeState::ScrollingTreeState):
(WebCore::ScrollingTreeState::setRequestedScrollPosition): Also set whether or not this represents a programmatic scroll.
* page/scrolling/ScrollingTreeState.h:
(ScrollingTreeState):
(WebCore::ScrollingTreeState::representsProgrammaticScroll):

Pass that bit back to the ScrollingCoordinator:
* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::ScrollingTree):
(WebCore::ScrollingTree::commitNewTreeState):
(WebCore::ScrollingTree::updateMainFrameScrollPosition):
* page/scrolling/ScrollingTree.h:

* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::requestScrollPositionUpdate): Pass the "is programmatic scroll" bit to the scrolling thread.
(WebCore::ScrollingCoordinator::updateMainFrameScrollPosition): Reset the "is programmatic scroll" bit on the FrameView.
* page/scrolling/ScrollingCoordinator.h:
(ScrollingCoordinator):

* page/FrameView.h:
(FrameView):
(WebCore::FrameView::inProgrammaticScroll): Expose setter/getters for the programmatic scroll flag.
(WebCore::FrameView::setInProgrammaticScroll):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129652 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WK2][WTR] Policy client: dumping from decidePolicyForResponse callback
https://bugs.webkit.org/show_bug.cgi?id=97034

Patch by Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> on 2012-09-26
Reviewed by Kenneth Rohde Christiansen.

Source/WebCore:

Exported WebCore::ResourceResponseBase::isAttachment() method for MAC port.

No new tests. No functionality added.

* WebCore.exp.in:

Source/WebKit2:

Added suggested filename getter to WKURLResponse interface and also added a property showing whether the response
is attachment.

* Shared/API/c/WKURLResponse.cpp:
(WKURLResponseSuggestedFilename):
(WKURLResponseIsAttachment):
* Shared/API/c/WKURLResponse.h:

Tools:

Provided dumping from WTR Policy client 'decidePolicyForResponse' callback.

* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::decidePolicyForResponse):

LayoutTests:

Unskipped some of http/tests/download tests from wk2/Skipped, put those which still fail
to an appropriate group in wk2/Skipped file. All of the http/tests/download tests still fail
for EFL WK1.

* platform/efl-wk1/TestExpectations:
* platform/efl/TestExpectations:
* platform/wk2/Skipped:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129653 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Implement the GetStats interface on PeerConnection
https://bugs.webkit.org/show_bug.cgi?id=95193

Source/Platform:

Patch by Harald Tveit Alvestrand <harald@alvestrand.no> on 2012-09-26
Reviewed by Adam Barth.

* chromium/public/WebRTCPeerConnectionHandler.h:
(WebKit):
(WebRTCPeerConnectionHandler):
(WebKit::WebRTCPeerConnectionHandler::getStats):
* chromium/public/WebRTCStatsRequest.h: added.
(WebCore):
(WebKit):
(WebRTCStatsRequest):
(WebKit::WebRTCStatsRequest::WebRTCStatsRequest):
(WebKit::WebRTCStatsRequest::~WebRTCStatsRequest):
(WebKit::WebRTCStatsRequest::operator=):

Source/WebCore:

Specification:
http://dev.w3.org/2011/webrtc/editor/webrtc-20120920.html

Patch by Harald Tveit Alvestrand <harald@alvestrand.no> on 2012-09-26
Reviewed by Adam Barth.

The implementation consists of a pure virtual platform object
(RTCStatsRequest) that is implemented in WebCore, and stores
its information in a straightforward data hierarchy.
This patch adds the call path and the storage structures.
It does not add filling in data.

Test: fast/mediastream/RTCPeerConnection-stats.html

* CMakeLists.txt:
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::getStats):
(WebCore):
* Modules/mediastream/RTCPeerConnection.h:
(WebCore):
(RTCPeerConnection):
* Modules/mediastream/RTCPeerConnection.idl:
* Modules/mediastream/RTCStatsCallback.h: Added.
(WebCore):
(RTCStatsCallback):
(WebCore::RTCStatsCallback::~RTCStatsCallback):
* Modules/mediastream/RTCStatsCallback.idl: Added.
* Modules/mediastream/RTCStatsElement.cpp: Added.
(WebCore):
(WebCore::RTCStatsElement::create):
(WebCore::RTCStatsElement::RTCStatsElement):
(WebCore::RTCStatsElement::stat):
* Modules/mediastream/RTCStatsElement.h: Added.
(WebCore):
(RTCStatsElement):
* Modules/mediastream/RTCStatsElement.idl: Added.
* Modules/mediastream/RTCStatsReport.cpp: Added.
(WebCore):
(WebCore::RTCStatsReport::create):
(WebCore::RTCStatsReport::RTCStatsReport):
* Modules/mediastream/RTCStatsReport.h: Added.
(WebCore):
(RTCStatsReport):
(WebCore::RTCStatsReport::local):
(WebCore::RTCStatsReport::remote):
* Modules/mediastream/RTCStatsReport.idl: Added.
* Modules/mediastream/RTCStatsRequestImpl.cpp: Added.
(WebCore):
(WebCore::RTCStatsRequestImpl::create):
(WebCore::RTCStatsRequestImpl::RTCStatsRequestImpl):
(WebCore::RTCStatsRequestImpl::~RTCStatsRequestImpl):
(WebCore::RTCStatsRequestImpl::requestSucceeded):
(WebCore::RTCStatsRequestImpl::stop):
(WebCore::RTCStatsRequestImpl::clear):
* Modules/mediastream/RTCStatsRequestImpl.h: Added.
(WebCore):
(RTCStatsRequestImpl):
* Modules/mediastream/RTCStatsResponse.cpp: Added.
(WebCore):
(WebCore::RTCStatsResponse::create):
(WebCore::RTCStatsResponse::RTCStatsResponse):
* Modules/mediastream/RTCStatsResponse.h: Added.
(WebCore):
(RTCStatsResponse):
(WebCore::RTCStatsResponse::result):
* Modules/mediastream/RTCStatsResponse.idl: Added.
* WebCore.gypi:
* platform/chromium/support/WebRTCStatsRequest.cpp: Copied from Source/Platform/chromium/public/WebRTCPeerConnectionHandler.h.
(WebKit):
(WebKit::WebRTCStatsRequest::WebRTCStatsRequest):
(WebKit::WebRTCStatsRequest::assign):
(WebKit::WebRTCStatsRequest::reset):
(WebKit::WebRTCStatsRequest::requestSucceeded):
* platform/mediastream/RTCPeerConnectionHandler.h:
(WebCore):
(RTCPeerConnectionHandler):
* platform/mediastream/RTCStatsRequest.h: Copied from Source/WebCore/platform/mediastream/RTCPeerConnectionHandler.h.
(WebCore):
(RTCStatsRequest):
(WebCore::RTCStatsRequest::~RTCStatsRequest):
(WebCore::RTCStatsRequest::RTCStatsRequest):
* platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.cpp:
(WebCore::RTCPeerConnectionHandlerChromium::getStats):
(WebCore):
* platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.h:
(RTCPeerConnectionHandlerChromium):

Tools:

Patch by Harald Tveit Alvestrand <harald@alvestrand.no> on 2012-09-26
Reviewed by Adam Barth.

* DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp:
(RTCStatsRequestSucceededTask):
(RTCStatsRequestSucceededTask::RTCStatsRequestSucceededTask):
(MockWebRTCPeerConnectionHandler::getStats):
* DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h:
(MockWebRTCPeerConnectionHandler):

LayoutTests:

Patch by Harald Tveit Alvestrand <harald@alvestrand.no> on 2012-09-26
Reviewed by Adam Barth.

* fast/mediastream/RTCPeerConnection-stats-expected.txt: Added.
* fast/mediastream/RTCPeerConnection-stats.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129654 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] Unreviewed buildfix after r129647.

* platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp: Revert incorrect include reordering.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129655 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Change FractionalLayoutUnit denominator to 64 to reduce precision loss when converting to floating point
https://bugs.webkit.org/show_bug.cgi?id=96139

Reviewed by Eric Seidel.

Source/WebCore: 

We currently use a denominator of 60 in FractionalLayoutUnit,
this causes a loss of precision when converting to floating
point.
        
By changing the denominator to 64 the values can better be
represented as floating point (without loosing any precision for
many values), this in turn allows us to remove the tolerance
hack in the line break logic and avoids problems caused by this
precision for web sites that do their own layout based on
element measurements.

Test: fast/sub-pixel/float-precision.html

* platform/FractionalLayoutUnit.h:
Change denominator to 64.
* rendering/RenderBlockLineLayout.cpp:
(WebCore::LineWidth::fitsOnLine):
Remove epsilon tolerance hack.

LayoutTests: 

Add new precision test and adjust expectations for existing tests as needed.

* fast/sub-pixel/float-precision-expected.html: Added.
* fast/sub-pixel/float-precision.html: Added.
* fast/sub-pixel/float-wrap-with-subpixel-top-expected.html:
* fast/sub-pixel/float-wrap-with-subpixel-top.html:
* fast/sub-pixel/layout-boxes-with-zoom-expected.html:
* fast/sub-pixel/layout-boxes-with-zoom.html:
* fast/sub-pixel/size-of-box-with-zoom-expected.html:
* fast/sub-pixel/size-of-box-with-zoom.html:
* platform/chromium-linux/css1/formatting_model/inline_elements-expected.txt:
* platform/chromium-linux/css2.1/t090501-c414-flt-03-b-g-expected.txt:
* platform/chromium-linux/fast/backgrounds/background-position-parsing-expected.txt:
* platform/chromium-linux/fast/block/margin-collapse/103-expected.txt:
* platform/chromium-linux/fast/borders/border-antialiasing-expected.png:
* platform/chromium-linux/fast/borders/border-radius-huge-assert-expected.png:
* platform/chromium-linux/fast/box-sizing/box-sizing-expected.png:
* platform/chromium-linux/fast/css/bidi-override-in-anonymous-block-expected.txt:
* platform/chromium-linux/fast/css/hsl-color-expected.png:
* platform/chromium-linux/fast/dom/HTMLMeterElement/meter-styles-expected.png:
* platform/chromium-linux/fast/encoding/utf-16-big-endian-expected.txt:
* platform/chromium-linux/fast/encoding/utf-16-little-endian-expected.txt:
* platform/chromium-linux/fast/forms/date/date-appearance-expected.png:
* platform/chromium-linux/fast/forms/form-element-geometry-expected.txt:
* platform/chromium-linux/fast/html/details-add-summary-1-expected.png:
* platform/chromium-linux/fast/html/details-add-summary-10-and-click-expected.png:
* platform/chromium-linux/fast/html/details-add-summary-2-expected.png:
* platform/chromium-linux/fast/html/details-add-summary-3-expected.png:
* platform/chromium-linux/fast/html/details-add-summary-4-expected.png:
* platform/chromium-linux/fast/html/details-add-summary-5-expected.png:
* platform/chromium-linux/fast/html/details-add-summary-6-and-click-expected.png:
* platform/chromium-linux/fast/html/details-add-summary-7-and-click-expected.png:
* platform/chromium-linux/fast/html/details-add-summary-8-and-click-expected.png:
* platform/chromium-linux/fast/html/details-add-summary-9-and-click-expected.png:
* platform/chromium-linux/fast/html/details-marker-style-expected.png:
* platform/chromium-linux/fast/html/details-no-summary1-expected.png:
* platform/chromium-linux/fast/html/details-no-summary3-expected.png:
* platform/chromium-linux/fast/html/details-open-javascript-expected.png:
* platform/chromium-linux/fast/html/details-open1-expected.png:
* platform/chromium-linux/fast/html/details-open3-expected.png:
* platform/chromium-linux/fast/html/details-open5-expected.png:
* platform/chromium-linux/fast/html/details-position-expected.png:
* platform/chromium-linux/fast/html/details-remove-summary-1-expected.png:
* platform/chromium-linux/fast/html/details-remove-summary-2-expected.png:
* platform/chromium-linux/fast/html/details-remove-summary-3-expected.png:
* platform/chromium-linux/fast/html/details-remove-summary-4-and-click-expected.png:
* platform/chromium-linux/fast/html/details-remove-summary-5-and-click-expected.png:
* platform/chromium-linux/fast/html/details-remove-summary-6-and-click-expected.png:
* platform/chromium-linux/fast/html/details-writing-mode-expected.png:
* platform/chromium-linux/fast/multicol/vertical-rl/float-multicol-expected.png:
* platform/chromium-linux/fast/parser/style-script-head-test-expected.txt:
* platform/chromium-linux/fast/text/line-breaks-expected.txt:
* platform/chromium-linux/svg/custom/use-css-no-effect-on-shadow-tree-expected.png:
* platform/chromium-linux/svg/custom/viewBox-hit-expected.png:
* platform/chromium-linux/svg/wicd/rightsizing-grid-expected.png:
* platform/chromium-linux/svg/wicd/test-rightsizing-b-expected.png:
* platform/chromium-linux/svg/wicd/test-rightsizing-b-expected.txt:
* platform/chromium-linux/svg/zoom/page/zoom-background-images-expected.png:
* platform/chromium-linux/svg/zoom/page/zoom-hixie-mixed-009-expected.png:
* platform/chromium-linux/svg/zoom/page/zoom-img-preserveAspectRatio-support-1-expected.png:
* platform/chromium-linux/svg/zoom/page/zoom-mask-with-percentages-expected.png:
* platform/chromium-linux/svg/zoom/page/zoom-svg-float-border-padding-expected.png:
* platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-absolute-size-2-expected.png:
* platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-absolute-size-2-expected.txt:
* platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-absolute-size-expected.png:
* platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-absolute-size-expected.txt:
* platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-override-size-expected.png:
* platform/chromium-linux/svg/zoom/page/zoom-svg-through-object-with-percentage-size-expected.png:
* platform/chromium-linux/svg/zoom/text/zoom-svg-float-border-padding-expected.png:
* platform/chromium-linux/tables/mozilla/bugs/bug2479-4-expected.txt:
* platform/chromium-linux/tables/mozilla/bugs/bug46480-1-expected.png:
* platform/chromium-linux/tables/mozilla/bugs/bug46480-2-expected.png:
* platform/chromium-win/compositing/visibility/visibility-image-layers-dynamic-expected.txt:
* platform/chromium-win/css1/formatting_model/vertical_formatting-expected.txt:
* platform/chromium-win/css2.1/t080301-c411-vt-mrgn-00-b-expected.txt:
* platform/chromium-win/fast/block/float/shrink-to-avoid-float-complexity-expected.txt:
* platform/chromium-win/fast/css/hsl-color-expected.txt:
* platform/chromium-win/fast/dom/HTMLMeterElement/meter-optimums-expected.txt:
* platform/chromium-win/fast/dom/HTMLMeterElement/meter-styles-expected.txt:
* platform/chromium-win/fast/multicol/span/span-as-immediate-child-complex-splitting-expected.txt:
* platform/chromium-win/fast/multicol/span/span-as-immediate-child-generated-content-expected.txt:
* platform/chromium-win/fast/multicol/span/span-as-immediate-columns-child-dynamic-expected.txt:
* platform/chromium-win/fast/multicol/span/span-as-immediate-columns-child-expected.txt:
* platform/chromium-win/fast/multicol/span/span-as-nested-columns-child-dynamic-expected.txt:
* platform/chromium-win/fast/multicol/span/span-as-nested-columns-child-expected.txt:
* platform/chromium-win/fast/multicol/span/span-margin-collapsing-expected.txt:
* platform/chromium-win/fast/text/whitespace/024-expected.txt:
* platform/chromium-win/svg/wicd/rightsizing-grid-expected.txt:
* platform/chromium-win/svg/zoom/page/zoom-hixie-mixed-009-expected.txt:
* platform/chromium-win/svg/zoom/page/zoom-replaced-intrinsic-ratio-001-expected.txt:
* platform/chromium-win/tables/mozilla/bugs/bug2479-1-expected.txt:
* platform/chromium-win/tables/mozilla/other/test3-expected.txt:
* platform/chromium-win/tables/mozilla_expected_failures/bugs/bug91057-expected.txt:
* platform/chromium/fast/css/getComputedStyle/getComputedStyle-margin-percentage-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129656 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reorder Cairo WebCore includes
https://bugs.webkit.org/show_bug.cgi?id=97679

Reviewed by Simon Hausmann.

* platform/graphics/cairo/FontCairo.cpp:
* platform/graphics/cairo/GraphicsContextCairo.cpp:
* platform/graphics/cairo/TransformationMatrixCairo.cpp:
* platform/wx/wxcode/cairo/non-kerned-drawing.cpp:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129657 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Update padding in ensureFocusTextElementVisible to be DPI independent.
https://bugs.webkit.org/show_bug.cgi?id=97684

Reviewed by Rob Buis.

Update padding in ensureFocusTextElementVisible to be DPI
independent and relative to the current zoom level.

Reviewed Internally by Gen Mak.

* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::ensureFocusTextElementVisible):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129658 268f45cc-cd09-0410-ab3c-d52691b4dbfc