REGRESSION (r191849): There's no yellow bouncy highlight when using Find on Page...
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Dec 2015 22:46:02 +0000 (22:46 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Dec 2015 22:46:02 +0000 (22:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=152241
<rdar://problem/23642574>

Reviewed by Simon Fraser.

Tests: pageoverlay/overlay-small-frame-mouse-events.html
       pageoverlay/overlay-small-frame-paints.html

* page/PageOverlay.cpp:
(WebCore::PageOverlay::bounds):
Revert r191849's change that made bounds() actually return the frame()
if we frame is manually overriden.

(WebCore::PageOverlay::mouseEvent):
Convert the mouse event the rest of the way into overlay coordinates (by
applying the overlay's frame origin) before deciding whether to handle
the event.

* page/PageOverlay.h:

* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* testing/Internals.cpp:
(WebCore::Internals::installMockPageOverlay):
* testing/Internals.h:
* testing/Internals.idl:
* testing/MockPageOverlay.cpp: Added.
(WebCore::MockPageOverlay::create):
(WebCore::MockPageOverlay::MockPageOverlay):
(WebCore::MockPageOverlay::setFrame):
* testing/MockPageOverlay.h: Added.
(WebCore::MockPageOverlay::overlay):
* testing/MockPageOverlay.idl: Added.
* testing/MockPageOverlayClient.cpp:
(WebCore::MockPageOverlayClient::installOverlay):
(WebCore::MockPageOverlayClient::uninstallAllOverlays):
(WebCore::MockPageOverlayClient::pageOverlayDestroyed):
(WebCore::MockPageOverlayClient::drawRect):
(WebCore::MockPageOverlayClient::mouseEvent):
* testing/MockPageOverlayClient.h:
Make internals.installMockPageOverlay return a MockPageOverlay object so
tests can manipulate their overlay. For now, expose setFrame.
Also, log when MockPageOverlayClient gets asked to paint or receives a mouse event,
which will show up in test output. Slightly unconventional, but very convenient.

* pageoverlay/overlay-small-frame-mouse-events-expected.txt: Added.
* pageoverlay/overlay-small-frame-mouse-events.html: Added.
Add a test ensuring that small-frame overlays get mouse events.

* pageoverlay/overlay-small-frame-paints-expected.txt: Added.
* pageoverlay/overlay-small-frame-paints.html: Added.
Add a test ensuring that small-frame overlays get paint callbacks.

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

21 files changed:
LayoutTests/ChangeLog
LayoutTests/pageoverlay/overlay-installation-expected.txt
LayoutTests/pageoverlay/overlay-large-document-expected.txt
LayoutTests/pageoverlay/overlay-large-document-scrolled-expected.txt
LayoutTests/pageoverlay/overlay-small-frame-mouse-events-expected.txt [new file with mode: 0644]
LayoutTests/pageoverlay/overlay-small-frame-mouse-events.html [new file with mode: 0644]
LayoutTests/pageoverlay/overlay-small-frame-paints-expected.txt [new file with mode: 0644]
LayoutTests/pageoverlay/overlay-small-frame-paints.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/page/PageOverlay.cpp
Source/WebCore/page/PageOverlay.h
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebCore/testing/MockPageOverlay.cpp [new file with mode: 0644]
Source/WebCore/testing/MockPageOverlay.h [new file with mode: 0644]
Source/WebCore/testing/MockPageOverlay.idl [new file with mode: 0644]
Source/WebCore/testing/MockPageOverlayClient.cpp
Source/WebCore/testing/MockPageOverlayClient.h

index bd7c322..a159675 100644 (file)
@@ -1,3 +1,19 @@
+2015-12-15  Tim Horton  <timothy_horton@apple.com>
+
+        REGRESSION (r191849): There's no yellow bouncy highlight when using Find on Page on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=152241
+        <rdar://problem/23642574>
+
+        Reviewed by Simon Fraser.
+
+        * pageoverlay/overlay-small-frame-mouse-events-expected.txt: Added.
+        * pageoverlay/overlay-small-frame-mouse-events.html: Added.
+        Add a test ensuring that small-frame overlays get mouse events.
+
+        * pageoverlay/overlay-small-frame-paints-expected.txt: Added.
+        * pageoverlay/overlay-small-frame-paints.html: Added.
+        Add a test ensuring that small-frame overlays get paint callbacks.
+
 2015-12-15  Myles C. Maxfield  <mmaxfield@apple.com>
 
         [Font Features] TrueType fonts trigger real features even when synthesis is applied
index 8934da5..c53e277 100644 (file)
@@ -1,3 +1,5 @@
+CONSOLE MESSAGE: MockPageOverlayClient::drawRect dirtyRect (0, 0, 800, 600)
+CONSOLE MESSAGE: MockPageOverlayClient::drawRect dirtyRect (0, 0, 800, 600)
 View-relative:
 (GraphicsLayer
   (children 1
index f6db2bc..7b43c96 100644 (file)
@@ -1,3 +1,8 @@
+CONSOLE MESSAGE: MockPageOverlayClient::drawRect dirtyRect (0, 0, 785, 585)
+CONSOLE MESSAGE: MockPageOverlayClient::drawRect dirtyRect (512, 512, 512, 512)
+CONSOLE MESSAGE: MockPageOverlayClient::drawRect dirtyRect (0, 512, 512, 512)
+CONSOLE MESSAGE: MockPageOverlayClient::drawRect dirtyRect (512, 0, 512, 512)
+CONSOLE MESSAGE: MockPageOverlayClient::drawRect dirtyRect (0, 0, 512, 512)
 View-relative:
 (GraphicsLayer
   (children 1
index f6db2bc..c2c8ee5 100644 (file)
@@ -1,3 +1,8 @@
+CONSOLE MESSAGE: MockPageOverlayClient::drawRect dirtyRect (0, 0, 785, 585)
+CONSOLE MESSAGE: MockPageOverlayClient::drawRect dirtyRect (4608, 4608, 400, 408)
+CONSOLE MESSAGE: MockPageOverlayClient::drawRect dirtyRect (4096, 4608, 512, 408)
+CONSOLE MESSAGE: MockPageOverlayClient::drawRect dirtyRect (4608, 4096, 400, 512)
+CONSOLE MESSAGE: MockPageOverlayClient::drawRect dirtyRect (4096, 4096, 512, 512)
 View-relative:
 (GraphicsLayer
   (children 1
diff --git a/LayoutTests/pageoverlay/overlay-small-frame-mouse-events-expected.txt b/LayoutTests/pageoverlay/overlay-small-frame-mouse-events-expected.txt
new file mode 100644 (file)
index 0000000..95bd527
--- /dev/null
@@ -0,0 +1,22 @@
+CONSOLE MESSAGE: line 16: MockPageOverlayClient::mouseEvent location (105, 105)
+CONSOLE MESSAGE: line 17: MockPageOverlayClient::mouseEvent location (105, 105)
+CONSOLE MESSAGE: line 18: MockPageOverlayClient::mouseEvent location (105, 105)
+CONSOLE MESSAGE: MockPageOverlayClient::drawRect dirtyRect (0, 0, 10, 10)
+View-relative:
+(GraphicsLayer
+)
+
+
+Document-relative:
+(GraphicsLayer
+  (children 1
+    (GraphicsLayer
+      (position 100.00 100.00)
+      (anchor 0.00 0.00)
+      (bounds 10.00 10.00)
+      (drawsContent 1)
+      (backgroundColor #00000000)
+    )
+  )
+)
+
diff --git a/LayoutTests/pageoverlay/overlay-small-frame-mouse-events.html b/LayoutTests/pageoverlay/overlay-small-frame-mouse-events.html
new file mode 100644 (file)
index 0000000..50eec69
--- /dev/null
@@ -0,0 +1,28 @@
+<html>
+<style>
+body {
+    height: 5000px;
+    width: 5000px;
+}
+</style>
+<script>
+window.onload = function () {
+    if (window.testRunner && window.internals) {
+        testRunner.dumpAsText(true);
+        var overlay = internals.installMockPageOverlay("document");
+
+        overlay.setFrame(100, 100, 10, 10);
+
+        eventSender.mouseMoveTo(105, 105);
+        eventSender.mouseDown();
+        eventSender.mouseUp();
+
+        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-small-frame-paints-expected.txt b/LayoutTests/pageoverlay/overlay-small-frame-paints-expected.txt
new file mode 100644 (file)
index 0000000..b85eb07
--- /dev/null
@@ -0,0 +1,19 @@
+CONSOLE MESSAGE: MockPageOverlayClient::drawRect dirtyRect (0, 0, 10, 10)
+View-relative:
+(GraphicsLayer
+)
+
+
+Document-relative:
+(GraphicsLayer
+  (children 1
+    (GraphicsLayer
+      (position 100.00 100.00)
+      (anchor 0.00 0.00)
+      (bounds 10.00 10.00)
+      (drawsContent 1)
+      (backgroundColor #00000000)
+    )
+  )
+)
+
diff --git a/LayoutTests/pageoverlay/overlay-small-frame-paints.html b/LayoutTests/pageoverlay/overlay-small-frame-paints.html
new file mode 100644 (file)
index 0000000..05e24d8
--- /dev/null
@@ -0,0 +1,24 @@
+<html>
+<style>
+body {
+    height: 5000px;
+    width: 5000px;
+}
+</style>
+<script>
+window.onload = function () {
+    if (window.testRunner && window.internals) {
+        testRunner.dumpAsText(true);
+        var overlay = internals.installMockPageOverlay("document");
+
+        overlay.setFrame(100, 100, 10, 10);
+
+        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
index 90c725d..e32065b 100644 (file)
@@ -1,3 +1,51 @@
+2015-12-15  Tim Horton  <timothy_horton@apple.com>
+
+        REGRESSION (r191849): There's no yellow bouncy highlight when using Find on Page on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=152241
+        <rdar://problem/23642574>
+
+        Reviewed by Simon Fraser.
+
+        Tests: pageoverlay/overlay-small-frame-mouse-events.html
+               pageoverlay/overlay-small-frame-paints.html
+
+        * page/PageOverlay.cpp:
+        (WebCore::PageOverlay::bounds):
+        Revert r191849's change that made bounds() actually return the frame()
+        if we frame is manually overriden.
+
+        (WebCore::PageOverlay::mouseEvent):
+        Convert the mouse event the rest of the way into overlay coordinates (by
+        applying the overlay's frame origin) before deciding whether to handle
+        the event.
+
+        * page/PageOverlay.h:
+
+        * DerivedSources.make:
+        * WebCore.xcodeproj/project.pbxproj:
+        * testing/Internals.cpp:
+        (WebCore::Internals::installMockPageOverlay):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+        * testing/MockPageOverlay.cpp: Added.
+        (WebCore::MockPageOverlay::create):
+        (WebCore::MockPageOverlay::MockPageOverlay):
+        (WebCore::MockPageOverlay::setFrame):
+        * testing/MockPageOverlay.h: Added.
+        (WebCore::MockPageOverlay::overlay):
+        * testing/MockPageOverlay.idl: Added.
+        * testing/MockPageOverlayClient.cpp:
+        (WebCore::MockPageOverlayClient::installOverlay):
+        (WebCore::MockPageOverlayClient::uninstallAllOverlays):
+        (WebCore::MockPageOverlayClient::pageOverlayDestroyed):
+        (WebCore::MockPageOverlayClient::drawRect):
+        (WebCore::MockPageOverlayClient::mouseEvent):
+        * testing/MockPageOverlayClient.h:
+        Make internals.installMockPageOverlay return a MockPageOverlay object so
+        tests can manipulate their overlay. For now, expose setFrame.
+        Also, log when MockPageOverlayClient gets asked to paint or receives a mouse event,
+        which will show up in test output. Slightly unconventional, but very convenient.
+
 2015-12-15  Myles C. Maxfield  <mmaxfield@apple.com>
 
         [Font Features] TrueType fonts trigger real features even when synthesis is applied
index d25705e..43e5603 100644 (file)
@@ -525,6 +525,7 @@ NON_SVG_BINDING_IDLS = \
     $(WebCore)/testing/MallocStatistics.idl \
     $(WebCore)/testing/MemoryInfo.idl \
     $(WebCore)/testing/MockContentFilterSettings.idl \
+       $(WebCore)/testing/MockPageOverlay.idl \
     $(WebCore)/testing/TypeConversions.idl \
     $(WebCore)/workers/AbstractWorker.idl \
     $(WebCore)/workers/DedicatedWorkerGlobalScope.idl \
index 06dea18..f9cf3b4 100644 (file)
                07277E5317D018CC0015534D /* JSMediaStreamTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 07277E4717D018CC0015534D /* JSMediaStreamTrack.h */; };
                07277E5417D018CC0015534D /* JSMediaStreamTrackEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07277E4817D018CC0015534D /* JSMediaStreamTrackEvent.cpp */; };
                07277E5517D018CC0015534D /* JSMediaStreamTrackEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 07277E4917D018CC0015534D /* JSMediaStreamTrackEvent.h */; };
-               07297FA71C1881C5003F0735 /* UserMediaPermissionCheck.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07297FA51C1881C5003F0735 /* UserMediaPermissionCheck.cpp */; settings = {ASSET_TAGS = (); }; };
+               07297FA71C1881C5003F0735 /* UserMediaPermissionCheck.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07297FA51C1881C5003F0735 /* UserMediaPermissionCheck.cpp */; };
                07297FA81C1881C5003F0735 /* UserMediaPermissionCheck.h in Headers */ = {isa = PBXBuildFile; fileRef = 07297FA61C1881C5003F0735 /* UserMediaPermissionCheck.h */; settings = {ATTRIBUTES = (Private, ); }; };
                072AE1E5183C0741000A5988 /* PluginReplacement.h in Headers */ = {isa = PBXBuildFile; fileRef = 072AE1DF183C0741000A5988 /* PluginReplacement.h */; };
                072AE1E6183C0741000A5988 /* QuickTimePluginReplacement.mm in Sources */ = {isa = PBXBuildFile; fileRef = 072AE1E0183C0741000A5988 /* QuickTimePluginReplacement.mm */; };
                2D3EF44A1917915C00034184 /* WebCoreCALayerExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D3EF4461917915C00034184 /* WebCoreCALayerExtras.h */; settings = {ATTRIBUTES = (Private, ); }; };
                2D3EF44B1917915C00034184 /* WebCoreCALayerExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D3EF4471917915C00034184 /* WebCoreCALayerExtras.mm */; };
                2D413F611A187A3F0041A521 /* LookupSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D413F601A187A3F0041A521 /* LookupSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               2D4150DE1C1F868C000A3BA2 /* JSMockPageOverlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D6F3E921C1F85550061DBD4 /* JSMockPageOverlay.cpp */; };
                2D46F04E17B96FBD005647F0 /* IntPoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D46F04D17B96FBD005647F0 /* IntPoint.cpp */; };
                2D46F05017B96FD2005647F0 /* IntSize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D46F04F17B96FD2005647F0 /* IntSize.cpp */; };
                2D481F00146B5C4C00AA7834 /* CrossfadeGeneratedImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D2FC0541460CD6F00263633 /* CrossfadeGeneratedImage.cpp */; };
                2D5C9D0119C7B52E00B3C5C1 /* PageOverlayController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D5C9CFD19C7B52E00B3C5C1 /* PageOverlayController.cpp */; };
                2D5C9D0219C7B52E00B3C5C1 /* PageOverlayController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D5C9CFE19C7B52E00B3C5C1 /* PageOverlayController.h */; settings = {ATTRIBUTES = (Private, ); }; };
                2D6E468417D660F500ECF8BB /* PDFDocumentImageMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D6E468217D660F500ECF8BB /* PDFDocumentImageMac.mm */; };
+               2D6F3E901C1ECB270061DBD4 /* MockPageOverlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D6F3E8A1C1ECB1C0061DBD4 /* MockPageOverlay.cpp */; };
+               2D6F3E911C1ECB2F0061DBD4 /* MockPageOverlay.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D6F3E8B1C1ECB1C0061DBD4 /* MockPageOverlay.h */; };
+               2D6F3E951C1F85550061DBD4 /* JSMockPageOverlay.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D6F3E931C1F85550061DBD4 /* JSMockPageOverlay.h */; };
                2D70BA1318074DDF0001908A /* PlatformCALayerCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D70BA1218074DDF0001908A /* PlatformCALayerCocoa.h */; settings = {ATTRIBUTES = (Private, ); }; };
                2D70BA1518074F860001908A /* PlatformCALayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D70BA1418074F850001908A /* PlatformCALayer.cpp */; };
                2D76BB821945632400CFD29A /* RunLoopObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D76BB801945632400CFD29A /* RunLoopObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
                2D5C9CFD19C7B52E00B3C5C1 /* PageOverlayController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageOverlayController.cpp; sourceTree = "<group>"; };
                2D5C9CFE19C7B52E00B3C5C1 /* PageOverlayController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageOverlayController.h; sourceTree = "<group>"; };
                2D6E468217D660F500ECF8BB /* PDFDocumentImageMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PDFDocumentImageMac.mm; sourceTree = "<group>"; };
+               2D6F3E8A1C1ECB1C0061DBD4 /* MockPageOverlay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MockPageOverlay.cpp; sourceTree = "<group>"; };
+               2D6F3E8B1C1ECB1C0061DBD4 /* MockPageOverlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockPageOverlay.h; sourceTree = "<group>"; };
+               2D6F3E8C1C1ECB1C0061DBD4 /* MockPageOverlay.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MockPageOverlay.idl; sourceTree = "<group>"; };
+               2D6F3E921C1F85550061DBD4 /* JSMockPageOverlay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMockPageOverlay.cpp; sourceTree = "<group>"; };
+               2D6F3E931C1F85550061DBD4 /* JSMockPageOverlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMockPageOverlay.h; sourceTree = "<group>"; };
                2D70BA1218074DDF0001908A /* PlatformCALayerCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformCALayerCocoa.h; sourceTree = "<group>"; };
                2D70BA1418074F850001908A /* PlatformCALayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformCALayer.cpp; sourceTree = "<group>"; };
                2D76BB801945632400CFD29A /* RunLoopObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RunLoopObserver.h; sourceTree = "<group>"; };
                                A1B5B29C1AAA846E008B6042 /* MockContentFilterSettings.cpp */,
                                A1B5B29D1AAA846E008B6042 /* MockContentFilterSettings.h */,
                                A19AEA1C1AAA7C4900B52B25 /* MockContentFilterSettings.idl */,
