Title: [165094] trunk
Revision
165094
Author
[email protected]
Date
2014-03-04 21:30:25 -0800 (Tue, 04 Mar 2014)

Log Message

Enable device pixel repaint rect tracking.
https://bugs.webkit.org/show_bug.cgi?id=129712

Reviewed by Simon Fraser.

Tracked repaint rects are device pixel snapped now to support hiDPI test cases.

Source/WebCore:

Test: fast/repaint/hidpi-device-pixel-based-repaint-rect-tracking.html

* WebCore.exp.in:
* page/FrameView.cpp:
(WebCore::FrameView::addTrackedRepaintRect):
(WebCore::FrameView::trackedRepaintRectsAsText): Print them as LayoutUnits to get
trailing zeros cut off.
* page/FrameView.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::calculateClipRects):
* rendering/RenderLayer.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::setContentsNeedDisplay):
(WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
* rendering/RenderView.cpp:
(WebCore::RenderView::repaintViewRectangle):

Source/WebKit/efl:

* WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
(DumpRenderTreeSupportEfl::trackedRepaintRects):

Source/WebKit/gtk:

* WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
(DumpRenderTreeSupportGtk::trackedRepaintRects):

Source/WebKit/mac:

* WebView/WebView.mm:
(-[WebView trackedRepaintRects]): Keep existing behavior for now.

LayoutTests:

* fast/repaint/hidpi-device-pixel-based-repaint-rect-tracking-expected.txt: Added.
* fast/repaint/hidpi-device-pixel-based-repaint-rect-tracking.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (165093 => 165094)


--- trunk/LayoutTests/ChangeLog	2014-03-05 04:44:15 UTC (rev 165093)
+++ trunk/LayoutTests/ChangeLog	2014-03-05 05:30:25 UTC (rev 165094)
@@ -1,3 +1,15 @@
+2014-03-04  Zalan Bujtas  <[email protected]>
+
+        Enable device pixel repaint rect tracking.
+        https://bugs.webkit.org/show_bug.cgi?id=129712
+
+        Reviewed by Simon Fraser.
+
+        Tracked repaint rects are device pixel snapped now to support hiDPI test cases.
+
+        * fast/repaint/hidpi-device-pixel-based-repaint-rect-tracking-expected.txt: Added.
+        * fast/repaint/hidpi-device-pixel-based-repaint-rect-tracking.html: Added.
+
 2014-03-01  Filip Pizlo  <[email protected]>
 
         DFG and FTL should specialize for and support CompareStrictEq over Misc (i.e. boolean, undefined, or null)

Added: trunk/LayoutTests/fast/repaint/hidpi-device-pixel-based-repaint-rect-tracking-expected.txt (0 => 165094)


--- trunk/LayoutTests/fast/repaint/hidpi-device-pixel-based-repaint-rect-tracking-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/hidpi-device-pixel-based-repaint-rect-tracking-expected.txt	2014-03-05 05:30:25 UTC (rev 165094)
@@ -0,0 +1,5 @@
+(repaint rects
+  (rect 0 0 22 22)
+  (rect 1.50 0 22 22)
+)
+

Added: trunk/LayoutTests/fast/repaint/hidpi-device-pixel-based-repaint-rect-tracking.html (0 => 165094)


--- trunk/LayoutTests/fast/repaint/hidpi-device-pixel-based-repaint-rect-tracking.html	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/hidpi-device-pixel-based-repaint-rect-tracking.html	2014-03-05 05:30:25 UTC (rev 165094)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that repaint rect tracking works for hiDPI cases.</title>
+<head>
+<style>
+  div {
+    position: absolute;
+    border: green solid 1px;
+    width: 20px;
+    height: 20px;
+    left: 0px;
+    top: 0px;
+  }
+</style>
+</head>
+<body>
+<div id=foo></div>
+
+<script>
+  function move() {
+    document.getElementById("foo").style.left = "1.5px";
+    if (window.testRunner) {
+        var dummy = document.body.offsetTop;
+        var repaintRects = window.internals.repaintRectsAsText();
+        window.internals.stopTrackingRepaints();
+
+        var pre = document.createElement('pre');
+        document.body.appendChild(pre);
+        pre.innerHTML = repaintRects;
+        testRunner.notifyDone();
+      }
+  }
+  
+  if (window.testRunner && window.internals) {
+    window.testRunner.dumpAsText(false);
+    window.internals.startTrackingRepaints();
+    testRunner.waitUntilDone();
+  }
+
+  setTimeout(move, 0);
+</script>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (165093 => 165094)


--- trunk/Source/WebCore/ChangeLog	2014-03-05 04:44:15 UTC (rev 165093)
+++ trunk/Source/WebCore/ChangeLog	2014-03-05 05:30:25 UTC (rev 165094)
@@ -1,3 +1,29 @@
+2014-03-04  Zalan Bujtas  <[email protected]>
+
+        Enable device pixel repaint rect tracking.
+        https://bugs.webkit.org/show_bug.cgi?id=129712
+
+        Reviewed by Simon Fraser.
+
+        Tracked repaint rects are device pixel snapped now to support hiDPI test cases.
+
+        Test: fast/repaint/hidpi-device-pixel-based-repaint-rect-tracking.html
+
+        * WebCore.exp.in:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::addTrackedRepaintRect):
+        (WebCore::FrameView::trackedRepaintRectsAsText): Print them as LayoutUnits to get
+        trailing zeros cut off.
+        * page/FrameView.h:
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::calculateClipRects):
+        * rendering/RenderLayer.h:
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::setContentsNeedDisplay):
+        (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
+        * rendering/RenderView.cpp:
+        (WebCore::RenderView::repaintViewRectangle):
+
 2014-03-04  Simon Fraser  <[email protected]>
 
         Don't clamp scrolling node offsets when the offset is changed by delegated scrolling

Modified: trunk/Source/WebCore/WebCore.exp.in (165093 => 165094)


--- trunk/Source/WebCore/WebCore.exp.in	2014-03-05 04:44:15 UTC (rev 165093)
+++ trunk/Source/WebCore/WebCore.exp.in	2014-03-05 05:30:25 UTC (rev 165094)
@@ -1931,6 +1931,7 @@
 __ZTVN7WebCore28InspectorFrontendClientLocal8SettingsE
 __ZTVN7WebCore31BasicColorMatrixFilterOperationE
 __ZTVN7WebCore37BasicComponentTransferFilterOperationE
+__ZN7WebCore10LayoutRectC1ERKNS_9FloatRectE
 __ZThn???_N7WebCore15GraphicsLayerCA28platformCALayerPaintContentsEPNS_15PlatformCALayerERNS_15GraphicsContextERKNS_9FloatRectE
 __ZThn???_N7WebCore15GraphicsLayerCA31platformCALayerAnimationStartedEd
 __ZThn???_N7WebCore15GraphicsLayerCA40platformCALayerSetNeedsToRevalidateTilesEv

Modified: trunk/Source/WebCore/page/FrameView.cpp (165093 => 165094)


--- trunk/Source/WebCore/page/FrameView.cpp	2014-03-05 04:44:15 UTC (rev 165093)
+++ trunk/Source/WebCore/page/FrameView.cpp	2014-03-05 05:30:25 UTC (rev 165094)
@@ -2057,12 +2057,12 @@
     return 0;
 }
 
