Title: [131476] trunk
Revision
131476
Author
[email protected]
Date
2012-10-16 10:51:53 -0700 (Tue, 16 Oct 2012)

Log Message

Implement testRunner.dumpSelectionRect() in WebKitTestRunner
https://bugs.webkit.org/show_bug.cgi?id=69545

Reviewed by Simon Fraser.

Source/WebCore: 

* WebCore.exp.in:

Source/WebKit2: 

* Shared/API/c/WKImage.h: Add another option that controls whether
the selection rectangle should be painted onto the snapshot.
* Shared/API/c/WKSharedAPICast.h:
(WebKit::toSnapshotOptions): Add a case for the new option
mentioned above.
* Shared/ImageOptions.h: More plumbing for the option above.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::scaledSnapshotWithOptions): Draw a red rectangle
around the selection area when
SnapshotOptionsPaintSelectionRectangle is set.

Tools: 

* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::dump): Set the
kWKSnapshotOptionsPaintSelectionRectangle option if
testRunner.dumpSelectionRect() is called.
* WebKitTestRunner/InjectedBundle/TestRunner.h:
(WTR::TestRunner::dumpSelectionRect):
(WTR::TestRunner::shouldDumpSelectionRect):
(TestRunner):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (131475 => 131476)


--- trunk/Source/WebCore/ChangeLog	2012-10-16 17:51:22 UTC (rev 131475)
+++ trunk/Source/WebCore/ChangeLog	2012-10-16 17:51:53 UTC (rev 131476)
@@ -1,3 +1,12 @@
+2012-10-16  Raphael Kubo da Costa  <[email protected]>
+
+        Implement testRunner.dumpSelectionRect() in WebKitTestRunner
+        https://bugs.webkit.org/show_bug.cgi?id=69545
+
+        Reviewed by Simon Fraser.
+
+        * WebCore.exp.in:
+
 2012-10-16  Allan Sandfeld Jensen  <[email protected]>
 
         [Qt] Implement fastBoundingPath/boundingPath distinction.

Modified: trunk/Source/WebCore/WebCore.exp.in (131475 => 131476)


--- trunk/Source/WebCore/WebCore.exp.in	2012-10-16 17:51:22 UTC (rev 131475)
+++ trunk/Source/WebCore/WebCore.exp.in	2012-10-16 17:51:53 UTC (rev 131476)
@@ -352,8 +352,10 @@
 __ZN7WebCore15FocusController15setInitialFocusENS_14FocusDirectionEPNS_13KeyboardEventE
 __ZN7WebCore15FocusController28setContainingWindowIsVisibleEb
 __ZN7WebCore15FocusController9setActiveEb
+__ZN7WebCore15GraphicsContext10strokeRectERKNS_9FloatRectEf
 __ZN7WebCore15GraphicsContext11clearShadowEv
 __ZN7WebCore15GraphicsContext12setFillColorERKNS_5ColorENS_10ColorSpaceE
+__ZN7WebCore15GraphicsContext14setStrokeColorERKNS_5ColorENS_10ColorSpaceE
 __ZN7WebCore15GraphicsContext15setFillGradientEN3WTF10PassRefPtrINS_8GradientEEE
 __ZN7WebCore15GraphicsContext18setShouldAntialiasEb
 __ZN7WebCore15GraphicsContext19setIsCALayerContextEb
@@ -848,6 +850,7 @@
 __ZN7WebCore7TextRun22setAllowsRoundingHacksEb
 __ZN7WebCore7cookiesEPKNS_8DocumentERKNS_4KURLE
 __ZN7WebCore7jsArrayEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEN3WTF10PassRefPtrINS_13DOMStringListEEE
+__ZN7WebCore7makeRGBEiii
 __ZN7WebCore7replaceERN3WTF6StringERKNS_17RegularExpressionERKS1_
 __ZN7WebCore7toRangeEN3JSC7JSValueE
 __ZN7WebCore8CSSValue7destroyEv

Modified: trunk/Source/WebKit2/ChangeLog (131475 => 131476)