+                               2D6F3E8A1C1ECB1C0061DBD4 /* MockPageOverlay.cpp */,
+                               2D6F3E8B1C1ECB1C0061DBD4 /* MockPageOverlay.h */,
+                               2D6F3E8C1C1ECB1C0061DBD4 /* MockPageOverlay.idl */,
                                2DAAE32C19DCAF6000E002D2 /* MockPageOverlayClient.cpp */,
                                2DAAE32D19DCAF6000E002D2 /* MockPageOverlayClient.h */,
                                EB081CD81696084400553730 /* TypeConversions.h */,
                                CD5393D2175E018600C07123 /* JSMemoryInfo.h */,
                                A19AEA1D1AAA806E00B52B25 /* JSMockContentFilterSettings.cpp */,
                                A19AEA1E1AAA806E00B52B25 /* JSMockContentFilterSettings.h */,
+                               2D6F3E921C1F85550061DBD4 /* JSMockPageOverlay.cpp */,
+                               2D6F3E931C1F85550061DBD4 /* JSMockPageOverlay.h */,
                                EBF5121A1696496C0056BD25 /* JSTypeConversions.cpp */,
                                EBF5121B1696496C0056BD25 /* JSTypeConversions.h */,
                        );
                                417DA71E13735DFA007C57FB /* JSInternals.h in Headers */,
                                A740B5A514C935AB00A77FA4 /* JSInternalSettings.h in Headers */,
                                53ED3FDF167A88E7006762E6 /* JSInternalSettingsGenerated.h in Headers */,
