Changeset 122641 in webkit
- Timestamp:
- Jul 13, 2012 4:23:40 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r122639 r122641 1 2012-07-13 Emil A Eklund <eae@chromium.org> 2 3 Use LayoutBoxExtent for image outsets 4 https://bugs.webkit.org/show_bug.cgi?id=91166 5 6 Reviewed by Tony Chang. 7 8 Change RenderStyle and calling code to use LayoutBoxExtent for image 9 outsets and remove text direction and writing mode versions of the 10 outline getters from RenderStyle as LayoutBoxExtent provides the same 11 functionality. 12 13 No new tests, no change in functionality. 14 15 * platform/graphics/FractionalLayoutBoxExtent.h: 16 * platform/graphics/FractionalLayoutBoxExtent.cpp: 17 (WebCore::FractionalLayoutBoxExtent::logicalTop): 18 (WebCore::FractionalLayoutBoxExtent::logicalBottom): 19 Add logicalTop and logicalBottom methods to go with the existing 20 logicalLeft and logicalRight ones. 21 22 * platform/graphics/FractionalLayoutRect.h: 23 (WebCore::FractionalLayoutRect::expand): 24 Add FractionalLayoutBoxExtent version of expand method. 25 26 * rendering/InlineFlowBox.cpp: 27 (WebCore::InlineFlowBox::addBorderOutsetVisualOverflow): 28 Change implementation to use the new FractionalLayoutBoxExtent version of 29 borderImageOutsets and the logicalTop/Bottom/Left/Right methods. 30 31 (WebCore::clipRectForNinePieceImageStrip): 32 Change implementation to use the new FractionalLayoutBoxExtent version of 33 borderImageOutsets. 34 35 * rendering/RenderBox.cpp: 36 (WebCore::RenderBox::maskClipRect): 37 Change implementation to use the new FractionalLayoutBoxExtent version of 38 borderImageOutsets and the new FractionalLayoutRect::expand method. 39 40 (WebCore::RenderBox::addVisualEffectOverflow): 41 Change implementation to use the new FractionalLayoutBoxExtent version of 42 borderImageOutsets. 43 44 * rendering/RenderBoxModelObject.cpp: 45 (WebCore::RenderBoxModelObject::paintNinePieceImage): 46 Change implementation to use the new FractionalLayoutBoxExtent version of 47 borderImageOutsets and the new FractionalLayoutRect::expand method. 48 49 * rendering/style/RenderStyle.h: 50 * rendering/style/RenderStyle.cpp: 51 (WebCore::RenderStyle::imageOutsets): 52 Change getImageOutsets to return a FractionalLayoutBoxExtent object and 53 rename to imageOutsets to match the webkit naming convention for getters. 54 55 Remove getBorderImageHorizontalOutsets, getBorderImageVerticalOutsets, 56 getBorderImageInlineDirectionOutsets, getImageHorizontalOutsets, 57 getImageVerticalOutsets and getBorderImageBlockDirectionOutsets methods 58 as the same functionality is provided by FractionalLayoutBoxExtent. 59 1 60 2012-07-13 David Hyatt <hyatt@apple.com> 2 61 -
trunk/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp
r118076 r122641 35 35 36 36 namespace WebCore { 37 38 FractionalLayoutUnit FractionalLayoutBoxExtent::logicalTop(const RenderStyle* style) const 39 { 40 return style->isHorizontalWritingMode() ? m_top : m_left; 41 } 42 43 FractionalLayoutUnit FractionalLayoutBoxExtent::logicalBottom(const RenderStyle* style) const 44 { 45 return style->isHorizontalWritingMode() ? m_bottom : m_right; 46 } 37 47 38 48 FractionalLayoutUnit FractionalLayoutBoxExtent::logicalLeft(const RenderStyle* style) const -
trunk/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h
r118076 r122641 54 54 inline void setLeft(FractionalLayoutUnit value) { m_left = value; } 55 55 56 FractionalLayoutUnit logicalTop(const RenderStyle*) const; 57 FractionalLayoutUnit logicalBottom(const RenderStyle*) const; 56 58 FractionalLayoutUnit logicalLeft(const RenderStyle*) const; 57 59 FractionalLayoutUnit logicalRight(const RenderStyle*) const; -
trunk/Source/WebCore/platform/graphics/FractionalLayoutRect.h
r116767 r122641 32 32 #define FractionalLayoutRect_h 33 33 34 #include "FractionalLayoutBoxExtent.h" 34 35 #include "FractionalLayoutPoint.h" 35 36 #include "IntRect.h" … … 100 101 101 102 void expand(const FractionalLayoutSize& size) { m_size += size; } 103 void expand(const FractionalLayoutBoxExtent& box) 104 { 105 m_location.move(-box.left(), -box.top()); 106 m_size.expand(box.left() + box.right(), box.top() + box.bottom()); 107 } 102 108 void expand(FractionalLayoutUnit dw, FractionalLayoutUnit dh) { m_size.expand(dw, dh); } 103 109 void contract(const FractionalLayoutSize& size) { m_size -= size; } -
trunk/Source/WebCore/rendering/InlineFlowBox.cpp
r121123 r122641 789 789 if (!style->hasBorderImageOutsets()) 790 790 return; 791 792 LayoutUnit borderOutsetLogicalTop; 793 LayoutUnit borderOutsetLogicalBottom; 794 style->getBorderImageBlockDirectionOutsets(borderOutsetLogicalTop, borderOutsetLogicalBottom); 791 792 FractionalLayoutBoxExtent borderOutsets = style->borderImageOutsets(); 793 794 LayoutUnit borderOutsetLogicalTop = borderOutsets.logicalTop(style); 795 LayoutUnit borderOutsetLogicalBottom = borderOutsets.logicalBottom(style); 796 LayoutUnit borderOutsetLogicalLeft = borderOutsets.logicalLeft(style); 797 LayoutUnit borderOutsetLogicalRight = borderOutsets.logicalRight(style); 795 798 796 799 // Similar to how glyph overflow works, if our lines are flipped, then it's actually the opposite border that applies, since … … 801 804 LayoutUnit logicalTopVisualOverflow = min(pixelSnappedLogicalTop() - outsetLogicalTop, logicalVisualOverflow.y()); 802 805 LayoutUnit logicalBottomVisualOverflow = max(pixelSnappedLogicalBottom() + outsetLogicalBottom, logicalVisualOverflow.maxY()); 803 804 LayoutUnit borderOutsetLogicalLeft;805 LayoutUnit borderOutsetLogicalRight;806 style->getBorderImageInlineDirectionOutsets(borderOutsetLogicalLeft, borderOutsetLogicalRight);807 806 808 807 LayoutUnit outsetLogicalLeft = includeLogicalLeftEdge() ? borderOutsetLogicalLeft : ZERO_LAYOUT_UNIT; … … 1188 1187 LayoutRect clipRect(paintRect); 1189 1188 RenderStyle* style = box->renderer()->style(); 1190 LayoutUnit topOutset; 1191 LayoutUnit rightOutset; 1192 LayoutUnit bottomOutset; 1193 LayoutUnit leftOutset; 1194 style->getImageOutsets(image, topOutset, rightOutset, bottomOutset, leftOutset); 1189 LayoutBoxExtent outsets = style->imageOutsets(image); 1195 1190 if (box->isHorizontal()) { 1196 clipRect.setY(paintRect.y() - topOutset);1197 clipRect.setHeight(paintRect.height() + topOutset + bottomOutset);1191 clipRect.setY(paintRect.y() - outsets.top()); 1192 clipRect.setHeight(paintRect.height() + outsets.top() + outsets.bottom()); 1198 1193 if (box->includeLogicalLeftEdge()) { 1199 clipRect.setX(paintRect.x() - leftOutset);1200 clipRect.setWidth(paintRect.width() + leftOutset);1194 clipRect.setX(paintRect.x() - outsets.left()); 1195 clipRect.setWidth(paintRect.width() + outsets.left()); 1201 1196 } 1202 1197 if (box->includeLogicalRightEdge()) 1203 clipRect.setWidth(clipRect.width() + rightOutset);1198 clipRect.setWidth(clipRect.width() + outsets.right()); 1204 1199 } else { 1205 clipRect.setX(paintRect.x() - leftOutset);1206 clipRect.setWidth(paintRect.width() + leftOutset + rightOutset);1200 clipRect.setX(paintRect.x() - outsets.left()); 1201 clipRect.setWidth(paintRect.width() + outsets.left() + outsets.right()); 1207 1202 if (box->includeLogicalLeftEdge()) { 1208 clipRect.setY(paintRect.y() - topOutset);1209 clipRect.setHeight(paintRect.height() + topOutset);1203 clipRect.setY(paintRect.y() - outsets.top()); 1204 clipRect.setHeight(paintRect.height() + outsets.top()); 1210 1205 } 1211 1206 if (box->includeLogicalRightEdge()) 1212 clipRect.setHeight(clipRect.height() + bottomOutset);1207 clipRect.setHeight(clipRect.height() + outsets.bottom()); 1213 1208 } 1214 1209 return clipRect; -
trunk/Source/WebCore/rendering/RenderBox.cpp
r122639 r122641 935 935 936 936 // Apply outsets to the border box. 937 LayoutUnit topOutset; 938 LayoutUnit rightOutset; 939 LayoutUnit bottomOutset; 940 LayoutUnit leftOutset; 941 style()->getMaskBoxImageOutsets(topOutset, rightOutset, bottomOutset, leftOutset); 942 943 borderImageRect.setX(borderImageRect.x() - leftOutset); 944 borderImageRect.setY(borderImageRect.y() - topOutset); 945 borderImageRect.setWidth(borderImageRect.width() + leftOutset + rightOutset); 946 borderImageRect.setHeight(borderImageRect.height() + topOutset + bottomOutset); 947 937 borderImageRect.expand(style()->maskBoxImageOutsets()); 948 938 return borderImageRect; 949 939 } … … 3586 3576 // Now compute border-image-outset overflow. 3587 3577 if (style()->hasBorderImageOutsets()) { 3588 LayoutUnit borderOutsetLeft; 3589 LayoutUnit borderOutsetRight; 3590 LayoutUnit borderOutsetTop; 3591 LayoutUnit borderOutsetBottom; 3592 style()->getBorderImageOutsets(borderOutsetTop, borderOutsetRight, borderOutsetBottom, borderOutsetLeft); 3578 LayoutBoxExtent borderOutsets = style()->borderImageOutsets(); 3593 3579 3594 3580 // In flipped blocks writing modes, the physical sides are inverted. For example in vertical-rl, the right 3595 3581 // border is at the lower x coordinate value. 3596 overflowMinX = min(overflowMinX, borderBox.x() - ((!isFlipped || isHorizontal) ? borderOutset Left : borderOutsetRight));3597 overflowMaxX = max(overflowMaxX, borderBox.maxX() + ((!isFlipped || isHorizontal) ? borderOutset Right : borderOutsetLeft));3598 overflowMinY = min(overflowMinY, borderBox.y() - ((!isFlipped || !isHorizontal) ? borderOutset Top : borderOutsetBottom));3599 overflowMaxY = max(overflowMaxY, borderBox.maxY() + ((!isFlipped || !isHorizontal) ? borderOutset Bottom : borderOutsetTop));3582 overflowMinX = min(overflowMinX, borderBox.x() - ((!isFlipped || isHorizontal) ? borderOutsets.left() : borderOutsets.right())); 3583 overflowMaxX = max(overflowMaxX, borderBox.maxX() + ((!isFlipped || isHorizontal) ? borderOutsets.right() : borderOutsets.left())); 3584 overflowMinY = min(overflowMinY, borderBox.y() - ((!isFlipped || !isHorizontal) ? borderOutsets.top() : borderOutsets.bottom())); 3585 overflowMaxY = max(overflowMaxY, borderBox.maxY() + ((!isFlipped || !isHorizontal) ? borderOutsets.bottom() : borderOutsets.top())); 3600 3586 } 3601 3587 -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r121296 r122641 1235 1235 // FIXME: border-image is broken with full page zooming when tiling has to happen, since the tiling function 1236 1236 // doesn't have any understanding of the zoom that is in effect on the tile. 1237 LayoutUnit topOutset; 1238 LayoutUnit rightOutset; 1239 LayoutUnit bottomOutset; 1240 LayoutUnit leftOutset; 1241 style->getImageOutsets(ninePieceImage, topOutset, rightOutset, bottomOutset, leftOutset); 1242 1243 LayoutUnit topWithOutset = rect.y() - topOutset; 1244 LayoutUnit bottomWithOutset = rect.maxY() + bottomOutset; 1245 LayoutUnit leftWithOutset = rect.x() - leftOutset; 1246 LayoutUnit rightWithOutset = rect.maxX() + rightOutset; 1247 IntRect borderImageRect = pixelSnappedIntRect(leftWithOutset, topWithOutset, rightWithOutset - leftWithOutset, bottomWithOutset - topWithOutset); 1237 LayoutRect rectWithOutsets = rect; 1238 rectWithOutsets.expand(style->imageOutsets(ninePieceImage)); 1239 IntRect borderImageRect = pixelSnappedIntRect(rectWithOutsets); 1248 1240 1249 1241 IntSize imageSize = calculateImageIntrinsicDimensions(styleImage, borderImageRect.size(), DoNotScaleByEffectiveZoom); -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r121127 r122641 1479 1479 #endif 1480 1480 1481 void RenderStyle::getImageOutsets(const NinePieceImage& image, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const 1482 { 1483 top = NinePieceImage::computeOutset(image.outset().top(), borderTopWidth()); 1484 right = NinePieceImage::computeOutset(image.outset().right(), borderRightWidth()); 1485 bottom = NinePieceImage::computeOutset(image.outset().bottom(), borderBottomWidth()); 1486 left = NinePieceImage::computeOutset(image.outset().left(), borderLeftWidth()); 1487 } 1488 1489 void RenderStyle::getImageHorizontalOutsets(const NinePieceImage& image, LayoutUnit& left, LayoutUnit& right) const 1490 { 1491 right = NinePieceImage::computeOutset(image.outset().right(), borderRightWidth()); 1492 left = NinePieceImage::computeOutset(image.outset().left(), borderLeftWidth()); 1493 } 1494 1495 void RenderStyle::getImageVerticalOutsets(const NinePieceImage& image, LayoutUnit& top, LayoutUnit& bottom) const 1496 { 1497 top = NinePieceImage::computeOutset(image.outset().top(), borderTopWidth()); 1498 bottom = NinePieceImage::computeOutset(image.outset().bottom(), borderBottomWidth()); 1481 LayoutBoxExtent RenderStyle::imageOutsets(const NinePieceImage& image) const 1482 { 1483 return LayoutBoxExtent(NinePieceImage::computeOutset(image.outset().top(), borderTopWidth()), 1484 NinePieceImage::computeOutset(image.outset().right(), borderRightWidth()), 1485 NinePieceImage::computeOutset(image.outset().bottom(), borderBottomWidth()), 1486 NinePieceImage::computeOutset(image.outset().left(), borderLeftWidth())); 1499 1487 } 1500 1488 -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r122264 r122641 441 441 } 442 442 443 void getImageOutsets(const NinePieceImage&, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const;443 LayoutBoxExtent imageOutsets(const NinePieceImage&) const; 444 444 bool hasBorderImageOutsets() const 445 445 { 446 446 return borderImage().hasImage() && borderImage().outset().nonZero(); 447 447 } 448 void getBorderImageOutsets(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const 449 { 450 return getImageOutsets(borderImage(), top, right, bottom, left); 451 } 452 void getBorderImageHorizontalOutsets(LayoutUnit& left, LayoutUnit& right) const 453 { 454 return getImageHorizontalOutsets(borderImage(), left, right); 455 } 456 void getBorderImageVerticalOutsets(LayoutUnit& top, LayoutUnit& bottom) const 457 { 458 return getImageVerticalOutsets(borderImage(), top, bottom); 459 } 460 void getBorderImageInlineDirectionOutsets(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const 461 { 462 return getImageInlineDirectionOutsets(borderImage(), logicalLeft, logicalRight); 463 } 464 void getBorderImageBlockDirectionOutsets(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const 465 { 466 return getImageBlockDirectionOutsets(borderImage(), logicalTop, logicalBottom); 467 } 468 469 void getMaskBoxImageOutsets(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const 470 { 471 return getImageOutsets(maskBoxImage(), top, right, bottom, left); 448 LayoutBoxExtent borderImageOutsets() const 449 { 450 return imageOutsets(borderImage()); 451 } 452 453 LayoutBoxExtent maskBoxImageOutsets() const 454 { 455 return imageOutsets(maskBoxImage()); 472 456 } 473 457 … … 1755 1739 } 1756 1740 1757 // Helpers for obtaining border image outsets for overflow.1758 void getImageHorizontalOutsets(const NinePieceImage&, LayoutUnit& left, LayoutUnit& right) const;1759 void getImageVerticalOutsets(const NinePieceImage&, LayoutUnit& top, LayoutUnit& bottom) const;1760 void getImageInlineDirectionOutsets(const NinePieceImage& image, LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const1761 {1762 return isHorizontalWritingMode() ? getImageHorizontalOutsets(image, logicalLeft, logicalRight) : getImageVerticalOutsets(image, logicalLeft, logicalRight);1763 }1764 void getImageBlockDirectionOutsets(const NinePieceImage& image, LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const1765 {1766 return isHorizontalWritingMode() ? getImageVerticalOutsets(image, logicalTop, logicalBottom) : getImageHorizontalOutsets(image, logicalTop, logicalBottom);1767 }1768 1769 1741 // Color accessors are all private to make sure callers use visitedDependentColor instead to access them. 1770 1742 Color invalidColor() const { static Color invalid; return invalid; }
Note: See TracChangeset
for help on using the changeset viewer.