Title: [137959] trunk/Source/WebCore
Revision
137959
Author
[email protected]
Date
2012-12-17 16:44:40 -0800 (Mon, 17 Dec 2012)

Log Message

DidHitRelevantRepaintedObjectsAreaThreshold should not use the viewRect since 
that varies
https://bugs.webkit.org/show_bug.cgi?id=105116
-and corresponding-
<rdar://problem/12889449>

Reviewed by Geoff Garen.

DidHitRelevantRepaintedObjectsAreaThreshold should not use the viewRect since that 
varies depending on window size. This can lead to a huge amount of variability in 
the heuristic which is not desired. Instead, we should use a hard-coded rect.
* page/Page.cpp:
(WebCore::relevantViewRect):
(WebCore):
(WebCore::Page::addRelevantRepaintedObject):
(WebCore::Page::addRelevantUnpaintedObject):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (137958 => 137959)


--- trunk/Source/WebCore/ChangeLog	2012-12-18 00:26:50 UTC (rev 137958)
+++ trunk/Source/WebCore/ChangeLog	2012-12-18 00:44:40 UTC (rev 137959)
@@ -1,3 +1,22 @@
+2012-12-17  Beth Dakin  <[email protected]>
+
+        DidHitRelevantRepaintedObjectsAreaThreshold should not use the viewRect since 
+        that varies
+        https://bugs.webkit.org/show_bug.cgi?id=105116
+        -and corresponding-
+        <rdar://problem/12889449>
+
+        Reviewed by Geoff Garen.
+
+        DidHitRelevantRepaintedObjectsAreaThreshold should not use the viewRect since that 
+        varies depending on window size. This can lead to a huge amount of variability in 
+        the heuristic which is not desired. Instead, we should use a hard-coded rect.
+        * page/Page.cpp:
+        (WebCore::relevantViewRect):
+        (WebCore):
+        (WebCore::Page::addRelevantRepaintedObject):
+        (WebCore::Page::addRelevantUnpaintedObject):
+
 2012-12-17  Simon Fraser  <[email protected]>
 
         Fix repositioning of fixed elements on zooming

Modified: trunk/Source/WebCore/page/Page.cpp (137958 => 137959)


--- trunk/Source/WebCore/page/Page.cpp	2012-12-18 00:26:50 UTC (rev 137958)
+++ trunk/Source/WebCore/page/Page.cpp	2012-12-18 00:44:40 UTC (rev 137959)
@@ -1191,6 +1191,23 @@
     m_relevantUnpaintedRegion = Region();
 }
 
+static LayoutRect relevantViewRect(RenderView* view)
+{
+    // DidHitRelevantRepaintedObjectsAreaThreshold is a LayoutMilestone intended to indicate that
+    // a certain relevant amount of content has been drawn to the screen. This is the rect that
+    // has been determined to be relevant in the context of this goal. We may choose to tweak
+    // the rect over time, much like we may choose to tweak gMinimumPaintedAreaRatio and
+    // gMaximumUnpaintedAreaRatio. But this seems to work well right now.
+    LayoutRect relevantViewRect = LayoutRect(0, 0, 980, 1300);
+
+    LayoutRect viewRect = view->viewRect();
+    // If the viewRect is wider than the relevantViewRect, center the relevantViewRect.
+    if (viewRect.width() > relevantViewRect.width())
+        relevantViewRect.setX((viewRect.width() - relevantViewRect.width()) / 2);
+
+    return relevantViewRect;
+}
+
 void Page::addRelevantRepaintedObject(RenderObject* object, const LayoutRect& objectPaintRect)
 {
     if (!isCountingRelevantRepaintedObjects())
@@ -1204,8 +1221,10 @@
     if (!view)
         return;
 
+    LayoutRect relevantRect = relevantViewRect(view);
+
     // The objects are only relevant if they are being painted within the viewRect().
-    if (!objectPaintRect.intersects(pixelSnappedIntRect(view->viewRect())))
+    if (!objectPaintRect.intersects(pixelSnappedIntRect(relevantRect)))
         return;
 
     IntRect snappedPaintRect = pixelSnappedIntRect(objectPaintRect);
@@ -1220,7 +1239,7 @@
 
     m_relevantPaintedRegion.unite(snappedPaintRect);
     
-    float viewArea = view->viewRect().width() * view->viewRect().height();
+    float viewArea = relevantRect.width() * relevantRect.height();
     float ratioOfViewThatIsPainted = m_relevantPaintedRegion.totalArea() / viewArea;
     float ratioOfViewThatIsUnpainted = m_relevantUnpaintedRegion.totalArea() / viewArea;
 
@@ -1237,9 +1256,9 @@
     if (!isCountingRelevantRepaintedObjects())
         return;
 
-    // The objects are only relevant if they are being painted within the viewRect().
+    // The objects are only relevant if they are being painted within the relevantViewRect().
     if (RenderView* view = object->view()) {
-        if (!objectPaintRect.intersects(pixelSnappedIntRect(view->viewRect())))
+        if (!objectPaintRect.intersects(pixelSnappedIntRect(relevantViewRect(view))))
             return;
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to