+                               2D6F3E911C1ECB2F0061DBD4 /* MockPageOverlay.h in Headers */,
                                A740B59514C935AB00A77FA4 /* JSMallocStatistics.h in Headers */,
                                CD5393D4175E018600C07123 /* JSMemoryInfo.h in Headers */,
                                A19AEA211AAA808600B52B25 /* JSMockContentFilterSettings.h in Headers */,
                                B22279CE0D00BF220071B782 /* SVGFEComponentTransferElement.h in Headers */,
                                B22279D10D00BF220071B782 /* SVGFECompositeElement.h in Headers */,
                                1921327511C0E6BB00456238 /* SVGFEConvolveMatrixElement.h in Headers */,
+                               2D6F3E951C1F85550061DBD4 /* JSMockPageOverlay.h in Headers */,
                                B22279D40D00BF220071B782 /* SVGFEDiffuseLightingElement.h in Headers */,
                                B22279D70D00BF220071B782 /* SVGFEDisplacementMapElement.h in Headers */,
                                B22279DA0D00BF220071B782 /* SVGFEDistantLightElement.h in Headers */,
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               2D4150DE1C1F868C000A3BA2 /* JSMockPageOverlay.cpp in Sources */,
                                417DA6D913734E6E007C57FB /* Internals.cpp in Sources */,
                                E179F0DA1B9774FE00ED0A27 /* Internals.mm in Sources */,
                                A7BF7EDF14C9175A0014489D /* InternalSettings.cpp in Sources */,
                                CD5393D3175E018600C07123 /* JSMemoryInfo.cpp in Sources */,
                                A19AEA221AAA808A00B52B25 /* JSMockContentFilterSettings.cpp in Sources */,
                                A1E5B31F1AAD1DA4006EBEFB /* JSMockContentFilterSettingsCustom.cpp in Sources */,
