Changeset 89977 in webkit
- Timestamp:
- Jun 28, 2011 4:56:01 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r89975 r89977 1 2011-06-28 Emil A Eklund <eae@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Switch RenderBox position/size to to new layout types 6 https://bugs.webkit.org/show_bug.cgi?id=63571 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/RenderBox.cpp: 13 * rendering/RenderBox.h: 14 * rendering/RenderBoxModelObject.cpp: 15 * rendering/RenderBoxModelObject.h: 16 * rendering/RenderInline.cpp: 17 * rendering/RenderInline.h: 18 * rendering/RenderVideo.cpp: 19 * rendering/RenderVideo.h: 20 1 21 2011-06-28 Sheriff Bot <webkit.review.bot@gmail.com> 2 22 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r89974 r89977 404 404 // More IE extensions. clientWidth and clientHeight represent the interior of an object 405 405 // excluding border and scrollbar. 406 int RenderBox::clientWidth() const406 LayoutUnit RenderBox::clientWidth() const 407 407 { 408 408 return width() - borderLeft() - borderRight() - verticalScrollbarWidth(); 409 409 } 410 410 411 int RenderBox::clientHeight() const411 LayoutUnit RenderBox::clientHeight() const 412 412 { 413 413 return height() - borderTop() - borderBottom() - horizontalScrollbarHeight(); … … 715 715 } 716 716 717 int RenderBox::computeBorderBoxLogicalWidth(int width) const718 { 719 int bordersPlusPadding = borderAndPaddingLogicalWidth();717 LayoutUnit RenderBox::computeBorderBoxLogicalWidth(LayoutUnit width) const 718 { 719 LayoutUnit bordersPlusPadding = borderAndPaddingLogicalWidth(); 720 720 if (style()->boxSizing() == CONTENT_BOX) 721 721 return width + bordersPlusPadding; … … 723 723 } 724 724 725 int RenderBox::computeBorderBoxLogicalHeight(int height) const726 { 727 int bordersPlusPadding = borderAndPaddingLogicalHeight();725 LayoutUnit RenderBox::computeBorderBoxLogicalHeight(LayoutUnit height) const 726 { 727 LayoutUnit bordersPlusPadding = borderAndPaddingLogicalHeight(); 728 728 if (style()->boxSizing() == CONTENT_BOX) 729 729 return height + bordersPlusPadding; … … 731 731 } 732 732 733 int RenderBox::computeContentBoxLogicalWidth(int width) const733 LayoutUnit RenderBox::computeContentBoxLogicalWidth(LayoutUnit width) const 734 734 { 735 735 if (style()->boxSizing() == BORDER_BOX) … … 738 738 } 739 739 740 int RenderBox::computeContentBoxLogicalHeight(int height) const740 LayoutUnit RenderBox::computeContentBoxLogicalHeight(LayoutUnit height) const 741 741 { 742 742 if (style()->boxSizing() == BORDER_BOX) -
trunk/Source/WebCore/rendering/RenderBox.h
r89974 r89977 45 45 RenderBox* lastChildBox() const; 46 46 47 int x() const { return m_frameRect.x(); }48 int y() const { return m_frameRect.y(); }49 int width() const { return m_frameRect.width(); }50 int height() const { return m_frameRect.height(); }51 52 void setX( int x) { m_frameRect.setX(x); }53 void setY( int y) { m_frameRect.setY(y); }54 void setWidth( int width) { m_frameRect.setWidth(width); }55 void setHeight( int height) { m_frameRect.setHeight(height); }56 57 int logicalLeft() const { return style()->isHorizontalWritingMode() ? x() : y(); }58 int logicalRight() const { return logicalLeft() + logicalWidth(); }59 int logicalTop() const { return style()->isHorizontalWritingMode() ? y() : x(); }60 int logicalBottom() const { return logicalTop() + logicalHeight(); }61 int logicalWidth() const { return style()->isHorizontalWritingMode() ? width() : height(); }62 int logicalHeight() const { return style()->isHorizontalWritingMode() ? height() : width(); }63 64 void setLogicalLeft( int left)47 LayoutUnit x() const { return m_frameRect.x(); } 48 LayoutUnit y() const { return m_frameRect.y(); } 49 LayoutUnit width() const { return m_frameRect.width(); } 50 LayoutUnit height() const { return m_frameRect.height(); } 51 52 void setX(LayoutUnit x) { m_frameRect.setX(x); } 53 void setY(LayoutUnit y) { m_frameRect.setY(y); } 54 void setWidth(LayoutUnit width) { m_frameRect.setWidth(width); } 55 void setHeight(LayoutUnit height) { m_frameRect.setHeight(height); } 56 57 LayoutUnit logicalLeft() const { return style()->isHorizontalWritingMode() ? x() : y(); } 58 LayoutUnit logicalRight() const { return logicalLeft() + logicalWidth(); } 59 LayoutUnit logicalTop() const { return style()->isHorizontalWritingMode() ? y() : x(); } 60 LayoutUnit logicalBottom() const { return logicalTop() + logicalHeight(); } 61 LayoutUnit logicalWidth() const { return style()->isHorizontalWritingMode() ? width() : height(); } 62 LayoutUnit logicalHeight() const { return style()->isHorizontalWritingMode() ? height() : width(); } 63 64 void setLogicalLeft(LayoutUnit left) 65 65 { 66 66 if (style()->isHorizontalWritingMode()) … … 69 69 setY(left); 70 70 } 71 void setLogicalTop( int top)71 void setLogicalTop(LayoutUnit top) 72 72 { 73 73 if (style()->isHorizontalWritingMode()) … … 76 76 setX(top); 77 77 } 78 void setLogicalLocation(const IntPoint& location)78 void setLogicalLocation(const LayoutPoint& location) 79 79 { 80 80 if (style()->isHorizontalWritingMode()) … … 83 83 setLocation(location.transposedPoint()); 84 84 } 85 void setLogicalWidth( int size)85 void setLogicalWidth(LayoutUnit size) 86 86 { 87 87 if (style()->isHorizontalWritingMode()) … … 90 90 setHeight(size); 91 91 } 92 void setLogicalHeight( int size)92 void setLogicalHeight(LayoutUnit size) 93 93 { 94 94 if (style()->isHorizontalWritingMode()) … … 97 97 setWidth(size); 98 98 } 99 void setLogicalSize(const IntSize& size)99 void setLogicalSize(const LayoutSize& size) 100 100 { 101 101 if (style()->isHorizontalWritingMode()) … … 105 105 } 106 106 107 IntPoint location() const { return m_frameRect.location(); }108 IntSize locationOffset() const { return IntSize(x(), y()); }109 IntSize size() const { return m_frameRect.size(); }110 111 void setLocation(const IntPoint& location) { m_frameRect.setLocation(location); }112 113 void setSize(const IntSize& size) { m_frameRect.setSize(size); }114 void move( int dx, int dy) { m_frameRect.move(dx, dy); }115 116 IntRect frameRect() const { return m_frameRect; }117 void setFrameRect(const IntRect& rect) { m_frameRect = rect; }118 119 IntRect borderBoxRect() const { return IntRect(0, 0, width(), height()); }120 virtual IntRect borderBoundingBox() const { return borderBoxRect(); }107 LayoutPoint location() const { return m_frameRect.location(); } 108 LayoutSize locationOffset() const { return LayoutSize(x(), y()); } 109 LayoutSize size() const { return m_frameRect.size(); } 110 111 void setLocation(const LayoutPoint& location) { m_frameRect.setLocation(location); } 112 113 void setSize(const LayoutSize& size) { m_frameRect.setSize(size); } 114 void move(LayoutUnit dx, LayoutUnit dy) { m_frameRect.move(dx, dy); } 115 116 LayoutRect frameRect() const { return m_frameRect; } 117 void setFrameRect(const LayoutRect& rect) { m_frameRect = rect; } 118 119 LayoutRect borderBoxRect() const { return LayoutRect(0, 0, width(), height()); } 120 virtual LayoutRect borderBoundingBox() const { return borderBoxRect(); } 121 121 122 122 // The content area of the box (excludes padding and border). 123 IntRect contentBoxRect() const { return IntRect(borderLeft() + paddingLeft(), borderTop() + paddingTop(), contentWidth(), contentHeight()); }123 LayoutRect contentBoxRect() const { return LayoutRect(borderLeft() + paddingLeft(), borderTop() + paddingTop(), contentWidth(), contentHeight()); } 124 124 // The content box in absolute coords. Ignores transforms. 125 IntRect absoluteContentBox() const;125 LayoutRect absoluteContentBox() const; 126 126 // The content box converted to absolute coords (taking transforms into account). 127 127 FloatQuad absoluteContentQuad() const; … … 170 170 int& logicalTopVisualOverflow, int& logicalBottomVisualOverflow); 171 171 172 int contentWidth() const { return clientWidth() - paddingLeft() - paddingRight(); }173 int contentHeight() const { return clientHeight() - paddingTop() - paddingBottom(); }174 int contentLogicalWidth() const { return style()->isHorizontalWritingMode() ? contentWidth() : contentHeight(); }175 int contentLogicalHeight() const { return style()->isHorizontalWritingMode() ? contentHeight() : contentWidth(); }172 LayoutUnit contentWidth() const { return clientWidth() - paddingLeft() - paddingRight(); } 173 LayoutUnit contentHeight() const { return clientHeight() - paddingTop() - paddingBottom(); } 174 LayoutUnit contentLogicalWidth() const { return style()->isHorizontalWritingMode() ? contentWidth() : contentHeight(); } 175 LayoutUnit contentLogicalHeight() const { return style()->isHorizontalWritingMode() ? contentHeight() : contentWidth(); } 176 176 177 177 // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlines (RenderFlow) 178 178 // to return the remaining width on a given line (and the height of a single line). 179 virtual int offsetWidth() const { return width(); }180 virtual int offsetHeight() const { return height(); }179 virtual LayoutUnit offsetWidth() const { return width(); } 180 virtual LayoutUnit offsetHeight() const { return height(); } 181 181 182 182 // More IE extensions. clientWidth and clientHeight represent the interior of an object 183 183 // excluding border and scrollbar. clientLeft/Top are just the borderLeftWidth and borderTopWidth. 184 int clientLeft() const { return borderLeft(); }185 int clientTop() const { return borderTop(); }186 int clientWidth() const;187 int clientHeight() const;188 int clientLogicalWidth() const { return style()->isHorizontalWritingMode() ? clientWidth() : clientHeight(); }189 int clientLogicalHeight() const { return style()->isHorizontalWritingMode() ? clientHeight() : clientWidth(); }190 int clientLogicalBottom() const { return borderBefore() + clientLogicalHeight(); }191 IntRect clientBoxRect() const { return IntRect(clientLeft(), clientTop(), clientWidth(), clientHeight()); }184 LayoutUnit clientLeft() const { return borderLeft(); } 185 LayoutUnit clientTop() const { return borderTop(); } 186 LayoutUnit clientWidth() const; 187 LayoutUnit clientHeight() const; 188 LayoutUnit clientLogicalWidth() const { return style()->isHorizontalWritingMode() ? clientWidth() : clientHeight(); } 189 LayoutUnit clientLogicalHeight() const { return style()->isHorizontalWritingMode() ? clientHeight() : clientWidth(); } 190 LayoutUnit clientLogicalBottom() const { return borderBefore() + clientLogicalHeight(); } 191 LayoutRect clientBoxRect() const { return LayoutRect(clientLeft(), clientTop(), clientWidth(), clientHeight()); } 192 192 193 193 // scrollWidth/scrollHeight will be the same as clientWidth/clientHeight unless the … … 255 255 virtual IntSize offsetFromContainer(RenderObject*, const IntPoint&) const; 256 256 257 int computeBorderBoxLogicalWidth(int width) const;258 int computeBorderBoxLogicalHeight(int height) const;259 int computeContentBoxLogicalWidth(int width) const;260 int computeContentBoxLogicalHeight(int height) const;257 LayoutUnit computeBorderBoxLogicalWidth(LayoutUnit width) const; 258 LayoutUnit computeBorderBoxLogicalHeight(LayoutUnit height) const; 259 LayoutUnit computeContentBoxLogicalWidth(LayoutUnit width) const; 260 LayoutUnit computeContentBoxLogicalHeight(LayoutUnit height) const; 261 261 262 262 virtual void borderFitAdjust(IntRect&) const { } // Shrink the box in which the border paints if border-fit is set. … … 468 468 private: 469 469 // The width/height of the contents + borders + padding. The x/y location is relative to our container (which is not always our parent). 470 IntRect m_frameRect;470 LayoutRect m_frameRect; 471 471 472 472 protected: -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r89970 r89977 381 381 } 382 382 383 int RenderBoxModelObject::relativePositionOffsetX() const383 LayoutUnit RenderBoxModelObject::relativePositionOffsetX() const 384 384 { 385 385 // Objects that shrink to avoid floats normally use available line width when computing containing block width. However … … 400 400 } 401 401 402 int RenderBoxModelObject::relativePositionOffsetY() const402 LayoutUnit RenderBoxModelObject::relativePositionOffsetY() const 403 403 { 404 404 RenderBlock* containingBlock = this->containingBlock(); … … 425 425 } 426 426 427 int RenderBoxModelObject::offsetLeft() const427 LayoutUnit RenderBoxModelObject::offsetLeft() const 428 428 { 429 429 // If the element is the HTML body element or does not have an associated box … … 433 433 434 434 RenderBoxModelObject* offsetPar = offsetParent(); 435 int xPos = (isBox() ? toRenderBox(this)->x() : 0);435 LayoutUnit xPos = (isBox() ? toRenderBox(this)->x() : 0); 436 436 437 437 // If the offsetParent of the element is null, or is the HTML body element, … … 459 459 } 460 460 461 int RenderBoxModelObject::offsetTop() const461 LayoutUnit RenderBoxModelObject::offsetTop() const 462 462 { 463 463 // If the element is the HTML body element or does not have an associated box … … 467 467 468 468 RenderBoxModelObject* offsetPar = offsetParent(); 469 int yPos = (isBox() ? toRenderBox(this)->y() : 0);469 LayoutUnit yPos = (isBox() ? toRenderBox(this)->y() : 0); 470 470 471 471 // If the offsetParent of the element is null, or is the HTML body element, -
trunk/Source/WebCore/rendering/RenderBoxModelObject.h
r89970 r89977 51 51 virtual void destroy(); 52 52 53 int relativePositionOffsetX() const;54 int relativePositionOffsetY() const;55 IntSize relativePositionOffset() const { return IntSize(relativePositionOffsetX(), relativePositionOffsetY()); }56 IntSize relativePositionLogicalOffset() const { return style()->isHorizontalWritingMode() ? relativePositionOffset() : relativePositionOffset().transposedSize(); }53 LayoutUnit relativePositionOffsetX() const; 54 LayoutUnit relativePositionOffsetY() const; 55 LayoutSize relativePositionOffset() const { return LayoutSize(relativePositionOffsetX(), relativePositionOffsetY()); } 56 LayoutSize relativePositionLogicalOffset() const { return style()->isHorizontalWritingMode() ? relativePositionOffset() : relativePositionOffset().transposedSize(); } 57 57 58 58 // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlines (RenderFlow) 59 59 // to return the remaining width on a given line (and the height of a single line). 60 virtual int offsetLeft() const;61 virtual int offsetTop() const;62 virtual int offsetWidth() const = 0;63 virtual int offsetHeight() const = 0;60 virtual LayoutUnit offsetLeft() const; 61 virtual LayoutUnit offsetTop() const; 62 virtual LayoutUnit offsetWidth() const = 0; 63 virtual LayoutUnit offsetHeight() const = 0; 64 64 65 65 virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); … … 72 72 73 73 // This will work on inlines to return the bounding box of all of the lines' border boxes. 74 virtual IntRect borderBoundingBox() const = 0;74 virtual LayoutRect borderBoundingBox() const = 0; 75 75 76 76 // Virtual since table cells override -
trunk/Source/WebCore/rendering/RenderInline.cpp
r89754 r89977 632 632 } 633 633 634 int RenderInline::offsetLeft() const635 { 636 int x = RenderBoxModelObject::offsetLeft();634 LayoutUnit RenderInline::offsetLeft() const 635 { 636 LayoutUnit x = RenderBoxModelObject::offsetLeft(); 637 637 if (InlineBox* firstBox = firstLineBoxIncludingCulling()) 638 638 x += firstBox->x(); … … 640 640 } 641 641 642 int RenderInline::offsetTop() const643 { 644 int y = RenderBoxModelObject::offsetTop();642 LayoutUnit RenderInline::offsetTop() const 643 { 644 LayoutUnit y = RenderBoxModelObject::offsetTop(); 645 645 if (InlineBox* firstBox = firstLineBoxIncludingCulling()) 646 646 y += firstBox->y(); -
trunk/Source/WebCore/rendering/RenderInline.h
r89754 r89977 122 122 virtual bool requiresLayer() const { return isRelPositioned() || isTransparent() || hasMask(); } 123 123 124 virtual int offsetLeft() const;125 virtual int offsetTop() const;126 virtual int offsetWidth() const { return linesBoundingBox().width(); }127 virtual int offsetHeight() const { return linesBoundingBox().height(); }124 virtual LayoutUnit offsetLeft() const; 125 virtual LayoutUnit offsetTop() const; 126 virtual LayoutUnit offsetWidth() const { return linesBoundingBox().width(); } 127 virtual LayoutUnit offsetHeight() const { return linesBoundingBox().height(); } 128 128 129 129 virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer); … … 136 136 virtual VisiblePosition positionForPoint(const IntPoint&); 137 137 138 virtual IntRect borderBoundingBox() const138 virtual LayoutRect borderBoundingBox() const 139 139 { 140 IntRect boundingBox = linesBoundingBox();141 return IntRect(0, 0, boundingBox.width(), boundingBox.height());140 LayoutRect boundingBox = linesBoundingBox(); 141 return LayoutRect(0, 0, boundingBox.width(), boundingBox.height()); 142 142 } 143 143 -
trunk/Source/WebCore/rendering/RenderVideo.cpp
r88505 r89977 301 301 } 302 302 303 int RenderVideo::offsetLeft() const303 LayoutUnit RenderVideo::offsetLeft() const 304 304 { 305 305 if (const RenderBlock* block = rendererPlaceholder(this)) … … 308 308 } 309 309 310 int RenderVideo::offsetTop() const310 LayoutUnit RenderVideo::offsetTop() const 311 311 { 312 312 if (const RenderBlock* block = rendererPlaceholder(this)) … … 315 315 } 316 316 317 int RenderVideo::offsetWidth() const317 LayoutUnit RenderVideo::offsetWidth() const 318 318 { 319 319 if (const RenderBlock* block = rendererPlaceholder(this)) … … 322 322 } 323 323 324 int RenderVideo::offsetHeight() const324 LayoutUnit RenderVideo::offsetHeight() const 325 325 { 326 326 if (const RenderBlock* block = rendererPlaceholder(this)) -
trunk/Source/WebCore/rendering/RenderVideo.h
r88505 r89977 76 76 77 77 #if ENABLE(FULLSCREEN_API) 78 virtual int offsetLeft() const;79 virtual int offsetTop() const;80 virtual int offsetWidth() const;81 virtual int offsetHeight() const;78 virtual LayoutUnit offsetLeft() const; 79 virtual LayoutUnit offsetTop() const; 80 virtual LayoutUnit offsetWidth() const; 81 virtual LayoutUnit offsetHeight() const; 82 82 #endif 83 83
Note: See TracChangeset
for help on using the changeset viewer.