Changeset 90030 in webkit
- Timestamp:
- Jun 29, 2011 11:58:23 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r90029 r90030 1 2011-06-29 Emil A Eklund <eae@chromium.org> 2 3 Reviewed by Darin Adler. 4 5 Switch hitTestColumns/Contents/Floats to to new layout types 6 https://bugs.webkit.org/show_bug.cgi?id=63589 7 8 Switch location and size methods for RenderBox over to the new layout unit abstraction. 9 10 No new tests, no functionality changes. 11 12 * rendering/ColumnInfo.h: 13 (WebCore::ColumnInfo::desiredColumnWidth): 14 (WebCore::ColumnInfo::setDesiredColumnWidth): 15 (WebCore::ColumnInfo::columnHeight): 16 (WebCore::ColumnInfo::setColumnCountAndHeight): 17 (WebCore::ColumnInfo::setColumnHeight): 18 (WebCore::ColumnInfo::updateMinimumColumnHeight): 19 (WebCore::ColumnInfo::minimumColumnHeight): 20 * rendering/RenderBlock.cpp: 21 (WebCore::RenderBlock::addOverflowFromChildren): 22 (WebCore::RenderBlock::paintColumnRules): 23 (WebCore::RenderBlock::paintColumnContents): 24 (WebCore::RenderBlock::hitTestFloats): 25 (WebCore::RenderBlock::hitTestColumns): 26 (WebCore::RenderBlock::hitTestContents): 27 (WebCore::RenderBlock::columnRectAt): 28 * rendering/RenderBlock.h: 29 (WebCore::RenderBlock::xPositionForFloatIncludingMargin): 30 (WebCore::RenderBlock::yPositionForFloatIncludingMargin): 31 * rendering/RenderLayer.cpp: 32 (WebCore::RenderLayer::hitTestContents): 33 * rendering/RenderLayer.h: 34 1 35 2011-06-29 Adrienne Walker <enne@google.com> 2 36 -
trunk/Source/WebCore/rendering/ColumnInfo.h
r76248 r90030 27 27 #define ColumnInfo_h 28 28 29 #include "LayoutTypes.h" 29 30 #include <wtf/Vector.h> 30 #include "IntRect.h"31 31 32 32 namespace WebCore { … … 46 46 { } 47 47 48 int desiredColumnWidth() const { return m_desiredColumnWidth; }49 void setDesiredColumnWidth( int width) { m_desiredColumnWidth = width; }48 LayoutUnit desiredColumnWidth() const { return m_desiredColumnWidth; } 49 void setDesiredColumnWidth(LayoutUnit width) { m_desiredColumnWidth = width; } 50 50 51 51 unsigned desiredColumnCount() const { return m_desiredColumnCount; } … … 53 53 54 54 unsigned columnCount() const { return m_columnCount; } 55 int columnHeight() const { return m_columnHeight; }55 LayoutUnit columnHeight() const { return m_columnHeight; } 56 56 57 57 // Set our count and height. This is enough info for a RenderBlock to compute page rects 58 58 // dynamically. 59 void setColumnCountAndHeight(int count, int height)59 void setColumnCountAndHeight(int count, LayoutUnit height) 60 60 { 61 61 m_columnCount = count; 62 62 m_columnHeight = height; 63 63 } 64 void setColumnHeight( int height) { m_columnHeight = height; }64 void setColumnHeight(LayoutUnit height) { m_columnHeight = height; } 65 65 66 void updateMinimumColumnHeight( int height) { m_minimumColumnHeight = std::max(height, m_minimumColumnHeight); }67 int minimumColumnHeight() const { return m_minimumColumnHeight; }66 void updateMinimumColumnHeight(LayoutUnit height) { m_minimumColumnHeight = std::max(height, m_minimumColumnHeight); } 67 LayoutUnit minimumColumnHeight() const { return m_minimumColumnHeight; } 68 68 69 69 int forcedBreaks() const { return m_forcedBreaks; } … … 88 88 89 89 private: 90 int m_desiredColumnWidth;90 LayoutUnit m_desiredColumnWidth; 91 91 unsigned m_desiredColumnCount; 92 92 93 93 unsigned m_columnCount; 94 int m_columnHeight;95 int m_minimumColumnHeight;94 LayoutUnit m_columnHeight; 95 LayoutUnit m_minimumColumnHeight; 96 96 int m_forcedBreaks; // FIXME: We will ultimately need to cache more information to balance around forced breaks properly. 97 97 int m_maximumDistanceBetweenForcedBreaks; -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r89983 r90030 1362 1362 ColumnInfo* colInfo = columnInfo(); 1363 1363 if (columnCount(colInfo)) { 1364 IntRect lastRect = columnRectAt(colInfo, columnCount(colInfo) - 1);1364 LayoutRect lastRect = columnRectAt(colInfo, columnCount(colInfo) - 1); 1365 1365 if (isHorizontalWritingMode()) { 1366 1366 int overflowLeft = !style()->isLeftToRightDirection() ? min(0, lastRect.x()) : 0; … … 1371 1371 addVisualOverflow(IntRect(overflowLeft, 0, overflowRight - overflowLeft, overflowHeight)); 1372 1372 } else { 1373 IntRect lastRect = columnRectAt(colInfo, columnCount(colInfo) - 1);1373 LayoutRect lastRect = columnRectAt(colInfo, columnCount(colInfo) - 1); 1374 1374 int overflowTop = !style()->isLeftToRightDirection() ? min(0, lastRect.y()) : 0; 1375 1375 int overflowBottom = style()->isLeftToRightDirection() ? max(height(), lastRect.maxY()) : 0; … … 2318 2318 2319 2319 for (unsigned i = 0; i < colCount; i++) { 2320 IntRect colRect = columnRectAt(colInfo, i);2320 LayoutRect colRect = columnRectAt(colInfo, i); 2321 2321 2322 2322 int inlineDirectionSize = isHorizontalWritingMode() ? colRect.width() : colRect.height(); … … 2356 2356 for (unsigned i = 0; i < colCount; i++) { 2357 2357 // For each rect, we clip to the rect, and then we adjust our coords. 2358 IntRect colRect = columnRectAt(colInfo, i);2358 LayoutRect colRect = columnRectAt(colInfo, i); 2359 2359 flipForWritingMode(colRect); 2360 2360 int logicalLeftOffset = (isHorizontalWritingMode() ? colRect.x() : colRect.y()) - logicalLeftOffsetForContent(); … … 3992 3992 } 3993 3993 3994 bool RenderBlock::hitTestFloats(const HitTestRequest& request, HitTestResult& result, const IntPoint& pointInContainer, const IntPoint& accumulatedOffset)3994 bool RenderBlock::hitTestFloats(const HitTestRequest& request, HitTestResult& result, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset) 3995 3995 { 3996 3996 if (!m_floatingObjects) 3997 3997 return false; 3998 3998 3999 IntPoint adjustedLocation = accumulatedOffset;3999 LayoutPoint adjustedLocation = accumulatedOffset; 4000 4000 if (isRenderView()) { 4001 4001 adjustedLocation += toSize(toRenderView(this)->frameView()->scrollPosition()); … … 4008 4008 FloatingObject* floatingObject = *it; 4009 4009 if (floatingObject->m_shouldPaint && !floatingObject->m_renderer->hasSelfPaintingLayer()) { 4010 int xOffset = xPositionForFloatIncludingMargin(floatingObject) - floatingObject->m_renderer->x();4011 int yOffset = yPositionForFloatIncludingMargin(floatingObject) - floatingObject->m_renderer->y();4012 IntPoint childPoint = flipFloatForWritingMode(floatingObject, adjustedLocation + IntSize(xOffset, yOffset));4010 LayoutUnit xOffset = xPositionForFloatIncludingMargin(floatingObject) - floatingObject->m_renderer->x(); 4011 LayoutUnit yOffset = yPositionForFloatIncludingMargin(floatingObject) - floatingObject->m_renderer->y(); 4012 LayoutPoint childPoint = flipFloatForWritingMode(floatingObject, adjustedLocation + LayoutSize(xOffset, yOffset)); 4013 4013 if (floatingObject->m_renderer->hitTest(request, result, pointInContainer, childPoint)) { 4014 4014 updateHitTestResult(result, pointInContainer - toSize(childPoint)); … … 4021 4021 } 4022 4022 4023 bool RenderBlock::hitTestColumns(const HitTestRequest& request, HitTestResult& result, const IntPoint& pointInContainer, const IntPoint& accumulatedOffset, HitTestAction hitTestAction)4023 bool RenderBlock::hitTestColumns(const HitTestRequest& request, HitTestResult& result, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction) 4024 4024 { 4025 4025 // We need to do multiple passes, breaking up our hit testing into strips. … … 4028 4028 if (!colCount) 4029 4029 return false; 4030 int logicalLeft = logicalLeftOffsetForContent();4031 int currLogicalTopOffset = 0;4030 LayoutUnit logicalLeft = logicalLeftOffsetForContent(); 4031 LayoutUnit currLogicalTopOffset = 0; 4032 4032 int i; 4033 4033 bool isHorizontal = isHorizontalWritingMode(); 4034 4034 for (i = 0; i < colCount; i++) { 4035 IntRect colRect = columnRectAt(colInfo, i);4036 int blockDelta = (isHorizontal ? colRect.height() : colRect.width());4035 LayoutRect colRect = columnRectAt(colInfo, i); 4036 LayoutUnit blockDelta = (isHorizontal ? colRect.height() : colRect.width()); 4037 4037 if (style()->isFlippedBlocksWritingMode()) 4038 4038 currLogicalTopOffset += blockDelta; … … 4041 4041 } 4042 4042 for (i = colCount - 1; i >= 0; i--) { 4043 IntRect colRect = columnRectAt(colInfo, i);4043 LayoutRect colRect = columnRectAt(colInfo, i); 4044 4044 flipForWritingMode(colRect); 4045 int currLogicalLeftOffset = (isHorizontal ? colRect.x() : colRect.y()) - logicalLeft;4046 int blockDelta = (isHorizontal ? colRect.height() : colRect.width());4045 LayoutUnit currLogicalLeftOffset = (isHorizontal ? colRect.x() : colRect.y()) - logicalLeft; 4046 LayoutUnit blockDelta = (isHorizontal ? colRect.height() : colRect.width()); 4047 4047 if (style()->isFlippedBlocksWritingMode()) 4048 4048 currLogicalTopOffset -= blockDelta; … … 4055 4055 // Adjust accumulatedOffset to change where we hit test. 4056 4056 4057 IntSize offset = isHorizontal ? IntSize(currLogicalLeftOffset, currLogicalTopOffset) : IntSize(currLogicalTopOffset, currLogicalLeftOffset);4058 IntPoint finalLocation = accumulatedOffset + offset;4057 LayoutSize offset = isHorizontal ? IntSize(currLogicalLeftOffset, currLogicalTopOffset) : LayoutSize(currLogicalTopOffset, currLogicalLeftOffset); 4058 LayoutPoint finalLocation = accumulatedOffset + offset; 4059 4059 if (result.isRectBasedTest() && !colRect.contains(result.rectForPoint(pointInContainer))) 4060 4060 hitTestContents(request, result, pointInContainer, finalLocation, hitTestAction); … … 4067 4067 } 4068 4068 4069 bool RenderBlock::hitTestContents(const HitTestRequest& request, HitTestResult& result, const IntPoint& pointInContainer, const IntPoint& accumulatedOffset, HitTestAction hitTestAction)4069 bool RenderBlock::hitTestContents(const HitTestRequest& request, HitTestResult& result, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction) 4070 4070 { 4071 4071 if (childrenInline() && !isTable()) { … … 4079 4079 childHitTest = HitTestChildBlockBackground; 4080 4080 for (RenderBox* child = lastChildBox(); child; child = child->previousSiblingBox()) { 4081 IntPoint childPoint = flipForWritingMode(child, accumulatedOffset, ParentToChildFlippingAdjustment);4081 LayoutPoint childPoint = flipForWritingMode(child, accumulatedOffset, ParentToChildFlippingAdjustment); 4082 4082 if (!child->hasSelfPaintingLayer() && !child->isFloating() && child->nodeAtPoint(request, result, pointInContainer, childPoint, childHitTest)) 4083 4083 return true; … … 4352 4352 } 4353 4353 4354 IntRect RenderBlock::columnRectAt(ColumnInfo* colInfo, unsigned index) const4354 LayoutRect RenderBlock::columnRectAt(ColumnInfo* colInfo, unsigned index) const 4355 4355 { 4356 4356 ASSERT(hasColumns() && gColumnInfoMap->get(this) == colInfo); 4357 4357 4358 4358 // Compute the appropriate rect based off our information. 4359 int colLogicalWidth = colInfo->desiredColumnWidth();4360 int colLogicalHeight = colInfo->columnHeight();4361 int colLogicalTop = borderBefore() + paddingBefore();4359 LayoutUnit colLogicalWidth = colInfo->desiredColumnWidth(); 4360 LayoutUnit colLogicalHeight = colInfo->columnHeight(); 4361 LayoutUnit colLogicalTop = borderBefore() + paddingBefore(); 4362 4362 int colGap = columnGap(); 4363 int colLogicalLeft = style()->isLeftToRightDirection() ?4364 logicalLeftOffsetForContent() + (index * (colLogicalWidth + colGap))4365 : logicalLeftOffsetForContent() + contentLogicalWidth() - colLogicalWidth - (index * (colLogicalWidth + colGap));4366 IntRect rect(colLogicalLeft, colLogicalTop, colLogicalWidth, colLogicalHeight); 4363 LayoutUnit colLogicalLeft = style()->isLeftToRightDirection() ? 4364 logicalLeftOffsetForContent() + (index * (colLogicalWidth + colGap)) 4365 : logicalLeftOffsetForContent() + contentLogicalWidth() - colLogicalWidth - (index * (colLogicalWidth + colGap)); 4366 4367 4367 if (isHorizontalWritingMode()) 4368 return IntRect(colLogicalLeft, colLogicalTop, colLogicalWidth, colLogicalHeight);4369 return IntRect(colLogicalTop, colLogicalLeft, colLogicalHeight, colLogicalWidth);4368 return LayoutRect(colLogicalLeft, colLogicalTop, colLogicalWidth, colLogicalHeight); 4369 return LayoutRect(colLogicalTop, colLogicalLeft, colLogicalHeight, colLogicalWidth); 4370 4370 } 4371 4371 -
trunk/Source/WebCore/rendering/RenderBlock.h
r89983 r90030 182 182 // These two functions take the ColumnInfo* to avoid repeated lookups of the info in the global HashMap. 183 183 unsigned columnCount(ColumnInfo*) const; 184 IntRect columnRectAt(ColumnInfo*, unsigned) const;184 LayoutRect columnRectAt(ColumnInfo*, unsigned) const; 185 185 186 186 int paginationStrut() const { return m_rareData ? m_rareData->m_paginationStrut : 0; } … … 495 495 } 496 496 497 int xPositionForFloatIncludingMargin(const FloatingObject* child) const497 LayoutUnit xPositionForFloatIncludingMargin(const FloatingObject* child) const 498 498 { 499 499 if (isHorizontalWritingMode()) … … 503 503 } 504 504 505 int yPositionForFloatIncludingMargin(const FloatingObject* child) const505 LayoutUnit yPositionForFloatIncludingMargin(const FloatingObject* child) const 506 506 { 507 507 if (isHorizontalWritingMode()) … … 590 590 int nextFloatLogicalBottomBelow(int) const; 591 591 592 virtual bool hitTestColumns(const HitTestRequest&, HitTestResult&, const IntPoint& pointInContainer, const IntPoint& accumulatedOffset, HitTestAction);593 virtual bool hitTestContents(const HitTestRequest&, HitTestResult&, const IntPoint& pointInContainer, const IntPoint& accumulatedOffset, HitTestAction);594 bool hitTestFloats(const HitTestRequest&, HitTestResult&, const IntPoint& pointInContainer, const IntPoint& accumulatedOffset);592 virtual bool hitTestColumns(const HitTestRequest&, HitTestResult&, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction); 593 virtual bool hitTestContents(const HitTestRequest&, HitTestResult&, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction); 594 bool hitTestFloats(const HitTestRequest&, HitTestResult&, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset); 595 595 596 596 virtual bool isPointInOverflowControl(HitTestResult&, const IntPoint& pointInContainer, const IntPoint& accumulatedOffset); -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r89984 r90030 3142 3142 } 3143 3143 3144 bool RenderLayer::hitTestContents(const HitTestRequest& request, HitTestResult& result, const IntRect& layerBounds, const IntPoint& hitTestPoint, HitTestFilter hitTestFilter) const3144 bool RenderLayer::hitTestContents(const HitTestRequest& request, HitTestResult& result, const LayoutRect& layerBounds, const LayoutPoint& hitTestPoint, HitTestFilter hitTestFilter) const 3145 3145 { 3146 3146 if (!renderer()->hitTest(request, result, hitTestPoint, -
trunk/Source/WebCore/rendering/RenderLayer.h
r89984 r90030 517 517 const HitTestingTransformState* containerTransformState) const; 518 518 519 bool hitTestContents(const HitTestRequest&, HitTestResult&, const IntRect& layerBounds, const IntPoint& hitTestPoint, HitTestFilter) const;519 bool hitTestContents(const HitTestRequest&, HitTestResult&, const LayoutRect& layerBounds, const LayoutPoint& hitTestPoint, HitTestFilter) const; 520 520 521 521 void computeScrollDimensions(bool* needHBar = 0, bool* needVBar = 0);
Note: See TracChangeset
for help on using the changeset viewer.