Changeset 57355 in webkit


Ignore:
Timestamp:
Apr 9, 2010 1:21:55 PM (14 years ago)
Author:
hyatt@apple.com
Message:

https://bugs.webkit.org/show_bug.cgi?id=37349, RenderStyle cleanup. Working from the outside in to
bring some style consistency to RenderStyle and its associated classes. This patch cleans up the
border and outline classes.

Reviewed by Adam Roben.

  • rendering/RenderTable.cpp:

(WebCore::RenderTable::calcBorderLeft):
(WebCore::RenderTable::calcBorderRight):
(WebCore::RenderTable::outerBorderTop):
(WebCore::RenderTable::outerBorderBottom):
(WebCore::RenderTable::outerBorderLeft):
(WebCore::RenderTable::outerBorderRight):

  • rendering/RenderTableCell.cpp:

(WebCore::compareBorders):

  • rendering/RenderTableSection.cpp:

(WebCore::RenderTableSection::calcOuterBorderTop):
(WebCore::RenderTableSection::calcOuterBorderBottom):
(WebCore::RenderTableSection::calcOuterBorderLeft):
(WebCore::RenderTableSection::calcOuterBorderRight):

  • rendering/style/BorderData.h:

(WebCore::BorderData::hasBorder):
(WebCore::BorderData::hasBorderRadius):
(WebCore::BorderData::borderLeftWidth):
(WebCore::BorderData::borderRightWidth):
(WebCore::BorderData::borderTopWidth):
(WebCore::BorderData::borderBottomWidth):
(WebCore::BorderData::operator==):
(WebCore::BorderData::left):
(WebCore::BorderData::right):
(WebCore::BorderData::top):
(WebCore::BorderData::bottom):
(WebCore::BorderData::image):
(WebCore::BorderData::topLeft):
(WebCore::BorderData::topRight):
(WebCore::BorderData::bottomLeft):
(WebCore::BorderData::bottomRight):

  • rendering/style/BorderValue.h:

(WebCore::BorderValue::BorderValue):
(WebCore::BorderValue::nonZero):
(WebCore::BorderValue::isTransparent):
(WebCore::BorderValue::operator==):
(WebCore::BorderValue::color):
(WebCore::BorderValue::width):
(WebCore::BorderValue::style):

  • rendering/style/CollapsedBorderValue.h:

(WebCore::CollapsedBorderValue::CollapsedBorderValue):
(WebCore::CollapsedBorderValue::width):
(WebCore::CollapsedBorderValue::style):
(WebCore::CollapsedBorderValue::exists):
(WebCore::CollapsedBorderValue::color):
(WebCore::CollapsedBorderValue::isTransparent):
(WebCore::CollapsedBorderValue::precedence):
(WebCore::CollapsedBorderValue::operator==):

  • rendering/style/OutlineValue.h:

(WebCore::OutlineValue::OutlineValue):
(WebCore::OutlineValue::operator==):
(WebCore::OutlineValue::offset):
(WebCore::OutlineValue::isAuto):

  • rendering/style/RenderStyle.cpp:

(WebCore::RenderStyle::getBorderRadiiForRect):

  • rendering/style/RenderStyle.h:

(WebCore::InheritedFlags::borderLeft):
(WebCore::InheritedFlags::borderRight):
(WebCore::InheritedFlags::borderTop):
(WebCore::InheritedFlags::borderBottom):
(WebCore::InheritedFlags::borderImage):
(WebCore::InheritedFlags::borderTopLeftRadius):
(WebCore::InheritedFlags::borderTopRightRadius):
(WebCore::InheritedFlags::borderBottomLeftRadius):
(WebCore::InheritedFlags::borderBottomRightRadius):
(WebCore::InheritedFlags::borderLeftStyle):
(WebCore::InheritedFlags::borderLeftColor):
(WebCore::InheritedFlags::borderLeftIsTransparent):
(WebCore::InheritedFlags::borderRightStyle):
(WebCore::InheritedFlags::borderRightColor):
(WebCore::InheritedFlags::borderRightIsTransparent):
(WebCore::InheritedFlags::borderTopStyle):
(WebCore::InheritedFlags::borderTopColor):
(WebCore::InheritedFlags::borderTopIsTransparent):
(WebCore::InheritedFlags::borderBottomStyle):
(WebCore::InheritedFlags::borderBottomColor):
(WebCore::InheritedFlags::borderBottomIsTransparent):
(WebCore::InheritedFlags::outlineWidth):
(WebCore::InheritedFlags::outlineStyleIsAuto):
(WebCore::InheritedFlags::outlineColor):
(WebCore::InheritedFlags::outlineOffset):
(WebCore::InheritedFlags::columnRuleColor):
(WebCore::InheritedFlags::resetBorderTop):
(WebCore::InheritedFlags::resetBorderRight):
(WebCore::InheritedFlags::resetBorderBottom):
(WebCore::InheritedFlags::resetBorderLeft):
(WebCore::InheritedFlags::resetBorderImage):
(WebCore::InheritedFlags::resetBorderTopLeftRadius):
(WebCore::InheritedFlags::resetBorderTopRightRadius):
(WebCore::InheritedFlags::resetBorderBottomLeftRadius):
(WebCore::InheritedFlags::resetBorderBottomRightRadius):
(WebCore::InheritedFlags::setBorderImage):
(WebCore::InheritedFlags::setBorderTopLeftRadius):
(WebCore::InheritedFlags::setBorderTopRightRadius):
(WebCore::InheritedFlags::setBorderBottomLeftRadius):
(WebCore::InheritedFlags::setBorderBottomRightRadius):
(WebCore::InheritedFlags::setBorderLeftWidth):
(WebCore::InheritedFlags::setBorderLeftStyle):
(WebCore::InheritedFlags::setBorderLeftColor):
(WebCore::InheritedFlags::setBorderRightWidth):
(WebCore::InheritedFlags::setBorderRightStyle):
(WebCore::InheritedFlags::setBorderRightColor):
(WebCore::InheritedFlags::setBorderTopWidth):
(WebCore::InheritedFlags::setBorderTopStyle):
(WebCore::InheritedFlags::setBorderTopColor):
(WebCore::InheritedFlags::setBorderBottomWidth):
(WebCore::InheritedFlags::setBorderBottomStyle):
(WebCore::InheritedFlags::setBorderBottomColor):
(WebCore::InheritedFlags::setOutlineWidth):
(WebCore::InheritedFlags::setOutlineStyle):
(WebCore::InheritedFlags::setOutlineColor):
(WebCore::InheritedFlags::setOutlineOffset):
(WebCore::InheritedFlags::setColumnRuleColor):
(WebCore::InheritedFlags::setColumnRuleWidth):

  • rendering/style/StyleMultiColData.h:

