Make it possible to test page overlays
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 4 Oct 2014 08:47:04 +0000 (08:47 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 4 Oct 2014 08:47:04 +0000 (08:47 +0000)
commit049a3561adb980e43dfa70837d0629e9811ad231
treef9f3ccab9ee1afb0e4cb4966a0b8fc34499f33d2
parent0d531d5f97a2d081578d0b8d67c3743cd87aea5b
Make it possible to test page overlays
https://bugs.webkit.org/show_bug.cgi?id=137339

Reviewed by Dan Bernstein.

Tests: pageoverlay/overlay-installation.html
       pageoverlay/overlay-large-document-scrolled.html
       pageoverlay/overlay-large-document.html

Do some initial work to make page overlays testable.
There are many more tests to be written, but this lays the groundwork.

* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:
* WebCore.vcxproj/WebCoreTestSupport.vcxproj:
* WebCore.vcxproj/WebCoreTestSupport.vcxproj.filters:
* CMakeLists.txt:
Add MockPageOverlayClient.

* platform/graphics/GraphicsLayer.h:
* page/PageOverlayController.h:
* page/PageOverlayController.cpp:
(WebCore::PageOverlayController::shouldSkipLayerInDump):
Don't skip PageOverlayController-owned layers in the layer tree dump if the
layerTreeAsText behavior says that we should include them.

* platform/graphics/GraphicsLayer.cpp:
(WebCore::dumpChildren):

* platform/graphics/GraphicsLayerClient.h:
(WebCore::GraphicsLayerClient::shouldSkipLayerInDump):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::shouldSkipLayerInDump):
* rendering/RenderLayerBacking.h:
Pass the LayerTreeAsTextBehavior through shouldSkipLayerInDump.

* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
Uninstall all page overlays when resetting to a consistent state.

(WebCore::Internals::installMockPageOverlay):
(WebCore::Internals::pageOverlayLayerTreeAsText):
Expose two new internals functions.
installMockPageOverlay takes "view" or "document", allowing script
to choose the appropriate overlay type.
pageOverlayLayerTreeAsText dumps both view and document-relative
overlays, from each overlay container layer.

* testing/Internals.h:
* testing/Internals.idl:
Fix some typos.

* testing/MockPageOverlayClient.cpp: Added.
(WebCore::MockPageOverlayClient::shared):
(WebCore::MockPageOverlayClient::MockPageOverlayClient):
(WebCore::MockPageOverlayClient::installOverlay):
(WebCore::MockPageOverlayClient::uninstallAllOverlays):
(WebCore::MockPageOverlayClient::layerTreeAsText):
(WebCore::MockPageOverlayClient::pageOverlayDestroyed):
(WebCore::MockPageOverlayClient::willMoveToPage):
(WebCore::MockPageOverlayClient::didMoveToPage):
When the overlay is parented, mark it as needing repaint.
Future tests might want to test overlays without content,
but for now this is a reasonable default behavior.

(WebCore::MockPageOverlayClient::drawRect):
Paint the overlay rects as described in the LayoutTests ChangeLog.

(WebCore::MockPageOverlayClient::mouseEvent):
(WebCore::MockPageOverlayClient::didScrollFrame):
(WebCore::MockPageOverlayClient::copyAccessibilityAttributeStringValueForPoint):
(WebCore::MockPageOverlayClient::copyAccessibilityAttributeBoolValueForPoint):
(WebCore::MockPageOverlayClient::copyAccessibilityAttributeNames):

* testing/MockPageOverlayClient.h: Added.

* pageoverlay/overlay-installation.html: Added.
Add a test which just installs one view-relative and one document-relative
overlay, and dumps the layer tree and pixel results. The mock overlay
strokes a blue rectangle (inset a little from the overlay bounds) for
view-relative overlays, and a green rectangle (inset a bit more) for
document-relative overlays.

* pageoverlay/overlay-large-document.html: Added.
* pageoverlay/overlay-large-document-scrolled.html: Added.
Tests that do the same as the -installation test, but with a larger document;
the view-relative overlay should be the same size (or slightly smaller,
because we have scrollbars now), but the document-relative overlay should
be the size of the document. The second test scrolls to maxX, maxY, and
the document-relative overlay should scroll along with it, while the
view-relative overlay should remain fixed.

* pageoverlay/overlay-installation-expected.txt: Added.
* pageoverlay/overlay-large-document-expected.txt: Added.
* pageoverlay/overlay-large-document-scrolled-expected.txt: Added.
"Normal" layer tree expectations.

* platform/mac-wk1/pageoverlay/overlay-installation-expected.png: Added.
* platform/mac-wk1/pageoverlay/overlay-installation-expected.txt: Added.
* platform/mac-wk1/pageoverlay/overlay-large-document-expected.png: Added.
* platform/mac-wk1/pageoverlay/overlay-large-document-expected.txt: Added.
* platform/mac-wk1/pageoverlay/overlay-large-document-scrolled-expected.png: Added.
* platform/mac-wk1/pageoverlay/overlay-large-document-scrolled-expected.txt: Added.
Expected results for WebKit1 differ for view-relative overlays, because
we don't currently hook up view-relative overlays for WebKit1.

* platform/mac/pageoverlay/overlay-installation-expected.png: Added.
* platform/mac/pageoverlay/overlay-large-document-expected.png: Added.
* platform/mac/pageoverlay/overlay-large-document-scrolled-expected.png: Added.
"Normal" pixel dump expectations.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
34 files changed:
LayoutTests/ChangeLog
LayoutTests/pageoverlay/overlay-installation-expected.txt [new file with mode: 0644]
LayoutTests/pageoverlay/overlay-installation.html [new file with mode: 0644]
LayoutTests/pageoverlay/overlay-large-document-expected.txt [new file with mode: 0644]
LayoutTests/pageoverlay/overlay-large-document-scrolled-expected.txt [new file with mode: 0644]
LayoutTests/pageoverlay/overlay-large-document-scrolled.html [new file with mode: 0644]
LayoutTests/pageoverlay/overlay-large-document.html [new file with mode: 0644]
LayoutTests/platform/mac-wk1/pageoverlay/overlay-installation-expected.png [new file with mode: 0644]
LayoutTests/platform/mac-wk1/pageoverlay/overlay-installation-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-wk1/pageoverlay/overlay-large-document-expected.png [new file with mode: 0644]
LayoutTests/platform/mac-wk1/pageoverlay/overlay-large-document-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-wk1/pageoverlay/overlay-large-document-scrolled-expected.png [new file with mode: 0644]
LayoutTests/platform/mac-wk1/pageoverlay/overlay-large-document-scrolled-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/pageoverlay/overlay-installation-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/pageoverlay/overlay-large-document-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/pageoverlay/overlay-large-document-scrolled-expected.png [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.vcxproj/WebCoreTestSupport.vcxproj
Source/WebCore/WebCore.vcxproj/WebCoreTestSupport.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/page/PageOverlayController.cpp
Source/WebCore/page/PageOverlayController.h
Source/WebCore/platform/graphics/GraphicsLayer.cpp
Source/WebCore/platform/graphics/GraphicsLayer.h
Source/WebCore/platform/graphics/GraphicsLayerClient.h
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderLayerBacking.h
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebCore/testing/MockPageOverlayClient.cpp [new file with mode: 0644]
Source/WebCore/testing/MockPageOverlayClient.h [new file with mode: 0644]