Title: [90030] trunk/Source/WebCore
Revision
90030
Author
[email protected]
Date
2011-06-29 11:58:23 -0700 (Wed, 29 Jun 2011)

Log Message

2011-06-29  Emil A Eklund  <[email protected]>

        Reviewed by Darin Adler.

        Switch hitTestColumns/Contents/Floats to to new layout types
        https://bugs.webkit.org/show_bug.cgi?id=63589

        Switch location and size methods for RenderBox over to the new layout unit abstraction.

        No new tests, no functionality changes.

        * rendering/ColumnInfo.h:
        (WebCore::ColumnInfo::desiredColumnWidth):
        (WebCore::ColumnInfo::setDesiredColumnWidth):
        (WebCore::ColumnInfo::columnHeight):
        (WebCore::ColumnInfo::setColumnCountAndHeight):
        (WebCore::ColumnInfo::setColumnHeight):
        (WebCore::ColumnInfo::updateMinimumColumnHeight):
        (WebCore::ColumnInfo::minimumColumnHeight):
        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::addOverflowFromChildren):
        (WebCore::RenderBlock::paintColumnRules):
        (WebCore::RenderBlock::paintColumnContents):
        (WebCore::RenderBlock::hitTestFloats):
        (WebCore::RenderBlock::hitTestColumns):
        (WebCore::RenderBlock::hitTestContents):
        (WebCore::RenderBlock::columnRectAt):
        * rendering/RenderBlock.h:
        (WebCore::RenderBlock::xPositionForFloatIncludingMargin):
        (WebCore::RenderBlock::yPositionForFloatIncludingMargin):
        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::hitTestContents):
        * rendering/RenderLayer.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (90029 => 90030)


--- trunk/Source/WebCore/ChangeLog	2011-06-29 18:30:07 UTC (rev 90029)
+++ trunk/Source/WebCore/ChangeLog	2011-06-29 18:58:23 UTC (rev 90030)
@@ -1,3 +1,37 @@
+2011-06-29  Emil A Eklund  <[email protected]>
+
+        Reviewed by Darin Adler.
+
+        Switch hitTestColumns/Contents/Floats to to new layout types
+        https://bugs.webkit.org/show_bug.cgi?id=63589
+
+        Switch location and size methods for RenderBox over to the new layout unit abstraction.
+
+        No new tests, no functionality changes.
+
+        * rendering/ColumnInfo.h:
+        (WebCore::ColumnInfo::desiredColumnWidth):
+        (WebCore::ColumnInfo::setDesiredColumnWidth):
+        (WebCore::ColumnInfo::columnHeight):
+        (WebCore::ColumnInfo::setColumnCountAndHeight):
+        (WebCore::ColumnInfo::setColumnHeight):
+        (WebCore::ColumnInfo::updateMinimumColumnHeight):
+        (WebCore::ColumnInfo::minimumColumnHeight):
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::addOverflowFromChildren):
+        (WebCore::RenderBlock::paintColumnRules):
+        (WebCore::RenderBlock::paintColumnContents):
+        (WebCore::RenderBlock::hitTestFloats):
+        (WebCore::RenderBlock::hitTestColumns):
+        (WebCore::RenderBlock::hitTestContents):
+        (WebCore::RenderBlock::columnRectAt):
+        * rendering/RenderBlock.h:
+        (WebCore::RenderBlock::xPositionForFloatIncludingMargin):
+        (WebCore::RenderBlock::yPositionForFloatIncludingMargin):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::hitTestContents):
+        * rendering/RenderLayer.h:
+
 2011-06-29  Adrienne Walker  <[email protected]>
 
         Reviewed by James Robinson.

Modified: trunk/Source/WebCore/rendering/ColumnInfo.h (90029 => 90030)


--- trunk/Source/WebCore/rendering/ColumnInfo.h	2011-06-29 18:30:07 UTC (rev 90029)
+++ trunk/Source/WebCore/rendering/ColumnInfo.h	2011-06-29 18:58:23 UTC (rev 90030)
@@ -26,8 +26,8 @@
 #ifndef ColumnInfo_h
 #define ColumnInfo_h
 
+#include "LayoutTypes.h"
 #include <wtf/Vector.h>