--- trunk/Source/WebKit2/ChangeLog	2012-10-16 17:51:22 UTC (rev 131475)
+++ trunk/Source/WebKit2/ChangeLog	2012-10-16 17:51:53 UTC (rev 131476)
@@ -1,3 +1,21 @@
+2012-10-16  Raphael Kubo da Costa  <[email protected]>
+
+        Implement testRunner.dumpSelectionRect() in WebKitTestRunner
+        https://bugs.webkit.org/show_bug.cgi?id=69545
+
+        Reviewed by Simon Fraser.
+
+        * Shared/API/c/WKImage.h: Add another option that controls whether
+        the selection rectangle should be painted onto the snapshot.
+        * Shared/API/c/WKSharedAPICast.h:
+        (WebKit::toSnapshotOptions): Add a case for the new option
+        mentioned above.
+        * Shared/ImageOptions.h: More plumbing for the option above.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::scaledSnapshotWithOptions): Draw a red rectangle
+        around the selection area when
+        SnapshotOptionsPaintSelectionRectangle is set.
+
 2012-10-16  Christophe Dumez  <[email protected]>
 
         [EFL][WK2] Have intent classes subclass RefCounted

Modified: trunk/Source/WebKit2/Shared/API/c/WKImage.h (131475 => 131476)


--- trunk/Source/WebKit2/Shared/API/c/WKImage.h	2012-10-16 17:51:22 UTC (rev 131475)
+++ trunk/Source/WebKit2/Shared/API/c/WKImage.h	2012-10-16 17:51:53 UTC (rev 131476)
@@ -41,7 +41,8 @@
 enum {
     kWKSnapshotOptionsShareable = 1 << 0,
     kWKSnapshotOptionsExcludeSelectionHighlighting = 1 << 1,
-    kWKSnapshotOptionsInViewCoordinates = 1 << 2
+    kWKSnapshotOptionsInViewCoordinates = 1 << 2,
+    kWKSnapshotOptionsPaintSelectionRectangle = 1 << 3
 };
 typedef uint32_t WKSnapshotOptions;
 

Modified: trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h (131475 => 131476)


--- trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h	2012-10-16 17:51:22 UTC (rev 131475)
+++ trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h	2012-10-16 17:51:53 UTC (rev 131476)
@@ -809,6 +809,8 @@
         snapshotOptions |= SnapshotOptionsExcludeSelectionHighlighting;
     if (wkSnapshotOptions & kWKSnapshotOptionsInViewCoordinates)
         snapshotOptions |= SnapshotOptionsInViewCoordinates;
+    if (wkSnapshotOptions & kWKSnapshotOptionsPaintSelectionRectangle)
+        snapshotOptions |= SnapshotOptionsPaintSelectionRectangle;
 
     return snapshotOptions;
 }

Modified: trunk/Source/WebKit2/Shared/ImageOptions.h (131475 => 131476)


--- trunk/Source/WebKit2/Shared/ImageOptions.h	2012-10-16 17:51:22 UTC (rev 131475)
+++ trunk/Source/WebKit2/Shared/ImageOptions.h	2012-10-16 17:51:53 UTC (rev 131476)
@@ -35,7 +35,8 @@
 enum {
     SnapshotOptionsShareable = 1 << 0,
     SnapshotOptionsExcludeSelectionHighlighting = 1 << 1,
-    SnapshotOptionsInViewCoordinates = 1 << 2
+    SnapshotOptionsInViewCoordinates = 1 << 2,
+    SnapshotOptionsPaintSelectionRectangle = 1 << 3
 };
 typedef uint32_t SnapshotOptions;
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (131475 => 131476)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2012-10-16 17:51:22 UTC (rev 131475)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2012-10-16 17:51:53 UTC (rev 131476)
@@ -1313,6 +1313,12 @@
 
     frameView->paintContentsForSnapshot(graphicsContext.get(), rect, shouldPaintSelection, coordinateSpace);
 
+    if (options & SnapshotOptionsPaintSelectionRectangle) {
+        FloatRect selectionRectangle = m_mainFrame->coreFrame()->selection()->bounds();
+        graphicsContext->setStrokeColor(Color(0xFF, 0, 0), ColorSpaceDeviceRGB);
+        graphicsContext->strokeRect(selectionRectangle, 1);
+    }
+
     return snapshot.release();
 }
 

Modified: trunk/Tools/ChangeLog (131475 => 131476)


