Title: [117697] trunk/Source/WebCore
Revision
117697
Author
[email protected]
Date
2012-05-19 13:48:14 -0700 (Sat, 19 May 2012)

Log Message

Simplify RenderOverflow by using Rects
https://bugs.webkit.org/show_bug.cgi?id=86894

Reviewed by Eric Seidel.

Simplify the RenderOverflow class and the uses of it by storing the
overflow values in rects and using the rects instead of the individual
values where it makes sense.

No new tests, no change in functionality.

* page/FrameView.cpp:
(WebCore::FrameView::adjustPageHeightDeprecated):
Change to use layoutOverflowRect().maxX() and replace C style casts with
C++ style to comply with style guide.
        
* rendering/InlineFlowBox.h:
(WebCore::InlineFlowBox::logicalLeftLayoutOverflow):
(WebCore::InlineFlowBox::logicalRightLayoutOverflow):
(WebCore::InlineFlowBox::logicalTopLayoutOverflow):
(WebCore::InlineFlowBox::logicalBottomLayoutOverflow):
(WebCore::InlineFlowBox::logicalLeftVisualOverflow):
(WebCore::InlineFlowBox::logicalRightVisualOverflow):
(WebCore::InlineFlowBox::logicalTopVisualOverflow):
(WebCore::InlineFlowBox::logicalBottomVisualOverflow):
Change methods to use layoutOverflowRect() and visualOverflowRect().
        
* rendering/RenderBox.cpp:
(WebCore::RenderBox::scrollWidth):
(WebCore::RenderBox::scrollHeight):
Change methods to use visualOverflowRect().
        
(WebCore::RenderBox::clearLayoutOverflow):
Use setLayoutOverflow instead of resetLayoutOverflow (which has been
removed as it did exactly the same thing as the set method).
        
* rendering/RenderBox.h:
(WebCore::RenderBox::maxLayoutOverflow):
(WebCore::RenderBox::logicalLeftLayoutOverflow):
(WebCore::RenderBox::logicalRightLayoutOverflow):
(WebCore::RenderBox::logicalLeftVisualOverflow):
(WebCore::RenderBox::logicalRightVisualOverflow):
Remove minYLayoutOverflow, maxYLayoutOverflow, minXLayoutOverflow and
maxXLayoutOverflow and update the remaining methods to use
layoutOverflowRect().
        
* rendering/RenderMarquee.cpp:
(WebCore::RenderMarquee::computePosition):
Change to use layoutOverflowRect().
        
* rendering/RenderOverflow.h:
(WebCore::RenderOverflow::RenderOverflow):
(WebCore::RenderOverflow::layoutOverflowRect):
(WebCore::RenderOverflow::visualOverflowRect):
(RenderOverflow):
(WebCore::RenderOverflow::setMinYLayoutOverflow):
(WebCore::RenderOverflow::setMaxYLayoutOverflow):
(WebCore::RenderOverflow::setMinXLayoutOverflow):
(WebCore::RenderOverflow::setMaxXLayoutOverflow):
(WebCore::RenderOverflow::setMinYVisualOverflow):
(WebCore::RenderOverflow::setMaxYVisualOverflow):
(WebCore::RenderOverflow::setMinXVisualOverflow):
(WebCore::RenderOverflow::setMaxXVisualOverflow):
(WebCore):
(WebCore::RenderOverflow::move):
(WebCore::RenderOverflow::addLayoutOverflow):
(WebCore::RenderOverflow::addVisualOverflow):
(WebCore::RenderOverflow::setLayoutOverflow):
(WebCore::RenderOverflow::setVisualOverflow):
Change RenderOverflow to use two rects instead of two sets of four
values. Remove [min|max][Layout|Visual]Overflow getters and change the
layoutOverflowRect and visualOverflowRect methods to return the rects.
        
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::shouldPaint):
Change to use visualOverflowRect().
        
* rendering/RenderTable.cpp:
(WebCore::RenderTable::layout):
Change to use visualOverflowRect().
        
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::clippedOverflowRectForRepaint):
Change to use visualOverflowRect().
        
* rendering/RenderTreeAsText.cpp:
(WebCore::writeLayers):
Change to use layoutOverflowRect().

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (117696 => 117697)