-#include "IntRect.h"
 
 namespace WebCore {
 
@@ -45,26 +45,26 @@
         , m_forcedBreakOffset(0)
         { }
     
-    int desiredColumnWidth() const { return m_desiredColumnWidth; }
-    void setDesiredColumnWidth(int width) { m_desiredColumnWidth = width; }
+    LayoutUnit desiredColumnWidth() const { return m_desiredColumnWidth; }
+    void setDesiredColumnWidth(LayoutUnit width) { m_desiredColumnWidth = width; }
     
     unsigned desiredColumnCount() const { return m_desiredColumnCount; }
     void setDesiredColumnCount(unsigned count) { m_desiredColumnCount = count; }
 
     unsigned columnCount() const { return m_columnCount; }
-    int columnHeight() const { return m_columnHeight; }
+    LayoutUnit columnHeight() const { return m_columnHeight; }
 
     // Set our count and height.  This is enough info for a RenderBlock to compute page rects
     // dynamically.
-    void setColumnCountAndHeight(int count, int height)
+    void setColumnCountAndHeight(int count, LayoutUnit height)
     { 
         m_columnCount = count;
         m_columnHeight = height;
     }
-    void setColumnHeight(int height) { m_columnHeight = height; }
+    void setColumnHeight(LayoutUnit height) { m_columnHeight = height; }
 
-    void updateMinimumColumnHeight(int height) { m_minimumColumnHeight = std::max(height, m_minimumColumnHeight); }
-    int minimumColumnHeight() const { return m_minimumColumnHeight; }
+    void updateMinimumColumnHeight(LayoutUnit height) { m_minimumColumnHeight = std::max(height, m_minimumColumnHeight); }
+    LayoutUnit minimumColumnHeight() const { return m_minimumColumnHeight; }
 
     int forcedBreaks() const { return m_forcedBreaks; }
     int forcedBreakOffset() const { return m_forcedBreakOffset; }
@@ -87,12 +87,12 @@
     }
 
 private:
-    int m_desiredColumnWidth;
+    LayoutUnit m_desiredColumnWidth;
     unsigned m_desiredColumnCount;
     
     unsigned m_columnCount;
