Changeset 197097 in webkit
- Timestamp:
- Feb 25, 2016, 4:01:32 AM (11 years ago)
- Location:
- releases/WebKitGTK/webkit-2.12
- Files:
-
- 2 added
- 10 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/css/background-position-serialize-expected.txt (modified) (1 diff)
-
LayoutTests/fast/css/background-position-serialize.html (modified) (2 diffs)
-
LayoutTests/fast/images/background-position-expected.html (added)
-
LayoutTests/fast/images/background-position.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/css/CSSPrimitiveValueMappings.h (modified) (3 diffs)
-
Source/WebCore/rendering/RenderBoxModelObject.cpp (modified) (5 diffs)
-
Source/WebCore/rendering/style/FillLayer.cpp (modified) (1 diff)
-
Source/WebCore/rendering/style/FillLayer.h (modified) (3 diffs)
-
Source/WebCore/rendering/style/RenderStyleConstants.cpp (modified) (1 diff)
-
Source/WebCore/rendering/style/RenderStyleConstants.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog
r197095 r197097 1 2016-02-22 Simon Fraser <simon.fraser@apple.com> 2 3 Repeated background images have the wrong position when using bottom/right-relative background-position 4 https://bugs.webkit.org/show_bug.cgi?id=154478 5 6 Reviewed by Dave Hyatt. 7 8 Enhanced background-position-serialize.html to test values that use right/bottom edge specifiers. 9 10 Ref test for background-position. 11 12 * fast/css/background-position-serialize-expected.txt: 13 * fast/css/background-position-serialize.html: 14 * fast/images/background-position-expected.html: Added. 15 * fast/images/background-position.html: Added. 16 * fast/images/resources/checker.png: Added. 17 1 18 2016-02-21 Chris Dumez <cdumez@apple.com> 2 19 -
releases/WebKitGTK/webkit-2.12/LayoutTests/fast/css/background-position-serialize-expected.txt
r112177 r197097 57 57 PASS: t.style.backgroundPositionY should be 15px, 25px, 35px and is. 58 58 PASS: t.style.cssText should be background-position: 10px 15px, 20px 25px, 30px 35px; and is. 59 t.setAttribute('style', 'background-position: bottom 10px right 20px'); 60 PASS: t.style.backgroundPosition should be right 20px bottom 10px and is. 61 PASS: window.getComputedStyle(t).backgroundPosition should be right 20px bottom 10px and is. 62 t.setAttribute('style', 'background-position: top 10px right 20px'); 63 PASS: t.style.backgroundPosition should be right 20px top 10px and is. 64 PASS: window.getComputedStyle(t).backgroundPosition should be right 20px top 10px and is. 65 t.setAttribute('style', 'background-position: 50% left'); 66 PASS: t.style.backgroundPosition should be and is. 67 t.setAttribute('style', 'background-position-x: right 20px'); 68 PASS: window.getComputedStyle(t).backgroundPositionX should be 0% and is. 69 t.setAttribute('style', 'background-position: right 20px bottom 10px'); 70 PASS: window.getComputedStyle(t).backgroundPosition should be right 20px bottom 10px and is. 71 PASS: window.getComputedStyle(t).backgroundPositionX should be 20px and is. 59 72 t.setAttribute('style', 'background: url(about:blank) 80% 80%;'); 60 73 t.style.backgroundPositionY = '50px' -
releases/WebKitGTK/webkit-2.12/LayoutTests/fast/css/background-position-serialize.html
r126656 r197097 1 1 <html> 2 2 <body> 3 <div id= t></div>4 <div id= console></div>3 <div id="t"></div> 4 <div id="console"></div> 5 5 <script> 6 6 function print(message, color) … … 112 112 shouldBe("t.style.cssText", "background-position: 10px 15px, 20px 25px, 30px 35px;"); 113 113 114 run("t.setAttribute('style', 'background-position: bottom 10px right 20px');"); 115 shouldBe("t.style.backgroundPosition", "right 20px bottom 10px"); 116 shouldBe("window.getComputedStyle(t).backgroundPosition", "right 20px bottom 10px"); 117 118 run("t.setAttribute('style', 'background-position: top 10px right 20px');"); 119 shouldBe("t.style.backgroundPosition", "right 20px top 10px"); 120 shouldBe("window.getComputedStyle(t).backgroundPosition", "right 20px top 10px"); 121 122 run("t.setAttribute('style', 'background-position: 50% left');"); // Invalid per spec. 123 shouldBe("t.style.backgroundPosition", ""); 124 125 run("t.setAttribute('style', 'background-position-x: right 20px');"); // This does not parse, but perhaps it should. 126 shouldBe("window.getComputedStyle(t).backgroundPositionX", "0%"); 127 128 run("t.setAttribute('style', 'background-position: right 20px bottom 10px');"); 129 shouldBe("window.getComputedStyle(t).backgroundPosition", "right 20px bottom 10px"); 130 shouldBe("window.getComputedStyle(t).backgroundPositionX", "20px"); // This is a bug. webkit.org/b/154551 131 114 132 run("t.setAttribute('style', 'background: url(about:blank) 80% 80%;');"); 115 133 run("t.style.backgroundPositionY = '50px'"); -
releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog
r197091 r197097 1 2016-02-22 Simon Fraser <simon.fraser@apple.com> 2 3 Repeated background images have the wrong position when using bottom/right-relative background-position 4 https://bugs.webkit.org/show_bug.cgi?id=154478 5 6 Reviewed by Dave Hyatt. 7 8 Fix RenderBoxModelObject::calculateBackgroundImageGeometry() to use the right position when 9 painting repeated background images when right/bottom edges are used. 10 11 Also rename BackgroundEdgeOrigin to Edge 12 13 Test: fast/images/background-position.html 14 15 * css/CSSPrimitiveValueMappings.h: 16 (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): 17 (WebCore::CSSPrimitiveValue::operator Edge): 18 (WebCore::CSSPrimitiveValue::operator BackgroundEdgeOrigin): Deleted. 19 * rendering/RenderBoxModelObject.cpp: 20 (WebCore::resolveEdgeRelativeLength): 21 (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry): 22 * rendering/style/FillLayer.cpp: 23 (WebCore::FillLayer::FillLayer): 24 * rendering/style/FillLayer.h: 25 (WebCore::FillLayer::backgroundXOrigin): 26 (WebCore::FillLayer::backgroundYOrigin): 27 (WebCore::FillLayer::setBackgroundXOrigin): 28 (WebCore::FillLayer::setBackgroundYOrigin): 29 * rendering/style/RenderStyleConstants.cpp: 30 (WebCore::operator<<): 31 * rendering/style/RenderStyleConstants.h: 32 1 33 2016-02-21 Chris Dumez <cdumez@apple.com> 2 34 -
releases/WebKitGTK/webkit-2.12/Source/WebCore/css/CSSPrimitiveValueMappings.h
r196075 r197097 903 903 #endif 904 904 905 template<> inline CSSPrimitiveValue::CSSPrimitiveValue( BackgroundEdgeOrigine)906 : CSSValue(PrimitiveClass) 907 { 908 m_primitiveUnitType = CSS_VALUE_ID; 909 switch (e) { 910 case TopEdge:905 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(Edge e) 906 : CSSValue(PrimitiveClass) 907 { 908 m_primitiveUnitType = CSS_VALUE_ID; 909 switch (e) { 910 case Edge::Top: 911 911 m_value.valueID = CSSValueTop; 912 912 break; 913 case RightEdge:913 case Edge::Right: 914 914 m_value.valueID = CSSValueRight; 915 915 break; 916 case BottomEdge:916 case Edge::Bottom: 917 917 m_value.valueID = CSSValueBottom; 918 918 break; 919 case LeftEdge:919 case Edge::Left: 920 920 m_value.valueID = CSSValueLeft; 921 921 break; … … 923 923 } 924 924 925 template<> inline CSSPrimitiveValue::operator BackgroundEdgeOrigin() const925 template<> inline CSSPrimitiveValue::operator Edge() const 926 926 { 927 927 ASSERT(isValueID()); … … 929 929 switch (m_value.valueID) { 930 930 case CSSValueTop: 931 return TopEdge;931 return Edge::Top; 932 932 case CSSValueRight: 933 return RightEdge;933 return Edge::Right; 934 934 case CSSValueBottom: 935 return BottomEdge;935 return Edge::Bottom; 936 936 case CSSValueLeft: 937 return LeftEdge;938 default: 939 break; 940 } 941 942 ASSERT_NOT_REACHED(); 943 return TopEdge;937 return Edge::Left; 938 default: 939 break; 940 } 941 942 ASSERT_NOT_REACHED(); 943 return Edge::Top; 944 944 } 945 945 -
releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderBoxModelObject.cpp
r195848 r197097 1045 1045 } 1046 1046 1047 static LayoutUnit resolveEdgeRelativeLength(const Length& length, Edge edge, LayoutUnit availableSpace, const LayoutSize& areaSize, const LayoutSize& tileSize) 1048 { 1049 LayoutUnit result = minimumValueForLength(length, availableSpace, false); 1050 1051 if (edge == Edge::Right) 1052 return areaSize.width() - tileSize.width() - result; 1053 1054 if (edge == Edge::Bottom) 1055 return areaSize.height() - tileSize.height() - result; 1056 1057 return result; 1058 } 1059 1047 1060 BackgroundImageGeometry RenderBoxModelObject::calculateBackgroundImageGeometry(const RenderLayerModelObject* paintContainer, const FillLayer& fillLayer, const LayoutPoint& paintOffset, 1048 1061 const LayoutRect& borderBoxRect, RenderElement* backgroundObject) const … … 1148 1161 LayoutSize phase; 1149 1162 LayoutSize noRepeat; 1150 LayoutUnit computedXPosition = minimumValueForLength(fillLayer.xPosition(), availableWidth, false);1163 LayoutUnit computedXPosition = resolveEdgeRelativeLength(fillLayer.xPosition(), fillLayer.backgroundXOrigin(), availableWidth, positioningAreaSize, tileSize); 1151 1164 if (backgroundRepeatX == RoundFill && positioningAreaSize.width() > 0 && tileSize.width() > 0) { 1152 1165 int numTiles = std::max(1, roundToInt(positioningAreaSize.width() / tileSize.width())); … … 1158 1171 } 1159 1172 1160 LayoutUnit computedYPosition = minimumValueForLength(fillLayer.yPosition(), availableHeight, false);1173 LayoutUnit computedYPosition = resolveEdgeRelativeLength(fillLayer.yPosition(), fillLayer.backgroundYOrigin(), availableHeight, positioningAreaSize, tileSize); 1161 1174 if (backgroundRepeatY == RoundFill && positioningAreaSize.height() > 0 && tileSize.height() > 0) { 1162 1175 int numTiles = std::max(1, roundToInt(positioningAreaSize.height() / tileSize.height())); … … 1182 1195 backgroundRepeatX = NoRepeatFill; 1183 1196 } 1197 1184 1198 if (backgroundRepeatX == NoRepeatFill) { 1185 LayoutUnit xOffset = left + (fillLayer.backgroundXOrigin() == RightEdge ? availableWidth - computedXPosition : computedXPosition);1199 LayoutUnit xOffset = left + computedXPosition; 1186 1200 if (xOffset > 0) 1187 1201 destinationRect.move(xOffset, 0); … … 1207 1221 } 1208 1222 if (backgroundRepeatY == NoRepeatFill) { 1209 LayoutUnit yOffset = top + (fillLayer.backgroundYOrigin() == BottomEdge ? availableHeight - computedYPosition : computedYPosition);1223 LayoutUnit yOffset = top + computedYPosition; 1210 1224 if (yOffset > 0) 1211 1225 destinationRect.move(0, yOffset); -
releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/style/FillLayer.cpp
r194496 r197097 66 66 , m_yPosSet(false) 67 67 , m_backgroundOriginSet(false) 68 , m_backgroundXOrigin( LeftEdge)69 , m_backgroundYOrigin( TopEdge)68 , m_backgroundXOrigin(static_cast<unsigned>(Edge::Left)) 69 , m_backgroundYOrigin(static_cast<unsigned>(Edge::Top)) 70 70 , m_compositeSet(type == MaskFillLayer) 71 71 , m_blendModeSet(false) -
releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/style/FillLayer.h
r194496 r197097 71 71 const Length& xPosition() const { return m_xPosition; } 72 72 const Length& yPosition() const { return m_yPosition; } 73 BackgroundEdgeOrigin backgroundXOrigin() const { return static_cast<BackgroundEdgeOrigin>(m_backgroundXOrigin); }74 BackgroundEdgeOrigin backgroundYOrigin() const { return static_cast<BackgroundEdgeOrigin>(m_backgroundYOrigin); }73 Edge backgroundXOrigin() const { return static_cast<Edge>(m_backgroundXOrigin); } 74 Edge backgroundYOrigin() const { return static_cast<Edge>(m_backgroundYOrigin); } 75 75 EFillAttachment attachment() const { return static_cast<EFillAttachment>(m_attachment); } 76 76 EFillBox clip() const { return static_cast<EFillBox>(m_clip); } … … 105 105 void setXPosition(Length length) { m_xPosition = WTFMove(length); m_xPosSet = true; } 106 106 void setYPosition(Length length) { m_yPosition = WTFMove(length); m_yPosSet = true; } 107 void setBackgroundXOrigin( BackgroundEdgeOrigin o) { m_backgroundXOrigin = o; m_backgroundOriginSet = true; }108 void setBackgroundYOrigin( BackgroundEdgeOrigin o) { m_backgroundYOrigin = o; m_backgroundOriginSet = true; }107 void setBackgroundXOrigin(Edge o) { m_backgroundXOrigin = static_cast<unsigned>(o); m_backgroundOriginSet = true; } 108 void setBackgroundYOrigin(Edge o) { m_backgroundYOrigin = static_cast<unsigned>(o); m_backgroundOriginSet = true; } 109 109 void setAttachment(EFillAttachment attachment) { m_attachment = attachment; m_attachmentSet = true; } 110 110 void setClip(EFillBox b) { m_clip = b; m_clipSet = true; } … … 203 203 unsigned m_yPosSet : 1; 204 204 unsigned m_backgroundOriginSet : 1; 205 unsigned m_backgroundXOrigin : 2; // BackgroundEdgeOrigin206 unsigned m_backgroundYOrigin : 2; // BackgroundEdgeOrigin205 unsigned m_backgroundXOrigin : 2; // Edge 206 unsigned m_backgroundYOrigin : 2; // Edge 207 207 unsigned m_compositeSet : 1; 208 208 unsigned m_blendModeSet : 1; -
releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/style/RenderStyleConstants.cpp
r195892 r197097 86 86 } 87 87 88 TextStream& operator<<(TextStream& ts, BackgroundEdgeOriginedge)88 TextStream& operator<<(TextStream& ts, Edge edge) 89 89 { 90 90 switch (edge) { 91 case TopEdge: ts << "top"; break;92 case RightEdge: ts << "right"; break;93 case BottomEdge: ts << "bottom"; break;94 case LeftEdge: ts << "left"; break;91 case Edge::Top: ts << "top"; break; 92 case Edge::Right: ts << "right"; break; 93 case Edge::Bottom: ts << "bottom"; break; 94 case Edge::Left: ts << "left"; break; 95 95 } 96 96 return ts; -
releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/style/RenderStyleConstants.h
r196075 r197097 231 231 enum EFillSizeType { Contain, Cover, SizeLength, SizeNone }; 232 232 233 // CSS3 Background Position234 enum BackgroundEdgeOrigin { TopEdge, RightEdge, BottomEdge, LeftEdge};233 // CSS3 <position> 234 enum class Edge { Top, Right, Bottom, Left }; 235 235 236 236 // CSS3 Mask Source Types … … 695 695 TextStream& operator<<(TextStream&, EFillRepeat); 696 696 TextStream& operator<<(TextStream&, EMaskSourceType); 697 TextStream& operator<<(TextStream&, BackgroundEdgeOrigin);697 TextStream& operator<<(TextStream&, Edge); 698 698 699 699 } // namespace WebCore
Note:
See TracChangeset
for help on using the changeset viewer.