Title: [125700] trunk
Revision
125700
Author
[email protected]
Date
2012-08-15 12:58:58 -0700 (Wed, 15 Aug 2012)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=93693
[WK2] REGRESSION(125091): pixel results don't sow scrollbars 
anymore

Reviewed by Sam Weinig.

Source/WebCore: 

This is a regression from http://trac.webkit.org/changeset/125091 
in which I failed to noticed that 
WKBundlePageCreateSnapshotInViewCoordinates() did actually do 
something different than 
WKBundlePageCreateSnapshotInDocumentCoordinates(). Specifically, 
it used ScrollView::paint() to paint instead of 
FrameView::paintContents(). So this patch restores that 
functionality by adding a value to SnapshotOptions indicating 
whether the snapshot should be taken in ViewCoordinates 
(otherwise it defaults to DocumentCoordinates).

FrameView:: paintContentsForSnapshot() now takes a new parameter 
that indicates whether to take the snapshot in document 
coordinates or view coordinates.
* WebCore.exp.in:
* page/FrameView.cpp:
(WebCore::FrameView::paintContentsForSnapshot):
* page/FrameView.h:

Source/WebKit2: 

This is a regression from http://trac.webkit.org/changeset/125091 
in which I failed to noticed that 
WKBundlePageCreateSnapshotInViewCoordinates() did actually do 
something different than 
WKBundlePageCreateSnapshotInDocumentCoordinates(). Specifically, 
it used ScrollView::paint() to paint instead of 
FrameView::paintContents(). So this patch restores that 
functionality by adding a value to SnapshotOptions indicating 
whether the snapshot should be taken in ViewCoordinates 
(otherwise it defaults to DocumentCoordinates).

* Shared/API/c/WKImage.h:
* Shared/API/c/WKSharedAPICast.h:
(WebKit::toSnapshotOptions):
* Shared/ImageOptions.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::scaledSnapshotWithOptions):

Even though we plan to deprecate this API, it should keep doing 
the right thing until it's gone.
* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageCreateSnapshotInViewCoordinates):

Tools: 

Use new API WKBundlePageCreateSnapshotWithOptions().
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::dump):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (125699 => 125700)


--- trunk/Source/WebCore/ChangeLog	2012-08-15 19:54:29 UTC (rev 125699)
+++ trunk/Source/WebCore/ChangeLog	2012-08-15 19:58:58 UTC (rev 125700)
@@ -1,3 +1,30 @@
+2012-08-15  Beth Dakin  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=93693
+        [WK2] REGRESSION(125091): pixel results don't sow scrollbars 
+        anymore
+
+        Reviewed by Sam Weinig.
+
+        This is a regression from http://trac.webkit.org/changeset/125091 
+        in which I failed to noticed that 
+        WKBundlePageCreateSnapshotInViewCoordinates() did actually do 
+        something different than 
+        WKBundlePageCreateSnapshotInDocumentCoordinates(). Specifically, 
+        it used ScrollView::paint() to paint instead of 
+        FrameView::paintContents(). So this patch restores that 
+        functionality by adding a value to SnapshotOptions indicating 
+        whether the snapshot should be taken in ViewCoordinates 
+        (otherwise it defaults to DocumentCoordinates).
+
+        FrameView:: paintContentsForSnapshot() now takes a new parameter 
+        that indicates whether to take the snapshot in document 
+        coordinates or view coordinates.
+        * WebCore.exp.in:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::paintContentsForSnapshot):
+        * page/FrameView.h:
+
 2012-08-15  Benjamin Poulain  <[email protected]>
 
         Use literal initialization for CSS's pseudo types

Modified: trunk/Source/WebCore/WebCore.exp.in (125699 => 125700)


--- trunk/Source/WebCore/WebCore.exp.in	2012-08-15 19:54:29 UTC (rev 125699)
+++ trunk/Source/WebCore/WebCore.exp.in	2012-08-15 19:58:58 UTC (rev 125700)
@@ -956,7 +956,7 @@
 __ZN7WebCore9FrameView22setBaseBackgroundColorERKNS_5ColorE
 __ZN7WebCore9FrameView23updateCanHaveScrollbarsEv
 __ZN7WebCore9FrameView24forceLayoutForPaginationERKNS_9FloatSizeES3_fNS_19AdjustViewSizeOrNotE
-__ZN7WebCore9FrameView24paintContentsForSnapshotEPNS_15GraphicsContextERKNS_7IntRectENS0_18SelectionInSnaphotE
+__ZN7WebCore9FrameView24paintContentsForSnapshotEPNS_15GraphicsContextERKNS_7IntRectENS0_18SelectionInSnaphotENS0_26CoordinateSpaceForSnapshotE
 __ZN7WebCore9FrameView26adjustPageHeightDeprecatedEPffff
 __ZN7WebCore9FrameView29setShouldUpdateWhileOffscreenEb
 __ZN7WebCore9FrameView37updateLayoutAndStyleIfNeededRecursiveEv

