Changeset 140365 in webkit
- Timestamp:
- Jan 21, 2013 2:35:28 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r140364 r140365 1 2013-01-21 Bem Jones-Bey <bjonesbe@adobe.com> 2 3 [CSS Exclusions] shape-outside on floats for rectangle shapes positioning 4 https://bugs.webkit.org/show_bug.cgi?id=100399 5 6 Reviewed by David Hyatt. 7 8 * fast/exclusions/shape-outside-floats/shape-outside-floats-positioning-expected.html: Added. 9 * fast/exclusions/shape-outside-floats/shape-outside-floats-positioning.html: Added. 10 * fast/exclusions/shape-outside-floats/shape-outside-floats-simple-rectangle-horizontal-multiple.html: 11 This test had incorrect coordinates for some of the shapes, causing them to break now that x and y are supported for the shapes. 12 1 13 2013-01-21 Robert Hogan <robert@webkit.org> 2 14 -
trunk/LayoutTests/fast/exclusions/shape-outside-floats/shape-outside-floats-simple-rectangle-horizontal-multiple.html
r137930 r140365 38 38 } 39 39 .float-right-exclusion { 40 -webkit-shape-outside: rectangle( 10px, 0px, 10px, 20px);40 -webkit-shape-outside: rectangle(0px, 0px, 10px, 20px); 41 41 float: right; 42 42 height: 20px; … … 50 50 } 51 51 .float-right-vertical-exclusion { 52 -webkit-shape-outside: rectangle(0px, 10px, 20px, 10px);52 -webkit-shape-outside: rectangle(0px, 0px, 20px, 10px); 53 53 float: right; 54 54 height: 20px; -
trunk/Source/WebCore/ChangeLog
r140359 r140365 1 2013-01-21 Bem Jones-Bey <bjonesbe@adobe.com> 2 3 [CSS Exclusions] shape-outside on floats for rectangle shapes positioning 4 https://bugs.webkit.org/show_bug.cgi?id=100399 5 6 Reviewed by David Hyatt. 7 8 When a float has a shape-outside with non-zero x or y, the float's 9 exclusion behavior can happen at a completely different location than 10 where the float's content is painted. This patch brings initial 11 support for this behavior. 12 13 Test: fast/exclusions/shape-outside-floats/shape-outside-floats-positioning.html 14 15 * rendering/RenderBlock.cpp: 16 (WebCore::RenderBlock::flipFloatForWritingModeForChild): If called 17 during painting, make sure to pass that state down to the float 18 positioning so that it can use the proper position. 19 (WebCore::RenderBlock::paintFloats): Since this is concerned with 20 painting, use the position of the float, not the shape. 21 (WebCore::RenderBlock::positionNewFloats): Set the correct location 22 for the float, relative to the location of the shape. 23 (WebCore::RenderBlock::addOverhangingFloats): Add FIXME. 24 * rendering/RenderBlock.h: 25 (WebCore::RenderBlock::xPositionForFloatIncludingMargin): 26 (WebCore::RenderBlock::yPositionForFloatIncludingMargin): Since the 27 position of the shape (FloatingObject) can be different from the 28 position of the float's box (RenderBox), the position needs to be 29 computed differently for painting than for determining layout. 30 (WebCore::RenderBlock::flipFloatForWritingModeForChild): Change 31 signature to take painting flag. 32 1 33 2013-01-21 Eric Carlson <eric.carlson@apple.com> 2 34 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r140358 r140365 3124 3124 } 3125 3125 3126 LayoutPoint RenderBlock::flipFloatForWritingModeForChild(const FloatingObject* child, const LayoutPoint& point ) const3126 LayoutPoint RenderBlock::flipFloatForWritingModeForChild(const FloatingObject* child, const LayoutPoint& point, FloatRenderingState renderingState) const 3127 3127 { 3128 3128 if (!style()->isFlippedBlocksWritingMode()) … … 3133 3133 // case. 3134 3134 if (isHorizontalWritingMode()) 3135 return LayoutPoint(point.x(), point.y() + height() - child->renderer()->height() - 2 * yPositionForFloatIncludingMargin(child ));3136 return LayoutPoint(point.x() + width() - child->renderer()->width() - 2 * xPositionForFloatIncludingMargin(child ), point.y());3135 return LayoutPoint(point.x(), point.y() + height() - child->renderer()->height() - 2 * yPositionForFloatIncludingMargin(child, renderingState)); 3136 return LayoutPoint(point.x() + width() - child->renderer()->width() - 2 * xPositionForFloatIncludingMargin(child, renderingState), point.y()); 3137 3137 } 3138 3138 … … 3150 3150 PaintInfo currentPaintInfo(paintInfo); 3151 3151 currentPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhaseBlockBackground; 3152 LayoutPoint childPoint = flipFloatForWritingModeForChild(r, LayoutPoint(paintOffset.x() + xPositionForFloatIncludingMargin(r ) - r->m_renderer->x(), paintOffset.y() + yPositionForFloatIncludingMargin(r) - r->m_renderer->y()));3152 LayoutPoint childPoint = flipFloatForWritingModeForChild(r, LayoutPoint(paintOffset.x() + xPositionForFloatIncludingMargin(r, FloatPaint) - r->m_renderer->x(), paintOffset.y() + yPositionForFloatIncludingMargin(r, FloatPaint) - r->m_renderer->y()), FloatPaint); 3153 3153 r->m_renderer->paint(currentPaintInfo, childPoint); 3154 3154 if (!preservePhase) { … … 4009 4009 setLogicalLeftForFloat(floatingObject, floatLogicalLocation.x()); 4010 4010 4011 bool hasShapeOutside = false;4012 4011 #if ENABLE(CSS_EXCLUSIONS) 4013 hasShapeOutside = floatingObject->renderer()->exclusionShapeOutsideInfo(); 4012 if (childBox->exclusionShapeOutsideInfo()) { 4013 // The CSS Exclusions specification says that the margins are ignored when a float has a shape outside. 4014 setLogicalLeftForChild(childBox, floatLogicalLocation.x() - childBox->exclusionShapeOutsideInfo()->shapeLogicalLeft()); 4015 setLogicalTopForChild(childBox, floatLogicalLocation.y() - childBox->exclusionShapeOutsideInfo()->shapeLogicalTop()); 4016 } else { 4014 4017 #endif 4015 // The CSS Exclusions specification says that the margins are ignored when a float has a shape outside. 4016 setLogicalLeftForChild(childBox, floatLogicalLocation.x() + (hasShapeOutside ? LayoutUnit() : childLogicalLeftMargin)); 4017 setLogicalTopForChild(childBox, floatLogicalLocation.y() + (hasShapeOutside ? LayoutUnit() : marginBeforeForChild(childBox))); 4018 setLogicalLeftForChild(childBox, floatLogicalLocation.x() + childLogicalLeftMargin); 4019 setLogicalTopForChild(childBox, floatLogicalLocation.y() + marginBeforeForChild(childBox)); 4020 #if ENABLE(CSS_EXCLUSIONS) 4021 } 4022 #endif 4018 4023 4019 4024 LayoutState* layoutState = view()->layoutState(); … … 4044 4049 setLogicalLeftForFloat(floatingObject, floatLogicalLocation.x()); 4045 4050 4046 // The CSS Exclusions specification says that the margins are ignored when a float has a shape outside. 4047 setLogicalLeftForChild(childBox, floatLogicalLocation.x() + (hasShapeOutside ? LayoutUnit() : childLogicalLeftMargin)); 4048 setLogicalTopForChild(childBox, floatLogicalLocation.y() + (hasShapeOutside ? LayoutUnit() : marginBeforeForChild(childBox))); 4051 #if ENABLE(CSS_EXCLUSIONS) 4052 if (childBox->exclusionShapeOutsideInfo()) { 4053 // The CSS Exclusions specification says that the margins are ignored when a float has a shape outside. 4054 setLogicalLeftForChild(childBox, floatLogicalLocation.x() - childBox->exclusionShapeOutsideInfo()->shapeLogicalLeft()); 4055 setLogicalTopForChild(childBox, floatLogicalLocation.y() - childBox->exclusionShapeOutsideInfo()->shapeLogicalTop()); 4056 } else { 4057 #endif 4058 setLogicalLeftForChild(childBox, floatLogicalLocation.x() + childLogicalLeftMargin); 4059 setLogicalTopForChild(childBox, floatLogicalLocation.y() + marginBeforeForChild(childBox)); 4060 #if ENABLE(CSS_EXCLUSIONS) 4061 } 4062 #endif 4063 4049 4064 4050 4065 if (childBlock) … … 4056 4071 setLogicalTopForFloat(floatingObject, floatLogicalLocation.y()); 4057 4072 #if ENABLE(CSS_EXCLUSIONS) 4058 if ( hasShapeOutside)4059 setLogicalHeightForFloat(floatingObject, floatingObject->renderer()->exclusionShapeOutsideInfo()->shapeLogicalHeight());4073 if (childBox->exclusionShapeOutsideInfo()) 4074 setLogicalHeightForFloat(floatingObject, childBox->exclusionShapeOutsideInfo()->shapeLogicalHeight()); 4060 4075 else 4061 4076 #endif … … 4539 4554 lowestFloatLogicalBottom = max(lowestFloatLogicalBottom, logicalBottom); 4540 4555 4556 // FIXME: Bug 106927 Handle situations where float and shape-outside overflow differently. 4541 4557 if (logicalBottom > logicalHeight()) { 4542 4558 // If the object is not in the list, we add it now. -
trunk/Source/WebCore/rendering/RenderBlock.h
r140291 r140365 689 689 }; 690 690 691 LayoutPoint flipFloatForWritingModeForChild(const FloatingObject*, const LayoutPoint&) const; 691 // When a float has shape outside, it needs to be handled differently at 692 // paint time and at layout time, since the coordinates of the shape 693 // (affecting layout) and the coordinates of the float itself (affecting 694 // where the content of the float is) can be in different places. This enum 695 // is used to change behavior based on that state. 696 enum FloatRenderingState { FloatLayout, FloatPaint }; 697 698 LayoutPoint flipFloatForWritingModeForChild(const FloatingObject*, const LayoutPoint&, FloatRenderingState = FloatLayout) const; 692 699 693 700 LayoutUnit logicalTopForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->y() : child->x(); } … … 731 738 } 732 739 733 LayoutUnit xPositionForFloatIncludingMargin(const FloatingObject* child) const 734 { 740 LayoutUnit xPositionForFloatIncludingMargin(const FloatingObject* child, FloatRenderingState renderingState = FloatLayout) const 741 { 742 #if ENABLE(CSS_EXCLUSIONS) 743 ExclusionShapeOutsideInfo *shapeOutside = child->renderer()->exclusionShapeOutsideInfo(); 744 if (renderingState == FloatPaint && shapeOutside) 745 return child->x() - (isHorizontalWritingMode() ? shapeOutside->shapeLogicalLeft() : shapeOutside->shapeLogicalTop()); 746 // FIXME: Bug 106928 This needs to properly handle the margin for floats with shape-outside for non-paint time. 747 #endif 748 735 749 if (isHorizontalWritingMode()) 736 750 return child->x() + child->renderer()->marginLeft(); … … 739 753 } 740 754 741 LayoutUnit yPositionForFloatIncludingMargin(const FloatingObject* child) const 742 { 755 LayoutUnit yPositionForFloatIncludingMargin(const FloatingObject* child, FloatRenderingState renderingState = FloatLayout) const 756 { 757 #if ENABLE(CSS_EXCLUSIONS) 758 ExclusionShapeOutsideInfo *shapeOutside = child->renderer()->exclusionShapeOutsideInfo(); 759 if (renderingState == FloatPaint && shapeOutside) 760 return child->y() - (isHorizontalWritingMode() ? shapeOutside->shapeLogicalTop() : shapeOutside->shapeLogicalLeft()); 761 // FIXME: Bug 106928 This needs to properly handle the margin for floats with shape-outside. 762 #endif 763 743 764 if (isHorizontalWritingMode()) 744 765 return child->y() + marginBeforeForChild(child->renderer());
Note: See TracChangeset
for help on using the changeset viewer.