--- trunk/Source/WebCore/ChangeLog	2012-05-19 20:41:42 UTC (rev 117696)
+++ trunk/Source/WebCore/ChangeLog	2012-05-19 20:48:14 UTC (rev 117697)
@@ -1,3 +1,94 @@
+2012-05-19  Emil A Eklund  <[email protected]>
+
+        Simplify RenderOverflow by using Rects
+        https://bugs.webkit.org/show_bug.cgi?id=86894
+
+        Reviewed by Eric Seidel.
+
+        Simplify the RenderOverflow class and the uses of it by storing the
+        overflow values in rects and using the rects instead of the individual
+        values where it makes sense.
+
+        No new tests, no change in functionality.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::adjustPageHeightDeprecated):
+        Change to use layoutOverflowRect().maxX() and replace C style casts with
+        C++ style to comply with style guide.
+        
+        * rendering/InlineFlowBox.h:
+        (WebCore::InlineFlowBox::logicalLeftLayoutOverflow):
+        (WebCore::InlineFlowBox::logicalRightLayoutOverflow):
+        (WebCore::InlineFlowBox::logicalTopLayoutOverflow):
+        (WebCore::InlineFlowBox::logicalBottomLayoutOverflow):
+        (WebCore::InlineFlowBox::logicalLeftVisualOverflow):
+        (WebCore::InlineFlowBox::logicalRightVisualOverflow):
+        (WebCore::InlineFlowBox::logicalTopVisualOverflow):
+        (WebCore::InlineFlowBox::logicalBottomVisualOverflow):
+        Change methods to use layoutOverflowRect() and visualOverflowRect().
+        
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::scrollWidth):
+        (WebCore::RenderBox::scrollHeight):
+        Change methods to use visualOverflowRect().
+        
+        (WebCore::RenderBox::clearLayoutOverflow):
+        Use setLayoutOverflow instead of resetLayoutOverflow (which has been
+        removed as it did exactly the same thing as the set method).
+        
+        * rendering/RenderBox.h:
+        (WebCore::RenderBox::maxLayoutOverflow):
+        (WebCore::RenderBox::logicalLeftLayoutOverflow):
+        (WebCore::RenderBox::logicalRightLayoutOverflow):
+        (WebCore::RenderBox::logicalLeftVisualOverflow):
+        (WebCore::RenderBox::logicalRightVisualOverflow):
+        Remove minYLayoutOverflow, maxYLayoutOverflow, minXLayoutOverflow and
+        maxXLayoutOverflow and update the remaining methods to use
+        layoutOverflowRect().
+        
+        * rendering/RenderMarquee.cpp:
+        (WebCore::RenderMarquee::computePosition):
+        Change to use layoutOverflowRect().
+        
+        * rendering/RenderOverflow.h:
+        (WebCore::RenderOverflow::RenderOverflow):
+        (WebCore::RenderOverflow::layoutOverflowRect):
+        (WebCore::RenderOverflow::visualOverflowRect):
+        (RenderOverflow):
+        (WebCore::RenderOverflow::setMinYLayoutOverflow):
+        (WebCore::RenderOverflow::setMaxYLayoutOverflow):
+        (WebCore::RenderOverflow::setMinXLayoutOverflow):
+        (WebCore::RenderOverflow::setMaxXLayoutOverflow):
+        (WebCore::RenderOverflow::setMinYVisualOverflow):
+        (WebCore::RenderOverflow::setMaxYVisualOverflow):
+        (WebCore::RenderOverflow::setMinXVisualOverflow):
+        (WebCore::RenderOverflow::setMaxXVisualOverflow):
+        (WebCore):
+        (WebCore::RenderOverflow::move):
+        (WebCore::RenderOverflow::addLayoutOverflow):
+        (WebCore::RenderOverflow::addVisualOverflow):
+        (WebCore::RenderOverflow::setLayoutOverflow):
+        (WebCore::RenderOverflow::setVisualOverflow):
+        Change RenderOverflow to use two rects instead of two sets of four
+        values. Remove [min|max][Layout|Visual]Overflow getters and change the
+        layoutOverflowRect and visualOverflowRect methods to return the rects.
+        
+        * rendering/RenderReplaced.cpp:
+        (WebCore::RenderReplaced::shouldPaint):
+        Change to use visualOverflowRect().
+        
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::layout):
+        Change to use visualOverflowRect().
+        
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::clippedOverflowRectForRepaint):
+        Change to use visualOverflowRect().
+        
+        * rendering/RenderTreeAsText.cpp:
+        (WebCore::writeLayers):
+        Change to use layoutOverflowRect().
+
 2012-05-19  Rob Buis  <[email protected]>
 
         Remove bbox caching from SVGPathElement

Modified: trunk/Source/WebCore/page/FrameView.cpp (117696 => 117697)


