Chromium Code Reviews| Index: third_party/WebKit/Source/core/style/ComputedStyle.h |
| diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.h b/third_party/WebKit/Source/core/style/ComputedStyle.h |
| index 395478dc55737d8c0f4707a660978886504b7240..68db5230d3b175688ccf5ab76e1667e333703bac 100644 |
| --- a/third_party/WebKit/Source/core/style/ComputedStyle.h |
| +++ b/third_party/WebKit/Source/core/style/ComputedStyle.h |
| @@ -103,6 +103,14 @@ inline bool compareEqual(const T& a, const T& b) { |
| if (!compareEqual(group->variable.color(), value)) \ |
| group.access()->variable.setColor(value) |
| +#define SET_BORDER_WIDTH(group, variable, value) \ |
| + if (!group->variable.widthEquals(value)) \ |
| + group.access()->variable.setWidth(value) |
|
pdr.
2017/01/27 20:28:44
Nit: should this line be indented?
Karl Øygard
2017/02/10 12:53:18
I agree, but the formatter disagrees...
|
| + |
| +#define SET_NESTED_BORDER_WIDTH(group, base, variable, value) \ |
| + if (!group->base->variable.widthEquals(value)) \ |
| + group.access()->base.access()->variable.setWidth(value) |
| + |
| namespace blink { |
| using std::max; |
| @@ -611,32 +619,34 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase, |
| void setBorderImageOutset(const BorderImageLengthBox&); |
| // Border width properties. |
| - static unsigned initialBorderWidth() { return 3; } |
| + static float initialBorderWidth() { return 3; } |
| // border-top-width |
| - int borderTopWidth() const { return m_surround->border.borderTopWidth(); } |
| - void setBorderTopWidth(unsigned v) { |
| - SET_VAR(m_surround, border.m_top.m_width, v); |
| + float borderTopWidth() const { return m_surround->border.borderTopWidth(); } |
| + void setBorderTopWidth(float v) { |
| + SET_BORDER_WIDTH(m_surround, border.m_top, v); |
| } |
| // border-bottom-width |
| - int borderBottomWidth() const { |
| + float borderBottomWidth() const { |
| return m_surround->border.borderBottomWidth(); |
| } |
| - void setBorderBottomWidth(unsigned v) { |
| - SET_VAR(m_surround, border.m_bottom.m_width, v); |
| + void setBorderBottomWidth(float v) { |
| + SET_BORDER_WIDTH(m_surround, border.m_bottom, v); |
| } |
| // border-left-width |
| - int borderLeftWidth() const { return m_surround->border.borderLeftWidth(); } |
| - void setBorderLeftWidth(unsigned v) { |
| - SET_VAR(m_surround, border.m_left.m_width, v); |
| + float borderLeftWidth() const { return m_surround->border.borderLeftWidth(); } |
| + void setBorderLeftWidth(float v) { |
| + SET_BORDER_WIDTH(m_surround, border.m_left, v); |
| } |
| // border-right-width |
| - int borderRightWidth() const { return m_surround->border.borderRightWidth(); } |
| - void setBorderRightWidth(unsigned v) { |
| - SET_VAR(m_surround, border.m_right.m_width, v); |
| + float borderRightWidth() const { |
| + return m_surround->border.borderRightWidth(); |
| + } |
| + void setBorderRightWidth(float v) { |
| + SET_BORDER_WIDTH(m_surround, border.m_right, v); |
| } |
| // Border style properties. |
| @@ -880,7 +890,7 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase, |
| return m_rareNonInheritedData->m_multiCol->ruleWidth(); |
| } |
| void setColumnRuleWidth(unsigned short w) { |
| - SET_NESTED_VAR(m_rareNonInheritedData, m_multiCol, m_rule.m_width, w); |
| + SET_NESTED_BORDER_WIDTH(m_rareNonInheritedData, m_multiCol, m_rule, w); |
| } |
| // column-span (aka -webkit-column-span) |
| @@ -1456,13 +1466,13 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase, |
| // outline-width |
| static unsigned short initialOutlineWidth() { return 3; } |
| - int outlineWidth() const { |
| + unsigned short outlineWidth() const { |
| if (m_rareNonInheritedData->m_outline.style() == BorderStyleNone) |
| return 0; |
| return m_rareNonInheritedData->m_outline.width(); |
| } |
| void setOutlineWidth(unsigned short v) { |
| - SET_VAR(m_rareNonInheritedData, m_outline.m_width, v); |
| + SET_BORDER_WIDTH(m_rareNonInheritedData, m_outline, v); |
| } |
| // outline-offset |
| @@ -3181,12 +3191,12 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase, |
| const BorderValue& borderAfter() const; |
| const BorderValue& borderStart() const; |
| const BorderValue& borderEnd() const; |
| - int borderAfterWidth() const; |
| - int borderBeforeWidth() const; |
| - int borderEndWidth() const; |
| - int borderStartWidth() const; |
| - int borderOverWidth() const; |
| - int borderUnderWidth() const; |
| + float borderAfterWidth() const; |
| + float borderBeforeWidth() const; |
| + float borderEndWidth() const; |
| + float borderStartWidth() const; |
| + float borderOverWidth() const; |
| + float borderUnderWidth() const; |
| bool hasBorderFill() const { return m_surround->border.hasBorderFill(); } |
| bool hasBorder() const { return m_surround->border.hasBorder(); } |