(WebCore::StyleMultiColData::ruleWidth):

Location:
trunk/WebCore
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r57351 r57355  
     12010-04-09  David Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Adam Roben.
     4       
     5        https://bugs.webkit.org/show_bug.cgi?id=37349, RenderStyle cleanup.  Working from the outside in to
     6        bring some style consistency to RenderStyle and its associated classes.  This patch cleans up the
     7        border and outline classes.
     8
     9        * rendering/RenderTable.cpp:
     10        (WebCore::RenderTable::calcBorderLeft):
     11        (WebCore::RenderTable::calcBorderRight):
     12        (WebCore::RenderTable::outerBorderTop):
     13        (WebCore::RenderTable::outerBorderBottom):
     14        (WebCore::RenderTable::outerBorderLeft):
     15        (WebCore::RenderTable::outerBorderRight):
     16        * rendering/RenderTableCell.cpp:
     17        (WebCore::compareBorders):
     18        * rendering/RenderTableSection.cpp:
     19        (WebCore::RenderTableSection::calcOuterBorderTop):
     20        (WebCore::RenderTableSection::calcOuterBorderBottom):
     21        (WebCore::RenderTableSection::calcOuterBorderLeft):
     22        (WebCore::RenderTableSection::calcOuterBorderRight):
     23        * rendering/style/BorderData.h:
     24        (WebCore::BorderData::hasBorder):
     25        (WebCore::BorderData::hasBorderRadius):
     26        (WebCore::BorderData::borderLeftWidth):
     27        (WebCore::BorderData::borderRightWidth):
     28        (WebCore::BorderData::borderTopWidth):
     29        (WebCore::BorderData::borderBottomWidth):
     30        (WebCore::BorderData::operator==):
     31        (WebCore::BorderData::left):
     32        (WebCore::BorderData::right):
     33        (WebCore::BorderData::top):
     34        (WebCore::BorderData::bottom):
     35        (WebCore::BorderData::image):
     36        (WebCore::BorderData::topLeft):
     37        (WebCore::BorderData::topRight):
     38        (WebCore::BorderData::bottomLeft):
     39        (WebCore::BorderData::bottomRight):
     40        * rendering/style/BorderValue.h:
     41        (WebCore::BorderValue::BorderValue):
     42        (WebCore::BorderValue::nonZero):
     43        (WebCore::BorderValue::isTransparent):
     44        (WebCore::BorderValue::operator==):
     45        (WebCore::BorderValue::color):
     46        (WebCore::BorderValue::width):
     47        (WebCore::BorderValue::style):
     48        * rendering/style/CollapsedBorderValue.h:
     49        (WebCore::CollapsedBorderValue::CollapsedBorderValue):
     50        (WebCore::CollapsedBorderValue::width):
     51        (WebCore::CollapsedBorderValue::style):
     52        (WebCore::CollapsedBorderValue::exists):
     53        (WebCore::CollapsedBorderValue::color):
     54        (WebCore::CollapsedBorderValue::isTransparent):
     55        (WebCore::CollapsedBorderValue::precedence):
     56        (WebCore::CollapsedBorderValue::operator==):
     57        * rendering/style/OutlineValue.h:
     58        (WebCore::OutlineValue::OutlineValue):
     59        (WebCore::OutlineValue::operator==):
     60        (WebCore::OutlineValue::offset):
     61        (WebCore::OutlineValue::isAuto):
     62        * rendering/style/RenderStyle.cpp:
     63        (WebCore::RenderStyle::getBorderRadiiForRect):
     64        * rendering/style/RenderStyle.h:
     65        (WebCore::InheritedFlags::borderLeft):
     66        (WebCore::InheritedFlags::borderRight):
     67        (WebCore::InheritedFlags::borderTop):
     68        (WebCore::InheritedFlags::borderBottom):
     69        (WebCore::InheritedFlags::borderImage):
     70        (WebCore::InheritedFlags::borderTopLeftRadius):
     71        (WebCore::InheritedFlags::borderTopRightRadius):
     72        (WebCore::InheritedFlags::borderBottomLeftRadius):
     73        (WebCore::InheritedFlags::borderBottomRightRadius):
     74        (WebCore::InheritedFlags::borderLeftStyle):
     75        (WebCore::InheritedFlags::borderLeftColor):
     76        (WebCore::InheritedFlags::borderLeftIsTransparent):
     77        (WebCore::InheritedFlags::borderRightStyle):
     78        (WebCore::InheritedFlags::borderRightColor):
     79        (WebCore::InheritedFlags::borderRightIsTransparent):
     80        (WebCore::InheritedFlags::borderTopStyle):
     81        (WebCore::InheritedFlags::borderTopColor):
     82        (WebCore::InheritedFlags::borderTopIsTransparent):
     83        (WebCore::InheritedFlags::borderBottomStyle):
     84        (WebCore::InheritedFlags::borderBottomColor):
     85        (WebCore::InheritedFlags::borderBottomIsTransparent):
     86        (WebCore::InheritedFlags::outlineWidth):
     87        (WebCore::InheritedFlags::outlineStyleIsAuto):
     88        (WebCore::InheritedFlags::outlineColor):
     89        (WebCore::InheritedFlags::outlineOffset):
     90        (WebCore::InheritedFlags::columnRuleColor):
     91        (WebCore::InheritedFlags::resetBorderTop):
     92        (WebCore::InheritedFlags::resetBorderRight):
     93        (WebCore::InheritedFlags::resetBorderBottom):
     94        (WebCore::InheritedFlags::resetBorderLeft):
     95        (WebCore::InheritedFlags::resetBorderImage):
     96        (WebCore::InheritedFlags::resetBorderTopLeftRadius):
     97        (WebCore::InheritedFlags::resetBorderTopRightRadius):
     98        (WebCore::InheritedFlags::resetBorderBottomLeftRadius):
     99        (WebCore::InheritedFlags::resetBorderBottomRightRadius):
     100        (WebCore::InheritedFlags::setBorderImage):
     101        (WebCore::InheritedFlags::setBorderTopLeftRadius):
     102        (WebCore::InheritedFlags::setBorderTopRightRadius):
     103        (WebCore::InheritedFlags::setBorderBottomLeftRadius):
     104        (WebCore::InheritedFlags::setBorderBottomRightRadius):
     105        (WebCore::InheritedFlags::setBorderLeftWidth):
     106        (WebCore::InheritedFlags::setBorderLeftStyle):
     107        (WebCore::InheritedFlags::setBorderLeftColor):
     108        (WebCore::InheritedFlags::setBorderRightWidth):
     109        (WebCore::InheritedFlags::setBorderRightStyle):
     110        (WebCore::InheritedFlags::setBorderRightColor):
     111        (WebCore::InheritedFlags::setBorderTopWidth):
     112        (WebCore::InheritedFlags::setBorderTopStyle):
     113        (WebCore::InheritedFlags::setBorderTopColor):
     114        (WebCore::InheritedFlags::setBorderBottomWidth):
     115        (WebCore::InheritedFlags::setBorderBottomStyle):
     116        (WebCore::InheritedFlags::setBorderBottomColor):
     117        (WebCore::InheritedFlags::setOutlineWidth):
     118        (WebCore::InheritedFlags::setOutlineStyle):
     119        (WebCore::InheritedFlags::setOutlineColor):
     120        (WebCore::InheritedFlags::setOutlineOffset):
     121        (WebCore::InheritedFlags::setColumnRuleColor):
     122        (WebCore::InheritedFlags::setColumnRuleWidth):
     123        * rendering/style/StyleMultiColData.h:
     124        (WebCore::StyleMultiColData::ruleWidth):
     125
    11262010-04-09  Andrey Kosyakov  <caseq@chromium.org>
    2127
  • trunk/WebCore/rendering/RenderTable.cpp

    r56319 r57355  
    725725            return 0;
    726726        if (tb.style() > BHIDDEN)
    727             borderWidth = tb.width;
     727            borderWidth = tb.width();
    728728
    729729        int leftmostColumn = style()->direction() == RTL ? numEffCols() - 1 : 0;
     
    734734                return 0;
    735735            if (gb.style() > BHIDDEN)
    736                 borderWidth = max(borderWidth, static_cast<unsigned>(gb.width));
     736                borderWidth = max(borderWidth, static_cast<unsigned>(gb.width()));
    737737        }
    738738       
     
    747747
    748748            if (sb.style() > BHIDDEN)
    749                 borderWidth = max(borderWidth, static_cast<unsigned>(sb.width));
     749                borderWidth = max(borderWidth, static_cast<unsigned>(sb.width()));
    750750
    751751            const RenderTableSection::CellStruct& cs = firstNonEmptySection->cellAt(0, leftmostColumn);
     
    761761
    762762                if (cb.style() > BHIDDEN)
    763                     borderWidth = max(borderWidth, static_cast<unsigned>(cb.width));
     763                    borderWidth = max(borderWidth, static_cast<unsigned>(cb.width()));
    764764                if (rb.style() > BHIDDEN)
    765                     borderWidth = max(borderWidth, static_cast<unsigned>(rb.width));
     765                    borderWidth = max(borderWidth, static_cast<unsigned>(rb.width()));
    766766            }
    767767        }
     
    784784            return 0;
    785785        if (tb.style() > BHIDDEN)
    786             borderWidth = tb.width;
     786            borderWidth = tb.width();
    787787
    788788        int rightmostColumn = style()->direction() == RTL ? 0 : numEffCols() - 1;
     
    793793                return 0;
    794794            if (gb.style() > BHIDDEN)
    795                 borderWidth = max(borderWidth, static_cast<unsigned>(gb.width));
     795                borderWidth = max(borderWidth, static_cast<unsigned>(gb.width()));
    796796        }
    797797       
     
    806806
    807807            if (sb.style() > BHIDDEN)
    808                 borderWidth = max(borderWidth, static_cast<unsigned>(sb.width));
     808                borderWidth = max(borderWidth, static_cast<unsigned>(sb.width()));
    809809
    810810            const RenderTableSection::CellStruct& cs = firstNonEmptySection->cellAt(0, rightmostColumn);
     
    820820
    821821                if (cb.style() > BHIDDEN)
    822                     borderWidth = max(borderWidth, static_cast<unsigned>(cb.width));
     822                    borderWidth = max(borderWidth, static_cast<unsigned>(cb.width()));
    823823                if (rb.style() > BHIDDEN)
    824                     borderWidth = max(borderWidth, static_cast<unsigned>(rb.width));
     824                    borderWidth = max(borderWidth, static_cast<unsigned>(rb.width()));
    825825            }
    826826        }
     
    873873        return 0;
    874874    if (tb.style() > BHIDDEN)
    875         borderWidth = max(borderWidth, static_cast<int>(tb.width / 2));
     875        borderWidth = max(borderWidth, static_cast<int>(tb.width() / 2));
    876876    return borderWidth;
    877877}
     
    899899        return 0;
    900900    if (tb.style() > BHIDDEN)
    901         borderWidth = max(borderWidth, static_cast<int>((tb.width + 1) / 2));
     901        borderWidth = max(borderWidth, static_cast<int>((tb.width() + 1) / 2));
    902902    return borderWidth;
    903903}
     
    914914        return 0;
    915915    if (tb.style() > BHIDDEN)
    916         borderWidth = tb.width / 2;
     916        borderWidth = tb.width() / 2;
    917917
    918918    bool allHidden = true;
     
    944944        return 0;
    945945    if (tb.style() > BHIDDEN)
    946         borderWidth = (tb.width + 1) / 2;
     946        borderWidth = (tb.width() + 1) / 2;
    947947
    948948    bool allHidden = true;
  • trunk/WebCore/rendering/RenderTableCell.cpp

    r57292 r57355  
    323323   
    324324    // The border have the same width and style.  Rely on precedence (cell over row over row group, etc.)
    325     return border1.precedence >= border2.precedence ? border1 : border2;
     325    return border1.precedence() >= border2.precedence() ? border1 : border2;
    326326}
    327327
  • trunk/WebCore/rendering/RenderTableSection.cpp

    r52683 r57355  
    721721        return -1;
    722722    if (sb.style() > BHIDDEN)
    723         borderWidth = sb.width;
     723        borderWidth = sb.width();
    724724
    725725    const BorderValue& rb = firstChild()->style()->borderTop();
    726726    if (rb.style() == BHIDDEN)
    727727        return -1;
    728     if (rb.style() > BHIDDEN && rb.width > borderWidth)
    729         borderWidth = rb.width;
     728    if (rb.style() > BHIDDEN && rb.width() > borderWidth)
     729        borderWidth = rb.width();
    730730
    731731    bool allHidden = true;
     
    743743            else
    744744                allHidden = false;
    745             if (gb.style() > BHIDDEN && gb.width > borderWidth)
    746                 borderWidth = gb.width;
    747             if (cb.style() > BHIDDEN && cb.width > borderWidth)
    748                 borderWidth = cb.width;
     745            if (gb.style() > BHIDDEN && gb.width() > borderWidth)
     746                borderWidth = gb.width();
     747            if (cb.style() > BHIDDEN && cb.width() > borderWidth)
     748                borderWidth = cb.width();
    749749        } else {
    750750            if (cb.style() == BHIDDEN)
     
    752752            else
    753753                allHidden = false;
    754             if (cb.style() > BHIDDEN && cb.width > borderWidth)
    755                 borderWidth = cb.width;
     754            if (cb.style() > BHIDDEN && cb.width() > borderWidth)
     755                borderWidth = cb.width();
    756756        }
    757757    }
     
    774774        return -1;
    775775    if (sb.style() > BHIDDEN)
    776         borderWidth = sb.width;
     776        borderWidth = sb.width();
    777777
    778778    const BorderValue& rb = lastChild()->style()->borderBottom();
    779779    if (rb.style() == BHIDDEN)
    780780        return -1;
    781     if (rb.style() > BHIDDEN && rb.width > borderWidth)
    782         borderWidth = rb.width;
     781    if (rb.style() > BHIDDEN && rb.width() > borderWidth)
     782        borderWidth = rb.width();
    783783
    784784    bool allHidden = true;
     
    796796            else
    797797                allHidden = false;
    798             if (gb.style() > BHIDDEN && gb.width > borderWidth)
    799                 borderWidth = gb.width;
    800             if (cb.style() > BHIDDEN && cb.width > borderWidth)
    801                 borderWidth = cb.width;
     798            if (gb.style() > BHIDDEN && gb.width() > borderWidth)
     799                borderWidth = gb.width();
     800            if (cb.style() > BHIDDEN && cb.width() > borderWidth)
     801                borderWidth = cb.width();
    802802        } else {
    803803            if (cb.style() == BHIDDEN)
     
    805805            else
    806806                allHidden = false;
    807             if (cb.style() > BHIDDEN && cb.width > borderWidth)
    808                 borderWidth = cb.width;
     807            if (cb.style() > BHIDDEN && cb.width() > borderWidth)
     808                borderWidth = cb.width();
    809809        }
    810810    }
     
    827827        return -1;
    828828    if (sb.style() > BHIDDEN)
    829         borderWidth = sb.width;
     829        borderWidth = sb.width();
    830830
    831831    int leftmostColumn = rtl ? totalCols - 1 : 0;
     
    835835        if (gb.style() == BHIDDEN)
    836836            return -1;
    837         if (gb.style() > BHIDDEN && gb.width > borderWidth)
    838             borderWidth = gb.width;
     837        if (gb.style() > BHIDDEN && gb.width() > borderWidth)
     838            borderWidth = gb.width();
    839839    }
    840840
     
    851851        else
    852852            allHidden = false;
    853         if (cb.style() > BHIDDEN && cb.width > borderWidth)
    854             borderWidth = cb.width;
    855         if (rb.style() > BHIDDEN && rb.width > borderWidth)
    856             borderWidth = rb.width;
     853        if (cb.style() > BHIDDEN && cb.width() > borderWidth)
     854            borderWidth = cb.width();
     855        if (rb.style() > BHIDDEN && rb.width() > borderWidth)
     856            borderWidth = rb.width();
    857857    }
    858858    if (allHidden)
     
    874874        return -1;
    875875    if (sb.style() > BHIDDEN)
    876         borderWidth = sb.width;
     876        borderWidth = sb.width();
    877877
    878878    int rightmostColumn = rtl ? 0 : totalCols - 1;
     
    882882        if (gb.style() == BHIDDEN)
    883883            return -1;
    884         if (gb.style() > BHIDDEN && gb.width > borderWidth)
    885             borderWidth = gb.width;
     884        if (gb.style() > BHIDDEN && gb.width() > borderWidth)
     885            borderWidth = gb.width();
    886886    }
    887887
     
    898898        else
    899899            allHidden = false;
    900         if (cb.style() > BHIDDEN && cb.width > borderWidth)
    901             borderWidth = cb.width;
    902         if (rb.style() > BHIDDEN && rb.width > borderWidth)
    903             borderWidth = rb.width;
     900        if (cb.style() > BHIDDEN && cb.width() > borderWidth)
     901            borderWidth = cb.width();
     902        if (rb.style() > BHIDDEN && rb.width() > borderWidth)
     903            borderWidth = rb.width();
    904904    }
    905905    if (allHidden)
  • trunk/WebCore/rendering/style/BorderData.h

    r36568 r57355  
    3333
    3434class BorderData {
     35friend class RenderStyle;
    3536public:
    36     BorderValue left;
    37     BorderValue right;
    38     BorderValue top;
    39     BorderValue bottom;
    40 
    41     NinePieceImage image;
    42 
    43     IntSize topLeft;
    44     IntSize topRight;
    45     IntSize bottomLeft;
    46     IntSize bottomRight;
    47 
    4837    bool hasBorder() const
    4938    {
    50         bool haveImage = image.hasImage();
    51         return left.nonZero(!haveImage) || right.nonZero(!haveImage) || top.nonZero(!haveImage) || bottom.nonZero(!haveImage);
     39        bool haveImage = m_image.hasImage();
     40        return m_left.nonZero(!haveImage) || m_right.nonZero(!haveImage) || m_top.nonZero(!haveImage) || m_bottom.nonZero(!haveImage);
    5241    }
    5342
    5443    bool hasBorderRadius() const
    5544    {
    56         if (topLeft.width() > 0)
     45        if (m_topLeft.width() > 0)
    5746            return true;
    58         if (topRight.width() > 0)
     47        if (m_topRight.width() > 0)
    5948            return true;
    60         if (bottomLeft.width() > 0)
     49        if (m_bottomLeft.width() > 0)
    6150            return true;
    62         if (bottomRight.width() > 0)
     51        if (m_bottomRight.width() > 0)
    6352            return true;
    6453        return false;
     
    6756    unsigned short borderLeftWidth() const
    6857    {
    69         if (!image.hasImage() && (left.style() == BNONE || left.style() == BHIDDEN))
     58        if (!m_image.hasImage() && (m_left.style() == BNONE || m_left.style() == BHIDDEN))
    7059            return 0;
    71         return left.width;
     60        return m_left.width();
    7261    }
    7362   
    7463    unsigned short borderRightWidth() const
    7564    {
    76         if (!image.hasImage() && (right.style() == BNONE || right.style() == BHIDDEN))
     65        if (!m_image.hasImage() && (m_right.style() == BNONE || m_right.style() == BHIDDEN))
    7766            return 0;
    78         return right.width;
     67        return m_right.width();
    7968    }
    8069   
    8170    unsigned short borderTopWidth() const
    8271    {
    83         if (!image.hasImage() && (top.style() == BNONE || top.style() == BHIDDEN))
     72        if (!m_image.hasImage() && (m_top.style() == BNONE || m_top.style() == BHIDDEN))
    8473            return 0;
    85         return top.width;
     74        return m_top.width();
    8675    }
    8776   
    8877    unsigned short borderBottomWidth() const
    8978    {
    90         if (!image.hasImage() && (bottom.style() == BNONE || bottom.style() == BHIDDEN))
     79        if (!m_image.hasImage() && (m_bottom.style() == BNONE || m_bottom.style() == BHIDDEN))
    9180            return 0;
    92         return bottom.width;
     81        return m_bottom.width();
    9382    }
    9483   
    9584    bool operator==(const BorderData& o) const
    9685    {
    97         return left == o.left && right == o.right && top == o.top && bottom == o.bottom && image == o.image &&
    98                topLeft == o.topLeft && topRight == o.topRight && bottomLeft == o.bottomLeft && bottomRight == o.bottomRight;
     86        return m_left == o.m_left && m_right == o.m_right && m_top == o.m_top && m_bottom == o.m_bottom && m_image == o.m_image
     87               && m_topLeft == o.m_topLeft && m_topRight == o.m_topRight && m_bottomLeft == o.m_bottomLeft && m_bottomRight == o.m_bottomRight;
    9988    }
    10089   
     
    10392        return !(*this == o);
    10493    }
     94   
     95    const BorderValue& left() const { return m_left; }
     96    const BorderValue& right() const { return m_right; }
     97    const BorderValue& top() const { return m_top; }
     98    const BorderValue& bottom() const { return m_bottom; }
     99   
     100    const NinePieceImage& image() const { return m_image; }
     101   
     102    const IntSize& topLeft() const { return m_topLeft; }
     103    const IntSize& topRight() const { return m_topRight; }
     104    const IntSize& bottomLeft() const { return m_bottomLeft; }
     105    const IntSize& bottomRight() const { return m_bottomRight; }
     106   
     107private:
     108    BorderValue m_left;
     109    BorderValue m_right;
     110    BorderValue m_top;
     111    BorderValue m_bottom;
     112
     113    NinePieceImage m_image;
     114
     115    IntSize m_topLeft;
     116    IntSize m_topRight;
     117    IntSize m_bottomLeft;
     118    IntSize m_bottomRight;
    105119};
    106120
  • trunk/WebCore/rendering/style/BorderValue.h

    r36579 r57355  
    3232
    3333class BorderValue {
     34friend class RenderStyle;
    3435public:
    3536    BorderValue()
    36         : width(3)
     37        : m_width(3)
    3738        , m_style(BNONE)
    3839    {
    3940    }
    4041
    41     Color color;
    42     unsigned width : 12;
    43     unsigned m_style : 4; // EBorderStyle
    44 
    45     EBorderStyle style() const { return static_cast<EBorderStyle>(m_style); }
    46    
    4742    bool nonZero(bool checkStyle = true) const
    4843    {
    49         return width != 0 && (!checkStyle || m_style != BNONE);
     44        return width() && (!checkStyle || m_style != BNONE);
    5045    }
    5146
    5247    bool isTransparent() const
    5348    {
    54         return color.isValid() && color.alpha() == 0;
     49        return m_color.isValid() && !m_color.alpha();
    5550    }
    5651
     
    6257    bool operator==(const BorderValue& o) const
    6358    {
    64         return width == o.width && m_style == o.m_style && color == o.color;
     59        return m_width == o.m_width && m_style == o.m_style && m_color == o.m_color;
    6560    }
    6661
     
    6964        return !(*this == o);
    7065    }
     66   
     67    const Color& color() const { return m_color; }
     68    unsigned short width() const { return m_width; }
     69    EBorderStyle style() const { return static_cast<EBorderStyle>(m_style); }
     70
     71protected:
     72    Color m_color;
     73    unsigned m_width : 12;
     74    unsigned m_style : 4; // EBorderStyle
    7175};
    7276
  • trunk/WebCore/rendering/style/CollapsedBorderValue.h

    r57292 r57355  
    3030namespace WebCore {
    3131
    32 struct CollapsedBorderValue {
     32class CollapsedBorderValue {
     33friend class RenderStyle;
     34public:
    3335    CollapsedBorderValue()
    34         : border(0)
    35         , precedence(BOFF)
     36        : m_border(0)
     37        , m_precedence(BOFF)
    3638    {
    3739    }
    3840
    3941    CollapsedBorderValue(const BorderValue* b, Color c, EBorderPrecedence p)
    40         : border(b)
    41         , borderColor(c)
    42         , precedence(p)
     42        : m_border(b)
     43        , m_borderColor(c)
     44        , m_precedence(p)
    4345    {
    4446    }
    4547
    46     int width() const { return border && border->nonZero() ? border->width : 0; }
    47     EBorderStyle style() const { return border ? border->style() : BHIDDEN; }
    48     bool exists() const { return border; }
    49     Color color() const { return borderColor; }
    50     bool isTransparent() const { return border ? border->isTransparent() : true; }
    51    
     48    int width() const { return m_border && m_border->nonZero() ? m_border->width() : 0; }
     49    EBorderStyle style() const { return m_border ? m_border->style() : BHIDDEN; }
     50    bool exists() const { return m_border; }
     51    const Color& color() const { return m_borderColor; }
     52    bool isTransparent() const { return m_border ? m_border->isTransparent() : true; }
     53    EBorderPrecedence precedence() const { return m_precedence; }
     54
    5255    bool operator==(const CollapsedBorderValue& o) const
    5356    {
    54         if (!border)
    55             return !o.border;
    56         if (!o.border)
     57        if (!m_border)
     58            return !o.m_border;
     59        if (!o.m_border)
    5760            return false;
    58         return *border == *o.border && borderColor == o.borderColor && precedence == o.precedence;
     61        return *m_border == *o.m_border && m_borderColor == o.m_borderColor && m_precedence == o.m_precedence;
    5962    }
    60    
    61     const BorderValue* border;
    62     Color borderColor;
    63     EBorderPrecedence precedence;   
     63
     64private:
     65    const BorderValue* m_border;
     66    Color m_borderColor;
     67    EBorderPrecedence m_precedence;   
    6468};
    6569
  • trunk/WebCore/rendering/style/OutlineValue.h

    r36568 r57355  
    3131
    3232class OutlineValue : public BorderValue {
     33friend class RenderStyle;
    3334public:
    3435    OutlineValue()
    35         : _offset(0)
    36         , _auto(false)
     36        : m_offset(0)
     37        , m_isAuto(false)
    3738    {
    3839    }
     
    4041    bool operator==(const OutlineValue& o) const
    4142    {
    42         return width == o.width && m_style == o.m_style && color == o.color && _offset == o._offset && _auto == o._auto;
     43        return m_width == o.m_width && m_style == o.m_style && m_color == o.m_color && m_offset == o.m_offset && m_isAuto == o.m_isAuto;
    4344    }
    4445   
     
    4849    }
    4950   
    50     int _offset;
    51     bool _auto;
     51    int offset() const { return m_offset; }
     52    bool isAuto() const { return m_isAuto; }
     53
     54private:
     55    int m_offset;
     56    bool m_isAuto;
    5257};
    5358
  • trunk/WebCore/rendering/style/RenderStyle.cpp

    r57292 r57355  
    734734void RenderStyle::getBorderRadiiForRect(const IntRect& r, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) const
    735735{
    736     topLeft = surround->border.topLeft;
    737     topRight = surround->border.topRight;
     736    topLeft = surround->border.topLeft();
     737    topRight = surround->border.topRight();
    738738   
    739     bottomLeft = surround->border.bottomLeft;
    740     bottomRight = surround->border.bottomRight;
     739    bottomLeft = surround->border.bottomLeft();
     740    bottomRight = surround->border.bottomRight();
    741741
    742742    // Constrain corner radii using CSS3 rules:
  • trunk/WebCore/rendering/style/RenderStyle.h

    r57292 r57355  
    386386
    387387    const BorderData& border() const { return surround->border; }
    388     const BorderValue& borderLeft() const { return surround->border.left; }
    389     const BorderValue& borderRight() const { return surround->border.right; }
    390     const BorderValue& borderTop() const { return surround->border.top; }
    391     const BorderValue& borderBottom() const { return surround->border.bottom; }
    392 
    393     const NinePieceImage& borderImage() const { return surround->border.image; }
    394 
    395     const IntSize& borderTopLeftRadius() const { return surround->border.topLeft; }
    396     const IntSize& borderTopRightRadius() const { return surround->border.topRight; }
    397     const IntSize& borderBottomLeftRadius() const { return surround->border.bottomLeft; }
    398     const IntSize& borderBottomRightRadius() const { return surround->border.bottomRight; }
     388    const BorderValue& borderLeft() const { return surround->border.left(); }
     389    const BorderValue& borderRight() const { return surround->border.right(); }
     390    const BorderValue& borderTop() const { return surround->border.top(); }
     391    const BorderValue& borderBottom() const { return surround->border.bottom(); }
     392
     393    const NinePieceImage& borderImage() const { return surround->border.image(); }
     394
     395    const IntSize& borderTopLeftRadius() const { return surround->border.topLeft(); }
     396    const IntSize& borderTopRightRadius() const { return surround->border.topRight(); }
     397    const IntSize& borderBottomLeftRadius() const { return surround->border.bottomLeft(); }
     398    const IntSize& borderBottomRightRadius() const { return surround->border.bottomRight(); }
    399399    bool hasBorderRadius() const { return surround->border.hasBorderRadius(); }
    400400
    401401    unsigned short borderLeftWidth() const { return surround->border.borderLeftWidth(); }
    402     EBorderStyle borderLeftStyle() const { return surround->border.left.style(); }
    403     const Color& borderLeftColor() const { return surround->border.left.color; }
    404     bool borderLeftIsTransparent() const { return surround->border.left.isTransparent(); }
     402    EBorderStyle borderLeftStyle() const { return surround->border.left().style(); }
     403    const Color& borderLeftColor() const { return surround->border.left().color(); }
     404    bool borderLeftIsTransparent() const { return surround->border.left().isTransparent(); }
    405405    unsigned short borderRightWidth() const { return surround->border.borderRightWidth(); }
    406     EBorderStyle borderRightStyle() const { return surround->border.right.style(); }
    407     const Color& borderRightColor() const { return surround->border.right.color; }
    408     bool borderRightIsTransparent() const { return surround->border.right.isTransparent(); }
     406    EBorderStyle borderRightStyle() const { return surround->border.right().style(); }
     407    const Color& borderRightColor() const { return surround->border.right().color(); }
     408    bool borderRightIsTransparent() const { return surround->border.right().isTransparent(); }
    409409    unsigned short borderTopWidth() const { return surround->border.borderTopWidth(); }
    410     EBorderStyle borderTopStyle() const { return surround->border.top.style(); }
    411     const Color& borderTopColor() const { return surround->border.top.color; }
    412     bool borderTopIsTransparent() const { return surround->border.top.isTransparent(); }
     410    EBorderStyle borderTopStyle() const { return surround->border.top().style(); }
     411    const Color& borderTopColor() const { return surround->border.top().color(); }
     412    bool borderTopIsTransparent() const { return surround->border.top().isTransparent(); }
    413413    unsigned short borderBottomWidth() const { return surround->border.borderBottomWidth(); }
    414     EBorderStyle borderBottomStyle() const { return surround->border.bottom.style(); }
    415     const Color& borderBottomColor() const { return surround->border.bottom.color; }
    416     bool borderBottomIsTransparent() const { return surround->border.bottom.isTransparent(); }
     414    EBorderStyle borderBottomStyle() const { return surround->border.bottom().style(); }
     415    const Color& borderBottomColor() const { return surround->border.bottom().color(); }
     416    bool borderBottomIsTransparent() const { return surround->border.bottom().isTransparent(); }
    417417
    418418    unsigned short outlineSize() const { return max(0, outlineWidth() + outlineOffset()); }
     
    421421        if (background->m_outline.style() == BNONE)
    422422            return 0;
    423         return background->m_outline.width;
     423        return background->m_outline.width();
    424424    }
    425425    bool hasOutline() const { return outlineWidth() > 0 && outlineStyle() > BHIDDEN; }
    426426    EBorderStyle outlineStyle() const { return background->m_outline.style(); }
    427     bool outlineStyleIsAuto() const { return background->m_outline._auto; }
    428     const Color& outlineColor() const { return background->m_outline.color; }
     427    bool outlineStyleIsAuto() const { return background->m_outline.isAuto(); }
     428    const Color& outlineColor() const { return background->m_outline.color(); }
    429429
    430430    EOverflow overflowX() const { return static_cast<EOverflow>(noninherited_flags._overflowX); }
     
    611611        if (background->m_outline.style() == BNONE)
    612612            return 0;
    613         return background->m_outline._offset;
     613        return background->m_outline.offset();
    614614    }
    615615
     
    662662    float columnGap() const { return rareNonInheritedData->m_multiCol->m_gap; }
    663663    bool hasNormalColumnGap() const { return rareNonInheritedData->m_multiCol->m_normalGap; }
    664     const Color& columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color; }
     664    const Color& columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color(); }
    665665    EBorderStyle columnRuleStyle() const { return rareNonInheritedData->m_multiCol->m_rule.style(); }
    666666    unsigned short columnRuleWidth() const { return rareNonInheritedData->m_multiCol->ruleWidth(); }
     
    757757
    758758    void resetBorder() { resetBorderImage(); resetBorderTop(); resetBorderRight(); resetBorderBottom(); resetBorderLeft(); resetBorderRadius(); }
    759     void resetBorderTop() { SET_VAR(surround, border.top, BorderValue()) }
    760     void resetBorderRight() { SET_VAR(surround, border.right, BorderValue()) }
    761     void resetBorderBottom() { SET_VAR(surround, border.bottom, BorderValue()) }
    762     void resetBorderLeft() { SET_VAR(surround, border.left, BorderValue()) }
    763     void resetBorderImage() { SET_VAR(surround, border.image, NinePieceImage()) }
     759    void resetBorderTop() { SET_VAR(surround, border.m_top, BorderValue()) }
     760    void resetBorderRight() { SET_VAR(surround, border.m_right, BorderValue()) }
     761    void resetBorderBottom() { SET_VAR(surround, border.m_bottom, BorderValue()) }
     762    void resetBorderLeft() { SET_VAR(surround, border.m_left, BorderValue()) }
     763    void resetBorderImage() { SET_VAR(surround, border.m_image, NinePieceImage()) }
    764764    void resetBorderRadius() { resetBorderTopLeftRadius(); resetBorderTopRightRadius(); resetBorderBottomLeftRadius(); resetBorderBottomRightRadius(); }
    765     void resetBorderTopLeftRadius() { SET_VAR(surround, border.topLeft, initialBorderRadius()) }
    766     void resetBorderTopRightRadius() { SET_VAR(surround, border.topRight, initialBorderRadius()) }
    767     void resetBorderBottomLeftRadius() { SET_VAR(surround, border.bottomLeft, initialBorderRadius()) }
    768     void resetBorderBottomRightRadius() { SET_VAR(surround, border.bottomRight, initialBorderRadius()) }
     765    void resetBorderTopLeftRadius() { SET_VAR(surround, border.m_topLeft, initialBorderRadius()) }
     766    void resetBorderTopRightRadius() { SET_VAR(surround, border.m_topRight, initialBorderRadius()) }
     767    void resetBorderBottomLeftRadius() { SET_VAR(surround, border.m_bottomLeft, initialBorderRadius()) }
     768    void resetBorderBottomRightRadius() { SET_VAR(surround, border.m_bottomRight, initialBorderRadius()) }
    769769
    770770    void resetOutline() { SET_VAR(background, m_outline, OutlineValue()) }
     
    777777    void setBackgroundSizeLength(LengthSize l) { SET_VAR(background, m_background.m_sizeLength, l) }
    778778   
    779     void setBorderImage(const NinePieceImage& b) { SET_VAR(surround, border.image, b) }
    780 
    781     void setBorderTopLeftRadius(const IntSize& s) { SET_VAR(surround, border.topLeft, s) }
    782     void setBorderTopRightRadius(const IntSize& s) { SET_VAR(surround, border.topRight, s) }
    783     void setBorderBottomLeftRadius(const IntSize& s) { SET_VAR(surround, border.bottomLeft, s) }
    784     void setBorderBottomRightRadius(const IntSize& s) { SET_VAR(surround, border.bottomRight, s) }
     779    void setBorderImage(const NinePieceImage& b) { SET_VAR(surround, border.m_image, b) }
     780
     781    void setBorderTopLeftRadius(const IntSize& s) { SET_VAR(surround, border.m_topLeft, s) }
     782    void setBorderTopRightRadius(const IntSize& s) { SET_VAR(surround, border.m_topRight, s) }
     783    void setBorderBottomLeftRadius(const IntSize& s) { SET_VAR(surround, border.m_bottomLeft, s) }
     784    void setBorderBottomRightRadius(const IntSize& s) { SET_VAR(surround, border.m_bottomRight, s) }
    785785
    786786    void setBorderRadius(const IntSize& s)
     
    794794    void getBorderRadiiForRect(const IntRect&, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) const;
    795795
    796     void setBorderLeftWidth(unsigned short v) { SET_VAR(surround, border.left.width, v) }
    797     void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.left.m_style, v) }
    798     void setBorderLeftColor(const Color& v) { SET_VAR(surround, border.left.color, v) }
    799     void setBorderRightWidth(unsigned short v) { SET_VAR(surround, border.right.width, v) }
    800     void setBorderRightStyle(EBorderStyle v) { SET_VAR(surround, border.right.m_style, v) }
    801     void setBorderRightColor(const Color& v) { SET_VAR(surround, border.right.color, v) }
    802     void setBorderTopWidth(unsigned short v) { SET_VAR(surround, border.top.width, v) }
    803     void setBorderTopStyle(EBorderStyle v) { SET_VAR(surround, border.top.m_style, v) }
    804     void setBorderTopColor(const Color& v) { SET_VAR(surround, border.top.color, v) }
    805     void setBorderBottomWidth(unsigned short v) { SET_VAR(surround, border.bottom.width, v) }
    806     void setBorderBottomStyle(EBorderStyle v) { SET_VAR(surround, border.bottom.m_style, v) }
    807     void setBorderBottomColor(const Color& v) { SET_VAR(surround, border.bottom.color, v) }
    808     void setOutlineWidth(unsigned short v) { SET_VAR(background, m_outline.width, v) }
     796    void setBorderLeftWidth(unsigned short v) { SET_VAR(surround, border.m_left.m_width, v) }
     797    void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.m_left.m_style, v) }
     798    void setBorderLeftColor(const Color& v) { SET_VAR(surround, border.m_left.m_color, v) }
     799    void setBorderRightWidth(unsigned short v) { SET_VAR(surround, border.m_right.m_width, v) }
     800    void setBorderRightStyle(EBorderStyle v) { SET_VAR(surround, border.m_right.m_style, v) }
     801    void setBorderRightColor(const Color& v) { SET_VAR(surround, border.m_right.m_color, v) }
     802    void setBorderTopWidth(unsigned short v) { SET_VAR(surround, border.m_top.m_width, v) }
     803    void setBorderTopStyle(EBorderStyle v) { SET_VAR(surround, border.m_top.m_style, v) }
     804    void setBorderTopColor(const Color& v) { SET_VAR(surround, border.m_top.m_color, v) }
     805    void setBorderBottomWidth(unsigned short v) { SET_VAR(surround, border.m_bottom.m_width, v) }
     806    void setBorderBottomStyle(EBorderStyle v) { SET_VAR(surround, border.m_bottom.m_style, v) }
     807    void setBorderBottomColor(const Color& v) { SET_VAR(surround, border.m_bottom.m_color, v) }
     808    void setOutlineWidth(unsigned short v) { SET_VAR(background, m_outline.m_width, v) }
    809809
    810810    void setOutlineStyle(EBorderStyle v, bool isAuto = false)
    811811    {
    812812        SET_VAR(background, m_outline.m_style, v)
    813         SET_VAR(background, m_outline._auto, isAuto)
    814     }
    815 
    816     void setOutlineColor(const Color& v) { SET_VAR(background, m_outline.color, v) }
     813        SET_VAR(background, m_outline.m_isAuto, isAuto)
     814    }
     815
     816    void setOutlineColor(const Color& v) { SET_VAR(background, m_outline.m_color, v) }
    817817
    818818    void setOverflowX(EOverflow v) { noninherited_flags._overflowX = v; }
     
    948948#endif
    949949
    950     void setOutlineOffset(int v) { SET_VAR(background, m_outline._offset, v) }
     950    void setOutlineOffset(int v) { SET_VAR(background, m_outline.m_offset, v) }
    951951    void setTextShadow(ShadowData* val, bool add=false);
    952952    void setTextStrokeColor(const Color& c) { SET_VAR(rareInheritedData, textStrokeColor, c) }
     
    992992    void setColumnGap(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, f); }
    993993    void setHasNormalColumnGap() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, 0); }
    994     void setColumnRuleColor(const Color& c) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.color, c); }
     994    void setColumnRuleColor(const Color& c) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_color, c); }
    995995    void setColumnRuleStyle(EBorderStyle b) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_style, b); }
    996     void setColumnRuleWidth(unsigned short w) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.width, w); }
     996    void setColumnRuleWidth(unsigned short w) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_width, w); }
    997997    void resetColumnRule() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule, BorderValue()) }
    998998    void setColumnBreakBefore(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakBefore, p); }
  • trunk/WebCore/rendering/style/StyleMultiColData.h

    r36587 r57355  
    5151        if (m_rule.style() == BNONE || m_rule.style() == BHIDDEN)
    5252            return 0;
    53         return m_rule.width;
     53        return m_rule.width();
    5454    }
    5555
Note: See TracChangeset for help on using the changeset viewer.