--- trunk/Source/WebCore/page/FrameView.cpp	2012-05-19 20:41:42 UTC (rev 117696)
+++ trunk/Source/WebCore/page/FrameView.cpp	2012-05-19 20:48:14 UTC (rev 117697)
@@ -3279,8 +3279,8 @@
     if (RenderView* root = rootRenderer(this)) {
         // Use a context with painting disabled.
         GraphicsContext context((PlatformGraphicsContext*)0);
-        root->setTruncatedAt((int)floorf(oldBottom));
-        IntRect dirtyRect(0, (int)floorf(oldTop), root->maxXLayoutOverflow(), (int)ceilf(oldBottom - oldTop));
+        root->setTruncatedAt(static_cast<int>(floorf(oldBottom)));
+        IntRect dirtyRect(0, static_cast<int>(floorf(oldTop)), root->layoutOverflowRect().maxX(), static_cast<int>(ceilf(oldBottom - oldTop)));
         root->setPrintRect(dirtyRect);
         root->layer()->paint(&context, dirtyRect);
         *newBottom = root->bestTruncatedAt();

Modified: trunk/Source/WebCore/rendering/InlineFlowBox.h (117696 => 117697)


--- trunk/Source/WebCore/rendering/InlineFlowBox.h	2012-05-19 20:41:42 UTC (rev 117696)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.h	2012-05-19 20:48:14 UTC (rev 117697)
@@ -207,18 +207,26 @@
     { 
         return m_overflow ? m_overflow->layoutOverflowRect() : enclosingLayoutRect(frameRectIncludingLineHeight(lineTop, lineBottom));
     }
-    LayoutUnit logicalLeftLayoutOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->minXLayoutOverflow() : m_overflow->minYLayoutOverflow()) : static_cast<LayoutUnit>(logicalLeft()); }
-    LayoutUnit logicalRightLayoutOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->maxXLayoutOverflow() : m_overflow->maxYLayoutOverflow()) : static_cast<LayoutUnit>(ceilf(logicalRight())); }
+    LayoutUnit logicalLeftLayoutOverflow() const
+    {
+        return m_overflow ? (isHorizontal() ? m_overflow->layoutOverflowRect().x() : m_overflow->layoutOverflowRect().y()) :
+                            static_cast<LayoutUnit>(logicalLeft());
+    }
+    LayoutUnit logicalRightLayoutOverflow() const
+    {
+        return m_overflow ? (isHorizontal() ? m_overflow->layoutOverflowRect().maxX() : m_overflow->layoutOverflowRect().maxY()) :
+                            static_cast<LayoutUnit>(ceilf(logicalRight()));
+    }
     LayoutUnit logicalTopLayoutOverflow(LayoutUnit lineTop) const
     {
         if (m_overflow)
-            return isHorizontal() ? m_overflow->minYLayoutOverflow() : m_overflow->minXLayoutOverflow();
+            return isHorizontal() ? m_overflow->layoutOverflowRect().y() : m_overflow->layoutOverflowRect().x();
         return lineTop;
     }
     LayoutUnit logicalBottomLayoutOverflow(LayoutUnit lineBottom) const
     {
         if (m_overflow)
-            return isHorizontal() ? m_overflow->maxYLayoutOverflow() : m_overflow->maxXLayoutOverflow();
+            return isHorizontal() ? m_overflow->layoutOverflowRect().maxY() : m_overflow->layoutOverflowRect().maxX();
         return lineBottom;
     }
     LayoutRect logicalLayoutOverflowRect(LayoutUnit lineTop, LayoutUnit lineBottom) const
@@ -233,18 +241,18 @@
     { 
         return m_overflow ? m_overflow->visualOverflowRect() : enclosingLayoutRect(frameRectIncludingLineHeight(lineTop, lineBottom));
     }
-    LayoutUnit logicalLeftVisualOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->minXVisualOverflow() : m_overflow->minYVisualOverflow()) : static_cast<LayoutUnit>(logicalLeft()); }
-    LayoutUnit logicalRightVisualOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->maxXVisualOverflow() : m_overflow->maxYVisualOverflow()) : static_cast<LayoutUnit>(ceilf(logicalRight())); }
+    LayoutUnit logicalLeftVisualOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->visualOverflowRect().x() : m_overflow->visualOverflowRect().y()) : static_cast<LayoutUnit>(logicalLeft()); }
+    LayoutUnit logicalRightVisualOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->visualOverflowRect().maxX() : m_overflow->visualOverflowRect().maxY()) : static_cast<LayoutUnit>(ceilf(logicalRight())); }
     LayoutUnit logicalTopVisualOverflow(LayoutUnit lineTop) const
     {
         if (m_overflow)
-            return isHorizontal() ? m_overflow->minYVisualOverflow() : m_overflow->minXVisualOverflow();
+            return isHorizontal() ? m_overflow->visualOverflowRect().y() : m_overflow->visualOverflowRect().x();
         return lineTop;
     }
     LayoutUnit logicalBottomVisualOverflow(LayoutUnit lineBottom) const
     {
         if (m_overflow)
-            return isHorizontal() ? m_overflow->maxYVisualOverflow() : m_overflow->maxXVisualOverflow();
+            return isHorizontal() ? m_overflow->visualOverflowRect().maxY() : m_overflow->visualOverflowRect().maxX();
         return lineBottom;
     }
     LayoutRect logicalVisualOverflowRect(LayoutUnit lineTop, LayoutUnit lineBottom) const

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (117696 => 117697)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2012-05-19 20:41:42 UTC (rev 117696)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2012-05-19 20:48:14 UTC (rev 117697)
@@ -499,8 +499,8 @@
     // For objects with visible overflow, this matches IE.
     // FIXME: Need to work right with writing modes.
     if (style()->isLeftToRightDirection())