+                               2D6F3E901C1ECB270061DBD4 /* MockPageOverlay.cpp in Sources */,
                                EBF5121C1696496C0056BD25 /* JSTypeConversions.cpp in Sources */,
                                CDC26B40160A8CC60026757B /* MockCDM.cpp in Sources */,
                                A1BF6B821AA96C7D00AF4A8A /* MockContentFilter.cpp in Sources */,
index b24b180..4e9c443 100644 (file)
@@ -75,7 +75,7 @@ PageOverlayController* PageOverlay::controller() const
 IntRect PageOverlay::bounds() const
 {
     if (!m_overrideFrame.isEmpty())
-        return m_overrideFrame;
+        return { { }, m_overrideFrame.size() };
 
     FrameView* frameView = m_page->mainFrame().view();
 
@@ -187,6 +187,7 @@ bool PageOverlay::mouseEvent(const PlatformMouseEvent& mouseEvent)
 
     if (m_overlayType == PageOverlay::OverlayType::Document)
         mousePositionInOverlayCoordinates = m_page->mainFrame().view()->windowToContents(mousePositionInOverlayCoordinates);
+    mousePositionInOverlayCoordinates.moveBy(-frame().location());
 
     // Ignore events outside the bounds.
     if (m_shouldIgnoreMouseEventsOutsideBounds && !bounds().contains(mousePositionInOverlayCoordinates))
index a61947e..3ce0e46 100644 (file)
@@ -78,6 +78,7 @@ public:
     virtual PageOverlayID pageOverlayID() const { return m_pageOverlayID; }
 
     void setPage(Page*);
+    Page* page() const { return m_page; }
     WEBCORE_EXPORT void setNeedsDisplay(const IntRect& dirtyRect);
     WEBCORE_EXPORT void setNeedsDisplay();
 
index 0712e82..7de2f13 100644 (file)
@@ -82,6 +82,7 @@
 #include "MediaPlayer.h"
 #include "MemoryCache.h"
 #include "MemoryInfo.h"
+#include "MockPageOverlay.h"
 #include "MockPageOverlayClient.h"
 #include "Page.h"
 #include "PageCache.h"
@@ -2990,16 +2991,15 @@ void Internals::setMockMediaPlaybackTargetPickerState(const String& deviceName,
 }
 #endif
 
-
-void Internals::installMockPageOverlay(const String& overlayType, ExceptionCode& ec)
+RefPtr<MockPageOverlay> Internals::installMockPageOverlay(const String& overlayType, ExceptionCode& ec)
 {
     Document* document = contextDocument();
     if (!document || !document->frame()) {
         ec = INVALID_ACCESS_ERR;
-        return;
+        return nullptr;
     }
 
-    MockPageOverlayClient::singleton().installOverlay(document->frame()->mainFrame(), overlayType == "view" ? PageOverlay::OverlayType::View : PageOverlay::OverlayType::Document);
+    return MockPageOverlayClient::singleton().installOverlay(document->frame()->mainFrame(), overlayType == "view" ? PageOverlay::OverlayType::View : PageOverlay::OverlayType::Document);
 }
 
 String Internals::pageOverlayLayerTreeAsText(ExceptionCode& ec) const
index 79f4dc4..61844a6 100644 (file)
@@ -58,6 +58,7 @@ class InternalSettings;
 class MallocStatistics;
 class MediaSession;
 class MemoryInfo;
+class MockPageOverlay;
 class Node;
 class Page;
 class Range;
@@ -417,7 +418,7 @@ public:
     void simulateSystemSleep() const;
     void simulateSystemWake() const;
 
-    void installMockPageOverlay(const String& overlayType, ExceptionCode&);
+    RefPtr<MockPageOverlay> installMockPageOverlay(const String& overlayType, ExceptionCode&);
     String pageOverlayLayerTreeAsText(ExceptionCode&) const;
 
     void setPageMuted(bool);
index 86d4001..1b04e3a 100644 (file)
@@ -385,7 +385,7 @@ enum MediaControlEvent {
     [Conditional=VIDEO] void simulateSystemWake();
     [Conditional=VIDEO] boolean elementIsBlockingDisplaySleep(Element element);
 
-    [RaisesException] void installMockPageOverlay(PageOverlayType type);
+    [RaisesException] MockPageOverlay installMockPageOverlay(PageOverlayType type);
     [RaisesException] DOMString pageOverlayLayerTreeAsText();
 
     void setPageMuted(boolean muted);
diff --git a/Source/WebCore/testing/MockPageOverlay.cpp b/Source/WebCore/testing/MockPageOverlay.cpp
new file mode 100644 (file)
index 0000000..0fe713f
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2015 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 "MockPageOverlay.h"
+
+#include "Document.h"
+#include "GraphicsContext.h"
+#include "GraphicsLayer.h"
+#include "MainFrame.h"
+#include "PageOverlayController.h"
+#include "PlatformMouseEvent.h"
+#include <wtf/NeverDestroyed.h>
+#include <wtf/text/StringBuilder.h>
+
+namespace WebCore {
+
+Ref<MockPageOverlay> MockPageOverlay::create(PageOverlay* overlay)
+{
+    return adoptRef(*new MockPageOverlay(overlay));
+}
+
+MockPageOverlay::MockPageOverlay(PageOverlay* overlay)
+    : m_overlay(overlay)
+{
+}
+
+void MockPageOverlay::setFrame(double x, double y, double width, double height)
+{
+    m_overlay->setFrame(IntRect(x, y, width, height));
+}
+
+}
diff --git a/Source/WebCore/testing/MockPageOverlay.h b/Source/WebCore/testing/MockPageOverlay.h
new file mode 100644 (file)
index 0000000..1377b68
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2015 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 MockPageOverlay_h
+#define MockPageOverlay_h
+
+#include "PageOverlay.h"
+
+namespace WebCore {
+
+class MainFrame;
+
+class MockPageOverlay : public RefCounted<MockPageOverlay> {
+public:
+    static Ref<MockPageOverlay> create(PageOverlay*);
+
+    void setFrame(double x, double y, double width, double height);
+
+    PageOverlay* overlay() const { return m_overlay.get(); }
+
+private:
+    explicit MockPageOverlay(PageOverlay*);
+
+    RefPtr<PageOverlay> m_overlay;
+};
+
+}
+
+#endif // MockPageOverlay_h
diff --git a/Source/WebCore/testing/MockPageOverlay.idl b/Source/WebCore/testing/MockPageOverlay.idl
new file mode 100644 (file)
index 0000000..7a5a4a8
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+[
+    NoInterfaceObject,
+    ImplementationLacksVTable
+] interface MockPageOverlay {
+    void setFrame(double x, double y, double width, double height);
+};
index cbc3856..03bb9ea 100644 (file)
 #include "config.h"
 #include "MockPageOverlayClient.h"
 
+#include "Document.h"
 #include "GraphicsContext.h"
 #include "GraphicsLayer.h"
 #include "MainFrame.h"
 #include "PageOverlayController.h"
+#include "PlatformMouseEvent.h"
 #include <wtf/NeverDestroyed.h>
+#include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
@@ -44,19 +47,24 @@ MockPageOverlayClient::MockPageOverlayClient()
 {
 }
 
-void MockPageOverlayClient::installOverlay(MainFrame& mainFrame, PageOverlay::OverlayType overlayType)
+Ref<MockPageOverlay> 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());
+    auto overlay = PageOverlay::create(*this, overlayType);
+    mainFrame.pageOverlayController().installPageOverlay(overlay.ptr(), PageOverlay::FadeMode::DoNotFade);
+
+    auto mockOverlay = MockPageOverlay::create(overlay.ptr());
+    m_overlays.add(mockOverlay.ptr());
+
+    return mockOverlay;
 }
 
 void MockPageOverlayClient::uninstallAllOverlays()
 {
     while (!m_overlays.isEmpty()) {
-        PageOverlay* overlay = m_overlays.takeAny();
-        ASSERT(overlay->controller());
-        overlay->controller()->uninstallPageOverlay(overlay, PageOverlay::FadeMode::DoNotFade);
+        MockPageOverlay* mockOverlay = m_overlays.takeAny();
+        PageOverlayController* overlayController = mockOverlay->overlay()->controller();
+        ASSERT(overlayController);
+        overlayController->uninstallPageOverlay(mockOverlay->overlay(), PageOverlay::FadeMode::DoNotFade);
     }
 }
 