-void FrameView::addTrackedRepaintRect(const IntRect& r)
+void FrameView::addTrackedRepaintRect(const FloatRect& r)
 {
     if (!m_isTrackingRepaints || r.isEmpty())
         return;
 
-    IntRect repaintRect = r;
+    FloatRect repaintRect = r;
     repaintRect.move(-scrollOffset());
     m_trackedRepaintRects.append(repaintRect);
 }
@@ -3977,7 +3977,7 @@
     if (!m_trackedRepaintRects.isEmpty()) {
         ts << "(repaint rects\n";
         for (size_t i = 0; i < m_trackedRepaintRects.size(); ++i)
-            ts << "  (rect " << m_trackedRepaintRects[i].x() << " " << m_trackedRepaintRects[i].y() << " " << m_trackedRepaintRects[i].width() << " " << m_trackedRepaintRects[i].height() << ")\n";
+            ts << "  (rect " << LayoutUnit(m_trackedRepaintRects[i].x()) << " " << LayoutUnit(m_trackedRepaintRects[i].y()) << " " << LayoutUnit(m_trackedRepaintRects[i].width()) << " " << LayoutUnit(m_trackedRepaintRects[i].height()) << ")\n";
         ts << ")\n";
     }
     return ts.release();

Modified: trunk/Source/WebCore/page/FrameView.h (165093 => 165094)