-        return snapSizeToPixel(max(clientWidth(), maxXLayoutOverflow() - borderLeft()), clientLeft());
-    return clientWidth() - min(ZERO_LAYOUT_UNIT, minXLayoutOverflow() - borderLeft());
+        return snapSizeToPixel(max(clientWidth(), layoutOverflowRect().maxX() - borderLeft()), clientLeft());
+    return clientWidth() - min(ZERO_LAYOUT_UNIT, layoutOverflowRect().x() - borderLeft());
 }
 
 int RenderBox::scrollHeight() const
@@ -509,7 +509,7 @@
         return layer()->scrollHeight();
     // For objects with visible overflow, this matches IE.
     // FIXME: Need to work right with writing modes.
-    return snapSizeToPixel(max(clientHeight(), maxYLayoutOverflow() - borderTop()), clientTop());
+    return snapSizeToPixel(max(clientHeight(), layoutOverflowRect().maxY() - borderTop()), clientTop());
 }
 
 int RenderBox::scrollLeft() const
@@ -3735,7 +3735,7 @@
         return;
     }
     
-    m_overflow->resetLayoutOverflow(borderBoxRect());
+    m_overflow->setLayoutOverflow(borderBoxRect());
 }
 
 static bool percentageLogicalHeightIsResolvable(const RenderBox* box)

Modified: trunk/Source/WebCore/rendering/RenderBox.h (117696 => 117697)


--- trunk/Source/WebCore/rendering/RenderBox.h	2012-05-19 20:41:42 UTC (rev 117696)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2012-05-19 20:48:14 UTC (rev 117697)
@@ -163,21 +163,13 @@
     // but it is on the right in vertical-rl.
     LayoutRect layoutOverflowRect() const { return m_overflow ? m_overflow->layoutOverflowRect() : clientBoxRect(); }
     IntRect pixelSnappedLayoutOverflowRect() const { return pixelSnappedIntRect(layoutOverflowRect()); }
-    LayoutUnit minYLayoutOverflow() const { return m_overflow? m_overflow->minYLayoutOverflow() : static_cast<LayoutUnit>(borderTop()); }
-    LayoutUnit maxYLayoutOverflow() const { return m_overflow ? m_overflow->maxYLayoutOverflow() : static_cast<LayoutUnit>(borderTop()) + clientHeight(); }
-    LayoutUnit minXLayoutOverflow() const { return m_overflow ? m_overflow->minXLayoutOverflow() : static_cast<LayoutUnit>(borderLeft()); }
-    LayoutUnit maxXLayoutOverflow() const { return m_overflow ? m_overflow->maxXLayoutOverflow() : static_cast<LayoutUnit>(borderLeft()) + clientWidth(); }
-    LayoutSize maxLayoutOverflow() const { return LayoutSize(maxXLayoutOverflow(), maxYLayoutOverflow()); }
-    LayoutUnit logicalLeftLayoutOverflow() const { return style()->isHorizontalWritingMode() ? minXLayoutOverflow() : minYLayoutOverflow(); }
-    LayoutUnit logicalRightLayoutOverflow() const { return style()->isHorizontalWritingMode() ? maxXLayoutOverflow() : maxYLayoutOverflow(); }
+    LayoutSize maxLayoutOverflow() const { return LayoutSize(layoutOverflowRect().maxX(), layoutOverflowRect().maxY()); }
+    LayoutUnit logicalLeftLayoutOverflow() const { return style()->isHorizontalWritingMode() ? layoutOverflowRect().x() : layoutOverflowRect().y(); }
+    LayoutUnit logicalRightLayoutOverflow() const { return style()->isHorizontalWritingMode() ? layoutOverflowRect().maxX() : layoutOverflowRect().maxY(); }
     
     virtual LayoutRect visualOverflowRect() const { return m_overflow ? m_overflow->visualOverflowRect() : borderBoxRect(); }