Modified: trunk/Source/WebCore/page/FrameView.cpp (125699 => 125700)


--- trunk/Source/WebCore/page/FrameView.cpp	2012-08-15 19:54:29 UTC (rev 125699)
+++ trunk/Source/WebCore/page/FrameView.cpp	2012-08-15 19:58:58 UTC (rev 125700)
@@ -3146,7 +3146,7 @@
     m_nodeToDraw = node;
 }
 
-void FrameView::paintContentsForSnapshot(GraphicsContext* context, const IntRect& imageRect, SelectionInSnaphot shouldPaintSelection)
+void FrameView::paintContentsForSnapshot(GraphicsContext* context, const IntRect& imageRect, SelectionInSnaphot shouldPaintSelection, CoordinateSpaceForSnapshot coordinateSpace)
 {
     updateLayoutAndStyleIfNeededRecursive();
 
@@ -3164,7 +3164,13 @@
         }
     }
 
-    paintContents(context, imageRect);
+    if (coordinateSpace == DocumentCoordinates)
+        paintContents(context, imageRect);
+    else {
+        // A snapshot in ViewCoordinates will include a scrollbar, and the snapshot will contain
+        // whatever content the document is currently scrolled to.
+        paint(context, imageRect);
+    }
 
     // Restore selection.
     if (shouldPaintSelection == ExcludeSelection) {

Modified: trunk/Source/WebCore/page/FrameView.h (125699 => 125700)


--- trunk/Source/WebCore/page/FrameView.h	2012-08-15 19:54:29 UTC (rev 125699)
+++ trunk/Source/WebCore/page/FrameView.h	2012-08-15 19:58:58 UTC (rev 125700)
@@ -247,7 +247,8 @@
     void setNodeToDraw(Node*);
 
     enum SelectionInSnaphot { IncludeSelection, ExcludeSelection };
-    void paintContentsForSnapshot(GraphicsContext*, const IntRect& imageRect, SelectionInSnaphot shouldPaintSelection);
+    enum CoordinateSpaceForSnapshot { DocumentCoordinates, ViewCoordinates };
+    void paintContentsForSnapshot(GraphicsContext*, const IntRect& imageRect, SelectionInSnaphot shouldPaintSelection, CoordinateSpaceForSnapshot);
 
     virtual void paintOverhangAreas(GraphicsContext*, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect);
     virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect);

Modified: trunk/Source/WebKit2/ChangeLog (125699 => 125700)


--- trunk/Source/WebKit2/ChangeLog	2012-08-15 19:54:29 UTC (rev 125699)
+++ trunk/Source/WebKit2/ChangeLog	2012-08-15 19:58:58 UTC (rev 125700)
@@ -1,3 +1,34 @@
+2012-08-15  Beth Dakin  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=93693
+        [WK2] REGRESSION(125091): pixel results don't sow scrollbars 
+        anymore
+
+        Reviewed by Sam Weinig.
+
+        This is a regression from http://trac.webkit.org/changeset/125091 
+        in which I failed to noticed that 
+        WKBundlePageCreateSnapshotInViewCoordinates() did actually do 
+        something different than 
+        WKBundlePageCreateSnapshotInDocumentCoordinates(). Specifically, 
+        it used ScrollView::paint() to paint instead of 
+        FrameView::paintContents(). So this patch restores that 
+        functionality by adding a value to SnapshotOptions indicating 
+        whether the snapshot should be taken in ViewCoordinates 
+        (otherwise it defaults to DocumentCoordinates).
+
+        * Shared/API/c/WKImage.h:
+        * Shared/API/c/WKSharedAPICast.h:
+        (WebKit::toSnapshotOptions):
+        * Shared/ImageOptions.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::scaledSnapshotWithOptions):
+
+        Even though we plan to deprecate this API, it should keep doing 
+        the right thing until it's gone.
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+        (WKBundlePageCreateSnapshotInViewCoordinates):
+
 2012-08-15  Brady Eidson  <[email protected]>
 
         Removing a plug-in element from a page opened in a background tab in Safari crashes

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


--- trunk/Source/WebKit2/Shared/API/c/WKImage.h	2012-08-15 19:54:29 UTC (rev 125699)
+++ trunk/Source/WebKit2/Shared/API/c/WKImage.h	2012-08-15 19:58:58 UTC (rev 125700)
@@ -40,7 +40,8 @@
 
 enum {
     kWKSnapshotOptionsShareable = 1 << 0,
-    kWKSnapshotOptionsExcludeSelectionHighlighting = 1 << 1
+    kWKSnapshotOptionsExcludeSelectionHighlighting = 1 << 1,
+    kWKSnapshotOptionsInViewCoordinates = 1 << 2
 };
 typedef uint32_t WKSnapshotOptions;
 

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


--- trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h	2012-08-15 19:54:29 UTC (rev 125699)
+++ trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h	2012-08-15 19:58:58 UTC (rev 125700)
@@ -776,6 +776,8 @@
         snapshotOptions |= SnapshotOptionsShareable;
     if (wkSnapshotOptions & kWKSnapshotOptionsExcludeSelectionHighlighting)
         snapshotOptions |= SnapshotOptionsExcludeSelectionHighlighting;