--- trunk/Source/WebCore/page/FrameView.h	2014-03-05 04:44:15 UTC (rev 165093)
+++ trunk/Source/WebCore/page/FrameView.h	2014-03-05 05:30:25 UTC (rev 165094)
@@ -377,7 +377,7 @@
     void setTracksRepaints(bool);
     bool isTrackingRepaints() const { return m_isTrackingRepaints; }
     void resetTrackedRepaints();
-    const Vector<IntRect>& trackedRepaintRects() const { return m_trackedRepaintRects; }
+    const Vector<FloatRect>& trackedRepaintRects() const { return m_trackedRepaintRects; }
     String trackedRepaintRectsAsText() const;
 
     typedef HashSet<ScrollableArea*> ScrollableAreaSet;
@@ -445,7 +445,7 @@
     void didAddWidgetToRenderTree(Widget&);
     void willRemoveWidgetFromRenderTree(Widget&);
 
-    void addTrackedRepaintRect(const IntRect&);
+    void addTrackedRepaintRect(const FloatRect&);
 
     // exposedRect represents WebKit's understanding of what part
     // of the view is actually exposed on screen (taking into account
@@ -628,7 +628,7 @@
     double m_lastPaintTime;
 
     bool m_isTrackingRepaints; // Used for testing.
-    Vector<IntRect> m_trackedRepaintRects;
+    Vector<FloatRect> m_trackedRepaintRects;
 
     bool m_shouldUpdateWhileOffscreen;
 

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (165093 => 165094)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-03-05 04:44:15 UTC (rev 165093)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2014-03-05 05:30:25 UTC (rev 165094)
@@ -5738,6 +5738,11 @@
     return pixelSnappedIntRect(boundingBox(root()));
 }
 
