Changeset 163152 in webkit


Ignore:
Timestamp:
Jan 30, 2014 7:52:14 PM (10 years ago)
Author:
Alan Bujtas
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:
Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r163148 r163152  
     12014-01-30  Zalan Bujtas  <zalan@apple.com>
     2
     3        Subpixel rendering: Change BorderData's width from unsigned to float to enable subpixel border painting.
     4        https://bugs.webkit.org/show_bug.cgi?id=127949
     5
     6        Reviewed by Andreas Kling.
     7
     8        Covered by existing tests. No change in functionality.
     9
     10        * css/DeprecatedStyleBuilder.cpp:
     11        (WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
     12        * page/animation/CSSPropertyAnimation.cpp:
     13        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
     14        * rendering/RenderTable.cpp:
     15        (WebCore::RenderTable::calcBorderStart):
     16        (WebCore::RenderTable::calcBorderEnd):
     17        * rendering/style/BorderValue.h:
     18        (WebCore::BorderValue::BorderValue):
     19        (WebCore::BorderValue::width):
     20        * rendering/style/RenderStyle.cpp:
     21        (WebCore::RenderStyle::borderBeforeWidth):
     22        (WebCore::RenderStyle::borderAfterWidth):
     23        (WebCore::RenderStyle::borderStartWidth):
     24        (WebCore::RenderStyle::borderEndWidth):
     25        * rendering/style/RenderStyle.h:
     26
    1272014-01-30  David Kilzer  <ddkilzer@apple.com>
    228
  • trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp

    r162579 r163152  
    23532353    setPropertyHandler(CSSPropertyBorderBottomRightRadius, ApplyPropertyBorderRadius<&RenderStyle::borderBottomRightRadius, &RenderStyle::setBorderBottomRightRadius, &RenderStyle::initialBorderRadius>::createHandler());
    23542354    setPropertyHandler(CSSPropertyBorderBottomStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderBottomStyle, EBorderStyle, &RenderStyle::setBorderBottomStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
    2355     setPropertyHandler(CSSPropertyBorderBottomWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderBottomWidth, &RenderStyle::setBorderBottomWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
     2355    setPropertyHandler(CSSPropertyBorderBottomWidth, ApplyPropertyComputeLength<float, &RenderStyle::borderBottomWidth, &RenderStyle::setBorderBottomWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
    23562356    setPropertyHandler(CSSPropertyBorderCollapse, ApplyPropertyDefault<EBorderCollapse, &RenderStyle::borderCollapse, EBorderCollapse, &RenderStyle::setBorderCollapse, EBorderCollapse, &RenderStyle::initialBorderCollapse>::createHandler());
    23572357    setPropertyHandler(CSSPropertyBorderImageOutset, ApplyPropertyBorderImageModifier<BorderImage, Outset>::createHandler());
     
    23622362    setPropertyHandler(CSSPropertyBorderLeftColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderLeftColor, &RenderStyle::setBorderLeftColor, &RenderStyle::setVisitedLinkBorderLeftColor, &RenderStyle::color>::createHandler());
    23632363    setPropertyHandler(CSSPropertyBorderLeftStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderLeftStyle, EBorderStyle, &RenderStyle::setBorderLeftStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
    2364     setPropertyHandler(CSSPropertyBorderLeftWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderLeftWidth, &RenderStyle::setBorderLeftWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
     2364    setPropertyHandler(CSSPropertyBorderLeftWidth, ApplyPropertyComputeLength<float, &RenderStyle::borderLeftWidth, &RenderStyle::setBorderLeftWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
    23652365    setPropertyHandler(CSSPropertyBorderRightColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderRightColor, &RenderStyle::setBorderRightColor, &RenderStyle::setVisitedLinkBorderRightColor, &RenderStyle::color>::createHandler());
    23662366    setPropertyHandler(CSSPropertyBorderRightStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderRightStyle, EBorderStyle, &RenderStyle::setBorderRightStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
    2367     setPropertyHandler(CSSPropertyBorderRightWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
     2367    setPropertyHandler(CSSPropertyBorderRightWidth, ApplyPropertyComputeLength<float, &RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
    23682368    setPropertyHandler(CSSPropertyBorderTopColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::borderTopColor, &RenderStyle::setBorderTopColor, &RenderStyle::setVisitedLinkBorderTopColor, &RenderStyle::color>::createHandler());
    23692369    setPropertyHandler(CSSPropertyBorderTopLeftRadius, ApplyPropertyBorderRadius<&RenderStyle::borderTopLeftRadius, &RenderStyle::setBorderTopLeftRadius, &RenderStyle::initialBorderRadius>::createHandler());
    23702370    setPropertyHandler(CSSPropertyBorderTopRightRadius, ApplyPropertyBorderRadius<&RenderStyle::borderTopRightRadius, &RenderStyle::setBorderTopRightRadius, &RenderStyle::initialBorderRadius>::createHandler());
    23712371    setPropertyHandler(CSSPropertyBorderTopStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::borderTopStyle, EBorderStyle, &RenderStyle::setBorderTopStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler());
    2372     setPropertyHandler(CSSPropertyBorderTopWidth, ApplyPropertyComputeLength<unsigned, &RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
     2372    setPropertyHandler(CSSPropertyBorderTopWidth, ApplyPropertyComputeLength<float, &RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth, &RenderStyle::initialBorderWidth, NormalDisabled, ThicknessEnabled>::createHandler());
    23732373    setPropertyHandler(CSSPropertyBottom, ApplyPropertyLength<&RenderStyle::bottom, &RenderStyle::setBottom, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
    23742374    setPropertyHandler(CSSPropertyBoxSizing, ApplyPropertyDefault<EBoxSizing, &RenderStyle::boxSizing, EBoxSizing, &RenderStyle::setBoxSizing, EBoxSizing, &RenderStyle::initialBoxSizing>::createHandler());
  • trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp

    r163079 r163152  
    11511151        new PropertyWrapperFlex(),
    11521152
    1153         new PropertyWrapper<unsigned>(CSSPropertyBorderLeftWidth, &RenderStyle::borderLeftWidth, &RenderStyle::setBorderLeftWidth),
    1154         new PropertyWrapper<unsigned>(CSSPropertyBorderRightWidth, &RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth),
    1155         new PropertyWrapper<unsigned>(CSSPropertyBorderTopWidth, &RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth),
    1156         new PropertyWrapper<unsigned>(CSSPropertyBorderBottomWidth, &RenderStyle::borderBottomWidth, &RenderStyle::setBorderBottomWidth),
     1153        new PropertyWrapper<float>(CSSPropertyBorderLeftWidth, &RenderStyle::borderLeftWidth, &RenderStyle::setBorderLeftWidth),
     1154        new PropertyWrapper<float>(CSSPropertyBorderRightWidth, &RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth),
     1155        new PropertyWrapper<float>(CSSPropertyBorderTopWidth, &RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth),
     1156        new PropertyWrapper<float>(CSSPropertyBorderBottomWidth, &RenderStyle::borderBottomWidth, &RenderStyle::setBorderBottomWidth),
    11571157        new LengthPropertyWrapper<Length>(CSSPropertyMarginLeft, &RenderStyle::marginLeft, &RenderStyle::setMarginLeft),
    11581158        new LengthPropertyWrapper<Length>(CSSPropertyMarginRight, &RenderStyle::marginRight, &RenderStyle::setMarginRight),
  • trunk/Source/WebCore/rendering/RenderTable.cpp

    r162907 r163152  
    962962        return 0;
    963963
    964     unsigned borderWidth = 0;
     964    float borderWidth = 0;
    965965
    966966    const BorderValue& tableStartBorder = style().borderStart();
     
    10161016        return 0;
    10171017
    1018     unsigned borderWidth = 0;
     1018    float borderWidth = 0;
    10191019
    10201020    const BorderValue& tableEndBorder = style().borderEnd();
  • trunk/Source/WebCore/rendering/style/BorderValue.h

    r111076 r163152  
    3535public:
    3636    BorderValue()
    37         : m_color(0)
     37        : m_width(3)
     38        , m_color(0)
    3839        , m_colorIsValid(false)
    39         , m_width(3)
    4040        , m_style(BNONE)
    4141        , m_isAuto(AUTO_OFF)
     
    7676    Color color() const { return Color(m_color, m_colorIsValid); }
    7777
    78     unsigned width() const { return m_width; }
     78    float width() const { return m_width; }
    7979    EBorderStyle style() const { return static_cast<EBorderStyle>(m_style); }
    8080
    8181protected:
     82    float m_width;
    8283    RGBA32 m_color;
    8384    unsigned m_colorIsValid : 1;
    8485
    85     unsigned m_width : 26;
    8686    unsigned m_style : 4; // EBorderStyle
    8787
  • trunk/Source/WebCore/rendering/style/RenderStyle.cpp

    r163079 r163152  
    5555
    5656struct SameSizeAsBorderValue {
     57    float m_width;
    5758    RGBA32 m_color;
    58     unsigned m_width;
     59    int m_restBits;
    5960};
    6061
     
    16831684}
    16841685
    1685 unsigned short RenderStyle::borderBeforeWidth() const
     1686float RenderStyle::borderBeforeWidth() const
    16861687{
    16871688    switch (writingMode()) {
     
    16991700}
    17001701
    1701 unsigned short RenderStyle::borderAfterWidth() const
     1702float RenderStyle::borderAfterWidth() const
    17021703{
    17031704    switch (writingMode()) {
     
    17151716}
    17161717
    1717 unsigned short RenderStyle::borderStartWidth() const
     1718float RenderStyle::borderStartWidth() const
    17181719{
    17191720    if (isHorizontalWritingMode())
     
    17221723}
    17231724
    1724 unsigned short RenderStyle::borderEndWidth() const
     1725float RenderStyle::borderEndWidth() const
    17251726{
    17261727    if (isHorizontalWritingMode())
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r163079 r163152  
    504504    bool hasBorderRadius() const { return surround->border.hasBorderRadius(); }
    505505
    506     unsigned borderLeftWidth() const { return surround->border.borderLeftWidth(); }
     506    float borderLeftWidth() const { return surround->border.borderLeftWidth(); }
    507507    EBorderStyle borderLeftStyle() const { return surround->border.left().style(); }
    508508    bool borderLeftIsTransparent() const { return surround->border.left().isTransparent(); }
    509     unsigned borderRightWidth() const { return surround->border.borderRightWidth(); }
     509    float borderRightWidth() const { return surround->border.borderRightWidth(); }
    510510    EBorderStyle borderRightStyle() const { return surround->border.right().style(); }
    511511    bool borderRightIsTransparent() const { return surround->border.right().isTransparent(); }
    512     unsigned borderTopWidth() const { return surround->border.borderTopWidth(); }
     512    float borderTopWidth() const { return surround->border.borderTopWidth(); }
    513513    EBorderStyle borderTopStyle() const { return surround->border.top().style(); }
    514514    bool borderTopIsTransparent() const { return surround->border.top().isTransparent(); }
    515     unsigned borderBottomWidth() const { return surround->border.borderBottomWidth(); }
     515    float borderBottomWidth() const { return surround->border.borderBottomWidth(); }
    516516    EBorderStyle borderBottomStyle() const { return surround->border.bottom().style(); }
    517517    bool borderBottomIsTransparent() const { return surround->border.bottom().isTransparent(); }
    518518   
    519     unsigned short borderBeforeWidth() const;
    520     unsigned short borderAfterWidth() const;
    521     unsigned short borderStartWidth() const;
    522     unsigned short borderEndWidth() const;
     519    float borderBeforeWidth() const;
     520    float borderAfterWidth() const;
     521    float borderStartWidth() const;
     522    float borderEndWidth() const;
    523523
    524524    unsigned short outlineSize() const { return std::max(0, outlineWidth() + outlineOffset()); }
     
    10921092        int topWidth, int bottomWidth, int leftWidth, int rightWidth, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const;
    10931093
    1094     void setBorderLeftWidth(unsigned v) { SET_VAR(surround, border.m_left.m_width, v); }
     1094    void setBorderLeftWidth(float v) { SET_VAR(surround, border.m_left.m_width, v); }
    10951095    void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.m_left.m_style, v); }
    10961096    void setBorderLeftColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_left, v); }
    1097     void setBorderRightWidth(unsigned v) { SET_VAR(surround, border.m_right.m_width, v); }
     1097    void setBorderRightWidth(float v) { SET_VAR(surround, border.m_right.m_width, v); }
    10981098    void setBorderRightStyle(EBorderStyle v) { SET_VAR(surround, border.m_right.m_style, v); }
    10991099    void setBorderRightColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_right, v); }
    1100     void setBorderTopWidth(unsigned v) { SET_VAR(surround, border.m_top.m_width, v); }
     1100    void setBorderTopWidth(float v) { SET_VAR(surround, border.m_top.m_width, v); }
    11011101    void setBorderTopStyle(EBorderStyle v) { SET_VAR(surround, border.m_top.m_style, v); }
    11021102    void setBorderTopColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_top, v); }
    1103     void setBorderBottomWidth(unsigned v) { SET_VAR(surround, border.m_bottom.m_width, v); }
     1103    void setBorderBottomWidth(float v) { SET_VAR(surround, border.m_bottom.m_width, v); }
    11041104    void setBorderBottomStyle(EBorderStyle v) { SET_VAR(surround, border.m_bottom.m_style, v); }
    11051105    void setBorderBottomColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_bottom, v); }
     
    16501650    static Color initialColor() { return Color::black; }
    16511651    static StyleImage* initialListStyleImage() { return 0; }
    1652     static unsigned initialBorderWidth() { return 3; }
     1652    static float initialBorderWidth() { return 3; }
    16531653    static unsigned short initialColumnRuleWidth() { return 3; }
    16541654    static unsigned short initialOutlineWidth() { return 3; }
Note: See TracChangeset for help on using the changeset viewer.