Title: [163152] trunk/Source/WebCore
Revision
163152
Author
[email protected]
Date
2014-01-30 19:52:14 -0800 (Thu, 30 Jan 2014)

Log Message

Subpixel rendering: Change BorderData's width from unsigned to float to enable subpixel border painting.
https://bugs.webkit.org/show_bug.cgi?id=127949

Reviewed by Andreas Kling.

Covered by existing tests. No change in functionality.

* css/DeprecatedStyleBuilder.cpp:
(WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
* page/animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::calcBorderStart):
(WebCore::RenderTable::calcBorderEnd):
* rendering/style/BorderValue.h:
(WebCore::BorderValue::BorderValue):
(WebCore::BorderValue::width):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::borderBeforeWidth):
(WebCore::RenderStyle::borderAfterWidth):
(WebCore::RenderStyle::borderStartWidth):
(WebCore::RenderStyle::borderEndWidth):
* rendering/style/RenderStyle.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (163151 => 163152)


--- trunk/Source/WebCore/ChangeLog	2014-01-31 03:38:06 UTC (rev 163151)
+++ trunk/Source/WebCore/ChangeLog	2014-01-31 03:52:14 UTC (rev 163152)
@@ -1,3 +1,29 @@
+2014-01-30  Zalan Bujtas  <[email protected]>
+
+        Subpixel rendering: Change BorderData's width from unsigned to float to enable subpixel border painting.
+        https://bugs.webkit.org/show_bug.cgi?id=127949
+
+        Reviewed by Andreas Kling.
+
+        Covered by existing tests. No change in functionality.
+
+        * css/DeprecatedStyleBuilder.cpp:
+        (WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
+        * page/animation/CSSPropertyAnimation.cpp:
+        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::calcBorderStart):
+        (WebCore::RenderTable::calcBorderEnd):
+        * rendering/style/BorderValue.h:
+        (WebCore::BorderValue::BorderValue):
+        (WebCore::BorderValue::width):
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::borderBeforeWidth):
+        (WebCore::RenderStyle::borderAfterWidth):
+        (WebCore::RenderStyle::borderStartWidth):
+        (WebCore::RenderStyle::borderEndWidth):
+        * rendering/style/RenderStyle.h:
+
 2014-01-30  David Kilzer  <[email protected]>
 
         Add security-checked cast for WebCore::CachedImage

Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (163151 => 163152)