+    if (wkSnapshotOptions & kWKSnapshotOptionsInViewCoordinates)
+        snapshotOptions |= SnapshotOptionsInViewCoordinates;
 
     return snapshotOptions;
 }

Modified: trunk/Source/WebKit2/Shared/ImageOptions.h (125699 => 125700)


--- trunk/Source/WebKit2/Shared/ImageOptions.h	2012-08-15 19:54:29 UTC (rev 125699)
+++ trunk/Source/WebKit2/Shared/ImageOptions.h	2012-08-15 19:58:58 UTC (rev 125700)
@@ -34,7 +34,8 @@
 
 enum {
     SnapshotOptionsShareable = 1 << 0,
-    SnapshotOptionsExcludeSelectionHighlighting = 1 << 1
+    SnapshotOptionsExcludeSelectionHighlighting = 1 << 1,
+    SnapshotOptionsInViewCoordinates = 1 << 2
 };
 typedef uint32_t SnapshotOptions;
 

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp (125699 => 125700)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp	2012-08-15 19:54:29 UTC (rev 125699)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp	2012-08-15 19:58:58 UTC (rev 125700)
@@ -295,7 +295,9 @@
 
 WKImageRef WKBundlePageCreateSnapshotInViewCoordinates(WKBundlePageRef pageRef, WKRect rect, WKImageOptions options)
 {
-    RefPtr<WebImage> webImage = toImpl(pageRef)->scaledSnapshotWithOptions(toIntRect(rect), 1, snapshotOptionsFromImageOptions(options));
+    SnapshotOptions snapshotOptions = snapshotOptionsFromImageOptions(options);
+    snapshotOptions |= SnapshotOptionsInViewCoordinates;
+    RefPtr<WebImage> webImage = toImpl(pageRef)->scaledSnapshotWithOptions(toIntRect(rect), 1, snapshotOptions);
     return toAPI(webImage.release().leakRef());
 }
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (125699 => 125700)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2012-08-15 19:54:29 UTC (rev 125699)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2012-08-15 19:58:58 UTC (rev 125700)
@@ -1225,8 +1225,12 @@
     if (options & SnapshotOptionsExcludeSelectionHighlighting)
         shouldPaintSelection = FrameView::ExcludeSelection;
 
-    frameView->paintContentsForSnapshot(graphicsContext.get(), rect, shouldPaintSelection);
+    FrameView::CoordinateSpaceForSnapshot coordinateSpace = FrameView::DocumentCoordinates;
+    if (options & SnapshotOptionsInViewCoordinates)
+        coordinateSpace = FrameView::ViewCoordinates;
 
+    frameView->paintContentsForSnapshot(graphicsContext.get(), rect, shouldPaintSelection, coordinateSpace);
+
     return snapshot.release();
 }
 

Modified: trunk/Tools/ChangeLog (125699 => 125700)


--- trunk/Tools/ChangeLog	2012-08-15 19:54:29 UTC (rev 125699)
+++ trunk/Tools/ChangeLog	2012-08-15 19:58:58 UTC (rev 125700)
@@ -1,3 +1,15 @@
+2012-08-15  Beth Dakin  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=93693
+        [WK2] REGRESSION(125091): pixel results don't sow scrollbars 
+        anymore
+
+        Reviewed by Sam Weinig.
+
+        Use new API WKBundlePageCreateSnapshotWithOptions().
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::InjectedBundlePage::dump):
+
 2012-08-15  Alexey Proskuryakov  <[email protected]>
 
         Add rfong to Bugzilla CC "contributor" list.

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (125699 => 125700)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2012-08-15 19:54:29 UTC (rev 125699)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2012-08-15 19:58:58 UTC (rev 125700)
@@ -899,7 +899,7 @@
         InjectedBundle::shared().dumpBackForwardListsForAllPages();
 
     if (InjectedBundle::shared().shouldDumpPixels() && InjectedBundle::shared().layoutTestController()->shouldDumpPixels()) {
-        InjectedBundle::shared().setPixelResult(adoptWK(WKBundlePageCreateSnapshotInViewCoordinates(m_page, WKBundleFrameGetVisibleContentBounds(WKBundlePageGetMainFrame(m_page)), kWKImageOptionsShareable)).get());
+        InjectedBundle::shared().setPixelResult(adoptWK(WKBundlePageCreateSnapshotWithOptions(m_page, WKBundleFrameGetVisibleContentBounds(WKBundlePageGetMainFrame(m_page)), kWKSnapshotOptionsShareable | kWKSnapshotOptionsInViewCoordinates)).get());
         if (WKBundlePageIsTrackingRepaints(m_page))
             InjectedBundle::shared().setRepaintRects(adoptWK(WKBundlePageCopyTrackedRepaintRects(m_page)).get());
     }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to