Changeset 105403 in webkit
- Timestamp:
- Jan 19, 2012 4:59:52 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r105402 r105403 1 2012-01-19 Alexis Menard <alexis.menard@openbossa.org> 2 3 Strange Result for getComputedStyle on borderWidth set in em 4 https://bugs.webkit.org/show_bug.cgi?id=18294 5 6 Reviewed by Tony Chang. 7 8 This test covers that setting big values to border-width will 9 return correct values. 10 11 * fast/css/border-width-large-expected.txt: Added. 12 * fast/css/border-width-large.html: Added. 13 1 14 2012-01-18 Nikolas Zimmermann <nzimmermann@rim.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r105402 r105403 1 2012-01-19 Alexis Menard <alexis.menard@openbossa.org> 2 3 Strange Result for getComputedStyle on borderWidth set in em 4 https://bugs.webkit.org/show_bug.cgi?id=18294 5 6 Reviewed by Tony Chang. 7 8 BorderValue stores its width on a 12 bits unsigned. This patch 9 increase it to 27. The patch also modify the way to set the 10 width or to get it, we now use a unsigned rather than a short. 11 12 Test: fast/css/border-width-large.html 13 14 * css/CSSPrimitiveValue.cpp: 15 (WebCore::CSSPrimitiveValue::computeLength): 16 * css/CSSStyleApplyProperty.cpp: 17 (WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty): 18 * page/animation/AnimationBase.cpp: 19 (WebCore::blendFunc): 20 (WebCore::AnimationBase::ensurePropertyMap): 21 * platform/animation/AnimationUtilities.h: 22 (WebCore::blend): 23 * rendering/RenderTheme.cpp: 24 (WebCore::RenderTheme::adjustStyle): 25 * rendering/style/BorderData.h: 26 (WebCore::BorderData::borderLeftWidth): 27 (WebCore::BorderData::borderRightWidth): 28 (WebCore::BorderData::borderTopWidth): 29 (WebCore::BorderData::borderBottomWidth): 30 * rendering/style/BorderValue.h: 31 (WebCore::BorderValue::width): 32 * rendering/style/RenderStyle.cpp: 33 * rendering/style/RenderStyle.h: 34 (WebCore::RenderStyleBitfields::borderLeftWidth): 35 (WebCore::RenderStyleBitfields::borderRightWidth): 36 (WebCore::RenderStyleBitfields::borderTopWidth): 37 (WebCore::RenderStyleBitfields::borderBottomWidth): 38 (WebCore::RenderStyleBitfields::setBorderLeftWidth): 39 (WebCore::RenderStyleBitfields::setBorderRightWidth): 40 (WebCore::RenderStyleBitfields::setBorderTopWidth): 41 (WebCore::RenderStyleBitfields::setBorderBottomWidth): 42 (WebCore::RenderStyleBitfields::initialBorderWidth): 43 (WebCore::RenderStyleBitfields::initialColumnRuleWidth): 44 (WebCore::RenderStyleBitfields::initialOutlineWidth): 45 1 46 2012-01-18 Nikolas Zimmermann <nzimmermann@rim.com> 2 47 -
trunk/Source/WebCore/css/CSSPrimitiveValue.cpp
r105135 r105403 361 361 } 362 362 363 template<> unsigned CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, double multiplier, bool computingFontSize) 364 { 365 return roundForImpreciseConversion<unsigned, UINT_MAX, 0>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize)); 366 } 367 363 368 template<> Length CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, double multiplier, bool computingFontSize) 364 369 { -
trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp
r105049 r105403 1699 1699 setPropertyHandler(CSSPropertyBorderLeftStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderLeftStyle, EBorderStyle, &RenderStyle::setBorderLeftStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler()); 1700 1700 1701 setPropertyHandler(CSSPropertyBorderTopWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());1702 setPropertyHandler(CSSPropertyBorderRightWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());1703 setPropertyHandler(CSSPropertyBorderBottomWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::borderBottomWidth, &RenderStyle::setBorderBottomWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());1704 setPropertyHandler(CSSPropertyBorderLeftWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::borderLeftWidth, &RenderStyle::setBorderLeftWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());1705 setPropertyHandler(CSSPropertyOutlineWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::outlineWidth, &RenderStyle::setOutlineWidth, &RenderStyle::initial BorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());1706 setPropertyHandler(CSSPropertyWebkitColumnRuleWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::columnRuleWidth, &RenderStyle::setColumnRuleWidth, &RenderStyle::initial BorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());1701 setPropertyHandler(CSSPropertyBorderTopWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler()); 1702 setPropertyHandler(CSSPropertyBorderRightWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler()); 1703 setPropertyHandler(CSSPropertyBorderBottomWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderBottomWidth, &RenderStyle::setBorderBottomWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler()); 1704 setPropertyHandler(CSSPropertyBorderLeftWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderLeftWidth, &RenderStyle::setBorderLeftWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler()); 1705 setPropertyHandler(CSSPropertyOutlineWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::outlineWidth, &RenderStyle::setOutlineWidth, &RenderStyle::initialOutlineWidth, NormalDisabled, ThicknessEnabled>::createHandler()); 1706 setPropertyHandler(CSSPropertyWebkitColumnRuleWidth, ApplyPropertyComputeLength<unsigned short, &RenderStyle::columnRuleWidth, &RenderStyle::setColumnRuleWidth, &RenderStyle::initialColumnRuleWidth, NormalDisabled, ThicknessEnabled>::createHandler()); 1707 1707 1708 1708 setPropertyHandler(CSSPropertyBorderTop, ApplyPropertyExpanding<SuppressValue, CSSPropertyBorderTopColor, CSSPropertyBorderTopStyle, CSSPropertyBorderTopWidth>::createHandler()); -
trunk/Source/WebCore/page/animation/AnimationBase.cpp
r104047 r105403 85 85 } 86 86 87 static inline unsigned blendFunc(const AnimationBase*, unsigned from, unsigned to, double progress) 88 { 89 return blend(from, to, progress); 90 } 91 87 92 static inline double blendFunc(const AnimationBase*, double from, double to, double progress) 88 93 { … … 951 956 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMaxHeight, &RenderStyle::maxHeight, &RenderStyle::setMaxHeight)); 952 957 953 gPropertyWrappers->append(new PropertyWrapper<unsigned short>(CSSPropertyBorderLeftWidth, &RenderStyle::borderLeftWidth, &RenderStyle::setBorderLeftWidth));954 gPropertyWrappers->append(new PropertyWrapper<unsigned short>(CSSPropertyBorderRightWidth, &RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth));955 gPropertyWrappers->append(new PropertyWrapper<unsigned short>(CSSPropertyBorderTopWidth, &RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth));956 gPropertyWrappers->append(new PropertyWrapper<unsigned short>(CSSPropertyBorderBottomWidth, &RenderStyle::borderBottomWidth, &RenderStyle::setBorderBottomWidth));958 gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderLeftWidth, &RenderStyle::borderLeftWidth, &RenderStyle::setBorderLeftWidth)); 959 gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderRightWidth, &RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth)); 960 gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderTopWidth, &RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth)); 961 gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderBottomWidth, &RenderStyle::borderBottomWidth, &RenderStyle::setBorderBottomWidth)); 957 962 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginLeft, &RenderStyle::marginLeft, &RenderStyle::setMarginLeft)); 958 963 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginRight, &RenderStyle::marginRight, &RenderStyle::setMarginRight)); -
trunk/Source/WebCore/platform/animation/AnimationUtilities.h
r102745 r105403 36 36 } 37 37 38 inline unsigned blend(unsigned from, unsigned to, double progress) 39 { 40 return static_cast<unsigned>(lround(static_cast<double>(from) + static_cast<double>(to - from) * progress)); 41 } 42 38 43 inline double blend(double from, double to, double progress) 39 44 { -
trunk/Source/WebCore/rendering/RenderTheme.cpp
r102655 r105403 112 112 LengthBox borderBox(style->borderTopWidth(), style->borderRightWidth(), style->borderBottomWidth(), style->borderLeftWidth()); 113 113 borderBox = m_theme->controlBorder(part, style->font(), borderBox, style->effectiveZoom()); 114 if (borderBox.top().value() != st yle->borderTopWidth()) {114 if (borderBox.top().value() != static_cast<int>(style->borderTopWidth())) { 115 115 if (borderBox.top().value()) 116 116 style->setBorderTopWidth(borderBox.top().value()); … … 118 118 style->resetBorderTop(); 119 119 } 120 if (borderBox.right().value() != st yle->borderRightWidth()) {120 if (borderBox.right().value() != static_cast<int>(style->borderRightWidth())) { 121 121 if (borderBox.right().value()) 122 122 style->setBorderRightWidth(borderBox.right().value()); … … 124 124 style->resetBorderRight(); 125 125 } 126 if (borderBox.bottom().value() != st yle->borderBottomWidth()) {126 if (borderBox.bottom().value() != static_cast<int>(style->borderBottomWidth())) { 127 127 style->setBorderBottomWidth(borderBox.bottom().value()); 128 128 if (borderBox.bottom().value()) … … 131 131 style->resetBorderBottom(); 132 132 } 133 if (borderBox.left().value() != st yle->borderLeftWidth()) {133 if (borderBox.left().value() != static_cast<int>(style->borderLeftWidth())) { 134 134 style->setBorderLeftWidth(borderBox.left().value()); 135 135 if (borderBox.left().value()) -
trunk/Source/WebCore/rendering/style/BorderData.h
r81625 r105403 61 61 } 62 62 63 unsigned shortborderLeftWidth() const63 unsigned borderLeftWidth() const 64 64 { 65 65 if (!m_image.hasImage() && (m_left.style() == BNONE || m_left.style() == BHIDDEN)) … … 68 68 } 69 69 70 unsigned shortborderRightWidth() const70 unsigned borderRightWidth() const 71 71 { 72 72 if (!m_image.hasImage() && (m_right.style() == BNONE || m_right.style() == BHIDDEN)) … … 75 75 } 76 76 77 unsigned shortborderTopWidth() const77 unsigned borderTopWidth() const 78 78 { 79 79 if (!m_image.hasImage() && (m_top.style() == BNONE || m_top.style() == BHIDDEN)) … … 82 82 } 83 83 84 unsigned shortborderBottomWidth() const84 unsigned borderBottomWidth() const 85 85 { 86 86 if (!m_image.hasImage() && (m_bottom.style() == BNONE || m_bottom.style() == BHIDDEN)) -
trunk/Source/WebCore/rendering/style/BorderValue.h
r97046 r105403 67 67 68 68 const Color& color() const { return m_color; } 69 unsigned shortwidth() const { return m_width; }69 unsigned width() const { return m_width; } 70 70 EBorderStyle style() const { return static_cast<EBorderStyle>(m_style); } 71 71 72 72 protected: 73 73 Color m_color; 74 unsigned m_width : 12;74 unsigned m_width : 27; 75 75 unsigned m_style : 4; // EBorderStyle 76 76 -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r103656 r105403 44 44 45 45 namespace WebCore { 46 47 struct SameSizeAsBorderValue { 48 Color m_color; 49 unsigned m_width; 50 }; 51 52 COMPILE_ASSERT(sizeof(BorderValue) == sizeof(SameSizeAsBorderValue), BorderValue_should_not_grow); 46 53 47 54 struct SameSizeAsRenderStyle : public RefCounted<SameSizeAsRenderStyle> { -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r105015 r105403 546 546 bool hasBorderRadius() const { return surround->border.hasBorderRadius(); } 547 547 548 unsigned shortborderLeftWidth() const { return surround->border.borderLeftWidth(); }548 unsigned borderLeftWidth() const { return surround->border.borderLeftWidth(); } 549 549 EBorderStyle borderLeftStyle() const { return surround->border.left().style(); } 550 550 bool borderLeftIsTransparent() const { return surround->border.left().isTransparent(); } 551 unsigned shortborderRightWidth() const { return surround->border.borderRightWidth(); }551 unsigned borderRightWidth() const { return surround->border.borderRightWidth(); } 552 552 EBorderStyle borderRightStyle() const { return surround->border.right().style(); } 553 553 bool borderRightIsTransparent() const { return surround->border.right().isTransparent(); } 554 unsigned shortborderTopWidth() const { return surround->border.borderTopWidth(); }554 unsigned borderTopWidth() const { return surround->border.borderTopWidth(); } 555 555 EBorderStyle borderTopStyle() const { return surround->border.top().style(); } 556 556 bool borderTopIsTransparent() const { return surround->border.top().isTransparent(); } 557 unsigned shortborderBottomWidth() const { return surround->border.borderBottomWidth(); }557 unsigned borderBottomWidth() const { return surround->border.borderBottomWidth(); } 558 558 EBorderStyle borderBottomStyle() const { return surround->border.bottom().style(); } 559 559 bool borderBottomIsTransparent() const { return surround->border.bottom().isTransparent(); } … … 1044 1044 LayoutUnit topWidth, LayoutUnit bottomWidth, LayoutUnit leftWidth, LayoutUnit rightWidth, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const; 1045 1045 1046 void setBorderLeftWidth(unsigned shortv) { SET_VAR(surround, border.m_left.m_width, v) }1046 void setBorderLeftWidth(unsigned v) { SET_VAR(surround, border.m_left.m_width, v) } 1047 1047 void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.m_left.m_style, v) } 1048 1048 void setBorderLeftColor(const Color& v) { SET_VAR(surround, border.m_left.m_color, v) } 1049 void setBorderRightWidth(unsigned shortv) { SET_VAR(surround, border.m_right.m_width, v) }1049 void setBorderRightWidth(unsigned v) { SET_VAR(surround, border.m_right.m_width, v) } 1050 1050 void setBorderRightStyle(EBorderStyle v) { SET_VAR(surround, border.m_right.m_style, v) } 1051 1051 void setBorderRightColor(const Color& v) { SET_VAR(surround, border.m_right.m_color, v) } 1052 void setBorderTopWidth(unsigned shortv) { SET_VAR(surround, border.m_top.m_width, v) }1052 void setBorderTopWidth(unsigned v) { SET_VAR(surround, border.m_top.m_width, v) } 1053 1053 void setBorderTopStyle(EBorderStyle v) { SET_VAR(surround, border.m_top.m_style, v) } 1054 1054 void setBorderTopColor(const Color& v) { SET_VAR(surround, border.m_top.m_color, v) } 1055 void setBorderBottomWidth(unsigned shortv) { SET_VAR(surround, border.m_bottom.m_width, v) }1055 void setBorderBottomWidth(unsigned v) { SET_VAR(surround, border.m_bottom.m_width, v) } 1056 1056 void setBorderBottomStyle(EBorderStyle v) { SET_VAR(surround, border.m_bottom.m_style, v) } 1057 1057 void setBorderBottomColor(const Color& v) { SET_VAR(surround, border.m_bottom.m_color, v) } … … 1514 1514 static Color initialColor() { return Color::black; } 1515 1515 static StyleImage* initialListStyleImage() { return 0; } 1516 static unsigned short initialBorderWidth() { return 3; } 1516 static unsigned initialBorderWidth() { return 3; } 1517 static unsigned short initialColumnRuleWidth() { return 3; } 1518 static unsigned short initialOutlineWidth() { return 3; } 1517 1519 static int initialLetterWordSpacing() { return 0; } 1518 1520 static Length initialSize() { return Length(); }
Note: See TracChangeset
for help on using the changeset viewer.