--- trunk/Tools/ChangeLog	2012-10-16 17:51:22 UTC (rev 131475)
+++ trunk/Tools/ChangeLog	2012-10-16 17:51:53 UTC (rev 131476)
@@ -1,3 +1,19 @@
+2012-10-16  Raphael Kubo da Costa  <[email protected]>
+
+        Implement testRunner.dumpSelectionRect() in WebKitTestRunner
+        https://bugs.webkit.org/show_bug.cgi?id=69545
+
+        Reviewed by Simon Fraser.
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::InjectedBundlePage::dump): Set the
+        kWKSnapshotOptionsPaintSelectionRectangle option if
+        testRunner.dumpSelectionRect() is called.
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        (WTR::TestRunner::dumpSelectionRect):
+        (WTR::TestRunner::shouldDumpSelectionRect):
+        (TestRunner):
+
 2012-10-16  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r131461.

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (131475 => 131476)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2012-10-16 17:51:22 UTC (rev 131475)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2012-10-16 17:51:53 UTC (rev 131476)
@@ -951,7 +951,11 @@
         InjectedBundle::shared().dumpBackForwardListsForAllPages();
 
     if (InjectedBundle::shared().shouldDumpPixels() && InjectedBundle::shared().testRunner()->shouldDumpPixels()) {
-        InjectedBundle::shared().setPixelResult(adoptWK(WKBundlePageCreateSnapshotWithOptions(m_page, WKBundleFrameGetVisibleContentBounds(WKBundlePageGetMainFrame(m_page)), kWKSnapshotOptionsShareable | kWKSnapshotOptionsInViewCoordinates)).get());
+        WKSnapshotOptions options = kWKSnapshotOptionsShareable | kWKSnapshotOptionsInViewCoordinates;
+        if (InjectedBundle::shared().testRunner()->shouldDumpSelectionRect())
+            options |= kWKSnapshotOptionsPaintSelectionRectangle;
+
+        InjectedBundle::shared().setPixelResult(adoptWK(WKBundlePageCreateSnapshotWithOptions(m_page, WKBundleFrameGetVisibleContentBounds(WKBundlePageGetMainFrame(m_page)), options)).get());
         if (WKBundlePageIsTrackingRepaints(m_page))
             InjectedBundle::shared().setRepaintRects(adoptWK(WKBundlePageCopyTrackedRepaintRects(m_page)).get());
     }

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (131475 => 131476)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2012-10-16 17:51:22 UTC (rev 131475)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2012-10-16 17:51:53 UTC (rev 131476)
@@ -73,7 +73,7 @@
     void dumpBackForwardList() { m_shouldDumpBackForwardListsForAllWindows = true; }
     void dumpChildFrameScrollPositions() { m_shouldDumpAllFrameScrollPositions = true; }
     void dumpEditingCallbacks() { m_dumpEditingCallbacks = true; }
-    void dumpSelectionRect() { } // Will need to do something when we support pixel tests.
+    void dumpSelectionRect() { m_dumpSelectionRect = true; }
     void dumpStatusCallbacks() { m_dumpStatusCallbacks = true; }
     void dumpTitleChanges() { m_dumpTitleChanges = true; }
     void dumpFullScreenCallbacks() { m_dumpFullScreenCallbacks = true; }
@@ -177,6 +177,7 @@
     bool shouldDumpWillCacheResponse() const { return m_dumpWillCacheResponse; }
     bool shouldDumpApplicationCacheDelegateCallbacks() const { return m_dumpApplicationCacheDelegateCallbacks; }
     bool shouldDumpDatabaseCallbacks() const { return m_dumpDatabaseCallbacks; }
+    bool shouldDumpSelectionRect() const { return m_dumpSelectionRect; }
 
     bool isPolicyDelegateEnabled() const { return m_policyDelegateEnabled; }
     bool isPolicyDelegatePermissive() const { return m_policyDelegatePermissive; }
@@ -279,6 +280,7 @@
     bool m_dumpStatusCallbacks;
     bool m_dumpTitleChanges;
     bool m_dumpPixels;
+    bool m_dumpSelectionRect;
     bool m_dumpFullScreenCallbacks;
     bool m_dumpFrameLoadCallbacks;
     bool m_dumpProgressFinishedCallback;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to