+FloatRect RenderLayer::absoluteBoundingBoxForPainting() const
+{
+    return pixelSnappedForPainting(boundingBox(root()), renderer().document().deviceScaleFactor());
+}
+
 LayoutRect RenderLayer::calculateLayerBounds(const RenderLayer* ancestorLayer, const LayoutPoint* offsetFromRoot, CalculateLayerBoundsFlags flags) const
 {
     if (!isSelfPaintingLayer())

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (165093 => 165094)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2014-03-05 04:44:15 UTC (rev 165093)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2014-03-05 05:30:25 UTC (rev 165094)
@@ -715,8 +715,10 @@
     LayoutRect boundingBox(const RenderLayer* rootLayer, CalculateLayerBoundsFlags = 0, const LayoutPoint* offsetFromRoot = 0) const;
     // Bounding box in the coordinates of this layer.
     LayoutRect localBoundingBox(CalculateLayerBoundsFlags = 0) const;
-    // Pixel snapped bounding box relative to the root.
+    // Deprecated: Pixel snapped bounding box relative to the root.
     IntRect absoluteBoundingBox() const;
+    // Device pixel snapped bounding box relative to the root. absoluteBoundingBox() callers will be directed to this.
+    FloatRect absoluteBoundingBoxForPainting() const;
 
     // Bounds used for layer overlap testing in RenderLayerCompositor.
     LayoutRect overlapBounds() const { return overlapBoundsIncludeChildren() ? calculateLayerBounds(this) : localBoundingBox(); }

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (165093 => 165094)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2014-03-05 04:44:15 UTC (rev 165093)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2014-03-05 05:30:25 UTC (rev 165094)
@@ -2068,7 +2068,7 @@
 
     FrameView& frameView = owningLayer().renderer().view().frameView();
     if (m_isMainFrameRenderViewLayer && frameView.isTrackingRepaints())
-        frameView.addTrackedRepaintRect(owningLayer().absoluteBoundingBox());
+        frameView.addTrackedRepaintRect(owningLayer().absoluteBoundingBoxForPainting());
     
     if (m_graphicsLayer && m_graphicsLayer->drawsContent()) {
         // By default, setNeedsDisplay will clip to the size of the GraphicsLayer, which does not include margin tiles.
@@ -2100,7 +2100,7 @@
     FloatRect pixelSnappedRectForPainting = pixelSnappedForPainting(r, deviceScaleFactor());
     FrameView& frameView = owningLayer().renderer().view().frameView();
     if (m_isMainFrameRenderViewLayer && frameView.isTrackingRepaints())
-        frameView.addTrackedRepaintRect(pixelSnappedIntRect(r));
+        frameView.addTrackedRepaintRect(pixelSnappedRectForPainting);
 
     if (m_graphicsLayer && m_graphicsLayer->drawsContent()) {
         FloatRect layerDirtyRect = pixelSnappedRectForPainting;

Modified: trunk/Source/WebCore/rendering/RenderView.cpp (165093 => 165094)


--- trunk/Source/WebCore/rendering/RenderView.cpp	2014-03-05 04:44:15 UTC (rev 165093)
+++ trunk/Source/WebCore/rendering/RenderView.cpp	2014-03-05 05:30:25 UTC (rev 165094)
@@ -560,10 +560,11 @@
         ownerBox.repaintRectangle(adjustedRect);
         return;
     }
-    IntRect pixelSnappedRect = pixelSnappedIntRect(repaintRect);
 
-    frameView().addTrackedRepaintRect(pixelSnappedRect);
+    frameView().addTrackedRepaintRect(pixelSnappedForPainting(repaintRect, document().deviceScaleFactor()));
 
+    // FIXME: convert all repaint rect dependencies to FloatRect/LayoutRect
+    IntRect pixelSnappedRect = pixelSnappedIntRect(repaintRect);
     if (!m_accumulatedRepaintRegion) {
         frameView().repaintContentRectangle(pixelSnappedRect);
         return;

Modified: trunk/Source/WebKit/efl/ChangeLog (165093 => 165094)


--- trunk/Source/WebKit/efl/ChangeLog	2014-03-05 04:44:15 UTC (rev 165093)
+++ trunk/Source/WebKit/efl/ChangeLog	2014-03-05 05:30:25 UTC (rev 165094)
@@ -1,3 +1,15 @@
+2014-03-04  Zalan Bujtas  <[email protected]>
+
+        Enable device pixel repaint rect tracking.
+        https://bugs.webkit.org/show_bug.cgi?id=129712
+
+        Reviewed by Simon Fraser.
+
+        Tracked repaint rects are device pixel snapped now to support hiDPI test cases.
+
+        * WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
+        (DumpRenderTreeSupportEfl::trackedRepaintRects):
+
 2014-02-25  Anders Carlsson  <[email protected]>
 
         Get rid of VisitedLinkStrategy

Modified: trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp (165093 => 165094)


--- trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp	2014-03-05 04:44:15 UTC (rev 165093)
+++ trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp	2014-03-05 05:30:25 UTC (rev 165094)
@@ -382,7 +382,7 @@
     if (!frame->view())
         return 0;
 
-    const Vector<WebCore::IntRect>& repaintRects = frame->view()->trackedRepaintRects();
+    const Vector<WebCore::FloatRect>& repaintRects = frame->view()->trackedRepaintRects();
     size_t count = repaintRects.size();
     Eina_List* rectList = 0;
 

Modified: trunk/Source/WebKit/gtk/ChangeLog (165093 => 165094)


--- trunk/Source/WebKit/gtk/ChangeLog	2014-03-05 04:44:15 UTC (rev 165093)
+++ trunk/Source/WebKit/gtk/ChangeLog	2014-03-05 05:30:25 UTC (rev 165094)
@@ -1,3 +1,15 @@
+2014-03-04  Zalan Bujtas  <[email protected]>
+
+        Enable device pixel repaint rect tracking.
+        https://bugs.webkit.org/show_bug.cgi?id=129712
+
+        Reviewed by Simon Fraser.
+
+        Tracked repaint rects are device pixel snapped now to support hiDPI test cases.
+
+        * WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
+        (DumpRenderTreeSupportGtk::trackedRepaintRects):
+
 2014-03-03  Martin Robinson  <[email protected]>
 
         [GTK] Fix some simple gtkdoc warnings for WebKit1

Modified: trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp (165093 => 165094)


--- trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp	2014-03-05 04:44:15 UTC (rev 165093)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp	2014-03-05 05:30:25 UTC (rev 165094)
@@ -640,7 +640,7 @@
         return 0;
 
     GSList* rects = 0;
-    const Vector<IntRect>& repaintRects = coreFrame->view()->trackedRepaintRects();
+    const Vector<FloatRect>& repaintRects = coreFrame->view()->trackedRepaintRects();
     for (unsigned i = 0; i < repaintRects.size(); i++) {
         GdkRectangle* rect = g_new0(GdkRectangle, 1);
         rect->x = repaintRects[i].x();

Modified: trunk/Source/WebKit/mac/ChangeLog (165093 => 165094)


--- trunk/Source/WebKit/mac/ChangeLog	2014-03-05 04:44:15 UTC (rev 165093)
+++ trunk/Source/WebKit/mac/ChangeLog	2014-03-05 05:30:25 UTC (rev 165094)
@@ -1,3 +1,15 @@
+2014-03-04  Zalan Bujtas  <[email protected]>
+
+        Enable device pixel repaint rect tracking.
+        https://bugs.webkit.org/show_bug.cgi?id=129712
+
+        Reviewed by Simon Fraser.
+
+        Tracked repaint rects are device pixel snapped now to support hiDPI test cases.
+
+        * WebView/WebView.mm:
+        (-[WebView trackedRepaintRects]): Keep existing behavior for now.
+
 2014-03-04  Simon Fraser  <[email protected]>
 
         Allow iOS DumpRenderTree crashes to show application-specific information

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (165093 => 165094)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2014-03-05 04:44:15 UTC (rev 165093)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2014-03-05 05:30:25 UTC (rev 165094)
@@ -3952,11 +3952,11 @@
     if (!view || !view->isTrackingRepaints())
         return nil;
 
-    const Vector<IntRect>& repaintRects = view->trackedRepaintRects();
+    const Vector<FloatRect>& repaintRects = view->trackedRepaintRects();
     NSMutableArray* rectsArray = [[NSMutableArray alloc] initWithCapacity:repaintRects.size()];
     
     for (unsigned i = 0; i < repaintRects.size(); ++i)
-        [rectsArray addObject:[NSValue valueWithRect:pixelSnappedIntRect(repaintRects[i])]];
+        [rectsArray addObject:[NSValue valueWithRect:pixelSnappedIntRect(LayoutRect(repaintRects[i]))]];
 
     return [rectsArray autorelease];
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to