Changeset 90288 in webkit
- Timestamp:
- Jul 1, 2011, 3:31:23 PM (14 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r90284 r90288 1 2011-07-01 Levi Weintraub <leviw@chromium.org> 2 3 Switch overflow and collapsedMargins to new layout types 4 https://bugs.webkit.org/show_bug.cgi?id=63840 5 6 Reviewed by Eric Seidel. 7 8 Switching overflow and collapsedMargins over to the new layout unit abstraction. 9 10 Also removing an unused function: blockDirectionOverflow 11 12 No new tests, no functionality changes. 13 14 * rendering/RenderBlock.cpp: 15 (WebCore::RenderBlock::collapsedMarginBeforeForChild): 16 (WebCore::RenderBlock::collapsedMarginAfterForChild): 17 * rendering/RenderBlock.h: 18 (WebCore::RenderBlock::collapsedMarginBefore): 19 (WebCore::RenderBlock::collapsedMarginAfter): 20 * rendering/RenderBox.cpp: 21 (WebCore::RenderBox::addOverflowFromChild): 22 (WebCore::RenderBox::addLayoutOverflow): 23 (WebCore::RenderBox::addVisualOverflow): 24 * rendering/RenderBox.h: 25 (WebCore::RenderBox::layoutOverflowRect): 26 (WebCore::RenderBox::minYLayoutOverflow): 27 (WebCore::RenderBox::maxYLayoutOverflow): 28 (WebCore::RenderBox::minXLayoutOverflow): 29 (WebCore::RenderBox::maxXLayoutOverflow): 30 (WebCore::RenderBox::maxLayoutOverflow): 31 (WebCore::RenderBox::logicalLeftLayoutOverflow): 32 (WebCore::RenderBox::logicalRightLayoutOverflow): 33 (WebCore::RenderBox::visualOverflowRect): 34 (WebCore::RenderBox::minYVisualOverflow): 35 (WebCore::RenderBox::maxYVisualOverflow): 36 (WebCore::RenderBox::minXVisualOverflow): 37 (WebCore::RenderBox::maxXVisualOverflow): 38 (WebCore::RenderBox::logicalLeftVisualOverflow): 39 (WebCore::RenderBox::logicalRightVisualOverflow): 40 (WebCore::RenderBox::addOverflowFromChild): 41 (WebCore::RenderBox::collapsedMarginBefore): 42 (WebCore::RenderBox::collapsedMarginAfter): 43 * rendering/RenderOverflow.h: 44 (WebCore::RenderOverflow::RenderOverflow): 45 (WebCore::RenderOverflow::minYLayoutOverflow): 46 (WebCore::RenderOverflow::maxYLayoutOverflow): 47 (WebCore::RenderOverflow::minXLayoutOverflow): 48 (WebCore::RenderOverflow::maxXLayoutOverflow): 49 (WebCore::RenderOverflow::minYVisualOverflow): 50 (WebCore::RenderOverflow::maxYVisualOverflow): 51 (WebCore::RenderOverflow::minXVisualOverflow): 52 (WebCore::RenderOverflow::maxXVisualOverflow): 53 (WebCore::RenderOverflow::setMinYLayoutOverflow): 54 (WebCore::RenderOverflow::setMaxYLayoutOverflow): 55 (WebCore::RenderOverflow::setMinXLayoutOverflow): 56 (WebCore::RenderOverflow::setMaxXLayoutOverflow): 57 (WebCore::RenderOverflow::setMinYVisualOverflow): 58 (WebCore::RenderOverflow::setMaxYVisualOverflow): 59 (WebCore::RenderOverflow::setMinXVisualOverflow): 60 (WebCore::RenderOverflow::setMaxXVisualOverflow): 61 (WebCore::RenderOverflow::layoutOverflowRect): 62 (WebCore::RenderOverflow::visualOverflowRect): 63 (WebCore::RenderOverflow::move): 64 (WebCore::RenderOverflow::addLayoutOverflow): 65 (WebCore::RenderOverflow::addVisualOverflow): 66 (WebCore::RenderOverflow::setLayoutOverflow): 67 (WebCore::RenderOverflow::setVisualOverflow): 68 (WebCore::RenderOverflow::resetLayoutOverflow): 69 1 70 2011-07-01 Nate Chapin <japhet@chromium.org> 2 71 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r90250 r90288 6089 6089 } 6090 6090 6091 int RenderBlock::collapsedMarginBeforeForChild(RenderBox* child) const6091 LayoutUnit RenderBlock::collapsedMarginBeforeForChild(RenderBox* child) const 6092 6092 { 6093 6093 // If the child has the same directionality as we do, then we can just return its … … 6106 6106 } 6107 6107 6108 int RenderBlock::collapsedMarginAfterForChild(RenderBox* child) const6108 LayoutUnit RenderBlock::collapsedMarginAfterForChild(RenderBox* child) const 6109 6109 { 6110 6110 // If the child has the same directionality as we do, then we can just return its -
trunk/Source/WebCore/rendering/RenderBlock.h
r90250 r90288 368 368 virtual bool isSelfCollapsingBlock() const; 369 369 370 virtual int collapsedMarginBefore() const { return maxPositiveMarginBefore() - maxNegativeMarginBefore(); }371 virtual int collapsedMarginAfter() const { return maxPositiveMarginAfter() - maxNegativeMarginAfter(); }370 virtual LayoutUnit collapsedMarginBefore() const { return maxPositiveMarginBefore() - maxNegativeMarginBefore(); } 371 virtual LayoutUnit collapsedMarginAfter() const { return maxPositiveMarginAfter() - maxNegativeMarginAfter(); } 372 372 373 373 virtual void repaintOverhangingFloats(bool paintAllDescendants); -
trunk/Source/WebCore/rendering/RenderBox.cpp
r90250 r90288 3210 3210 } 3211 3211 3212 void RenderBox::addOverflowFromChild(RenderBox* child, const IntSize& delta)3212 void RenderBox::addOverflowFromChild(RenderBox* child, const LayoutSize& delta) 3213 3213 { 3214 3214 // Only propagate layout overflow from the child if the child isn't clipping its overflow. If it is, then 3215 3215 // its overflow is internal to it, and we don't care about it. layoutOverflowRectForPropagation takes care of this 3216 3216 // and just propagates the border box rect instead. 3217 IntRect childLayoutOverflowRect = child->layoutOverflowRectForPropagation(style());3217 LayoutRect childLayoutOverflowRect = child->layoutOverflowRectForPropagation(style()); 3218 3218 childLayoutOverflowRect.move(delta); 3219 3219 addLayoutOverflow(childLayoutOverflowRect); … … 3224 3224 if (child->hasSelfPaintingLayer() || hasOverflowClip()) 3225 3225 return; 3226 IntRect childVisualOverflowRect = child->visualOverflowRectForPropagation(style());3226 LayoutRect childVisualOverflowRect = child->visualOverflowRectForPropagation(style()); 3227 3227 childVisualOverflowRect.move(delta); 3228 3228 addVisualOverflow(childVisualOverflowRect); 3229 3229 } 3230 3230 3231 void RenderBox::addLayoutOverflow(const IntRect& rect)3232 { 3233 IntRect clientBox = clientBoxRect();3231 void RenderBox::addLayoutOverflow(const LayoutRect& rect) 3232 { 3233 LayoutRect clientBox = clientBoxRect(); 3234 3234 if (clientBox.contains(rect) || rect.isEmpty()) 3235 3235 return; 3236 3236 3237 3237 // For overflow clip objects, we don't want to propagate overflow into unreachable areas. 3238 IntRect overflowRect(rect);3238 LayoutRect overflowRect(rect); 3239 3239 if (hasOverflowClip() || isRenderView()) { 3240 3240 // Overflow is in the block's coordinate space and thus is flipped for horizontal-bt and vertical-rl … … 3265 3265 } 3266 3266 3267 void RenderBox::addVisualOverflow(const IntRect& rect)3268 { 3269 IntRect borderBox = borderBoxRect();3267 void RenderBox::addVisualOverflow(const LayoutRect& rect) 3268 { 3269 LayoutRect borderBox = borderBoxRect(); 3270 3270 if (borderBox.contains(rect) || rect.isEmpty()) 3271 3271 return; -
trunk/Source/WebCore/rendering/RenderBox.h
r90250 r90288 140 140 // respectively are flipped when compared to their physical counterparts. For example minX is on the left in vertical-lr, 141 141 // but it is on the right in vertical-rl. 142 IntRect layoutOverflowRect() const { return m_overflow ? m_overflow->layoutOverflowRect() : clientBoxRect(); }143 int minYLayoutOverflow() const { return m_overflow? m_overflow->minYLayoutOverflow() : borderTop(); }144 int maxYLayoutOverflow() const { return m_overflow ? m_overflow->maxYLayoutOverflow() : borderTop() + clientHeight(); }145 int minXLayoutOverflow() const { return m_overflow ? m_overflow->minXLayoutOverflow() : borderLeft(); }146 int maxXLayoutOverflow() const { return m_overflow ? m_overflow->maxXLayoutOverflow() : borderLeft() + clientWidth(); }147 IntSize maxLayoutOverflow() const { return IntSize(maxXLayoutOverflow(), maxYLayoutOverflow()); }148 int logicalLeftLayoutOverflow() const { return style()->isHorizontalWritingMode() ? minXLayoutOverflow() : minYLayoutOverflow(); }149 int logicalRightLayoutOverflow() const { return style()->isHorizontalWritingMode() ? maxXLayoutOverflow() : maxYLayoutOverflow(); }150 151 IntRect visualOverflowRect() const { return m_overflow ? m_overflow->visualOverflowRect() : borderBoxRect(); }152 int minYVisualOverflow() const { return m_overflow? m_overflow->minYVisualOverflow() : 0; }153 int maxYVisualOverflow() const { return m_overflow ? m_overflow->maxYVisualOverflow() : height(); }154 int minXVisualOverflow() const { return m_overflow ? m_overflow->minXVisualOverflow() : 0; }155 int maxXVisualOverflow() const { return m_overflow ? m_overflow->maxXVisualOverflow() : width(); }156 int logicalLeftVisualOverflow() const { return style()->isHorizontalWritingMode() ? minXVisualOverflow() : minYVisualOverflow(); }157 int logicalRightVisualOverflow() const { return style()->isHorizontalWritingMode() ? maxXVisualOverflow() : maxYVisualOverflow(); }158 159 void addLayoutOverflow(const IntRect&);160 void addVisualOverflow(const IntRect&);142 LayoutRect layoutOverflowRect() const { return m_overflow ? m_overflow->layoutOverflowRect() : clientBoxRect(); } 143 LayoutUnit minYLayoutOverflow() const { return m_overflow? m_overflow->minYLayoutOverflow() : borderTop(); } 144 LayoutUnit maxYLayoutOverflow() const { return m_overflow ? m_overflow->maxYLayoutOverflow() : borderTop() + clientHeight(); } 145 LayoutUnit minXLayoutOverflow() const { return m_overflow ? m_overflow->minXLayoutOverflow() : borderLeft(); } 146 LayoutUnit maxXLayoutOverflow() const { return m_overflow ? m_overflow->maxXLayoutOverflow() : borderLeft() + clientWidth(); } 147 LayoutSize maxLayoutOverflow() const { return LayoutSize(maxXLayoutOverflow(), maxYLayoutOverflow()); } 148 LayoutUnit logicalLeftLayoutOverflow() const { return style()->isHorizontalWritingMode() ? minXLayoutOverflow() : minYLayoutOverflow(); } 149 LayoutUnit logicalRightLayoutOverflow() const { return style()->isHorizontalWritingMode() ? maxXLayoutOverflow() : maxYLayoutOverflow(); } 150 151 LayoutRect visualOverflowRect() const { return m_overflow ? m_overflow->visualOverflowRect() : borderBoxRect(); } 152 LayoutUnit minYVisualOverflow() const { return m_overflow? m_overflow->minYVisualOverflow() : 0; } 153 LayoutUnit maxYVisualOverflow() const { return m_overflow ? m_overflow->maxYVisualOverflow() : height(); } 154 LayoutUnit minXVisualOverflow() const { return m_overflow ? m_overflow->minXVisualOverflow() : 0; } 155 LayoutUnit maxXVisualOverflow() const { return m_overflow ? m_overflow->maxXVisualOverflow() : width(); } 156 LayoutUnit logicalLeftVisualOverflow() const { return style()->isHorizontalWritingMode() ? minXVisualOverflow() : minYVisualOverflow(); } 157 LayoutUnit logicalRightVisualOverflow() const { return style()->isHorizontalWritingMode() ? maxXVisualOverflow() : maxYVisualOverflow(); } 158 159 void addLayoutOverflow(const LayoutRect&); 160 void addVisualOverflow(const LayoutRect&); 161 161 162 162 void addShadowOverflow(); 163 void addOverflowFromChild(RenderBox* child) { addOverflowFromChild(child, IntSize(child->x(), child->y())); }164 void addOverflowFromChild(RenderBox* child, const IntSize& delta);163 void addOverflowFromChild(RenderBox* child) { addOverflowFromChild(child, child->locationOffset()); } 164 void addOverflowFromChild(RenderBox* child, const LayoutSize& delta); 165 165 void clearLayoutOverflow(); 166 166 167 167 void updateLayerTransform(); 168 169 void blockDirectionOverflow(bool isLineHorizontal, int& logicalTopLayoutOverflow, int& logicalBottomLayoutOverflow,170 int& logicalTopVisualOverflow, int& logicalBottomVisualOverflow);171 168 172 169 LayoutUnit contentWidth() const { return clientWidth() - paddingLeft() - paddingRight(); } … … 228 225 enum MarginSign { PositiveMargin, NegativeMargin }; 229 226 virtual bool isSelfCollapsingBlock() const { return false; } 230 virtual int collapsedMarginBefore() const { return marginBefore(); }231 virtual int collapsedMarginAfter() const { return marginAfter(); }227 virtual LayoutUnit collapsedMarginBefore() const { return marginBefore(); } 228 virtual LayoutUnit collapsedMarginAfter() const { return marginAfter(); } 232 229 233 230 virtual void absoluteRects(Vector<IntRect>&, const IntPoint& accumulatedOffset); -
trunk/Source/WebCore/rendering/RenderOverflow.h
r77397 r90288 22 22 #define RenderOverflow_h 23 23 24 #include " IntRect.h"24 #include "LayoutTypes.h" 25 25 26 26 namespace WebCore … … 41 41 WTF_MAKE_NONCOPYABLE(RenderOverflow); WTF_MAKE_FAST_ALLOCATED; 42 42 public: 43 RenderOverflow(const IntRect& layoutRect, const IntRect& visualRect)43 RenderOverflow(const LayoutRect& layoutRect, const LayoutRect& visualRect) 44 44 : m_minYLayoutOverflow(layoutRect.y()) 45 45 , m_maxYLayoutOverflow(layoutRect.maxY()) … … 53 53 } 54 54 55 int minYLayoutOverflow() const { return m_minYLayoutOverflow; }56 int maxYLayoutOverflow() const { return m_maxYLayoutOverflow; }57 int minXLayoutOverflow() const { return m_minXLayoutOverflow; }58 int maxXLayoutOverflow() const { return m_maxXLayoutOverflow; }59 IntRect layoutOverflowRect() const;55 LayoutUnit minYLayoutOverflow() const { return m_minYLayoutOverflow; } 56 LayoutUnit maxYLayoutOverflow() const { return m_maxYLayoutOverflow; } 57 LayoutUnit minXLayoutOverflow() const { return m_minXLayoutOverflow; } 58 LayoutUnit maxXLayoutOverflow() const { return m_maxXLayoutOverflow; } 59 LayoutRect layoutOverflowRect() const; 60 60 61 int minYVisualOverflow() const { return m_minYVisualOverflow; }62 int maxYVisualOverflow() const { return m_maxYVisualOverflow; }63 int minXVisualOverflow() const { return m_minXVisualOverflow; }64 int maxXVisualOverflow() const { return m_maxXVisualOverflow; }65 IntRect visualOverflowRect() const;61 LayoutUnit minYVisualOverflow() const { return m_minYVisualOverflow; } 62 LayoutUnit maxYVisualOverflow() const { return m_maxYVisualOverflow; } 63 LayoutUnit minXVisualOverflow() const { return m_minXVisualOverflow; } 64 LayoutUnit maxXVisualOverflow() const { return m_maxXVisualOverflow; } 65 LayoutRect visualOverflowRect() const; 66 66 67 void setMinYLayoutOverflow( int overflow) { m_minYLayoutOverflow = overflow; }68 void setMaxYLayoutOverflow( int overflow) { m_maxYLayoutOverflow = overflow; }69 void setMinXLayoutOverflow( int overflow) { m_minXLayoutOverflow = overflow; }70 void setMaxXLayoutOverflow( int overflow) { m_maxXLayoutOverflow = overflow; }67 void setMinYLayoutOverflow(LayoutUnit overflow) { m_minYLayoutOverflow = overflow; } 68 void setMaxYLayoutOverflow(LayoutUnit overflow) { m_maxYLayoutOverflow = overflow; } 69 void setMinXLayoutOverflow(LayoutUnit overflow) { m_minXLayoutOverflow = overflow; } 70 void setMaxXLayoutOverflow(LayoutUnit overflow) { m_maxXLayoutOverflow = overflow; } 71 71 72 void setMinYVisualOverflow( int overflow) { m_minYVisualOverflow = overflow; }73 void setMaxYVisualOverflow( int overflow) { m_maxYVisualOverflow = overflow; }74 void setMinXVisualOverflow( int overflow) { m_minXVisualOverflow = overflow; }75 void setMaxXVisualOverflow( int overflow) { m_maxXVisualOverflow = overflow; }72 void setMinYVisualOverflow(LayoutUnit overflow) { m_minYVisualOverflow = overflow; } 73 void setMaxYVisualOverflow(LayoutUnit overflow) { m_maxYVisualOverflow = overflow; } 74 void setMinXVisualOverflow(LayoutUnit overflow) { m_minXVisualOverflow = overflow; } 75 void setMaxXVisualOverflow(LayoutUnit overflow) { m_maxXVisualOverflow = overflow; } 76 76 77 void move( int dx, int dy);77 void move(LayoutUnit dx, LayoutUnit dy); 78 78 79 void addLayoutOverflow(const IntRect&);80 void addVisualOverflow(const IntRect&);79 void addLayoutOverflow(const LayoutRect&); 80 void addVisualOverflow(const LayoutRect&); 81 81 82 void setLayoutOverflow(const IntRect&);83 void setVisualOverflow(const IntRect&);82 void setLayoutOverflow(const LayoutRect&); 83 void setVisualOverflow(const LayoutRect&); 84 84 85 void resetLayoutOverflow(const IntRect& defaultRect);85 void resetLayoutOverflow(const LayoutRect& defaultRect); 86 86 87 87 private: 88 int m_minYLayoutOverflow;89 int m_maxYLayoutOverflow;90 int m_minXLayoutOverflow;91 int m_maxXLayoutOverflow;88 LayoutUnit m_minYLayoutOverflow; 89 LayoutUnit m_maxYLayoutOverflow; 90 LayoutUnit m_minXLayoutOverflow; 91 LayoutUnit m_maxXLayoutOverflow; 92 92 93 int m_minYVisualOverflow;94 int m_maxYVisualOverflow;95 int m_minXVisualOverflow;96 int m_maxXVisualOverflow;93 LayoutUnit m_minYVisualOverflow; 94 LayoutUnit m_maxYVisualOverflow; 95 LayoutUnit m_minXVisualOverflow; 96 LayoutUnit m_maxXVisualOverflow; 97 97 }; 98 98 99 inline IntRect RenderOverflow::layoutOverflowRect() const99 inline LayoutRect RenderOverflow::layoutOverflowRect() const 100 100 { 101 return IntRect(m_minXLayoutOverflow, m_minYLayoutOverflow, m_maxXLayoutOverflow - m_minXLayoutOverflow, m_maxYLayoutOverflow - m_minYLayoutOverflow);101 return LayoutRect(m_minXLayoutOverflow, m_minYLayoutOverflow, m_maxXLayoutOverflow - m_minXLayoutOverflow, m_maxYLayoutOverflow - m_minYLayoutOverflow); 102 102 } 103 103 104 inline IntRect RenderOverflow::visualOverflowRect() const104 inline LayoutRect RenderOverflow::visualOverflowRect() const 105 105 { 106 return IntRect(m_minXVisualOverflow, m_minYVisualOverflow, m_maxXVisualOverflow - m_minXVisualOverflow, m_maxYVisualOverflow - m_minYVisualOverflow);106 return LayoutRect(m_minXVisualOverflow, m_minYVisualOverflow, m_maxXVisualOverflow - m_minXVisualOverflow, m_maxYVisualOverflow - m_minYVisualOverflow); 107 107 } 108 108 109 inline void RenderOverflow::move( int dx, int dy)109 inline void RenderOverflow::move(LayoutUnit dx, LayoutUnit dy) 110 110 { 111 111 m_minYLayoutOverflow += dy; … … 120 120 } 121 121 122 inline void RenderOverflow::addLayoutOverflow(const IntRect& rect)122 inline void RenderOverflow::addLayoutOverflow(const LayoutRect& rect) 123 123 { 124 124 m_minYLayoutOverflow = std::min(rect.y(), m_minYLayoutOverflow); … … 128 128 } 129 129 130 inline void RenderOverflow::addVisualOverflow(const IntRect& rect)130 inline void RenderOverflow::addVisualOverflow(const LayoutRect& rect) 131 131 { 132 132 m_minYVisualOverflow = std::min(rect.y(), m_minYVisualOverflow); … … 136 136 } 137 137 138 inline void RenderOverflow::setLayoutOverflow(const IntRect& rect)138 inline void RenderOverflow::setLayoutOverflow(const LayoutRect& rect) 139 139 { 140 140 m_minYLayoutOverflow = rect.y(); … … 144 144 } 145 145 146 inline void RenderOverflow::setVisualOverflow(const IntRect& rect)146 inline void RenderOverflow::setVisualOverflow(const LayoutRect& rect) 147 147 { 148 148 m_minYVisualOverflow = rect.y(); … … 152 152 } 153 153 154 inline void RenderOverflow::resetLayoutOverflow(const IntRect& rect)154 inline void RenderOverflow::resetLayoutOverflow(const LayoutRect& rect) 155 155 { 156 156 m_minYLayoutOverflow = rect.y();
Note:
See TracChangeset
for help on using the changeset viewer.