--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp	2014-01-31 03:38:06 UTC (rev 163151)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp	2014-01-31 03:52:14 UTC (rev 163152)
@@ -2352,7 +2352,7 @@
     setPropertyHandler(CSSPropertyBorderBottomLeftRadius, ApplyPropertyBorderRadius<&RenderStyle::borderBottomLeftRadius, &RenderStyle::setBorderBottomLeftRadius, &RenderStyle::initialBorderRadius>::createHandler());
     setPropertyHandler(CSSPropertyBorderBottomRightRadius, ApplyPropertyBorderRadius<&RenderStyle::borderBottomRightRadius, &RenderStyle::setBorderBottomRightRadius, &RenderStyle::initialBorderRadius>::createHandler());
     setPropertyHandler(CSSPropertyBorderBottomStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderBottomStyle, EBorderStyle, &RenderStyle::setBorderBottomStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
-    setPropertyHandler(CSSPropertyBorderBottomWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderBottomWidth, &RenderStyle::setBorderBottomWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
+    setPropertyHandler(CSSPropertyBorderBottomWidth, ApplyPropertyComputeLength<float, &RenderStyle::borderBottomWidth, &RenderStyle::setBorderBottomWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
     setPropertyHandler(CSSPropertyBorderCollapse, ApplyPropertyDefault<EBorderCollapse, &RenderStyle::borderCollapse, EBorderCollapse, &RenderStyle::setBorderCollapse, EBorderCollapse, &RenderStyle::initialBorderCollapse>::createHandler());
     setPropertyHandler(CSSPropertyBorderImageOutset, ApplyPropertyBorderImageModifier<BorderImage, Outset>::createHandler());
     setPropertyHandler(CSSPropertyBorderImageRepeat, ApplyPropertyBorderImageModifier<BorderImage, Repeat>::createHandler());
@@ -2361,15 +2361,15 @@
     setPropertyHandler(CSSPropertyBorderImageWidth, ApplyPropertyBorderImageModifier<BorderImage, Width>::createHandler());
     setPropertyHandler(CSSPropertyBorderLeftColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderLeftColor, &RenderStyle::setBorderLeftColor, &RenderStyle::setVisitedLinkBorderLeftColor, &RenderStyle::color>::createHandler());
     setPropertyHandler(CSSPropertyBorderLeftStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderLeftStyle, EBorderStyle, &RenderStyle::setBorderLeftStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
-    setPropertyHandler(CSSPropertyBorderLeftWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderLeftWidth, &RenderStyle::setBorderLeftWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
+    setPropertyHandler(CSSPropertyBorderLeftWidth, ApplyPropertyComputeLength<float, &RenderStyle::borderLeftWidth, &RenderStyle::setBorderLeftWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
     setPropertyHandler(CSSPropertyBorderRightColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderRightColor, &RenderStyle::setBorderRightColor, &RenderStyle::setVisitedLinkBorderRightColor, &RenderStyle::color>::createHandler());
     setPropertyHandler(CSSPropertyBorderRightStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderRightStyle, EBorderStyle, &RenderStyle::setBorderRightStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
-    setPropertyHandler(CSSPropertyBorderRightWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
+    setPropertyHandler(CSSPropertyBorderRightWidth, ApplyPropertyComputeLength<float, &RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
     setPropertyHandler(CSSPropertyBorderTopColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderTopColor, &RenderStyle::setBorderTopColor, &RenderStyle::setVisitedLinkBorderTopColor, &RenderStyle::color>::createHandler());
     setPropertyHandler(CSSPropertyBorderTopLeftRadius, ApplyPropertyBorderRadius<&RenderStyle::borderTopLeftRadius, &RenderStyle::setBorderTopLeftRadius, &RenderStyle::initialBorderRadius>::createHandler());
     setPropertyHandler(CSSPropertyBorderTopRightRadius, ApplyPropertyBorderRadius<&RenderStyle::borderTopRightRadius, &RenderStyle::setBorderTopRightRadius, &RenderStyle::initialBorderRadius>::createHandler());
     setPropertyHandler(CSSPropertyBorderTopStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderTopStyle, EBorderStyle, &RenderStyle::setBorderTopStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
-    setPropertyHandler(CSSPropertyBorderTopWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
+    setPropertyHandler(CSSPropertyBorderTopWidth, ApplyPropertyComputeLength<float, &RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
     setPropertyHandler(CSSPropertyBottom, ApplyPropertyLength<&RenderStyle::bottom, &RenderStyle::setBottom, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
     setPropertyHandler(CSSPropertyBoxSizing, ApplyPropertyDefault<EBoxSizing, &RenderStyle::boxSizing, EBoxSizing, &RenderStyle::setBoxSizing, EBoxSizing, &RenderStyle::initialBoxSizing>::createHandler());
     setPropertyHandler(CSSPropertyCaptionSide, ApplyPropertyDefault<ECaptionSide, &RenderStyle::captionSide, ECaptionSide, &RenderStyle::setCaptionSide, ECaptionSide, &RenderStyle::initialCaptionSide>::createHandler());

Modified: trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp (163151 => 163152)


--- trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp	2014-01-31 03:38:06 UTC (rev 163151)
+++ trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp	2014-01-31 03:52:14 UTC (rev 163152)
@@ -1150,10 +1150,10 @@
 
         new PropertyWrapperFlex(),
 
-        new PropertyWrapper<unsigned>(CSSPropertyBorderLeftWidth, &RenderStyle::borderLeftWidth, &RenderStyle::setBorderLeftWidth),
-        new PropertyWrapper<unsigned>(CSSPropertyBorderRightWidth, &RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth),
-        new PropertyWrapper<unsigned>(CSSPropertyBorderTopWidth, &RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth),
-        new PropertyWrapper<unsigned>(CSSPropertyBorderBottomWidth, &RenderStyle::borderBottomWidth, &RenderStyle::setBorderBottomWidth),
+        new PropertyWrapper<float>(CSSPropertyBorderLeftWidth, &RenderStyle::borderLeftWidth, &RenderStyle::setBorderLeftWidth),
+        new PropertyWrapper<float>(CSSPropertyBorderRightWidth, &RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth),
+        new PropertyWrapper<float>(CSSPropertyBorderTopWidth, &RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth),
+        new PropertyWrapper<float>(CSSPropertyBorderBottomWidth, &RenderStyle::borderBottomWidth, &RenderStyle::setBorderBottomWidth),
         new LengthPropertyWrapper<Length>(CSSPropertyMarginLeft, &RenderStyle::marginLeft, &RenderStyle::setMarginLeft),
         new LengthPropertyWrapper<Length>(CSSPropertyMarginRight, &RenderStyle::marginRight, &RenderStyle::setMarginRight),
         new LengthPropertyWrapper<Length>(CSSPropertyMarginTop, &RenderStyle::marginTop, &RenderStyle::setMarginTop),

Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (163151 => 163152)


--- trunk/Source/WebCore/rendering/RenderTable.cpp	2014-01-31 03:38:06 UTC (rev 163151)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp	2014-01-31 03:52:14 UTC (rev 163152)
@@ -961,7 +961,7 @@
     if (!numEffCols())
         return 0;
 
-    unsigned borderWidth = 0;
+    float borderWidth = 0;
 
     const BorderValue& tableStartBorder = style().borderStart();
     if (tableStartBorder.style() == BHIDDEN)
@@ -1015,7 +1015,7 @@
     if (!numEffCols())
         return 0;
 
-    unsigned borderWidth = 0;
+    float borderWidth = 0;
 
     const BorderValue& tableEndBorder = style().borderEnd();
     if (tableEndBorder.style() == BHIDDEN)

Modified: trunk/Source/WebCore/rendering/style/BorderValue.h (163151 => 163152)


--- trunk/Source/WebCore/rendering/style/BorderValue.h	2014-01-31 03:38:06 UTC (rev 163151)
+++ trunk/Source/WebCore/rendering/style/BorderValue.h	2014-01-31 03:52:14 UTC (rev 163152)
@@ -34,9 +34,9 @@
 friend class RenderStyle;
 public:
     BorderValue()
-        : m_color(0)
+        : m_width(3)
+        , m_color(0)
         , m_colorIsValid(false)
-        , m_width(3)
         , m_style(BNONE)
         , m_isAuto(AUTO_OFF)
     {
@@ -75,14 +75,14 @@
 
     Color color() const { return Color(m_color, m_colorIsValid); }
 
-    unsigned width() const { return m_width; }
+    float width() const { return m_width; }
     EBorderStyle style() const { return static_cast<EBorderStyle>(m_style); }
 
 protected:
+    float m_width;
     RGBA32 m_color;
     unsigned m_colorIsValid : 1;
 
-    unsigned m_width : 26;
     unsigned m_style : 4; // EBorderStyle
 
     // This is only used by OutlineValue but moved here to keep the bits packed.

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (163151 => 163152)


--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2014-01-31 03:38:06 UTC (rev 163151)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2014-01-31 03:52:14 UTC (rev 163152)
@@ -54,8 +54,9 @@
 namespace WebCore {
 
 struct SameSizeAsBorderValue {
+    float m_width;
     RGBA32 m_color;
-    unsigned m_width;
+    int m_restBits;
 };
 
 COMPILE_ASSERT(sizeof(BorderValue) == sizeof(SameSizeAsBorderValue), BorderValue_should_not_grow);
@@ -1682,7 +1683,7 @@
     return isLeftToRightDirection() ? borderBottom() : borderTop();
 }
 
-unsigned short RenderStyle::borderBeforeWidth() const
+float RenderStyle::borderBeforeWidth() const
 {
     switch (writingMode()) {
     case TopToBottomWritingMode:
@@ -1698,7 +1699,7 @@
     return borderTopWidth();
 }
 
-unsigned short RenderStyle::borderAfterWidth() const
+float RenderStyle::borderAfterWidth() const
 {
     switch (writingMode()) {
     case TopToBottomWritingMode:
@@ -1714,14 +1715,14 @@
     return borderBottomWidth();
 }
 
-unsigned short RenderStyle::borderStartWidth() const
+float RenderStyle::borderStartWidth() const
 {
     if (isHorizontalWritingMode())
         return isLeftToRightDirection() ? borderLeftWidth() : borderRightWidth();
     return isLeftToRightDirection() ? borderTopWidth() : borderBottomWidth();
 }
 
-unsigned short RenderStyle::borderEndWidth() const
+float RenderStyle::borderEndWidth() const
 {
     if (isHorizontalWritingMode())
         return isLeftToRightDirection() ? borderRightWidth() : borderLeftWidth();

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (163151 => 163152)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2014-01-31 03:38:06 UTC (rev 163151)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2014-01-31 03:52:14 UTC (rev 163152)
@@ -503,23 +503,23 @@
     const LengthSize& borderBottomRightRadius() const { return surround->border.bottomRight(); }
     bool hasBorderRadius() const { return surround->border.hasBorderRadius(); }
 
-    unsigned borderLeftWidth() const { return surround->border.borderLeftWidth(); }
+    float borderLeftWidth() const { return surround->border.borderLeftWidth(); }
     EBorderStyle borderLeftStyle() const { return surround->border.left().style(); }
     bool borderLeftIsTransparent() const { return surround->border.left().isTransparent(); }
-    unsigned borderRightWidth() const { return surround->border.borderRightWidth(); }
+    float borderRightWidth() const { return surround->border.borderRightWidth(); }
     EBorderStyle borderRightStyle() const { return surround->border.right().style(); }
     bool borderRightIsTransparent() const { return surround->border.right().isTransparent(); }
-    unsigned borderTopWidth() const { return surround->border.borderTopWidth(); }
+    float borderTopWidth() const { return surround->border.borderTopWidth(); }
     EBorderStyle borderTopStyle() const { return surround->border.top().style(); }
     bool borderTopIsTransparent() const { return surround->border.top().isTransparent(); }
-    unsigned borderBottomWidth() const { return surround->border.borderBottomWidth(); }
+    float borderBottomWidth() const { return surround->border.borderBottomWidth(); }
     EBorderStyle borderBottomStyle() const { return surround->border.bottom().style(); }
     bool borderBottomIsTransparent() const { return surround->border.bottom().isTransparent(); }
     
-    unsigned short borderBeforeWidth() const;
-    unsigned short borderAfterWidth() const;
-    unsigned short borderStartWidth() const;
-    unsigned short borderEndWidth() const;
+    float borderBeforeWidth() const;
+    float borderAfterWidth() const;
+    float borderStartWidth() const;
+    float borderEndWidth() const;
 
     unsigned short outlineSize() const { return std::max(0, outlineWidth() + outlineOffset()); }
     unsigned short outlineWidth() const
@@ -1091,16 +1091,16 @@
     RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect,
         int topWidth, int bottomWidth, int leftWidth, int rightWidth, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const;
 
-    void setBorderLeftWidth(unsigned v) { SET_VAR(surround, border.m_left.m_width, v); }
+    void setBorderLeftWidth(float v) { SET_VAR(surround, border.m_left.m_width, v); }
     void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.m_left.m_style, v); }
     void setBorderLeftColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_left, v); }
-    void setBorderRightWidth(unsigned v) { SET_VAR(surround, border.m_right.m_width, v); }
+    void setBorderRightWidth(float v) { SET_VAR(surround, border.m_right.m_width, v); }
     void setBorderRightStyle(EBorderStyle v) { SET_VAR(surround, border.m_right.m_style, v); }
     void setBorderRightColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_right, v); }
-    void setBorderTopWidth(unsigned v) { SET_VAR(surround, border.m_top.m_width, v); }
+    void setBorderTopWidth(float v) { SET_VAR(surround, border.m_top.m_width, v); }
     void setBorderTopStyle(EBorderStyle v) { SET_VAR(surround, border.m_top.m_style, v); }
     void setBorderTopColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_top, v); }
-    void setBorderBottomWidth(unsigned v) { SET_VAR(surround, border.m_bottom.m_width, v); }
+    void setBorderBottomWidth(float v) { SET_VAR(surround, border.m_bottom.m_width, v); }
     void setBorderBottomStyle(EBorderStyle v) { SET_VAR(surround, border.m_bottom.m_style, v); }
     void setBorderBottomColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_bottom, v); }
 
@@ -1649,7 +1649,7 @@
 #endif
     static Color initialColor() { return Color::black; }
     static StyleImage* initialListStyleImage() { return 0; }
-    static unsigned initialBorderWidth() { return 3; }
+    static float initialBorderWidth() { return 3; }
     static unsigned short initialColumnRuleWidth() { return 3; }
     static unsigned short initialOutlineWidth() { return 3; }
     static float initialLetterSpacing() { return 0; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to