-    LayoutUnit minYVisualOverflow() const { return m_overflow? m_overflow->minYVisualOverflow() : ZERO_LAYOUT_UNIT; }
-    LayoutUnit maxYVisualOverflow() const { return m_overflow ? m_overflow->maxYVisualOverflow() : height(); }
-    LayoutUnit minXVisualOverflow() const { return m_overflow ? m_overflow->minXVisualOverflow() : ZERO_LAYOUT_UNIT; }
-    LayoutUnit maxXVisualOverflow() const { return m_overflow ? m_overflow->maxXVisualOverflow() : width(); }
-    LayoutUnit logicalLeftVisualOverflow() const { return style()->isHorizontalWritingMode() ? minXVisualOverflow() : minYVisualOverflow(); }
-    LayoutUnit logicalRightVisualOverflow() const { return style()->isHorizontalWritingMode() ? maxXVisualOverflow() : maxYVisualOverflow(); }
+    LayoutUnit logicalLeftVisualOverflow() const { return style()->isHorizontalWritingMode() ? visualOverflowRect().x() : visualOverflowRect().y(); }
+    LayoutUnit logicalRightVisualOverflow() const { return style()->isHorizontalWritingMode() ? visualOverflowRect().maxX() : visualOverflowRect().maxY(); }
     
     void addLayoutOverflow(const LayoutRect&);
     void addVisualOverflow(const LayoutRect&);

Modified: trunk/Source/WebCore/rendering/RenderMarquee.cpp (117696 => 117697)


