Changeset 147384 in webkit
- Timestamp:
- Apr 1, 2013 10:39:57 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r147383 r147384 1 2013-04-01 Hans Muller <hmuller@adobe.com> 2 3 [CSS Exclusions] shape-outside on floats fails to respect shape-margin's vertical extent 4 https://bugs.webkit.org/show_bug.cgi?id=113600 5 6 Reviewed by Dirk Schulze. 7 8 Corrected the expected values in the ellipse-margin-left and ellipse-margin-right tests because the 9 shape-outside float layout code now (correctly) takes into account the shape's margin boundary. 10 11 * fast/exclusions/shape-outside-floats/shape-outside-floats-ellipse-margin-bottom-expected.html: Added. 12 * fast/exclusions/shape-outside-floats/shape-outside-floats-ellipse-margin-bottom.html: Added. 13 * fast/exclusions/shape-outside-floats/shape-outside-floats-ellipse-margin-left-expected.txt: 14 * fast/exclusions/shape-outside-floats/shape-outside-floats-ellipse-margin-left.html: 15 * fast/exclusions/shape-outside-floats/shape-outside-floats-ellipse-margin-right-expected.txt: 16 * fast/exclusions/shape-outside-floats/shape-outside-floats-ellipse-margin-right.html: 17 1 18 2013-04-01 Adam Barth <abarth@webkit.org> 2 19 -
trunk/LayoutTests/fast/exclusions/shape-outside-floats/shape-outside-floats-ellipse-margin-left-expected.txt
r147249 r147384 1 1 PASS elementRect('s1').top is 0 2 PASS elementRect('s1').left is 3 732 PASS elementRect('s1').left is 347 3 3 PASS elementRect('s2').top is 20 4 PASS elementRect('s2').left is 39 74 PASS elementRect('s2').left is 390 5 5 PASS elementRect('s3').top is 40 6 PASS elementRect('s3').left is 41 36 PASS elementRect('s3').left is 417 7 7 The left edges of the three black squares should follow the outer ellipse boundary and each square should appear on a subsequent line. 8 8 -
trunk/LayoutTests/fast/exclusions/shape-outside-floats/shape-outside-floats-ellipse-margin-left.html
r147249 r147384 33 33 position: absolute; 34 34 display:block; 35 top: 0px;36 left: 0px;35 top: -25px; 36 left: -25px; 37 37 width: 500px; 38 38 height: 300px; … … 46 46 <div id="float-left"> 47 47 <svg id="svg-shape-ellipse" xmlns="http://www.w3.org/2000/"> 48 <ellipse cx="2 00" cy="100" rx="200" ry="100" fill="green"></ellipse>49 <ellipse cx="2 00" cy="100" rx="225" ry="125" fill="none" stroke="green"></ellipse>48 <ellipse cx="225" cy="125" rx="200" ry="100" fill="green"></ellipse> 49 <ellipse cx="225" cy="125" rx="225" ry="125" fill="none" stroke="green"></ellipse> 50 50 </svg> 51 51 </div> … … 64 64 // You'll find the equation for the X intercept of an elliptical arc here (among other places): 65 65 // http://hansmuller-webkit.blogspot.com/2012/07/computing-horizonal-rounded-rectangle.html 66 //67 // Note also: only the "ellipse(200px, 100px, 200px, 100px)" itself fits within the container element. The margin68 // ellipse extends above and to the left by another 25 pixels. The +25 adjustment to Y accounts for this.69 70 66 71 67 function marginEllipseLeftXIntercept(y, cx, rx, ry) 72 68 { 73 return String( SubPixelLayout.roundLineLeft(cx + rx * Math.sqrt(1 - Math.pow((ry - (y + 25)) / ry, 2))) );69 return String( SubPixelLayout.roundLineLeft(cx + rx * Math.sqrt(1 - Math.pow((ry - y) / ry, 2))) ); 74 70 } 75 71 … … 80 76 81 77 shouldBe("elementRect('s1').top", "0"); 82 shouldBe("elementRect('s1').left", marginEllipseLeftXIntercept(20, 2 00, 225, 125));78 shouldBe("elementRect('s1').left", marginEllipseLeftXIntercept(20, 225, 225, 125)); 83 79 84 80 shouldBe("elementRect('s2').top", "20"); 85 shouldBe("elementRect('s2').left", marginEllipseLeftXIntercept(40, 2 00, 225, 125));81 shouldBe("elementRect('s2').left", marginEllipseLeftXIntercept(40, 225, 225, 125)); 86 82 87 83 shouldBe("elementRect('s3').top", "40"); 88 shouldBe("elementRect('s3').left", marginEllipseLeftXIntercept(60, 2 00, 225, 125));84 shouldBe("elementRect('s3').left", marginEllipseLeftXIntercept(60, 225, 225, 125)); 89 85 90 86 </script> -
trunk/LayoutTests/fast/exclusions/shape-outside-floats/shape-outside-floats-ellipse-margin-right-expected.txt
r147249 r147384 1 1 PASS elementRect('s1').top is 0 2 PASS elementRect('s1').right is 1 272 PASS elementRect('s1').right is 152 3 3 PASS elementRect('s2').top is 20 4 PASS elementRect('s2').right is 1 024 PASS elementRect('s2').right is 110 5 5 PASS elementRect('s3').top is 40 6 PASS elementRect('s3').right is 8 66 PASS elementRect('s3').right is 82 7 7 The right edges of the three black squares should follow the outer ellipse boundary and each square should appear on a subsequent line. 8 8 -
trunk/LayoutTests/fast/exclusions/shape-outside-floats/shape-outside-floats-ellipse-margin-right.html
r147249 r147384 34 34 position: absolute; 35 35 display:block; 36 top: 0px;37 left: - 50px;36 top: -25px; 37 left: -25px; 38 38 width: 500px; 39 39 height: 300px; … … 47 47 <div id="float-right"> 48 48 <svg id="svg-shape-ellipse" xmlns="http://www.w3.org/2000/"> 49 <ellipse cx="2 50" cy="100" rx="200" ry="100" fill="green"></ellipse>50 <ellipse cx="2 50" cy="100" rx="225" ry="125" fill="none" stroke="green"></ellipse>49 <ellipse cx="225" cy="125" rx="200" ry="100" fill="green"></ellipse> 50 <ellipse cx="225" cy="125" rx="225" ry="125" fill="none" stroke="green"></ellipse> 51 51 </svg> 52 52 </div> … … 65 65 // You'll find the equation for the X intercept of an elliptical arc here (among other places): 66 66 // http://hansmuller-webkit.blogspot.com/2012/07/computing-horizonal-rounded-rectangle.html 67 //68 // Note also: only the "ellipse(200px, 100px, 200px, 100px)" itself fits within the container element. The margin69 // ellipse extends above and to the left by another 25 pixels. The +25 adjustment to Y accounts for this.70 71 67 72 68 function marginEllipseRightXIntercept(y, cx, rx, ry) 73 69 { 74 70 var containerWidth = document.getElementById("container").getBoundingClientRect().width; 75 return String( SubPixelLayout.roundLineRight(containerWidth - (cx + rx * Math.sqrt(1 - Math.pow((ry - (y + 25)) / ry, 2)))) );71 return String( SubPixelLayout.roundLineRight(containerWidth - (cx + rx * Math.sqrt(1 - Math.pow((ry - y) / ry, 2)))) ); 76 72 } 77 73 … … 82 78 83 79 shouldBe("elementRect('s1').top", "0"); 84 shouldBe("elementRect('s1').right", marginEllipseRightXIntercept(20, 2 00, 225, 125));80 shouldBe("elementRect('s1').right", marginEllipseRightXIntercept(20, 225, 225, 125)); 85 81 86 82 shouldBe("elementRect('s2').top", "20"); 87 shouldBe("elementRect('s2').right", marginEllipseRightXIntercept(40, 2 00, 225, 125));83 shouldBe("elementRect('s2').right", marginEllipseRightXIntercept(40, 225, 225, 125)); 88 84 89 85 shouldBe("elementRect('s3').top", "40"); 90 shouldBe("elementRect('s3').right", marginEllipseRightXIntercept(60, 2 00, 225, 125));86 shouldBe("elementRect('s3').right", marginEllipseRightXIntercept(60, 225, 225, 125)); 91 87 92 88 </script> -
trunk/Source/WebCore/ChangeLog
r147383 r147384 1 2013-04-01 Hans Muller <hmuller@adobe.com> 2 3 [CSS Exclusions] shape-outside on floats fails to respect shape-margin's vertical extent 4 https://bugs.webkit.org/show_bug.cgi?id=113600 5 6 Reviewed by Dirk Schulze. 7 8 ExclusionShapeInsideInfo classes need to depend on the ExclusionShape's padded boundary and 9 ExclusionShapeOutsideInfo classes should depend on the ExclusionShape's margin boundary. Added 10 a virtual method to the ExclusionShapeInfo that returns the ExclusionShape's logical bounding box - 11 computedShapeLogicalBoundingBox() - and overrode that method in the subclasses to return the 12 value of the appropriate ExclusionShape method. Added shapeMarginLogicalBoundingBox() and 13 shapePaddingLogicalBoundingBox() methods to ExclusionShape and removed the shapeLogicalBoundingBox() 14 method, which did not take shape-margin or shape-padding into account. 15 16 Test: fast/exclusions/shape-outside-floats/shape-outside-floats-ellipse-margin-bottom.html 17 18 * rendering/ExclusionPolygon.h: Defined the padding and margin bounding box virtual methods. 19 * rendering/ExclusionRectangle.h: Defined the padding and margin bounding box virtual methods. 20 * rendering/ExclusionShape.h: Added the padding and margin bounding box virtual abstract methods. Removed shapeLogicalBoundingBox(). 21 (ExclusionShape): 22 * rendering/ExclusionShapeInfo.h: 23 (WebCore::ExclusionShapeInfo::shapeLogicalTop): Now calls computedShapeLogicalBoundingBox(). 24 (WebCore::ExclusionShapeInfo::shapeLogicalBottom): Ditto. 25 (WebCore::ExclusionShapeInfo::shapeLogicalLeft): Ditto. 26 (WebCore::ExclusionShapeInfo::shapeLogicalRight): Ditto. 27 (WebCore::ExclusionShapeInfo::shapeLogicalWidth): Ditto. 28 (WebCore::ExclusionShapeInfo::shapeLogicalHeight): Ditto. 29 (ExclusionShapeInfo): Added computedShapeLogicalBoundingBox(). 30 * rendering/ExclusionShapeInsideInfo.h: 31 (ExclusionShapeInsideInfo): 32 (WebCore::ExclusionShapeInsideInfo::computedShapeLogicalBoundingBox): Gets the padded shape's bounding box. 33 * rendering/ExclusionShapeOutsideInfo.h: 34 (ExclusionShapeOutsideInfo): 35 (WebCore::ExclusionShapeOutsideInfo::computedShapeLogicalBoundingBox): Gets the margin shape's bounding box. 36 1 37 2013-04-01 Adam Barth <abarth@webkit.org> 2 38 -
trunk/Source/WebCore/rendering/ExclusionPolygon.h
r147111 r147384 81 81 } 82 82 83 virtual FloatRect shapeLogicalBoundingBox() const OVERRIDE { return m_polygon.boundingBox(); } 83 virtual FloatRect shapeMarginLogicalBoundingBox() const OVERRIDE { return shapeMarginBounds().boundingBox(); } 84 virtual FloatRect shapePaddingLogicalBoundingBox() const OVERRIDE { return shapePaddingBounds().boundingBox(); } 84 85 virtual bool isEmpty() const OVERRIDE { return m_polygon.isEmpty(); } 85 86 virtual void getExcludedIntervals(float logicalTop, float logicalHeight, SegmentList&) const OVERRIDE; -
trunk/Source/WebCore/rendering/ExclusionRectangle.h
r144258 r147384 69 69 } 70 70 71 virtual FloatRect shapeLogicalBoundingBox() const OVERRIDE { return m_bounds; } 71 virtual FloatRect shapeMarginLogicalBoundingBox() const OVERRIDE { return shapeMarginBounds(); } 72 virtual FloatRect shapePaddingLogicalBoundingBox() const OVERRIDE { return shapePaddingBounds(); } 72 73 virtual bool isEmpty() const OVERRIDE { return m_bounds.isEmpty(); } 73 74 virtual void getExcludedIntervals(float logicalTop, float logicalHeight, SegmentList&) const OVERRIDE; -
trunk/Source/WebCore/rendering/ExclusionShape.h
r144258 r147384 66 66 float shapeMargin() const { return m_margin; } 67 67 float shapePadding() const { return m_padding; } 68 virtual FloatRect shapeLogicalBoundingBox() const = 0; 68 virtual FloatRect shapeMarginLogicalBoundingBox() const = 0; 69 virtual FloatRect shapePaddingLogicalBoundingBox() const = 0; 69 70 virtual bool isEmpty() const = 0; 70 71 virtual void getIncludedIntervals(float logicalTop, float logicalHeight, SegmentList&) const = 0; -
trunk/Source/WebCore/rendering/ExclusionShapeInfo.h
r144776 r147384 87 87 virtual bool computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight); 88 88 89 LayoutUnit shapeLogicalTop() const { return floatLogicalTopToLayoutUnit(computedShape ()->shapeLogicalBoundingBox().y()) + logicalTopOffset(); }90 LayoutUnit shapeLogicalBottom() const { return floatLogicalBottomToLayoutUnit(computedShape ()->shapeLogicalBoundingBox().maxY()) + logicalTopOffset(); }91 LayoutUnit shapeLogicalLeft() const { return computedShape ()->shapeLogicalBoundingBox().x() + logicalLeftOffset(); }92 LayoutUnit shapeLogicalRight() const { return computedShape ()->shapeLogicalBoundingBox().maxX() + logicalLeftOffset(); }93 LayoutUnit shapeLogicalWidth() const { return computedShape ()->shapeLogicalBoundingBox().width(); }94 LayoutUnit shapeLogicalHeight() const { return computedShape ()->shapeLogicalBoundingBox().height(); }89 LayoutUnit shapeLogicalTop() const { return floatLogicalTopToLayoutUnit(computedShapeLogicalBoundingBox().y()) + logicalTopOffset(); } 90 LayoutUnit shapeLogicalBottom() const { return floatLogicalBottomToLayoutUnit(computedShapeLogicalBoundingBox().maxY()) + logicalTopOffset(); } 91 LayoutUnit shapeLogicalLeft() const { return computedShapeLogicalBoundingBox().x() + logicalLeftOffset(); } 92 LayoutUnit shapeLogicalRight() const { return computedShapeLogicalBoundingBox().maxX() + logicalLeftOffset(); } 93 LayoutUnit shapeLogicalWidth() const { return computedShapeLogicalBoundingBox().width(); } 94 LayoutUnit shapeLogicalHeight() const { return computedShapeLogicalBoundingBox().height(); } 95 95 96 96 LayoutUnit logicalLineTop() const { return m_shapeLineTop + logicalTopOffset(); } … … 107 107 108 108 const ExclusionShape* computedShape() const; 109 virtual FloatRect computedShapeLogicalBoundingBox() const = 0; 109 110 110 111 // Use ceil and floor to ensure that the returned LayoutUnit value is within the shape's bounds. -
trunk/Source/WebCore/rendering/ExclusionShapeInsideInfo.h
r145610 r147384 98 98 bool needsLayout() { return m_needsLayout; } 99 99 100 protected: 101 virtual FloatRect computedShapeLogicalBoundingBox() const OVERRIDE { return computedShape()->shapePaddingLogicalBoundingBox(); } 102 100 103 private: 101 104 ExclusionShapeInsideInfo(const RenderBlock* renderer) -
trunk/Source/WebCore/rendering/ExclusionShapeOutsideInfo.h
r144776 r147384 51 51 static PassOwnPtr<ExclusionShapeOutsideInfo> createInfo(const RenderBox* renderer) { return adoptPtr(new ExclusionShapeOutsideInfo(renderer)); } 52 52 static bool isEnabledFor(const RenderBox*); 53 54 protected: 55 virtual FloatRect computedShapeLogicalBoundingBox() const OVERRIDE { return computedShape()->shapeMarginLogicalBoundingBox(); } 56 53 57 private: 54 58 ExclusionShapeOutsideInfo(const RenderBox* renderer) : ExclusionShapeInfo<RenderBox, &RenderStyle::shapeOutside, &ExclusionShape::getExcludedIntervals>(renderer) { }
Note: See TracChangeset
for help on using the changeset viewer.