2011-06-01 Levi Weintraub <leviw@chromium.org>
authorleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Jun 2011 23:15:58 +0000 (23:15 +0000)
committerleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Jun 2011 23:15:58 +0000 (23:15 +0000)
        Reviewed by Eric Seidel.

        Switch paintOverflowControls to use IntPoint
        https://bugs.webkit.org/show_bug.cgi?id=61884

        Switching paintOverflowControls to use an IntPoint instead of a pair of ints.

        No new tests since this is simple refactoring.

        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::paint):
        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::paintOverflowControls):
        (WebCore::RenderLayer::paintLayer):
        * rendering/RenderLayer.h:
        * rendering/RenderLayerBacking.cpp:
        (WebCore::RenderLayerBacking::paintIntoLayer):

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

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayer.h
Source/WebCore/rendering/RenderLayerBacking.cpp

index a56f88d..566e3b8 100644 (file)
@@ -1,3 +1,23 @@
+2011-06-01  Levi Weintraub  <leviw@chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Switch paintOverflowControls to use IntPoint
+        https://bugs.webkit.org/show_bug.cgi?id=61884
+
+        Switching paintOverflowControls to use an IntPoint instead of a pair of ints.
+
+        No new tests since this is simple refactoring.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::paint):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::paintOverflowControls):
+        (WebCore::RenderLayer::paintLayer):
+        * rendering/RenderLayer.h:
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::paintIntoLayer):
+
 2011-06-01  Abhishek Arya  <inferno@chromium.org>
 
         Reviewed by Alexey Proskuryakov.
index 790112e..b5f4b29 100644 (file)
@@ -2268,7 +2268,7 @@ void RenderBlock::paint(PaintInfo& paintInfo, int tx, int ty)
     // z-index.  We paint after we painted the background/border, so that the scrollbars will
     // sit above the background/border.
     if (hasOverflowClip() && style()->visibility() == VISIBLE && (phase == PaintPhaseBlockBackground || phase == PaintPhaseChildBlockBackground) && paintInfo.shouldPaintWithinRoot(this))
-        layer()->paintOverflowControls(paintInfo.context, tx, ty, paintInfo.rect);
+        layer()->paintOverflowControls(paintInfo.context, IntPoint(tx, ty), paintInfo.rect);
 }
 
 void RenderBlock::paintColumnRules(PaintInfo& paintInfo, int tx, int ty)
index a5f131d..af35a4f 100644 (file)
@@ -2266,7 +2266,7 @@ void RenderLayer::updateScrollInfoAfterLayout()
         updateOverflowStatus(horizontalOverflow, verticalOverflow);
 }
 
