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)
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]

index 6a3fcd3..f41aa59 100644 (file)
@@ -1,3 +1,45 @@
+2014-10-04  Tim Horton  <timothy_horton@apple.com>
+
+        Make it possible to test page overlays
+        https://bugs.webkit.org/show_bug.cgi?id=137339
+
+        Reviewed by Dan Bernstein.
+
+        * 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.
+
 2014-10-04  Roger Fong  <roger_fong@apple.com>
 
         [Windows] Skip remaining failing media tests after adding audio devices to the bots.
diff --git a/LayoutTests/pageoverlay/overlay-installation-expected.txt b/LayoutTests/pageoverlay/overlay-installation-expected.txt
new file mode 100644 (file)
index 0000000..8934da5
--- /dev/null
@@ -0,0 +1,25 @@
+View-relative:
+(GraphicsLayer
+  (children 1
+    (GraphicsLayer
+      (anchor 0.00 0.00)
+      (bounds 800.00 600.00)
+      (drawsContent 1)
+      (backgroundColor #00000000)
+    )
+  )
+)
+
+
+Document-relative:
+(GraphicsLayer
+  (children 1
+    (GraphicsLayer
+      (anchor 0.00 0.00)
+      (bounds 800.00 600.00)
+      (drawsContent 1)
+      (backgroundColor #00000000)
+    )
+  )
+)
+
diff --git a/LayoutTests/pageoverlay/overlay-installation.html b/LayoutTests/pageoverlay/overlay-installation.html
new file mode 100644 (file)
index 0000000..5a4b235
--- /dev/null
@@ -0,0 +1,17 @@
+<html>
+<script>
+window.onload = function () {
+    if (window.testRunner && window.internals) {
+        testRunner.dumpAsText(true);
+        internals.installMockPageOverlay("document");
+        internals.installMockPageOverlay("view");
+
+        var layersResult = document.getElementById('layers');
+        layersResult.innerText = window.internals.pageOverlayLayerTreeAsText();
+    }
+}
+</script>
+<body>
+    <pre id="layers" style="position: absolute; height: 1px; width: 1px; overflow: hidden;"></pre>
+</body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/pageoverlay/overlay-large-document-expected.txt b/LayoutTests/pageoverlay/overlay-large-document-expected.txt
new file mode 100644 (file)
index 0000000..f6db2bc
--- /dev/null
@@ -0,0 +1,25 @@
+View-relative:
+(GraphicsLayer
+  (children 1
+    (GraphicsLayer
+      (anchor 0.00 0.00)
+      (bounds 785.00 585.00)
+      (drawsContent 1)
+      (backgroundColor #00000000)
+    )
+  )
+)
+
+
+Document-relative:
+(GraphicsLayer
+  (children 1
+    (GraphicsLayer
+      (anchor 0.00 0.00)
+      (bounds 5008.00 5016.00)
+      (drawsContent 1)
+      (backgroundColor #00000000)
+    )
+  )
+)
+
diff --git a/LayoutTests/pageoverlay/overlay-large-document-scrolled-expected.txt b/LayoutTests/pageoverlay/overlay-large-document-scrolled-expected.txt
new file mode 100644 (file)
index 0000000..f6db2bc
--- /dev/null
@@ -0,0 +1,25 @@
+View-relative:
+(GraphicsLayer
+  (children 1
+    (GraphicsLayer
+      (anchor 0.00 0.00)
+      (bounds 785.00 585.00)
+      (drawsContent 1)
+      (backgroundColor #00000000)
+    )
+  )
+)
+
+
+Document-relative:
+(GraphicsLayer
+  (children 1
+    (GraphicsLayer
+      (anchor 0.00 0.00)
+      (bounds 5008.00 5016.00)
+      (drawsContent 1)
+      (backgroundColor #00000000)
+    )
+  )
+)
+
diff --git a/LayoutTests/pageoverlay/overlay-large-document-scrolled.html b/LayoutTests/pageoverlay/overlay-large-document-scrolled.html
new file mode 100644 (file)
index 0000000..ad6e60a
--- /dev/null
@@ -0,0 +1,25 @@
+<html>
+<style>
+body {
+    height: 5000px;
+    width: 5000px;
+}
+</style>
+<script>
+window.onload = function () {
+    if (window.testRunner && window.internals) {
+        testRunner.dumpAsText(true);
+        internals.installMockPageOverlay("document");
+        internals.installMockPageOverlay("view");
+
+        window.scrollTo(10000, 10000);
+
+        var layersResult = document.getElementById('layers');
+        layersResult.innerText = window.internals.pageOverlayLayerTreeAsText();
+    }
+}
+</script>
+<body>
+    <pre id="layers" style="position: absolute; height: 1px; width: 1px; overflow: hidden;"></pre>
+</body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/pageoverlay/overlay-large-document.html b/LayoutTests/pageoverlay/overlay-large-document.html
new file mode 100644 (file)
index 0000000..2063a4d
--- /dev/null
@@ -0,0 +1,23 @@
+<html>
+<style>
+body {
+    height: 5000px;
+    width: 5000px;
+}
+</style>
+<script>
+window.onload = function () {
+    if (window.testRunner && window.internals) {
+        testRunner.dumpAsText(true);
+        internals.installMockPageOverlay("document");
+        internals.installMockPageOverlay("view");
+
+        var layersResult = document.getElementById('layers');
+        layersResult.innerText = window.internals.pageOverlayLayerTreeAsText();
+    }
+}
+</script>
+<body>
+    <pre id="layers" style="position: absolute; height: 1px; width: 1px; overflow: hidden;"></pre>
+</body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/platform/mac-wk1/pageoverlay/overlay-installation-expected.png b/LayoutTests/platform/mac-wk1/pageoverlay/overlay-installation-expected.png
new file mode 100644 (file)
index 0000000..7d3693c
Binary files /dev/null and b/LayoutTests/platform/mac-wk1/pageoverlay/overlay-installation-expected.png differ
diff --git a/LayoutTests/platform/mac-wk1/pageoverlay/overlay-installation-expected.txt b/LayoutTests/platform/mac-wk1/pageoverlay/overlay-installation-expected.txt
new file mode 100644 (file)
index 0000000..8934da5
--- /dev/null
@@ -0,0 +1,25 @@
+View-relative:
+(GraphicsLayer
+  (children 1
+    (GraphicsLayer
+      (anchor 0.00 0.00)
+      (bounds 800.00 600.00)
+      (drawsContent 1)
+      (backgroundColor #00000000)
+    )
+  )
+)
+
+
+Document-relative:
+(GraphicsLayer
+  (children 1
+    (GraphicsLayer
+      (anchor 0.00 0.00)
+      (bounds 800.00 600.00)
+      (drawsContent 1)
+      (backgroundColor #00000000)
+    )
+  )
+)
+
diff --git a/LayoutTests/platform/mac-wk1/pageoverlay/overlay-large-document-expected.png b/LayoutTests/platform/mac-wk1/pageoverlay/overlay-large-document-expected.png
new file mode 100644 (file)
index 0000000..fa01558
Binary files /dev/null and b/LayoutTests/platform/mac-wk1/pageoverlay/overlay-large-document-expected.png differ
diff --git a/LayoutTests/platform/mac-wk1/pageoverlay/overlay-large-document-expected.txt b/LayoutTests/platform/mac-wk1/pageoverlay/overlay-large-document-expected.txt
new file mode 100644 (file)
index 0000000..56be0a0
--- /dev/null
@@ -0,0 +1,25 @@
+View-relative:
+(GraphicsLayer
+  (children 1
+    (GraphicsLayer
+      (anchor 0.00 0.00)
+      (bounds 800.00 600.00)
+      (drawsContent 1)
+      (backgroundColor #00000000)
+    )
+  )
+)
+
+
+Document-relative:
+(GraphicsLayer
+  (children 1
+    (GraphicsLayer
+      (anchor 0.00 0.00)
+      (bounds 5008.00 5016.00)
+      (drawsContent 1)
+      (backgroundColor #00000000)
+    )
+  )
+)
+
diff --git a/LayoutTests/platform/mac-wk1/pageoverlay/overlay-large-document-scrolled-expected.png b/LayoutTests/platform/mac-wk1/pageoverlay/overlay-large-document-scrolled-expected.png
new file mode 100644 (file)
index 0000000..bc37e13
Binary files /dev/null and b/LayoutTests/platform/mac-wk1/pageoverlay/overlay-large-document-scrolled-expected.png differ
diff --git a/LayoutTests/platform/mac-wk1/pageoverlay/overlay-large-document-scrolled-expected.txt b/LayoutTests/platform/mac-wk1/pageoverlay/overlay-large-document-scrolled-expected.txt
new file mode 100644 (file)
index 0000000..56be0a0
--- /dev/null
@@ -0,0 +1,25 @@
+View-relative:
+(GraphicsLayer
+  (children 1
+    (GraphicsLayer
+      (anchor 0.00 0.00)
+      (bounds 800.00 600.00)
+      (drawsContent 1)
+      (backgroundColor #00000000)
+    )
+  )
+)
+
+
+Document-relative:
+(GraphicsLayer
+  (children 1
+    (GraphicsLayer
+      (anchor 0.00 0.00)
+      (bounds 5008.00 5016.00)
+      (drawsContent 1)
+      (backgroundColor #00000000)
+    )
+  )
+)
+
diff --git a/LayoutTests/platform/mac/pageoverlay/overlay-installation-expected.png b/LayoutTests/platform/mac/pageoverlay/overlay-installation-expected.png
new file mode 100644 (file)
index 0000000..3604e0d
Binary files /dev/null and b/LayoutTests/platform/mac/pageoverlay/overlay-installation-expected.png differ
diff --git a/LayoutTests/platform/mac/pageoverlay/overlay-large-document-expected.png b/LayoutTests/platform/mac/pageoverlay/overlay-large-document-expected.png
new file mode 100644 (file)
index 0000000..2fb2620
Binary files /dev/null and b/LayoutTests/platform/mac/pageoverlay/overlay-large-document-expected.png differ
diff --git a/LayoutTests/platform/mac/pageoverlay/overlay-large-document-scrolled-expected.png b/LayoutTests/platform/mac/pageoverlay/overlay-large-document-scrolled-expected.png
new file mode 100644 (file)
index 0000000..0bb1a12
Binary files /dev/null and b/LayoutTests/platform/mac/pageoverlay/overlay-large-document-scrolled-expected.png differ
index 5a47cb4..67d218b 100644 (file)
@@ -3170,6 +3170,8 @@ set(WebCoreTestSupport_SOURCES
     testing/InternalSettings.cpp
     testing/Internals.cpp
 
+    testing/MockPageOverlayClient.cpp
+
     testing/js/WebCoreTestSupport.cpp
 )
 
index 7fa3ad9..28afe1a 100644 (file)
@@ -1,3 +1,81 @@
+2014-10-04  Tim Horton  <timothy_horton@apple.com>
+
+        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.
+
 2014-10-04  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         Move DragController::createFragmentFromDragData implementation to the editor
index 617a7ba..f996977 100644 (file)
@@ -919,6 +919,7 @@ __ZN7WebCore21NetworkStorageSession28createPrivateBrowsingSessionERKN3WTF6String
 __ZN7WebCore21PageOverlayController18installPageOverlayEN3WTF10PassRefPtrINS_11PageOverlayEEENS3_8FadeModeE
 __ZN7WebCore21PageOverlayController20uninstallPageOverlayEPNS_11PageOverlayENS1_8FadeModeE
 __ZN7WebCore21PageOverlayController20viewOverlayRootLayerEv
+__ZN7WebCore21PageOverlayController24documentOverlayRootLayerEv
 __ZN7WebCore21PageOverlayController32copyAccessibilityAttributesNamesEb
 __ZN7WebCore21PageOverlayController43copyAccessibilityAttributeBoolValueForPointEN3WTF6StringENS_10FloatPointERb
 __ZN7WebCore21PageOverlayController45copyAccessibilityAttributeStringValueForPointEN3WTF6StringENS_10FloatPointERS2_
@@ -1065,6 +1066,7 @@ __ZN7WebCore28UserMessageHandlerDescriptorC1ERKN3WTF12AtomicStringERNS_15DOMWrap
 __ZN7WebCore28UserMessageHandlerDescriptorD1Ev
 __ZN7WebCore28encodeWithURLEscapeSequencesERKN3WTF6StringE
 __ZN7WebCore28removeLanguageChangeObserverEPv
+__ZN7WebCore28throwArgumentMustBeEnumErrorERN3JSC9ExecStateEjPKcS4_S4_S4_
 __ZN7WebCore29cookieRequestHeaderFieldValueERKNS_21NetworkStorageSessionERKNS_3URLES5_
 __ZN7WebCore29createDefaultParagraphElementERNS_8DocumentE
 __ZN7WebCore29isCharacterSmartReplaceExemptEib
@@ -1616,6 +1618,7 @@ __ZNK7WebCore11HistoryItem8childrenEv
 __ZNK7WebCore11HistoryItem8referrerEv
 __ZNK7WebCore11HistoryItem9urlStringEv
 __ZNK7WebCore11HistoryItem9viewStateEv
+__ZNK7WebCore11PageOverlay10controllerEv
 __ZNK7WebCore11PageOverlay5frameEv
 __ZNK7WebCore11PageOverlay6boundsEv
 __ZNK7WebCore11RenderBlock25inlineElementContinuationEv
@@ -1642,6 +1645,7 @@ __ZNK7WebCore12TextEncoding6decodeEPKcmbRb
 __ZNK7WebCore12TextIterator4nodeEv
 __ZNK7WebCore12TextIterator5rangeEv
 __ZNK7WebCore13ContainerNode15countChildNodesEv
+__ZNK7WebCore13GraphicsLayer15layerTreeAsTextEj
 __ZNK7WebCore13GraphicsLayer18accumulatedOpacityEv
 __ZNK7WebCore13GraphicsLayer18getDebugBorderInfoERNS_5ColorERf
 __ZNK7WebCore13GraphicsLayer26backingStoreMemoryEstimateEv
index fc8c9c3..e3dc819 100644 (file)
       <ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Production|x64'">
       </ForcedIncludeFiles>
     </ClCompile>
+    <ClCompile Include="..\testing\MockPageOverlayClient.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">
+      </PrecompiledHeader>
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4065;4273;4565;4701;4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4065;4273;4565;4701;4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">4065;4273;4565;4701;4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">4065;4273;4565;4701;4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">4065;4273;4565;4701;4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">4065;4273;4565;4701;4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      <ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+      </ForcedIncludeFiles>
+      <ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+      </ForcedIncludeFiles>
+      <ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">
+      </ForcedIncludeFiles>
+      <ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">
+      </ForcedIncludeFiles>
+      <ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">
+      </ForcedIncludeFiles>
+      <ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">
+      </ForcedIncludeFiles>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">
+      </PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Production|x64'">
+      </PrecompiledHeader>
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4065;4273;4565;4701;4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4065;4273;4565;4701;4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">4065;4273;4565;4701;4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">4065;4273;4565;4701;4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">4065;4273;4565;4701;4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Production|x64'">4065;4273;4565;4701;4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      <ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+      </ForcedIncludeFiles>
+      <ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </ForcedIncludeFiles>
+      <ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">
+      </ForcedIncludeFiles>
+      <ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">
+      </ForcedIncludeFiles>
+      <ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">
+      </ForcedIncludeFiles>
+      <ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Production|x64'">
+      </ForcedIncludeFiles>
+    </ClCompile>
     <ClCompile Include="..\testing\InternalSettings.cpp">
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
       </PrecompiledHeader>
     <ClInclude Include="..\testing\MallocStatistics.h" />
     <ClInclude Include="..\testing\MemoryInfo.h" />
     <ClInclude Include="..\testing\MockCDM.h" />
+    <ClInclude Include="..\testing\MockPageOverlayClient.h" />
     <ClInclude Include="..\testing\TypeConversions.h" />
     <ClInclude Include="..\testing\Internals.h" />
     <ClInclude Include="..\testing\InternalSettings.h" />
index af7e863..6402d5e 100644 (file)
@@ -42,6 +42,9 @@
     <ClCompile Include="..\testing\MockCDM.cpp">
       <Filter>testing</Filter>
     </ClCompile>
+    <ClCompile Include="..\testing\MockPageOverlayClient.cpp">
+      <Filter>testing</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebCore\DerivedSources\InternalSettingsGenerated.h">
@@ -87,5 +90,8 @@
     <ClInclude Include="..\testing\MockCDM.h">
       <Filter>testing</Filter>
     </ClInclude>
+    <ClInclude Include="..\testing\MockPageOverlayClient.h">
+      <Filter>testing</Filter>
+    </ClInclude>
   </ItemGroup>
 </Project>
\ No newline at end of file
index c32b045..cf07cec 100644 (file)
                2D8FEBDD143E3EF70072502B /* CSSCrossfadeValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D8FEBDB143E3EF70072502B /* CSSCrossfadeValue.h */; };
                2D9066060BE141D400956998 /* LayoutState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D9066040BE141D400956998 /* LayoutState.cpp */; };
                2D9066070BE141D400956998 /* LayoutState.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D9066050BE141D400956998 /* LayoutState.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               2D97F04719DD413C001EE9C3 /* MockPageOverlayClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2DAAE32C19DCAF6000E002D2 /* MockPageOverlayClient.cpp */; };
+               2D97F04819DD4140001EE9C3 /* MockPageOverlayClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DAAE32D19DCAF6000E002D2 /* MockPageOverlayClient.h */; };
                2D9A246E15B9BD0000D34527 /* DOMSecurityPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D9A246B15B9BBDD00D34527 /* DOMSecurityPolicy.h */; };
                2D9A246F15B9BD2F00D34527 /* DOMSecurityPolicy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D9A246A15B9BBDD00D34527 /* DOMSecurityPolicy.cpp */; };
                2D9A247315B9C2D100D34527 /* DOMDOMSecurityPolicy.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D9A247215B9C2C700D34527 /* DOMDOMSecurityPolicy.mm */; };
                2D9A247115B9C29500D34527 /* DOMDOMSecurityPolicyInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMDOMSecurityPolicyInternal.h; sourceTree = "<group>"; };
                2D9A247215B9C2C700D34527 /* DOMDOMSecurityPolicy.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMDOMSecurityPolicy.mm; sourceTree = "<group>"; };
                2D9F0E1214FF1CBF00BA0FF7 /* linearSRGB.icc */ = {isa = PBXFileReference; lastKnownFileType = file; path = linearSRGB.icc; sourceTree = "<group>"; };
+               2DAAE32C19DCAF6000E002D2 /* MockPageOverlayClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MockPageOverlayClient.cpp; sourceTree = "<group>"; };
+               2DAAE32D19DCAF6000E002D2 /* MockPageOverlayClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockPageOverlayClient.h; sourceTree = "<group>"; };
                2DE70022192FE82A00B0975C /* DisplayRefreshMonitorMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplayRefreshMonitorMac.h; sourceTree = "<group>"; };
                2E0888C3114883A900AF4265 /* DOMFormData.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMFormData.idl; sourceTree = "<group>"; };
                2E0888D21148848A00AF4265 /* JSDOMFormData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMFormData.cpp; sourceTree = "<group>"; };
                                CD5393CC175DCCE600C07123 /* MemoryInfo.idl */,
                                CDC26B3C160A62B00026757B /* MockCDM.cpp */,
                                CDC26B3D160A62B00026757B /* MockCDM.h */,
+                               2DAAE32C19DCAF6000E002D2 /* MockPageOverlayClient.cpp */,
+                               2DAAE32D19DCAF6000E002D2 /* MockPageOverlayClient.h */,
                                EB081CD81696084400553730 /* TypeConversions.h */,
                                EB081CD91696084400553730 /* TypeConversions.idl */,
                                E1BA67191742BEF400C20251 /* WebCoreTestShimLibrary.cpp */,
                                EBF5121D1696496C0056BD25 /* JSTypeConversions.h in Headers */,
                                CDC26B41160A8CCE0026757B /* MockCDM.h in Headers */,
                                AA5F3B8D16CC33D100455EB0 /* PlatformSpeechSynthesizerMock.h in Headers */,
+                               2D97F04819DD4140001EE9C3 /* MockPageOverlayClient.h in Headers */,
                                41815C1F138319830057AAA4 /* WebCoreTestSupport.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                                A740B5A714C935AF00A77FA4 /* JSInternalSettings.cpp in Sources */,
                                53ED3FDE167A88E7006762E6 /* JSInternalSettingsGenerated.cpp in Sources */,
                                A740B59714C935AF00A77FA4 /* JSMallocStatistics.cpp in Sources */,
+                               2D97F04719DD413C001EE9C3 /* MockPageOverlayClient.cpp in Sources */,
                                CD5393D3175E018600C07123 /* JSMemoryInfo.cpp in Sources */,
                                EBF5121C1696496C0056BD25 /* JSTypeConversions.cpp in Sources */,
                                CDC26B40160A8CC60026757B /* MockCDM.cpp in Sources */,
index fa5ad21..1e44964 100644 (file)
@@ -358,4 +358,9 @@ void PageOverlayController::didChangeOverlayBackgroundColor(PageOverlay& overlay
     m_overlayGraphicsLayers.get(&overlay)->setBackgroundColor(overlay.backgroundColor());
 }
 
+bool PageOverlayController::shouldSkipLayerInDump(const GraphicsLayer*, LayerTreeAsTextBehavior behavior) const
+{
+    return !(behavior & LayerTreeAsTextIncludePageOverlayLayers);
+}
+
 } // namespace WebKit
index 269c736..33698af 100644 (file)
@@ -87,7 +87,7 @@ private:
     virtual void notifyFlushRequired(const GraphicsLayer*) override;
     virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const FloatRect& clipRect) override;
     virtual float deviceScaleFactor() const override;
-    virtual bool shouldSkipLayerInDump(const GraphicsLayer*) const override { return true; }
+    virtual bool shouldSkipLayerInDump(const GraphicsLayer*, LayerTreeAsTextBehavior) const override;
 
     std::unique_ptr<GraphicsLayer> m_documentOverlayRootLayer;
     std::unique_ptr<GraphicsLayer> m_viewOverlayRootLayer;
index 6c6146d..394b2ef 100644 (file)
@@ -605,7 +605,7 @@ static void dumpChildren(TextStream& ts, const Vector<GraphicsLayer*>& children,
 {
     totalChildCount += children.size();
     for (auto* child : children) {
-        if (!child->client().shouldSkipLayerInDump(child)) {
+        if (!child->client().shouldSkipLayerInDump(child, behavior)) {
             child->dumpLayer(ts, indent + 2, behavior);
             continue;
         }
index 7db7b70..d88db27 100644 (file)
 
 namespace WebCore {
 
-enum LayerTreeAsTextBehaviorFlags {
-    LayerTreeAsTextBehaviorNormal = 0,
-    LayerTreeAsTextDebug = 1 << 0, // Dump extra debugging info like layer addresses.
-    LayerTreeAsTextIncludeVisibleRects = 1 << 1,
-    LayerTreeAsTextIncludeTileCaches = 1 << 2,
-    LayerTreeAsTextIncludeRepaintRects = 1 << 3,
-    LayerTreeAsTextIncludePaintingPhases = 1 << 4,
-    LayerTreeAsTextIncludeContentLayers = 1 << 5
-};
-typedef unsigned LayerTreeAsTextBehavior;
-
 class GraphicsContext;
 class GraphicsLayerFactory;
 class Image;
index 25922cb..b45df1c 100644 (file)
@@ -56,6 +56,18 @@ enum AnimatedPropertyID {
     AnimatedPropertyWebkitFilter
 };
 
+enum LayerTreeAsTextBehaviorFlags {
+    LayerTreeAsTextBehaviorNormal = 0,
+    LayerTreeAsTextDebug = 1 << 0, // Dump extra debugging info like layer addresses.
+    LayerTreeAsTextIncludeVisibleRects = 1 << 1,
+    LayerTreeAsTextIncludeTileCaches = 1 << 2,
+    LayerTreeAsTextIncludeRepaintRects = 1 << 3,
+    LayerTreeAsTextIncludePaintingPhases = 1 << 4,
+    LayerTreeAsTextIncludeContentLayers = 1 << 5,
+    LayerTreeAsTextIncludePageOverlayLayers = 1 << 6,
+};
+typedef unsigned LayerTreeAsTextBehavior;
+
 class GraphicsLayerClient {
 public:
     virtual ~GraphicsLayerClient() {}
@@ -96,7 +108,7 @@ public:
 
     virtual bool isTrackingRepaints() const { return false; }
 
-    virtual bool shouldSkipLayerInDump(const GraphicsLayer*) const { return false; }
+    virtual bool shouldSkipLayerInDump(const GraphicsLayer*, LayerTreeAsTextBehavior) const { return false; }
     virtual bool shouldDumpPropertyForLayer(const GraphicsLayer*, const char*) const { return true; }
 
     virtual bool shouldAggressivelyRetainTiles(const GraphicsLayer*) const { return false; }
index e3ccbc7..d69ad92 100644 (file)
@@ -2265,7 +2265,7 @@ bool RenderLayerBacking::isTrackingRepaints() const
     return static_cast<GraphicsLayerClient&>(compositor()).isTrackingRepaints();
 }
 
-bool RenderLayerBacking::shouldSkipLayerInDump(const GraphicsLayer* layer) const
+bool RenderLayerBacking::shouldSkipLayerInDump(const GraphicsLayer* layer, LayerTreeAsTextBehavior) const
 {
     // Skip the root tile cache's flattening layer.
     return m_isMainFrameRenderViewLayer && layer && layer == m_childContainmentLayer.get();
index 3e44841..7d9185f 100644 (file)
@@ -211,7 +211,7 @@ public:
     virtual bool getCurrentTransform(const GraphicsLayer*, TransformationMatrix&) const override;
 
     virtual bool isTrackingRepaints() const override;
-    virtual bool shouldSkipLayerInDump(const GraphicsLayer*) const override;
+    virtual bool shouldSkipLayerInDump(const GraphicsLayer*, LayerTreeAsTextBehavior) const override;
     virtual bool shouldDumpPropertyForLayer(const GraphicsLayer*, const char* propertyName) const override;
 
     virtual bool shouldAggressivelyRetainTiles(const GraphicsLayer*) const override;
index 6549550..3e3ba33 100644 (file)
@@ -75,7 +75,9 @@
 #include "MediaSessionManager.h"
 #include "MemoryCache.h"
 #include "MemoryInfo.h"
+#include "MockPageOverlayClient.h"
 #include "Page.h"
+#include "PageOverlay.h"
 #include "PrintContext.h"
 #include "PseudoElement.h"
 #include "Range.h"
@@ -300,6 +302,8 @@ void Internals::resetToConsistentState(Page* page)
     AXObjectCache::setEnhancedUserInterfaceAccessibility(false);
     AXObjectCache::disableAccessibility();
 #endif
+
+    MockPageOverlayClient::shared().uninstallAllOverlays();
 }
 
 Internals::Internals(Document* document)
@@ -2356,4 +2360,28 @@ void Internals::simulateSystemWake() const
 #endif
 }
 
+void Internals::installMockPageOverlay(const String& overlayType, ExceptionCode& ec)
+{
+    Document* document = contextDocument();
+    if (!document || !document->frame()) {
+        ec = INVALID_ACCESS_ERR;
+        return;
+    }
+
+    MockPageOverlayClient::shared().installOverlay(document->frame()->mainFrame(), overlayType == "view" ? PageOverlay::OverlayType::View : PageOverlay::OverlayType::Document);
+}
+
+String Internals::pageOverlayLayerTreeAsText(ExceptionCode& ec) const
+{
+    Document* document = contextDocument();
+    if (!document || !document->frame()) {
+        ec = INVALID_ACCESS_ERR;
+        return String();
+    }
+
+    document->updateLayout();
+
+    return MockPageOverlayClient::shared().layerTreeAsText(document->frame()->mainFrame());
+}
+
 }
index 6cc7d24..df02e34 100644 (file)
@@ -342,6 +342,9 @@ public:
     void simulateSystemSleep() const;
     void simulateSystemWake() const;
 
+    void installMockPageOverlay(const String& overlayType, ExceptionCode&);
+    String pageOverlayLayerTreeAsText(ExceptionCode&) const;
+
 private:
     explicit Internals(Document*);
     Document* contextDocument() const;
index fe52d6a..ba51253 100644 (file)
 
     // As per spec: http://www.w3.org/TR/WebIDL/#idl-sequence
     // "Sequences must not be used as the type of an attribute, constant or exception field."
-    // FIXME: this will lead to BUG interals.consoleProfiles !== interals.consoleProfiles as profile will always returns new array.
+    // FIXME: this will lead to BUG internals.consoleProfiles !== internals.consoleProfiles as profile will always returns new array.
     readonly attribute ScriptProfile[] consoleProfiles;
 
     unsigned long numberOfLiveNodes();
 
     DOMString[] getReferencedFilePaths();
 
-    // These functions both reset the tracked repaint rects. They are inteded to be used in the following order:
+    // These functions both reset the tracked repaint rects. They are intended to be used in the following order:
     //  startTrackingRepaints, repaintRectsAsText, stopTrackingRepaints.
     [RaisesException] void startTrackingRepaints();
     [RaisesException] void stopTrackingRepaints();
     
     [Conditional=VIDEO] void simulateSystemSleep();
     [Conditional=VIDEO] void simulateSystemWake();
+    
+    [RaisesException] void installMockPageOverlay(PageOverlayType type);
+    [RaisesException] DOMString pageOverlayLayerTreeAsText();
 };
+
+enum PageOverlayType {
+    "view",
+    "document"
+};
\ No newline at end of file
diff --git a/Source/WebCore/testing/MockPageOverlayClient.cpp b/Source/WebCore/testing/MockPageOverlayClient.cpp
new file mode 100644 (file)
index 0000000..be09c3d
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MockPageOverlayClient.h"
+
+#include "GraphicsContext.h"
+#include "GraphicsLayer.h"
+#include "MainFrame.h"
+#include "PageOverlayController.h"
+#include <wtf/NeverDestroyed.h>
+
+namespace WebCore {
+
+MockPageOverlayClient& MockPageOverlayClient::shared()
+{
+    static NeverDestroyed<MockPageOverlayClient> sharedClient;
+    return sharedClient.get();
+}
+
+MockPageOverlayClient::MockPageOverlayClient()
+{
+}
+
+void MockPageOverlayClient::installOverlay(MainFrame& mainFrame, PageOverlay::OverlayType overlayType)
+{
+    RefPtr<PageOverlay> overlay = PageOverlay::create(*this, overlayType);
+    mainFrame.pageOverlayController().installPageOverlay(overlay, PageOverlay::FadeMode::DoNotFade);
+    m_overlays.add(overlay.get());
+}
+
+void MockPageOverlayClient::uninstallAllOverlays()
+{
+    while (!m_overlays.isEmpty()) {
+        PageOverlay* overlay = m_overlays.takeAny();
+        ASSERT(overlay->controller());
+        overlay->controller()->uninstallPageOverlay(overlay, PageOverlay::FadeMode::DoNotFade);
+    }
+}
+
+String MockPageOverlayClient::layerTreeAsText(MainFrame& mainFrame)
+{
+    return "View-relative:\n" + mainFrame.pageOverlayController().viewOverlayRootLayer().layerTreeAsText(LayerTreeAsTextIncludePageOverlayLayers) + "\n\nDocument-relative:\n" + mainFrame.pageOverlayController().documentOverlayRootLayer().layerTreeAsText(LayerTreeAsTextIncludePageOverlayLayers);
+}
+
+void MockPageOverlayClient::pageOverlayDestroyed(PageOverlay& overlay)
+{
+    m_overlays.remove(&overlay);
+}
+
+void MockPageOverlayClient::willMoveToPage(PageOverlay&, Page*)
+{
+}
+
+void MockPageOverlayClient::didMoveToPage(PageOverlay& overlay, Page* page)
+{
+    if (page)
+        overlay.setNeedsDisplay();
+}
+
+void MockPageOverlayClient::drawRect(PageOverlay& overlay, GraphicsContext& context, const IntRect&)
+{
+    GraphicsContextStateSaver stateSaver(context);
+
+    FloatRect insetRect = overlay.bounds();
+
+    if (overlay.overlayType() == PageOverlay::OverlayType::Document) {
+        context.setStrokeColor(Color(0, 255, 0), ColorSpaceDeviceRGB);
+        insetRect.inflate(-50);
+    } else {
+        context.setStrokeColor(Color(0, 0, 255), ColorSpaceDeviceRGB);
+        insetRect.inflate(-20);
+    }
+
+    context.strokeRect(insetRect, 20);
+}
+
+bool MockPageOverlayClient::mouseEvent(PageOverlay&, const PlatformMouseEvent&)
+{
+    return false;
+}
+
+void MockPageOverlayClient::didScrollFrame(PageOverlay&, Frame&)
+{
+}
+
+bool MockPageOverlayClient::copyAccessibilityAttributeStringValueForPoint(PageOverlay&, String /* attribute */, FloatPoint, String&)
+{
+    return false;
+}
+
+bool MockPageOverlayClient::copyAccessibilityAttributeBoolValueForPoint(PageOverlay&, String /* attribute */, FloatPoint, bool&)
+{
+    return false;
+}
+
+Vector<String> MockPageOverlayClient::copyAccessibilityAttributeNames(PageOverlay&, bool /* parameterizedNames */)
+{
+    return Vector<String>();
+}
+
+}
diff --git a/Source/WebCore/testing/MockPageOverlayClient.h b/Source/WebCore/testing/MockPageOverlayClient.h
new file mode 100644 (file)
index 0000000..7d463f2
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MockPageOverlayClient_h
+#define MockPageOverlayClient_h
+
+#include "PageOverlay.h"
+#include <wtf/HashSet.h>
+
+namespace WebCore {
+
+class MainFrame;
+
+class MockPageOverlayClient final : public PageOverlay::Client {
+    friend class NeverDestroyed<MockPageOverlayClient>;
+public:
+    static MockPageOverlayClient& shared();
+
+    explicit MockPageOverlayClient();
+
+    void installOverlay(MainFrame&, PageOverlay::OverlayType);
+    void uninstallAllOverlays();
+
+    String layerTreeAsText(MainFrame&);
+
+    virtual ~MockPageOverlayClient() { }
+
+private:
+    virtual void pageOverlayDestroyed(PageOverlay&) override;
+    virtual void willMoveToPage(PageOverlay&, Page*) override;
+    virtual void didMoveToPage(PageOverlay&, Page*) override;
+    virtual void drawRect(PageOverlay&, GraphicsContext&, const IntRect& dirtyRect) override;
+    virtual bool mouseEvent(PageOverlay&, const PlatformMouseEvent&) override;
+    virtual void didScrollFrame(PageOverlay&, Frame&) override;
+
+    virtual bool copyAccessibilityAttributeStringValueForPoint(PageOverlay&, String /* attribute */, FloatPoint, String&) override;
+    virtual bool copyAccessibilityAttributeBoolValueForPoint(PageOverlay&, String /* attribute */, FloatPoint, bool&) override;
+    virtual Vector<String> copyAccessibilityAttributeNames(PageOverlay&, bool /* parameterizedNames */) override;
+
+    HashSet<PageOverlay*> m_overlays;
+};
+
+}
+
+#endif // MockPageOverlayClient_h