-    int m_columnHeight;
-    int m_minimumColumnHeight;
+    LayoutUnit m_columnHeight;
+    LayoutUnit m_minimumColumnHeight;
     int m_forcedBreaks; // FIXME: We will ultimately need to cache more information to balance around forced breaks properly.
     int m_maximumDistanceBetweenForcedBreaks;
     int m_forcedBreakOffset;

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (90029 => 90030)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-06-29 18:30:07 UTC (rev 90029)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-06-29 18:58:23 UTC (rev 90030)
@@ -1361,7 +1361,7 @@
     } else {
         ColumnInfo* colInfo = columnInfo();
         if (columnCount(colInfo)) {
-            IntRect lastRect = columnRectAt(colInfo, columnCount(colInfo) - 1);
+            LayoutRect lastRect = columnRectAt(colInfo, columnCount(colInfo) - 1);
             if (isHorizontalWritingMode()) {
                 int overflowLeft = !style()->isLeftToRightDirection() ? min(0, lastRect.x()) : 0;
                 int overflowRight = style()->isLeftToRightDirection() ? max(width(), lastRect.maxX()) : 0;
@@ -1370,7 +1370,7 @@
                 if (!hasOverflowClip())
                     addVisualOverflow(IntRect(overflowLeft, 0, overflowRight - overflowLeft, overflowHeight));
             } else {
-                IntRect lastRect = columnRectAt(colInfo, columnCount(colInfo) - 1);
+                LayoutRect lastRect = columnRectAt(colInfo, columnCount(colInfo) - 1);
                 int overflowTop = !style()->isLeftToRightDirection() ? min(0, lastRect.y()) : 0;
                 int overflowBottom = style()->isLeftToRightDirection() ? max(height(), lastRect.maxY()) : 0;
                 int overflowWidth = borderBefore() + paddingBefore() + colInfo->columnHeight();
@@ -2317,7 +2317,7 @@
     bool antialias = !currentCTM.isIdentityOrTranslationOrFlipped();
 
     for (unsigned i = 0; i < colCount; i++) {
-        IntRect colRect = columnRectAt(colInfo, i);
+        LayoutRect colRect = columnRectAt(colInfo, i);
 
         int inlineDirectionSize = isHorizontalWritingMode() ? colRect.width() : colRect.height();
         
@@ -2355,7 +2355,7 @@
     int currLogicalTopOffset = 0;
     for (unsigned i = 0; i < colCount; i++) {
         // For each rect, we clip to the rect, and then we adjust our coords.
-        IntRect colRect = columnRectAt(colInfo, i);
+        LayoutRect colRect = columnRectAt(colInfo, i);
         flipForWritingMode(colRect);
         int logicalLeftOffset = (isHorizontalWritingMode() ? colRect.x() : colRect.y()) - logicalLeftOffsetForContent();
         IntSize offset = isHorizontalWritingMode() ? IntSize(logicalLeftOffset, currLogicalTopOffset) : IntSize(currLogicalTopOffset, logicalLeftOffset);
@@ -3991,12 +3991,12 @@
     return false;
 }
 
-bool RenderBlock::hitTestFloats(const HitTestRequest& request, HitTestResult& result, const IntPoint& pointInContainer, const IntPoint& accumulatedOffset)
+bool RenderBlock::hitTestFloats(const HitTestRequest& request, HitTestResult& result, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset)
 {
     if (!m_floatingObjects)
         return false;
 
-    IntPoint adjustedLocation = accumulatedOffset;
+    LayoutPoint adjustedLocation = accumulatedOffset;
     if (isRenderView()) {
         adjustedLocation += toSize(toRenderView(this)->frameView()->scrollPosition());
     }
@@ -4007,9 +4007,9 @@
         --it;
         FloatingObject* floatingObject = *it;
         if (floatingObject->m_shouldPaint && !floatingObject->m_renderer->hasSelfPaintingLayer()) {
-            int xOffset = xPositionForFloatIncludingMargin(floatingObject) - floatingObject->m_renderer->x();
-            int yOffset = yPositionForFloatIncludingMargin(floatingObject) - floatingObject->m_renderer->y();
-            IntPoint childPoint = flipFloatForWritingMode(floatingObject, adjustedLocation + IntSize(xOffset, yOffset));
+            LayoutUnit xOffset = xPositionForFloatIncludingMargin(floatingObject) - floatingObject->m_renderer->x();
+            LayoutUnit yOffset = yPositionForFloatIncludingMargin(floatingObject) - floatingObject->m_renderer->y();
+            LayoutPoint childPoint = flipFloatForWritingMode(floatingObject, adjustedLocation + LayoutSize(xOffset, yOffset));
             if (floatingObject->m_renderer->hitTest(request, result, pointInContainer, childPoint)) {
                 updateHitTestResult(result, pointInContainer - toSize(childPoint));
                 return true;
@@ -4020,30 +4020,30 @@
     return false;
 }
 
-bool RenderBlock::hitTestColumns(const HitTestRequest& request, HitTestResult& result, const IntPoint& pointInContainer, const IntPoint& accumulatedOffset, HitTestAction hitTestAction)
+bool RenderBlock::hitTestColumns(const HitTestRequest& request, HitTestResult& result, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction)
 {
     // We need to do multiple passes, breaking up our hit testing into strips.
     ColumnInfo* colInfo = columnInfo();
     int colCount = columnCount(colInfo);
     if (!colCount)
         return false;
-    int logicalLeft = logicalLeftOffsetForContent();
-    int currLogicalTopOffset = 0;
+    LayoutUnit logicalLeft = logicalLeftOffsetForContent();
+    LayoutUnit currLogicalTopOffset = 0;
     int i;
     bool isHorizontal = isHorizontalWritingMode();
     for (i = 0; i < colCount; i++) {
-        IntRect colRect = columnRectAt(colInfo, i);
-        int blockDelta =  (isHorizontal ? colRect.height() : colRect.width());
+        LayoutRect colRect = columnRectAt(colInfo, i);
+        LayoutUnit blockDelta =  (isHorizontal ? colRect.height() : colRect.width());
         if (style()->isFlippedBlocksWritingMode())
             currLogicalTopOffset += blockDelta;
         else
             currLogicalTopOffset -= blockDelta;
     }
     for (i = colCount - 1; i >= 0; i--) {
-        IntRect colRect = columnRectAt(colInfo, i);
+        LayoutRect colRect = columnRectAt(colInfo, i);
         flipForWritingMode(colRect);
-        int currLogicalLeftOffset = (isHorizontal ? colRect.x() : colRect.y()) - logicalLeft;
-        int blockDelta =  (isHorizontal ? colRect.height() : colRect.width());
+        LayoutUnit currLogicalLeftOffset = (isHorizontal ? colRect.x() : colRect.y()) - logicalLeft;
+        LayoutUnit blockDelta =  (isHorizontal ? colRect.height() : colRect.width());
         if (style()->isFlippedBlocksWritingMode())
             currLogicalTopOffset -= blockDelta;
         else
@@ -4054,8 +4054,8 @@
             // The point is inside this column.
             // Adjust accumulatedOffset to change where we hit test.
         
-            IntSize offset = isHorizontal ? IntSize(currLogicalLeftOffset, currLogicalTopOffset) : IntSize(currLogicalTopOffset, currLogicalLeftOffset);
-            IntPoint finalLocation = accumulatedOffset + offset;
+            LayoutSize offset = isHorizontal ? IntSize(currLogicalLeftOffset, currLogicalTopOffset) : LayoutSize(currLogicalTopOffset, currLogicalLeftOffset);
+            LayoutPoint finalLocation = accumulatedOffset + offset;
             if (result.isRectBasedTest() && !colRect.contains(result.rectForPoint(pointInContainer)))
                 hitTestContents(request, result, pointInContainer, finalLocation, hitTestAction);
             else
@@ -4066,7 +4066,7 @@
     return false;
 }
 
-bool RenderBlock::hitTestContents(const HitTestRequest& request, HitTestResult& result, const IntPoint& pointInContainer, const IntPoint& accumulatedOffset, HitTestAction hitTestAction)
+bool RenderBlock::hitTestContents(const HitTestRequest& request, HitTestResult& result, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction)
 {
     if (childrenInline() && !isTable()) {
         // We have to hit-test our line boxes.
@@ -4078,7 +4078,7 @@
         if (hitTestAction == HitTestChildBlockBackgrounds)
             childHitTest = HitTestChildBlockBackground;
         for (RenderBox* child = lastChildBox(); child; child = child->previousSiblingBox()) {
-            IntPoint childPoint = flipForWritingMode(child, accumulatedOffset, ParentToChildFlippingAdjustment);
+            LayoutPoint childPoint = flipForWritingMode(child, accumulatedOffset, ParentToChildFlippingAdjustment);
             if (!child->hasSelfPaintingLayer() && !child->isFloating() && child->nodeAtPoint(request, result, pointInContainer, childPoint, childHitTest))
                 return true;
         }
@@ -4351,22 +4351,22 @@
     return colInfo->columnCount();
 }
 
-IntRect RenderBlock::columnRectAt(ColumnInfo* colInfo, unsigned index) const
+LayoutRect RenderBlock::columnRectAt(ColumnInfo* colInfo, unsigned index) const
 {
     ASSERT(hasColumns() && gColumnInfoMap->get(this) == colInfo);
 
     // Compute the appropriate rect based off our information.
-    int colLogicalWidth = colInfo->desiredColumnWidth();
-    int colLogicalHeight = colInfo->columnHeight();
-    int colLogicalTop = borderBefore() + paddingBefore();
+    LayoutUnit colLogicalWidth = colInfo->desiredColumnWidth();
+    LayoutUnit colLogicalHeight = colInfo->columnHeight();
+    LayoutUnit colLogicalTop = borderBefore() + paddingBefore();
     int colGap = columnGap();
-    int colLogicalLeft = style()->isLeftToRightDirection() ? 
-                          logicalLeftOffsetForContent() + (index * (colLogicalWidth + colGap))
-                        : logicalLeftOffsetForContent() + contentLogicalWidth() - colLogicalWidth - (index * (colLogicalWidth + colGap));
-    IntRect rect(colLogicalLeft, colLogicalTop, colLogicalWidth, colLogicalHeight);
+    LayoutUnit colLogicalLeft = style()->isLeftToRightDirection() ? 
+                                 logicalLeftOffsetForContent() + (index * (colLogicalWidth + colGap))
+                               : logicalLeftOffsetForContent() + contentLogicalWidth() - colLogicalWidth - (index * (colLogicalWidth + colGap));
+
     if (isHorizontalWritingMode())
-        return IntRect(colLogicalLeft, colLogicalTop, colLogicalWidth, colLogicalHeight);
-    return IntRect(colLogicalTop, colLogicalLeft, colLogicalHeight, colLogicalWidth);
+        return LayoutRect(colLogicalLeft, colLogicalTop, colLogicalWidth, colLogicalHeight);
+    return LayoutRect(colLogicalTop, colLogicalLeft, colLogicalHeight, colLogicalWidth);
 }
 
 bool RenderBlock::layoutColumns(bool hasSpecifiedPageLogicalHeight, int pageLogicalHeight, LayoutStateMaintainer& statePusher)

Modified: trunk/Source/WebCore/rendering/RenderBlock.h (90029 => 90030)


--- trunk/Source/WebCore/rendering/RenderBlock.h	2011-06-29 18:30:07 UTC (rev 90029)
+++ trunk/Source/WebCore/rendering/RenderBlock.h	2011-06-29 18:58:23 UTC (rev 90030)
@@ -181,7 +181,7 @@
     
     // These two functions take the ColumnInfo* to avoid repeated lookups of the info in the global HashMap.
     unsigned columnCount(ColumnInfo*) const;
-    IntRect columnRectAt(ColumnInfo*, unsigned) const;
+    LayoutRect columnRectAt(ColumnInfo*, unsigned) const;
 
     int paginationStrut() const { return m_rareData ? m_rareData->m_paginationStrut : 0; }
     void setPaginationStrut(int);
@@ -494,7 +494,7 @@
             child->setHeight(logicalWidth);
     }
 
-    int xPositionForFloatIncludingMargin(const FloatingObject* child) const
+    LayoutUnit xPositionForFloatIncludingMargin(const FloatingObject* child) const
     {
         if (isHorizontalWritingMode())
             return child->x() + child->renderer()->marginLeft();
@@ -502,7 +502,7 @@
             return child->x() + marginBeforeForChild(child->renderer());
     }
         
-    int yPositionForFloatIncludingMargin(const FloatingObject* child) const
+    LayoutUnit yPositionForFloatIncludingMargin(const FloatingObject* child) const
     {
         if (isHorizontalWritingMode())
             return child->y() + marginBeforeForChild(child->renderer());
@@ -589,9 +589,9 @@
     int lowestFloatLogicalBottom(FloatingObject::Type = FloatingObject::FloatBoth) const;
     int nextFloatLogicalBottomBelow(int) const;
     
-    virtual bool hitTestColumns(const HitTestRequest&, HitTestResult&, const IntPoint& pointInContainer, const IntPoint& accumulatedOffset, HitTestAction);
-    virtual bool hitTestContents(const HitTestRequest&, HitTestResult&, const IntPoint& pointInContainer, const IntPoint& accumulatedOffset, HitTestAction);
-    bool hitTestFloats(const HitTestRequest&, HitTestResult&, const IntPoint& pointInContainer, const IntPoint& accumulatedOffset);
+    virtual bool hitTestColumns(const HitTestRequest&, HitTestResult&, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction);
+    virtual bool hitTestContents(const HitTestRequest&, HitTestResult&, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction);
+    bool hitTestFloats(const HitTestRequest&, HitTestResult&, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset);
 
     virtual bool isPointInOverflowControl(HitTestResult&, const IntPoint& pointInContainer, const IntPoint& accumulatedOffset);
 

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (90029 => 90030)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2011-06-29 18:30:07 UTC (rev 90029)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2011-06-29 18:58:23 UTC (rev 90030)
@@ -3141,7 +3141,7 @@
     return 0;
 }
 
-bool RenderLayer::hitTestContents(const HitTestRequest& request, HitTestResult& result, const IntRect& layerBounds, const IntPoint& hitTestPoint, HitTestFilter hitTestFilter) const
+bool RenderLayer::hitTestContents(const HitTestRequest& request, HitTestResult& result, const LayoutRect& layerBounds, const LayoutPoint& hitTestPoint, HitTestFilter hitTestFilter) const
 {
     if (!renderer()->hitTest(request, result, hitTestPoint,
                             toPoint(layerBounds.location() - renderBoxLocation()),

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (90029 => 90030)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2011-06-29 18:30:07 UTC (rev 90029)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2011-06-29 18:58:23 UTC (rev 90030)
@@ -516,7 +516,7 @@
                             const IntRect& hitTestRect, const IntPoint& hitTestPoint,
                             const HitTestingTransformState* containerTransformState) const;
     
-    bool hitTestContents(const HitTestRequest&, HitTestResult&, const IntRect& layerBounds, const IntPoint& hitTestPoint, HitTestFilter) const;
+    bool hitTestContents(const HitTestRequest&, HitTestResult&, const LayoutRect& layerBounds, const LayoutPoint& hitTestPoint, HitTestFilter) const;
     
     void computeScrollDimensions(bool* needHBar = 0, bool* needVBar = 0);
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to