-void RenderLayer::paintOverflowControls(GraphicsContext* context, int tx, int ty, const IntRect& damageRect, bool paintingOverlayControls)
+void RenderLayer::paintOverflowControls(GraphicsContext* context, const IntPoint& paintOffset, const IntRect& damageRect, bool paintingOverlayControls)
 {
     // Don't do anything if we have no overflow.
     if (!renderer()->hasOverflowClip())
@@ -2281,7 +2281,7 @@ void RenderLayer::paintOverflowControls(GraphicsContext* context, int tx, int ty
     if (hasOverlayScrollbars() && !paintingOverlayControls) {
         RenderView* renderView = renderer()->view();
         renderView->layer()->setContainsDirtyOverlayScrollbars(true);
-        m_cachedOverlayScrollbarOffset = IntPoint(tx, ty);
+        m_cachedOverlayScrollbarOffset = paintOffset;
         renderView->frameView()->setContainsScrollableAreaWithOverlayScrollbars(true);
         return;
     }
@@ -2290,17 +2290,14 @@ void RenderLayer::paintOverflowControls(GraphicsContext* context, int tx, int ty
     if (paintingOverlayControls && !hasOverlayScrollbars())
         return;
 
-    int offsetX = tx;
-    int offsetY = ty;
-    if (paintingOverlayControls) {
-        offsetX = m_cachedOverlayScrollbarOffset.x();
-        offsetY = m_cachedOverlayScrollbarOffset.y();
-    }
+    IntPoint adjustedPaintOffset = paintOffset;
+    if (paintingOverlayControls)
+        adjustedPaintOffset = m_cachedOverlayScrollbarOffset;
 
     // Move the scrollbar widgets if necessary.  We normally move and resize widgets during layout, but sometimes
     // widgets can move without layout occurring (most notably when you scroll a document that
     // contains fixed positioned elements).
-    positionOverflowControls(IntSize(offsetX, offsetY));
+    positionOverflowControls(toSize(adjustedPaintOffset));
 
     // Now that we're sure the scrollbars are in the right place, paint them.
     if (m_hBar
@@ -2323,10 +2320,10 @@ void RenderLayer::paintOverflowControls(GraphicsContext* context, int tx, int ty
 
     // We fill our scroll corner with white if we have a scrollbar that doesn't run all the way up to the
     // edge of the box.
-    paintScrollCorner(context, IntPoint(offsetX, offsetY), damageRect);
+    paintScrollCorner(context, adjustedPaintOffset, damageRect);
     
     // Paint our resizer last, since it sits on top of the scroll corner.
-    paintResizer(context, IntPoint(offsetX, offsetY), damageRect);
+    paintResizer(context, adjustedPaintOffset, damageRect);
 }
 
 void RenderLayer::paintScrollCorner(GraphicsContext* context, const IntPoint& paintOffset, const IntRect& damageRect)
@@ -2708,7 +2705,7 @@ void RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* p,
 
     if (paintingOverlayScrollbars) {
         setClip(p, paintDirtyRect, damageRect);
-        paintOverflowControls(p, tx, ty, damageRect, true);
+        paintOverflowControls(p, IntPoint(tx, ty), damageRect, true);
         restoreClip(p, paintDirtyRect, damageRect);
     }
 
index c7a8ae3..ed66af1 100644 (file)
@@ -261,7 +261,7 @@ public:
     bool hitTestOverflowControls(HitTestResult&, const IntPoint& localPoint);
     IntSize offsetFromResizeCorner(const IntPoint& absolutePoint) const;
 
-    void paintOverflowControls(GraphicsContext*, int tx, int ty, const IntRect& damageRect, bool paintingOverlayControls = false);
+    void paintOverflowControls(GraphicsContext*, const IntPoint&, const IntRect& damageRect, bool paintingOverlayControls = false);
     void paintScrollCorner(GraphicsContext*, const IntPoint&, const IntRect& damageRect);
     void paintResizer(GraphicsContext*, const IntPoint&, const IntRect& damageRect);
 
index da18ef4..4a38212 100644 (file)
@@ -1100,11 +1100,9 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*
     // Calculate the clip rects we should use.
     IntRect layerBounds, damageRect, clipRectToApply, outlineRect;
     m_owningLayer->calculateRects(rootLayer, paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect);
-    
-    int x = layerBounds.x();        // layerBounds is computed relative to rootLayer
-    int y = layerBounds.y();
-    int tx = x - m_owningLayer->renderBoxX();
-    int ty = y - m_owningLayer->renderBoxY();
+
+    int tx = layerBounds.x() - m_owningLayer->renderBoxX();
+    int ty = layerBounds.y() - m_owningLayer->renderBoxY();
 
     // If this layer's renderer is a child of the paintingRoot, we render unconditionally, which
     // is done by passing a nil paintingRoot down to our renderer (as if no paintingRoot was ever set).
@@ -1127,7 +1125,7 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*
         // Our scrollbar widgets paint exactly when we tell them to, so that they work properly with
         // z-index.  We paint after we painted the background/border, so that the scrollbars will
         // sit above the background/border.
-        m_owningLayer->paintOverflowControls(context, x, y, damageRect);
+        m_owningLayer->paintOverflowControls(context, layerBounds.location(), damageRect);
         
         // Restore the clip.
         restoreClip(context, paintDirtyRect, damageRect);