--- trunk/Source/WebCore/rendering/RenderMarquee.cpp	2012-05-19 20:41:42 UTC (rev 117696)
+++ trunk/Source/WebCore/rendering/RenderMarquee.cpp	2012-05-19 20:48:14 UTC (rev 117697)
@@ -137,7 +137,7 @@
         }
     }
     else {
-        int contentHeight = box->maxYLayoutOverflow() - box->borderTop() + box->paddingBottom();
+        int contentHeight = box->layoutOverflowRect().maxY() - box->borderTop() + box->paddingBottom();
         int clientHeight = box->clientHeight();
         if (dir == MUP) {
             if (stopAtContentEdge)

Modified: trunk/Source/WebCore/rendering/RenderOverflow.h (117696 => 117697)


--- trunk/Source/WebCore/rendering/RenderOverflow.h	2012-05-19 20:41:42 UTC (rev 117696)
+++ trunk/Source/WebCore/rendering/RenderOverflow.h	2012-05-19 20:48:14 UTC (rev 117697)
@@ -41,38 +41,23 @@
     WTF_MAKE_NONCOPYABLE(RenderOverflow); WTF_MAKE_FAST_ALLOCATED;
 public:
     RenderOverflow(const LayoutRect& layoutRect, const LayoutRect& visualRect) 
-        : m_minYLayoutOverflow(layoutRect.y())
-        , m_maxYLayoutOverflow(layoutRect.maxY())
-        , m_minXLayoutOverflow(layoutRect.x())
-        , m_maxXLayoutOverflow(layoutRect.maxX())
-        , m_minYVisualOverflow(visualRect.y())
-        , m_maxYVisualOverflow(visualRect.maxY())
-        , m_minXVisualOverflow(visualRect.x())
-        , m_maxXVisualOverflow(visualRect.maxX())
+        : m_layoutOverflow(layoutRect)
+        , m_visualOverflow(visualRect)
     {
     }
    
-    LayoutUnit minYLayoutOverflow() const { return m_minYLayoutOverflow; }
-    LayoutUnit maxYLayoutOverflow() const { return m_maxYLayoutOverflow; }
-    LayoutUnit minXLayoutOverflow() const { return m_minXLayoutOverflow; }
-    LayoutUnit maxXLayoutOverflow() const { return m_maxXLayoutOverflow; }
-    LayoutRect layoutOverflowRect() const;
+    const LayoutRect layoutOverflowRect() const { return m_layoutOverflow; }
+    const LayoutRect visualOverflowRect() const { return m_visualOverflow; }
 
-    LayoutUnit minYVisualOverflow() const { return m_minYVisualOverflow; }
-    LayoutUnit maxYVisualOverflow() const { return m_maxYVisualOverflow; }
-    LayoutUnit minXVisualOverflow() const { return m_minXVisualOverflow; }
-    LayoutUnit maxXVisualOverflow() const { return m_maxXVisualOverflow; }
-    LayoutRect visualOverflowRect() const;
-
-    void setMinYLayoutOverflow(LayoutUnit overflow) { m_minYLayoutOverflow = overflow; }
-    void setMaxYLayoutOverflow(LayoutUnit overflow) { m_maxYLayoutOverflow = overflow; }
-    void setMinXLayoutOverflow(LayoutUnit overflow) { m_minXLayoutOverflow = overflow; }
-    void setMaxXLayoutOverflow(LayoutUnit overflow) { m_maxXLayoutOverflow = overflow; }
+    void setMinYLayoutOverflow(LayoutUnit overflow) { m_layoutOverflow.setY(overflow); }
+    void setMaxYLayoutOverflow(LayoutUnit overflow) { m_layoutOverflow.setHeight(overflow - m_layoutOverflow.y()); }
+    void setMinXLayoutOverflow(LayoutUnit overflow) { m_layoutOverflow.setX(overflow); }
+    void setMaxXLayoutOverflow(LayoutUnit overflow) { m_layoutOverflow.setWidth(overflow - m_layoutOverflow.x()); }
     
-    void setMinYVisualOverflow(LayoutUnit overflow) { m_minYVisualOverflow = overflow; }
-    void setMaxYVisualOverflow(LayoutUnit overflow) { m_maxYVisualOverflow = overflow; }
-    void setMinXVisualOverflow(LayoutUnit overflow) { m_minXVisualOverflow = overflow; }
-    void setMaxXVisualOverflow(LayoutUnit overflow) { m_maxXVisualOverflow = overflow; }
+    void setMinYVisualOverflow(LayoutUnit overflow) { m_visualOverflow.setY(overflow); }
+    void setMaxYVisualOverflow(LayoutUnit overflow) { m_visualOverflow.setHeight(overflow - m_layoutOverflow.y()); }
+    void setMinXVisualOverflow(LayoutUnit overflow) { m_visualOverflow.setX(overflow); }
+    void setMaxXVisualOverflow(LayoutUnit overflow) { m_visualOverflow.setWidth(overflow - m_layoutOverflow.x()); }
     
     void move(LayoutUnit dx, LayoutUnit dy);
     
@@ -82,83 +67,47 @@
     void setLayoutOverflow(const LayoutRect&);
     void setVisualOverflow(const LayoutRect&);
 
-    void resetLayoutOverflow(const LayoutRect& defaultRect);
-
 private:
-    LayoutUnit m_minYLayoutOverflow;
-    LayoutUnit m_maxYLayoutOverflow;
-    LayoutUnit m_minXLayoutOverflow;
-    LayoutUnit m_maxXLayoutOverflow;
-
-    LayoutUnit m_minYVisualOverflow;
-    LayoutUnit m_maxYVisualOverflow;
-    LayoutUnit m_minXVisualOverflow;
-    LayoutUnit m_maxXVisualOverflow;
+    LayoutRect m_layoutOverflow;
+    LayoutRect m_visualOverflow;
 };
 
-inline LayoutRect RenderOverflow::layoutOverflowRect() const
-{
-    return LayoutRect(m_minXLayoutOverflow, m_minYLayoutOverflow, m_maxXLayoutOverflow - m_minXLayoutOverflow, m_maxYLayoutOverflow - m_minYLayoutOverflow);
-}
-
-inline LayoutRect RenderOverflow::visualOverflowRect() const
-{
-    return LayoutRect(m_minXVisualOverflow, m_minYVisualOverflow, m_maxXVisualOverflow - m_minXVisualOverflow, m_maxYVisualOverflow - m_minYVisualOverflow);
-}
-
 inline void RenderOverflow::move(LayoutUnit dx, LayoutUnit dy)
 {
-    m_minYLayoutOverflow += dy;
-    m_maxYLayoutOverflow += dy;
-    m_minXLayoutOverflow += dx;
-    m_maxXLayoutOverflow += dx;
-    
-    m_minYVisualOverflow += dy;
-    m_maxYVisualOverflow += dy;
-    m_minXVisualOverflow += dx;
-    m_maxXVisualOverflow += dx;
+    m_layoutOverflow.move(dx, dy);
+    m_visualOverflow.move(dx, dy);
 }
 
 inline void RenderOverflow::addLayoutOverflow(const LayoutRect& rect)
 {
-    m_minYLayoutOverflow = std::min(rect.y(), m_minYLayoutOverflow);
-    m_maxYLayoutOverflow = std::max(rect.maxY(), m_maxYLayoutOverflow);
-    m_minXLayoutOverflow = std::min(rect.x(), m_minXLayoutOverflow);
-    m_maxXLayoutOverflow = std::max(rect.maxX(), m_maxXLayoutOverflow);
+    LayoutUnit maxX = std::max(rect.maxX(), m_layoutOverflow.maxX());
+    LayoutUnit maxY = std::max(rect.maxY(), m_layoutOverflow.maxY());
+    m_layoutOverflow.setX(std::min(rect.x(), m_layoutOverflow.x()));
+    m_layoutOverflow.setY(std::min(rect.y(), m_layoutOverflow.y()));
+    m_layoutOverflow.setWidth(maxX - m_layoutOverflow.x());
+    m_layoutOverflow.setHeight(maxY - m_layoutOverflow.y());
 }
 
 inline void RenderOverflow::addVisualOverflow(const LayoutRect& rect)
 {
-    m_minYVisualOverflow = std::min(rect.y(), m_minYVisualOverflow);
-    m_maxYVisualOverflow = std::max(rect.maxY(), m_maxYVisualOverflow);
-    m_minXVisualOverflow = std::min(rect.x(), m_minXVisualOverflow);
-    m_maxXVisualOverflow = std::max(rect.maxX(), m_maxXVisualOverflow);
+    LayoutUnit maxX = std::max(rect.maxX(), m_visualOverflow.maxX());
+    LayoutUnit maxY = std::max(rect.maxY(), m_visualOverflow.maxY());
+    m_visualOverflow.setX(std::min(rect.x(), m_visualOverflow.x()));
+    m_visualOverflow.setY(std::min(rect.y(), m_visualOverflow.y()));
+    m_visualOverflow.setWidth(maxX - m_visualOverflow.x());
+    m_visualOverflow.setHeight(maxY - m_visualOverflow.y());
 }
 
 inline void RenderOverflow::setLayoutOverflow(const LayoutRect& rect)
 {
-    m_minYLayoutOverflow = rect.y();
-    m_maxYLayoutOverflow = rect.maxY();
-    m_minXLayoutOverflow = rect.x();
-    m_maxXLayoutOverflow = rect.maxX();
+    m_layoutOverflow = rect;
 }
 
 inline void RenderOverflow::setVisualOverflow(const LayoutRect& rect)
 {
-    m_minYVisualOverflow = rect.y();
-    m_maxYVisualOverflow = rect.maxY();
-    m_minXVisualOverflow = rect.x();
-    m_maxXVisualOverflow = rect.maxX();
+    m_visualOverflow = rect;
 }
 
-inline void RenderOverflow::resetLayoutOverflow(const LayoutRect& rect)
-{
-    m_minYLayoutOverflow = rect.y();
-    m_maxYLayoutOverflow = rect.maxY();
-    m_minXLayoutOverflow = rect.x();
-    m_maxXLayoutOverflow = rect.maxX();
-}
-
 } // namespace WebCore
 
 #endif // RenderOverflow_h

Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (117696 => 117697)


