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 530ca187ad96fd55c51e399fd4e182de0116e59a..bec09ad018f742e7405169ffecc71a941d07f6b0 100644 |
| --- a/third_party/WebKit/Source/core/style/ComputedStyle.h |
| +++ b/third_party/WebKit/Source/core/style/ComputedStyle.h |
| @@ -562,23 +562,27 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase, |
| // Border color properties. |
| // border-left-color |
| - void SetBorderLeftColor(const StyleColor& v) { |
| - SET_BORDERVALUE_COLOR(surround_data_, border_.left_, v); |
| + void SetBorderLeftColor(const StyleColor& color) { |
| + SetBorderLeftColorInternal(color.Resolve(Color())); |
| + SetBorderLeftColorIsCurrentColor(color.IsCurrentColor()); |
| } |
| // border-right-color |
| - void SetBorderRightColor(const StyleColor& v) { |
| - SET_BORDERVALUE_COLOR(surround_data_, border_.right_, v); |
| + void SetBorderRightColor(const StyleColor& color) { |
| + SetBorderRightColorInternal(color.Resolve(Color())); |
| + SetBorderRightColorIsCurrentColor(color.IsCurrentColor()); |
| } |
| // border-top-color |
| - void SetBorderTopColor(const StyleColor& v) { |
| - SET_BORDERVALUE_COLOR(surround_data_, border_.top_, v); |
| + void SetBorderTopColor(const StyleColor& color) { |
| + SetBorderTopColorInternal(color.Resolve(Color())); |
| + SetBorderTopColorIsCurrentColor(color.IsCurrentColor()); |
| } |
| // border-bottom-color |
| - void SetBorderBottomColor(const StyleColor& v) { |
| - SET_BORDERVALUE_COLOR(surround_data_, border_.bottom_, v); |
|
shend
2017/05/09 07:24:41
Can we get rid of this macro now?
nainar
2017/05/09 07:40:39
Nope. Needed by BorderValue.
|
| + void SetBorderBottomColor(const StyleColor& color) { |
| + SetBorderBottomColorInternal(color.Resolve(Color())); |
| + SetBorderBottomColorIsCurrentColor(color.IsCurrentColor()); |
| } |
| // box-shadow (aka -webkit-box-shadow) |
| @@ -2846,16 +2850,24 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase, |
| void SetBorderImageSlicesFill(bool); |
| const BorderData& Border() const { return surround_data_->border_; } |
| const BorderValue BorderLeft() const { |
| - return BorderValue(surround_data_->border_.Left(), BorderLeftWidth()); |
| + return BorderValue(surround_data_->border_.Left(), |
| + VisitedDependentColor(CSSPropertyBorderLeftColor), |
| + BorderLeftWidth()); |
| } |
| const BorderValue BorderRight() const { |
| - return BorderValue(surround_data_->border_.Right(), BorderRightWidth()); |
| + return BorderValue(surround_data_->border_.Right(), |
| + VisitedDependentColor(CSSPropertyBorderRightColor), |
| + BorderRightWidth()); |
| } |
| const BorderValue BorderTop() const { |
| - return BorderValue(surround_data_->border_.Top(), BorderTopWidth()); |
| + return BorderValue(surround_data_->border_.Top(), |
| + VisitedDependentColor(CSSPropertyBorderTopColor), |
| + BorderTopWidth()); |
| } |
| const BorderValue BorderBottom() const { |
| - return BorderValue(surround_data_->border_.Bottom(), BorderBottomWidth()); |
| + return BorderValue(surround_data_->border_.Bottom(), |
| + VisitedDependentColor(CSSPropertyBorderBottomColor), |
| + BorderBottomWidth()); |
| } |
| bool BorderSizeEquals(const ComputedStyle& o) const { |
| return BorderWidthEquals(BorderLeftWidth(), o.BorderLeftWidth()) && |
| @@ -2892,7 +2904,10 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase, |
| return false; |
| } |
| bool HasBorderColorReferencingCurrentColor() const { |
| - return Border().HasBorderColorReferencingCurrentColor(); |
| + return (BorderLeft().NonZero() && BorderLeftColor().IsCurrentColor()) || |
| + (BorderRight().NonZero() && BorderRightColor().IsCurrentColor()) || |
| + (BorderTop().NonZero() && BorderTopColor().IsCurrentColor()) || |
| + (BorderBottom().NonZero() && BorderBottomColor().IsCurrentColor()); |
| } |
| bool RadiiEqual(const ComputedStyle& o) const { |
| @@ -2914,19 +2929,19 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase, |
| ResetBorderBottomRightRadius(); |
| } |
| void ResetBorderTop() { |
| - SET_VAR(surround_data_, border_.top_, BorderColorAndStyle()); |
| + SET_VAR(surround_data_, border_.top_, BorderStyle()); |
| SetBorderTopWidth(3); |
| } |
| void ResetBorderRight() { |
| - SET_VAR(surround_data_, border_.right_, BorderColorAndStyle()); |
| + SET_VAR(surround_data_, border_.right_, BorderStyle()); |
| SetBorderRightWidth(3); |
| } |
| void ResetBorderBottom() { |
| - SET_VAR(surround_data_, border_.bottom_, BorderColorAndStyle()); |
| + SET_VAR(surround_data_, border_.bottom_, BorderStyle()); |
| SetBorderBottomWidth(3); |
| } |
| void ResetBorderLeft() { |
| - SET_VAR(surround_data_, border_.left_, BorderColorAndStyle()); |
| + SET_VAR(surround_data_, border_.left_, BorderStyle()); |
| SetBorderLeftWidth(3); |
| } |
| void ResetBorderImage() { |
| @@ -3489,16 +3504,24 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase, |
| // Color accessors are all private to make sure callers use |
| // VisitedDependentColor instead to access them. |
| StyleColor BorderLeftColor() const { |
| - return surround_data_->border_.Left().GetColor(); |
| + return BorderLeftColorIsCurrentColor() |
| + ? StyleColor::CurrentColor() |
| + : StyleColor(BorderBottomColorInternal()); |
| } |
| StyleColor BorderRightColor() const { |
| - return surround_data_->border_.Right().GetColor(); |
| + return BorderRightColorIsCurrentColor() |
| + ? StyleColor::CurrentColor() |
| + : StyleColor(BorderBottomColorInternal()); |
| } |
| StyleColor BorderTopColor() const { |
| - return surround_data_->border_.Top().GetColor(); |
| + return BorderTopColorIsCurrentColor() |
| + ? StyleColor::CurrentColor() |
| + : StyleColor(BorderBottomColorInternal()); |
| } |
| StyleColor BorderBottomColor() const { |
| - return surround_data_->border_.Bottom().GetColor(); |
| + return BorderBottomColorIsCurrentColor() |
| + ? StyleColor::CurrentColor() |
| + : StyleColor(BorderBottomColorInternal()); |
| } |
| StyleColor BackgroundColor() const { |
| return background_data_->background_color_; |