Changeset 119455 in webkit
- Timestamp:
- Jun 4, 2012 9:38:19 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r119454 r119455 1 2012-06-04 Tony Chang <tony@chromium.org> 2 3 CSS property 'order' should be a number rather than an int 4 https://bugs.webkit.org/show_bug.cgi?id=88111 5 6 Reviewed by Ojan Vafai. 7 8 * css3/flexbox/css-properties-expected.txt: 9 * css3/flexbox/css-properties.html: Allow decimal values. 10 * css3/flexbox/flex-order.html: Fix tests based on float limits. 11 1 12 2012-06-04 Leo Yang <leo.yang@torchmobile.com.cn> 2 13 -
trunk/LayoutTests/css3/flexbox/css-properties-expected.txt
r119316 r119455 14 14 PASS flexitem.style.webkitOrder is "0" 15 15 PASS flexitem.style.webkitOrder is "0" 16 PASS flexitem.style.webkitOrder is " 0"16 PASS flexitem.style.webkitOrder is "1.5" 17 17 PASS flexitem.style.webkitOrder is "" 18 18 PASS flexbox.style.webkitJustifyContent is "" -
trunk/LayoutTests/css3/flexbox/css-properties.html
r119316 r119455 41 41 shouldBeEqualToString('flexitem.style.webkitOrder', '0'); 42 42 43 // -webkit-order must be an integer.44 flexitem.style.webkitOrder = 1.5;45 shouldBeEqualToString('flexitem.style.webkitOrder', '0');46 47 43 flexitem.style.webkitOrder = "test"; 48 44 shouldBeEqualToString('flexitem.style.webkitOrder', '0'); 45 46 flexitem.style.webkitOrder = 1.5; 47 shouldBeEqualToString('flexitem.style.webkitOrder', '1.5'); 49 48 50 49 flexitem.style.webkitOrder = ''; -
trunk/LayoutTests/css3/flexbox/flex-order.html
r119255 r119455 34 34 35 35 <div style="display: -webkit-flex" class="horizontal-box"> 36 <div class="first" style="-webkit- flex: 1; -webkit-order: 0"></div>37 <div class="second" style=" -webkit-flex: 1;"></div>38 <div class="third" style="-webkit- flex: 1; -webkit-order: 3"></div>39 <div class="fourth" style="-webkit- flex: 1; -webkit-order: 20"></div>36 <div class="first" style="-webkit-order: 0"></div> 37 <div class="second" style=""></div> 38 <div class="third" style="-webkit-order: 3"></div> 39 <div class="fourth" style="-webkit-order: 20"></div> 40 40 </div> 41 41 42 42 <div style="display: -webkit-flex" class="horizontal-box"> 43 <div class="fourth" style="-webkit- flex: 1; -webkit-order: 4"></div>44 <div class="third" style="-webkit- flex: 1; -webkit-order: 3"></div>45 <div class="second" style="-webkit- flex: 1; -webkit-order: 2"></div>46 <div class="first" style="-webkit- flex: 1; -webkit-order: 1"></div>43 <div class="fourth" style="-webkit-order: 4"></div> 44 <div class="third" style="-webkit-order: 3"></div> 45 <div class="second" style="-webkit-order: 2"></div> 46 <div class="first" style="-webkit-order: 1"></div> 47 47 </div> 48 48 49 49 <!-- The example from the spec. --> 50 50 <div style="display: -webkit-flex" class="horizontal-box"> 51 <div class="third" style="-webkit- flex: 1; -webkit-order: 1"></div>52 <div class="first" style=" -webkit-flex: 1"></div>53 <div class="fourth" style="-webkit- flex: 1; -webkit-order: 1"></div>54 <div class="second" style="-webkit- flex: 1; -webkit-order: 0"></div>51 <div class="third" style="-webkit-order: 1"></div> 52 <div class="first" style=""></div> 53 <div class="fourth" style="-webkit-order: 1"></div> 54 <div class="second" style="-webkit-order: 0"></div> 55 55 </div> 56 56 57 57 <div style="display: -webkit-flex" class="horizontal-box"> 58 <div class="fourth" style="-webkit- flex: 1; -webkit-order: 2"></div>59 <div class="second" style=" -webkit-flex: 1"></div>60 <div class="third" style=" -webkit-flex: 1"></div>61 <div class="first" style="-webkit- flex: 1; -webkit-order: -10"></div>58 <div class="fourth" style="-webkit-order: 2"></div> 59 <div class="second" style=""></div> 60 <div class="third" style=""></div> 61 <div class="first" style="-webkit-order: -10"></div> 62 62 </div> 63 63 64 64 <div style="display: -webkit-flex" class="horizontal-box"> 65 <div class="fourth" style="-webkit- flex: 1; -webkit-order: 2000000000"></div>66 <div class="second" style="-webkit- flex: 1; -webkit-order: 1000000000"></div>67 <div class="third" style="-webkit- flex: 1; -webkit-order: 1000000000"></div>68 <div class="first" style="-webkit- flex: 1; -webkit-order: -1000000000"></div>65 <div class="fourth" style="-webkit-order: 2000000000"></div> 66 <div class="second" style="-webkit-order: 1000000000"></div> 67 <div class="third" style="-webkit-order: 1000000000"></div> 68 <div class="first" style="-webkit-order: -1000000000"></div> 69 69 </div> 70 70 71 <!-- Floating numbers are ignored and we use the default of 1 instead. -->71 <!-- Decimal numbers are OK. --> 72 72 <div style="display: -webkit-flex" class="horizontal-box"> 73 <div class=" second" style="-webkit-flex: 1;-webkit-order: 2.5"></div>74 <div class=" fourth" style="-webkit-flex: 1; -webkit-order: 2"></div>75 <div class="first" style="-webkit- flex: 1; -webkit-order: -1"></div>76 <div class=" third" style="-webkit-flex: 1"></div>73 <div class="fourth" style="-webkit-order: 2.5"></div> 74 <div class="third" style="-webkit-order: 1.1"></div> 75 <div class="first" style="-webkit-order: -1.7"></div> 76 <div class="second" style=""></div> 77 77 </div> 78 78 79 79 <div style="display: -webkit-flex" class="horizontal-box"> 80 <div class="second" style="-webkit- flex: 1; -webkit-order: 0"></div>81 <div class="first" style="-webkit-flex: 1;-webkit-order: -1"></div>82 <div class="fourth" style="-webkit-flex: 1;-webkit-order: 1"></div>83 <div class="third" style=" -webkit-flex: 1"></div>80 <div class="second" style="-webkit-order: 0"></div> 81 <div class="first" style="-webkit-order: -1"></div> 82 <div class="fourth" style="-webkit-order: 1"></div> 83 <div class="third" style=""></div> 84 84 </div> 85 85 86 <!-- Values greater than what can be stored in an int are clamped from 87 -2,147,483,646 (int min + 2) to 2,147,483,647. --> 86 <!-- Values greater than what can be stored in a float are clamped. --> 88 87 <div style="display: -webkit-flex" class="horizontal-box"> 89 <div class="third" style="-webkit- flex: 1; -webkit-order: 4000000000"></div>90 <div class="fourth" style="-webkit- flex: 1; -webkit-order: 3000000000"></div>91 <div class="first" style=" -webkit-flex: 1;"></div>92 <div class="second" style="-webkit- flex: 1; -webkit-order: 2147483646"></div>88 <div class="third" style="-webkit-order: 99999999999999999999999999999999999999999"></div> 89 <div class="fourth" style="-webkit-order: 88888888888888888888888888888888888888888"></div> 90 <div class="first" style=""></div> 91 <div class="second" style="-webkit-order: 2147483646"></div> 93 92 </div> 94 93 95 94 <div style="display: -webkit-flex" class="horizontal-box"> 96 <div class=" second" style="-webkit-flex: 1;-webkit-order: 4000000000"></div>97 <div class="third" style="-webkit- flex: 1; -webkit-order: 3000000000"></div>98 <div class="first" style=" -webkit-flex: 1;"></div>99 <div class=" fourth" style="-webkit-flex: 1;-webkit-order: 2147483647"></div>95 <div class="fourth" style="-webkit-order: 4000000000"></div> 96 <div class="third" style="-webkit-order: 3000000000"></div> 97 <div class="first" style=""></div> 98 <div class="second" style="-webkit-order: 2147483647"></div> 100 99 </div> 101 100 102 101 <div style="display: -webkit-flex" class="horizontal-box"> 103 <div class=" third" style="-webkit-flex: 1; -webkit-order: -2147483645"></div>104 <div class=" first" style="-webkit-flex: 1; -webkit-order: -2147483646"></div>105 <div class=" second" style="-webkit-flex: 1; -webkit-order: -2147483647"></div>106 <div class="fourth" style=" -webkit-flex: 1;"></div>102 <div class="first" style="-webkit-order: -99999999999999999999999999999999999999999"></div> 103 <div class="second" style="-webkit-order: -88888888888888888888888888888888888888888"></div> 104 <div class="third" style="-webkit-order: -77777777777777777777777777777777777777777"></div> 105 <div class="fourth" style=""></div> 107 106 </div> 108 107 -
trunk/Source/WebCore/ChangeLog
r119452 r119455 1 2012-06-04 Tony Chang <tony@chromium.org> 2 3 CSS property 'order' should be a number rather than an int 4 https://bugs.webkit.org/show_bug.cgi?id=88111 5 6 Reviewed by Ojan Vafai. 7 8 This changed in the spec: 9 http://dev.w3.org/csswg/css3-flexbox/#order 10 11 I also fixed the compile with CSS3_FLEXBOX disabled. 12 13 No new tests, covered by existing tests. 14 15 * css/CSSComputedStyleDeclaration.cpp: 16 (WebCore): 17 (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): 18 * css/CSSParser.cpp: 19 (WebCore::CSSParser::parseValue): 20 * css/CSSProperty.cpp: Parse as float, remove clamping for HashMap<int>. 21 (WebCore::CSSProperty::isInheritedProperty): 22 * css/StyleBuilder.cpp: 23 (WebCore::StyleBuilder::StyleBuilder): 24 * css/StyleResolver.cpp: 25 (WebCore::StyleResolver::collectMatchingRulesForList): 26 * rendering/RenderFlexibleBox.cpp: Remove traits for HashMap<int>. 27 (RenderFlexibleBox::OrderIterator): 28 * rendering/RenderFlexibleBox.h: 29 * rendering/style/RenderStyle.h: 30 * rendering/style/StyleRareNonInheritedData.h: 31 (StyleRareNonInheritedData): 32 1 33 2012-06-04 Hugo Parente Lima <hugo.lima@openbossa.org> 2 34 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r119298 r119455 279 279 CSSPropertyWebkitMaskSize, 280 280 CSSPropertyWebkitNbspMode, 281 #if ENABLE(CSS3_FLEXBOX) 281 282 CSSPropertyWebkitOrder, 283 #endif 282 284 #if ENABLE(OVERFLOW_SCROLLING) 283 285 CSSPropertyWebkitOverflowScrolling, … … 1652 1654 } 1653 1655 case CSSPropertyWebkitOrder: 1654 return cssValuePool().createValue(style->order() , CSSPrimitiveValue::CSS_NUMBER);1656 return cssValuePool().createValue(style->order()); 1655 1657 case CSSPropertyWebkitJustifyContent: 1656 1658 return cssValuePool().createValue(style->justifyContent()); -
trunk/Source/WebCore/css/CSSParser.cpp
r119316 r119455 2097 2097 break; 2098 2098 case CSSPropertyWebkitOrder: 2099 if (validUnit(value, FInteger, CSSStrictMode)) { 2100 // We restrict the smallest value to int min + 2 because we use int min and int min + 1 as special values in a hash set. 2101 parsedValue = cssValuePool().createValue(max(static_cast<double>(std::numeric_limits<int>::min() + 2), value->fValue), 2102 static_cast<CSSPrimitiveValue::UnitTypes>(value->unit)); 2103 m_valueList->next(); 2104 } 2099 validPrimitive = validUnit(value, FNumber); 2105 2100 break; 2106 2101 #endif -
trunk/Source/WebCore/css/CSSProperty.cpp
r119298 r119455 548 548 case CSSPropertyWebkitFlexWrap: 549 549 case CSSPropertyWebkitJustifyContent: 550 case CSSPropertyWebkitOrder: 550 551 #endif 551 552 case CSSPropertyWebkitFontSizeDelta: … … 596 597 case CSSPropertyWebkitMinLogicalWidth: 597 598 case CSSPropertyWebkitMinLogicalHeight: 598 case CSSPropertyWebkitOrder:599 599 case CSSPropertyWebkitPaddingAfter: 600 600 case CSSPropertyWebkitPaddingBefore: -
trunk/Source/WebCore/css/StyleBuilder.cpp
r119298 r119455 1945 1945 setPropertyHandler(CSSPropertyWebkitFlexWrap, ApplyPropertyDefault<EFlexWrap, &RenderStyle::flexWrap, EFlexWrap, &RenderStyle::setFlexWrap, EFlexWrap, &RenderStyle::initialFlexWrap>::createHandler()); 1946 1946 setPropertyHandler(CSSPropertyWebkitJustifyContent, ApplyPropertyDefault<EJustifyContent, &RenderStyle::justifyContent, EJustifyContent, &RenderStyle::setJustifyContent, EJustifyContent, &RenderStyle::initialJustifyContent>::createHandler()); 1947 setPropertyHandler(CSSPropertyWebkitOrder, ApplyPropertyDefault<float, &RenderStyle::order, float, &RenderStyle::setOrder, float, &RenderStyle::initialOrder>::createHandler()); 1947 1948 #endif 1948 1949 #if ENABLE(CSS_REGIONS) … … 1990 1991 setPropertyHandler(CSSPropertyWebkitMatchNearestMailBlockquoteColor, ApplyPropertyDefault<EMatchNearestMailBlockquoteColor, &RenderStyle::matchNearestMailBlockquoteColor, EMatchNearestMailBlockquoteColor, &RenderStyle::setMatchNearestMailBlockquoteColor, EMatchNearestMailBlockquoteColor, &RenderStyle::initialMatchNearestMailBlockquoteColor>::createHandler()); 1991 1992 setPropertyHandler(CSSPropertyWebkitNbspMode, ApplyPropertyDefault<ENBSPMode, &RenderStyle::nbspMode, ENBSPMode, &RenderStyle::setNBSPMode, ENBSPMode, &RenderStyle::initialNBSPMode>::createHandler()); 1992 setPropertyHandler(CSSPropertyWebkitOrder, ApplyPropertyDefault<int, &RenderStyle::order, int, &RenderStyle::setOrder, int, &RenderStyle::initialOrder>::createHandler());1993 1993 setPropertyHandler(CSSPropertyWebkitPerspectiveOrigin, ApplyPropertyExpanding<SuppressValue, CSSPropertyWebkitPerspectiveOriginX, CSSPropertyWebkitPerspectiveOriginY>::createHandler()); 1994 1994 setPropertyHandler(CSSPropertyWebkitPerspectiveOriginX, ApplyPropertyLength<&RenderStyle::perspectiveOriginX, &RenderStyle::setPerspectiveOriginX, &RenderStyle::initialPerspectiveOriginX>::createHandler()); -
trunk/Source/WebCore/css/StyleResolver.cpp
r119408 r119455 4132 4132 case CSSPropertyWebkitFlexWrap: 4133 4133 case CSSPropertyWebkitJustifyContent: 4134 case CSSPropertyWebkitOrder: 4134 4135 #endif 4135 4136 #if ENABLE(CSS_REGIONS) … … 4172 4173 case CSSPropertyWebkitMatchNearestMailBlockquoteColor: 4173 4174 case CSSPropertyWebkitNbspMode: 4174 case CSSPropertyWebkitOrder:4175 4175 case CSSPropertyWebkitPerspectiveOrigin: 4176 4176 case CSSPropertyWebkitPerspectiveOriginX: -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r119316 r119455 40 40 namespace WebCore { 41 41 42 // Normally, -1 and 0 are not valid in a HashSet, but these are relatively likely flex-order values. Instead,43 // we make the two smallest int values invalid flex-order values (in the css parser code we clamp them to44 // int min + 2).45 struct RenderFlexibleBox::OrderHashTraits : WTF::GenericHashTraits<int> {46 static const bool emptyValueIsZero = false;47 static int emptyValue() { return std::numeric_limits<int>::min(); }48 static void constructDeletedValue(int& slot) { slot = std::numeric_limits<int>::min() + 1; }49 static bool isDeletedValue(int value) { return value == std::numeric_limits<int>::min() + 1; }50 };51 52 42 class RenderFlexibleBox::OrderIterator { 53 43 public: … … 100 90 RenderFlexibleBox* m_flexibleBox; 101 91 RenderBox* m_currentChild; 102 Vector< int> m_orderValues;103 Vector< int>::const_iterator m_orderValuesIterator;92 Vector<float> m_orderValues; 93 Vector<float>::const_iterator m_orderValuesIterator; 104 94 }; 105 95 -
trunk/Source/WebCore/rendering/RenderFlexibleBox.h
r119298 r119455 60 60 }; 61 61 62 struct OrderHashTraits; 63 typedef HashSet<int, DefaultHash<int>::Hash, OrderHashTraits> OrderHashSet; 62 typedef HashSet<float> OrderHashSet; 64 63 65 64 class OrderIterator; -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r119316 r119455 805 805 EBoxPack boxPack() const { return static_cast<EBoxPack>(rareNonInheritedData->m_deprecatedFlexibleBox->pack); } 806 806 807 int order() const { return rareNonInheritedData->m_order; }807 float order() const { return rareNonInheritedData->m_order; } 808 808 float positiveFlex() const { return rareNonInheritedData->m_flexibleBox->m_positiveFlex; } 809 809 float negativeFlex() const { return rareNonInheritedData->m_flexibleBox->m_negativeFlex; } … … 1250 1250 void setNegativeFlex(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_negativeFlex, f); } 1251 1251 void setFlexPreferredSize(Length l) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_preferredSize, l); } 1252 void setOrder( int o) { SET_VAR(rareNonInheritedData, m_order, o); }1252 void setOrder(float o) { SET_VAR(rareNonInheritedData, m_order, o); } 1253 1253 void setAlignContent(EAlignContent p) { SET_VAR(rareNonInheritedData, m_alignContent, p); } 1254 1254 void setAlignItems(EAlignItems a) { SET_VAR(rareNonInheritedData, m_alignItems, a); } … … 1584 1584 static float initialNegativeFlex() { return 1; } 1585 1585 static Length initialFlexPreferredSize() { return Length(Auto); } 1586 static int initialOrder() { return 0; }1586 static float initialOrder() { return 0; } 1587 1587 static EAlignContent initialAlignContent() { return AlignContentStretch; } 1588 1588 static EAlignItems initialAlignItems() { return AlignStretch; } -
trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h
r119298 r119455 147 147 Color m_visitedLinkBorderBottomColor; 148 148 149 int m_order;149 float m_order; 150 150 151 151 AtomicString m_flowThread;
Note: See TracChangeset
for help on using the changeset viewer.