--- trunk/Source/WebCore/rendering/RenderReplaced.cpp	2012-05-19 20:41:42 UTC (rev 117696)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp	2012-05-19 20:48:14 UTC (rev 117697)
@@ -181,8 +181,8 @@
     LayoutPoint adjustedPaintOffset = paintOffset + location();
 
     // Early exit if the element touches the edges.
-    LayoutUnit top = adjustedPaintOffset.y() + minYVisualOverflow();
-    LayoutUnit bottom = adjustedPaintOffset.y() + maxYVisualOverflow();
+    LayoutUnit top = adjustedPaintOffset.y() + visualOverflowRect().y();
+    LayoutUnit bottom = adjustedPaintOffset.y() + visualOverflowRect().maxY();
     if (isSelected() && m_inlineBoxWrapper) {
         LayoutUnit selTop = paintOffset.y() + m_inlineBoxWrapper->root()->selectionTop();
         LayoutUnit selBottom = paintOffset.y() + selTop + m_inlineBoxWrapper->root()->selectionHeight();
@@ -192,7 +192,7 @@
     
     LayoutRect localRepaintRect = paintInfo.rect;
     localRepaintRect.inflate(maximalOutlineSize(paintInfo.phase));
-    if (adjustedPaintOffset.x() + minXVisualOverflow() >= localRepaintRect.maxX() || adjustedPaintOffset.x() + maxXVisualOverflow() <= localRepaintRect.x())
+    if (adjustedPaintOffset.x() + visualOverflowRect().x() >= localRepaintRect.maxX() || adjustedPaintOffset.x() + visualOverflowRect().maxX() <= localRepaintRect.x())
         return false;
 
     if (top >= localRepaintRect.maxY() || bottom <= localRepaintRect.y())

Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (117696 => 117697)


--- trunk/Source/WebCore/rendering/RenderTable.cpp	2012-05-19 20:41:42 UTC (rev 117696)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp	2012-05-19 20:48:14 UTC (rev 117697)
@@ -423,7 +423,7 @@
     while (section) {
         if (!sectionMoved && section->logicalTop() != logicalHeight()) {
             sectionMoved = true;
-            movedSectionLogicalTop = min(logicalHeight(), section->logicalTop()) + (style()->isHorizontalWritingMode() ? section->minYVisualOverflow() : section->minXVisualOverflow());
+            movedSectionLogicalTop = min(logicalHeight(), section->logicalTop()) + (style()->isHorizontalWritingMode() ? section->visualOverflowRect().y() : section->visualOverflowRect().x());
         }
         section->setLogicalLocation(LayoutPoint(sectionLogicalLeft, logicalHeight()));
 
@@ -462,9 +462,9 @@
     // Repaint with our new bounds if they are different from our old bounds.
     if (!didFullRepaint && sectionMoved) {
         if (style()->isHorizontalWritingMode())
-            repaintRectangle(LayoutRect(minXVisualOverflow(), movedSectionLogicalTop, maxXVisualOverflow() - minXVisualOverflow(), maxYVisualOverflow() - movedSectionLogicalTop));
+            repaintRectangle(LayoutRect(visualOverflowRect().x(), movedSectionLogicalTop, visualOverflowRect().width(), visualOverflowRect().maxY() - movedSectionLogicalTop));
         else
-            repaintRectangle(LayoutRect(movedSectionLogicalTop, minYVisualOverflow(), maxXVisualOverflow() - movedSectionLogicalTop, maxYVisualOverflow() - minYVisualOverflow()));
+            repaintRectangle(LayoutRect(movedSectionLogicalTop, visualOverflowRect().y(), visualOverflowRect().maxX() - movedSectionLogicalTop, visualOverflowRect().height()));
     }
 
     setNeedsLayout(false);

Modified: trunk/Source/WebCore/rendering/RenderTableCell.cpp (117696 => 117697)


--- trunk/Source/WebCore/rendering/RenderTableCell.cpp	2012-05-19 20:41:42 UTC (rev 117696)
+++ trunk/Source/WebCore/rendering/RenderTableCell.cpp	2012-05-19 20:48:14 UTC (rev 117697)
@@ -290,8 +290,8 @@
             right = max(right, below->borderHalfRight(true));
         }
     }