@@ -67,7 +75,12 @@ String MockPageOverlayClient::layerTreeAsText(MainFrame& mainFrame)
 
 void MockPageOverlayClient::pageOverlayDestroyed(PageOverlay& overlay)
 {
-    m_overlays.remove(&overlay);
+    for (auto& mockOverlay : m_overlays) {
+        if (mockOverlay->overlay() == &overlay) {
+            m_overlays.remove(mockOverlay);
+            return;
+        }
+    }
 }
 
 void MockPageOverlayClient::willMoveToPage(PageOverlay&, Page*)
@@ -80,8 +93,20 @@ void MockPageOverlayClient::didMoveToPage(PageOverlay& overlay, Page* page)
         overlay.setNeedsDisplay();
 }
 
-void MockPageOverlayClient::drawRect(PageOverlay& overlay, GraphicsContext& context, const IntRect&)
+void MockPageOverlayClient::drawRect(PageOverlay& overlay, GraphicsContext& context, const IntRect& dirtyRect)
 {
+    StringBuilder message;
+    message.appendLiteral("MockPageOverlayClient::drawRect dirtyRect (");
+    message.appendNumber(dirtyRect.x());
+    message.appendLiteral(", ");
+    message.appendNumber(dirtyRect.y());
+    message.appendLiteral(", ");
+    message.appendNumber(dirtyRect.width());
+    message.appendLiteral(", ");
+    message.appendNumber(dirtyRect.height());
+    message.appendLiteral(")");
+    overlay.page()->mainFrame().document()->addConsoleMessage(MessageSource::Other, MessageLevel::Debug, message.toString());
+
     GraphicsContextStateSaver stateSaver(context);
 
     FloatRect insetRect = overlay.bounds();
@@ -97,8 +122,16 @@ void MockPageOverlayClient::drawRect(PageOverlay& overlay, GraphicsContext& cont
     context.strokeRect(insetRect, 20);
 }
 
-bool MockPageOverlayClient::mouseEvent(PageOverlay&, const PlatformMouseEvent&)
+bool MockPageOverlayClient::mouseEvent(PageOverlay& overlay, const PlatformMouseEvent& event)
 {
+    StringBuilder message;
+    message.appendLiteral("MockPageOverlayClient::mouseEvent location (");
+    message.appendNumber(event.position().x());
+    message.appendLiteral(", ");
+    message.appendNumber(event.position().y());
+    message.appendLiteral(")");
+    overlay.page()->mainFrame().document()->addConsoleMessage(MessageSource::Other, MessageLevel::Debug, message.toString());
+
     return false;
 }
 
index 1dd297b..e6c655e 100644 (file)
@@ -26,6 +26,7 @@
 #ifndef MockPageOverlayClient_h
 #define MockPageOverlayClient_h
 
+#include "MockPageOverlay.h"
 #include "PageOverlay.h"
 #include <wtf/HashSet.h>
 
@@ -40,7 +41,7 @@ public:
 
     explicit MockPageOverlayClient();
 
-    void installOverlay(MainFrame&, PageOverlay::OverlayType);
+    Ref<MockPageOverlay> installOverlay(MainFrame&, PageOverlay::OverlayType);
     void uninstallAllOverlays();
 
     String layerTreeAsText(MainFrame&);
@@ -59,7 +60,7 @@ private:
     virtual bool copyAccessibilityAttributeBoolValueForPoint(PageOverlay&, String /* attribute */, FloatPoint, bool&) override;
     virtual Vector<String> copyAccessibilityAttributeNames(PageOverlay&, bool /* parameterizedNames */) override;
 
-    HashSet<PageOverlay*> m_overlays;
+    HashSet<MockPageOverlay*> m_overlays;
 };
 
 }