Changeset 142164 in webkit
- Timestamp:
- Feb 7, 2013 12:50:21 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r142152 r142164 1 2013-02-07 Bear Travis <betravis@adobe.com> 2 3 [CSS Exclusions] shape-inside does not properly handle padding or border 4 https://bugs.webkit.org/show_bug.cgi?id=102715 5 6 Reviewed by David Hyatt. 7 8 Test that borders and padding are properly accounted for when laying out text in 9 a shape inside. 10 11 * fast/exclusions/shape-inside/shape-inside-bottom-edge.html: Modified to no longer 12 use padding. 13 * fast/exclusions/shape-inside/shape-inside-box-sizing-expected.html: Added. 14 * fast/exclusions/shape-inside/shape-inside-box-sizing.html: Added. 15 1 16 2013-01-27 Robert Hogan <robert@webkit.org> 2 17 -
trunk/LayoutTests/fast/exclusions/shape-inside/shape-inside-bottom-edge.html
r132127 r142164 29 29 #shape-inside-no-overlap { 30 30 top: 0px; 31 padding-top: 150px;32 31 } 33 32 #shape-inside-no-overlap::before, #shape-inside-overlap::before { 33 display: block; 34 height: 150px; 35 content: ' '; 36 } 37 #shape-inside-overlap::before { 38 height: 149.9px; 39 } 34 40 #shape-background-overlap { 35 41 top: 250px; … … 38 44 #shape-inside-overlap { 39 45 top: 200px; 40 padding-top: 149.9px;41 46 } 42 47 </style> -
trunk/Source/WebCore/ChangeLog
r142163 r142164 1 2013-02-07 Bear Travis <betravis@adobe.com> 2 3 [CSS Exclusions] shape-inside does not properly handle padding or border 4 https://bugs.webkit.org/show_bug.cgi?id=102715 5 6 Reviewed by David Hyatt. 7 8 This patch positions the exclusion shape based on the value of the css box sizing 9 property. Geometry calculations happen in the shape coordinate space. For layout, 10 these coordinates are translated to the border-box coordinate system by adding 11 the appropriate offsets. 12 13 Test: fast/exclusions/shape-inside/shape-inside-box-sizing.html 14 15 * rendering/ExclusionShapeInfo.cpp: 16 (WebCore::::computedShape): Pass m_shapeLogicalWidth to the exclusion shape 17 geometry code. 18 * rendering/ExclusionShapeInfo.h: 19 (WebCore::ExclusionShapeInfo::setShapeSize): Adjust block layout dimensions to 20 shape dimensions when checking to see if the shape geometry must be recalculated. 21 (WebCore::ExclusionShapeInfo::shapeLogicalTop): Account for layout offsets. 22 (WebCore::ExclusionShapeInfo::shapeLogicalBottom): Ditto. 23 (WebCore::ExclusionShapeInfo::shapeLogicalLeft): Ditto. 24 (WebCore::ExclusionShapeInfo::shapeLogicalRight): Ditto. 25 (WebCore::ExclusionShapeInfo::logicalTopOffset): Return the offset from the logical 26 top of the border box to the logical top of the shape. 27 (WebCore::ExclusionShapeInfo::logicalLeftOffset): Return the offset from the logical 28 left of the border box to the logical left of the shape. 29 (ExclusionShapeInfo): 30 * rendering/ExclusionShapeInsideInfo.cpp: 31 (WebCore::ExclusionShapeInsideInfo::computeSegmentsForLine): Adjust line top to 32 be in shape coordinates. 33 (WebCore::ExclusionShapeInsideInfo::adjustLogicalLineTop): Ditto. 34 * rendering/ExclusionShapeInsideInfo.h: 35 (WebCore::ExclusionShapeInsideInfo::lineOverlapsShapeBounds): Use consistent 36 coordinate system (border box) to test for whether a line overlaps a shape. 37 (WebCore::ExclusionShapeInsideInfo::logicalLineTop): Include the logical offset 38 from the border box. 39 (WebCore::ExclusionShapeInsideInfo::logicalLineBottom): Ditto. 40 1 41 2013-02-07 Benjamin Poulain <bpoulain@apple.com> 2 42 -
trunk/Source/WebCore/rendering/ExclusionShapeInfo.cpp
r140978 r142164 50 50 ASSERT(shape); 51 51 52 m_shape = ExclusionShape::createExclusionShape(shape, m_ logicalWidth, m_logicalHeight, m_renderer->style()->writingMode());52 m_shape = ExclusionShape::createExclusionShape(shape, m_shapeLogicalWidth, m_shapeLogicalHeight, m_renderer->style()->writingMode()); 53 53 ASSERT(m_shape); 54 54 return m_shape.get(); -
trunk/Source/WebCore/rendering/ExclusionShapeInfo.h
r140978 r142164 73 73 void setShapeSize(LayoutUnit logicalWidth, LayoutUnit logicalHeight) 74 74 { 75 if (m_logicalWidth == logicalWidth && m_logicalHeight == logicalHeight) 75 if (m_renderer->style()->boxSizing() == CONTENT_BOX) { 76 logicalWidth -= m_renderer->borderAndPaddingLogicalWidth(); 77 logicalHeight -= m_renderer->borderAndPaddingLogicalHeight(); 78 } 79 80 if (m_shapeLogicalWidth == logicalWidth && m_shapeLogicalHeight == logicalHeight) 76 81 return; 77 82 dirtyShapeSize(); 78 m_ logicalWidth = logicalWidth;79 m_ logicalHeight = logicalHeight;83 m_shapeLogicalWidth = logicalWidth; 84 m_shapeLogicalHeight = logicalHeight; 80 85 } 81 86 82 LayoutUnit shapeLogicalTop() const { return floatLogicalTopToLayoutUnit(computedShape()->shapeLogicalBoundingBox().y()) ; }83 LayoutUnit shapeLogicalBottom() const { return floatLogicalBottomToLayoutUnit(computedShape()->shapeLogicalBoundingBox().maxY()) ; }84 LayoutUnit shapeLogicalLeft() const { return computedShape()->shapeLogicalBoundingBox().x() ; }85 LayoutUnit shapeLogicalRight() const { return computedShape()->shapeLogicalBoundingBox().y() ; }87 LayoutUnit shapeLogicalTop() const { return floatLogicalTopToLayoutUnit(computedShape()->shapeLogicalBoundingBox().y()) + logicalTopOffset(); } 88 LayoutUnit shapeLogicalBottom() const { return floatLogicalBottomToLayoutUnit(computedShape()->shapeLogicalBoundingBox().maxY()) + logicalTopOffset(); } 89 LayoutUnit shapeLogicalLeft() const { return computedShape()->shapeLogicalBoundingBox().x() + logicalLeftOffset(); } 90 LayoutUnit shapeLogicalRight() const { return computedShape()->shapeLogicalBoundingBox().y() + logicalLeftOffset(); } 86 91 LayoutUnit shapeLogicalWidth() const { return computedShape()->shapeLogicalBoundingBox().width(); } 87 92 LayoutUnit shapeLogicalHeight() const { return computedShape()->shapeLogicalBoundingBox().height(); } … … 99 104 LayoutUnit floatLogicalBottomToLayoutUnit(float logicalBottom) const { return LayoutUnit::fromFloatFloor(logicalBottom); } 100 105 106 LayoutUnit logicalTopOffset() const { return m_renderer->style()->boxSizing() == CONTENT_BOX ? m_renderer->borderBefore() + m_renderer->paddingBefore() : LayoutUnit(); } 107 LayoutUnit logicalLeftOffset() const { return m_renderer->style()->boxSizing() == CONTENT_BOX ? m_renderer->borderStart() + m_renderer->paddingStart() : LayoutUnit(); } 108 101 109 private: 102 110 mutable OwnPtr<ExclusionShape> m_shape; 103 111 104 LayoutUnit m_ logicalWidth;105 LayoutUnit m_ logicalHeight;112 LayoutUnit m_shapeLogicalWidth; 113 LayoutUnit m_shapeLogicalHeight; 106 114 const RenderType* m_renderer; 107 115 }; -
trunk/Source/WebCore/rendering/ExclusionShapeInsideInfo.cpp
r140978 r142164 39 39 { 40 40 ASSERT(lineHeight >= 0); 41 m_ lineTop = lineTop;41 m_shapeLineTop = lineTop - logicalTopOffset(); 42 42 m_lineHeight = lineHeight; 43 43 m_segments.clear(); 44 44 m_segmentRanges.clear(); 45 45 46 if (lineOverlapsShapeBounds()) { 47 computedShape()->getIncludedIntervals(lineTop, std::min(lineHeight, shapeLogicalBottom() - lineTop), m_segments); 46 if (lineOverlapsShapeBounds()) 47 computedShape()->getIncludedIntervals(m_shapeLineTop, std::min(m_lineHeight, shapeLogicalBottom() - lineTop), m_segments); 48 49 LayoutUnit logicalLeftOffset = this->logicalLeftOffset(); 50 for (size_t i = 0; i < m_segments.size(); i++) { 51 m_segments[i].logicalLeft += logicalLeftOffset; 52 m_segments[i].logicalRight += logicalLeftOffset; 48 53 } 49 54 return m_segments.size(); … … 53 58 { 54 59 const ExclusionShape* shape = computedShape(); 55 if (!shape || m_lineHeight <= 0 || m_lineTop> shapeLogicalBottom())60 if (!shape || m_lineHeight <= 0 || logicalLineTop() > shapeLogicalBottom()) 56 61 return false; 57 62 58 63 float floatNewLineTop; 59 if (shape->firstIncludedIntervalLogicalTop(m_ lineTop, FloatSize(minSegmentWidth, m_lineHeight), floatNewLineTop)) {64 if (shape->firstIncludedIntervalLogicalTop(m_shapeLineTop, FloatSize(minSegmentWidth, m_lineHeight), floatNewLineTop)) { 60 65 LayoutUnit newLineTop = floatLogicalTopToLayoutUnit(floatNewLineTop); 61 if (newLineTop > m_ lineTop) {62 m_ lineTop = newLineTop;66 if (newLineTop > m_shapeLineTop) { 67 m_shapeLineTop = newLineTop; 63 68 return true; 64 69 } -
trunk/Source/WebCore/rendering/ExclusionShapeInsideInfo.h
r140978 r142164 64 64 return shape && (shape->type() == BasicShape::BASIC_SHAPE_RECTANGLE || shape->type() == BasicShape::BASIC_SHAPE_POLYGON); 65 65 } 66 bool lineOverlapsShapeBounds() const { return m_lineTop < shapeLogicalBottom() && m_lineTop + m_lineHeight>= shapeLogicalTop(); }66 bool lineOverlapsShapeBounds() const { return logicalLineTop() < shapeLogicalBottom() && logicalLineBottom() >= shapeLogicalTop(); } 67 67 68 68 bool hasSegments() const … … 86 86 bool computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight); 87 87 bool adjustLogicalLineTop(float minSegmentWidth); 88 LayoutUnit logicalLineTop() const { return m_lineTop; } 88 LayoutUnit logicalLineTop() const { return m_shapeLineTop + logicalTopOffset(); } 89 LayoutUnit logicalLineBottom() const { return m_shapeLineTop + m_lineHeight + logicalTopOffset(); } 89 90 90 91 private: 91 92 ExclusionShapeInsideInfo(const RenderBlock* renderer) : ExclusionShapeInfo<RenderBlock, &RenderStyle::shapeInside>(renderer) { } 92 93 93 LayoutUnit m_ lineTop;94 LayoutUnit m_shapeLineTop; 94 95 LayoutUnit m_lineHeight; 95 96
Note: See TracChangeset
for help on using the changeset viewer.