-    LayoutPoint location(max<LayoutUnit>(left, -minXVisualOverflow()), max<LayoutUnit>(top, -minYVisualOverflow()));
-    LayoutRect r(-location.x(), -location.y(), location.x() + max(width() + right, maxXVisualOverflow()), location.y() + max(height() + bottom, maxYVisualOverflow()));
+    LayoutPoint location(max<LayoutUnit>(left, -visualOverflowRect().x()), max<LayoutUnit>(top, -visualOverflowRect().y()));
+    LayoutRect r(-location.x(), -location.y(), location.x() + max(width() + right, visualOverflowRect().maxX()), location.y() + max(height() + bottom, visualOverflowRect().maxY()));
 
     if (RenderView* v = view()) {
         // FIXME: layoutDelta needs to be applied in parts before/after transforms and

Modified: trunk/Source/WebCore/rendering/RenderTreeAsText.cpp (117696 => 117697)


--- trunk/Source/WebCore/rendering/RenderTreeAsText.cpp	2012-05-19 20:41:42 UTC (rev 117696)
+++ trunk/Source/WebCore/rendering/RenderTreeAsText.cpp	2012-05-19 20:48:14 UTC (rev 117697)
@@ -710,8 +710,8 @@
     // FIXME: Apply overflow to the root layer to not break every test.  Complete hack.  Sigh.
     LayoutRect paintDirtyRect(paintRect);
     if (rootLayer == l) {
-        paintDirtyRect.setWidth(max<LayoutUnit>(paintDirtyRect.width(), rootLayer->renderBox()->maxXLayoutOverflow()));
-        paintDirtyRect.setHeight(max<LayoutUnit>(paintDirtyRect.height(), rootLayer->renderBox()->maxYLayoutOverflow()));
+        paintDirtyRect.setWidth(max<LayoutUnit>(paintDirtyRect.width(), rootLayer->renderBox()->layoutOverflowRect().maxX()));
+        paintDirtyRect.setHeight(max<LayoutUnit>(paintDirtyRect.height(), rootLayer->renderBox()->layoutOverflowRect().maxY()));
         l->setSize(l->size().expandedTo(pixelSnappedIntSize(l->renderBox()->maxLayoutOverflow(), LayoutPoint(0, 0))));
     }
     
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to