| 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 1c7035340a3e14fca53571c65699951383eda71e..5c87aa6cbbbd93d74f0dde1b150343e3f6bafc16 100644
|
| --- a/third_party/WebKit/Source/core/style/ComputedStyle.h
|
| +++ b/third_party/WebKit/Source/core/style/ComputedStyle.h
|
| @@ -476,8 +476,8 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
|
| // TODO(nainar): Move all fixed point logic to a separate class.
|
| // border-top-width
|
| float BorderTopWidth() const {
|
| - if (surround_data_->border_.top_.Style() == kBorderStyleNone ||
|
| - surround_data_->border_.top_.Style() == kBorderStyleHidden)
|
| + if (BorderTopStyle() == EBorderStyle::kNone ||
|
| + BorderTopStyle() == EBorderStyle::kHidden)
|
| return 0;
|
| return static_cast<float>(BorderTopWidthInternal()) /
|
| kBorderWidthDenominator;
|
| @@ -485,11 +485,14 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
|
| void SetBorderTopWidth(float v) {
|
| surround_data_.Access()->border_top_width_ = WidthToFixedPoint(v);
|
| }
|
| + bool BorderTopNonZero() const {
|
| + return BorderTopWidth() && (BorderTopStyle() != EBorderStyle::kNone);
|
| + }
|
|
|
| // border-bottom-width
|
| float BorderBottomWidth() const {
|
| - if (surround_data_->border_.bottom_.Style() == kBorderStyleNone ||
|
| - surround_data_->border_.bottom_.Style() == kBorderStyleHidden)
|
| + if (BorderBottomStyle() == EBorderStyle::kNone ||
|
| + BorderBottomStyle() == EBorderStyle::kHidden)
|
| return 0;
|
| return static_cast<float>(BorderBottomWidthInternal()) /
|
| kBorderWidthDenominator;
|
| @@ -497,11 +500,14 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
|
| void SetBorderBottomWidth(float v) {
|
| surround_data_.Access()->border_bottom_width_ = WidthToFixedPoint(v);
|
| }
|
| + bool BorderBottomNonZero() const {
|
| + return BorderBottomWidth() && (BorderBottomStyle() != EBorderStyle::kNone);
|
| + }
|
|
|
| // border-left-width
|
| float BorderLeftWidth() const {
|
| - if (surround_data_->border_.left_.Style() == kBorderStyleNone ||
|
| - surround_data_->border_.left_.Style() == kBorderStyleHidden)
|
| + if (BorderLeftStyle() == EBorderStyle::kNone ||
|
| + BorderLeftStyle() == EBorderStyle::kHidden)
|
| return 0;
|
| return static_cast<float>(BorderLeftWidthInternal()) /
|
| kBorderWidthDenominator;
|
| @@ -509,11 +515,14 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
|
| void SetBorderLeftWidth(float v) {
|
| surround_data_.Access()->border_left_width_ = WidthToFixedPoint(v);
|
| }
|
| + bool BorderLeftNonZero() const {
|
| + return BorderLeftWidth() && (BorderLeftStyle() != EBorderStyle::kNone);
|
| + }
|
|
|
| // border-right-width
|
| float BorderRightWidth() const {
|
| - if (surround_data_->border_.right_.Style() == kBorderStyleNone ||
|
| - surround_data_->border_.right_.Style() == kBorderStyleHidden)
|
| + if (BorderRightStyle() == EBorderStyle::kNone ||
|
| + BorderRightStyle() == EBorderStyle::kHidden)
|
| return 0;
|
| return static_cast<float>(BorderRightWidthInternal()) /
|
| kBorderWidthDenominator;
|
| @@ -521,41 +530,11 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
|
| void SetBorderRightWidth(float v) {
|
| surround_data_.Access()->border_right_width_ = WidthToFixedPoint(v);
|
| }
|
| -
|
| - // Border style properties.
|
| - static EBorderStyle InitialBorderStyle() { return kBorderStyleNone; }
|
| -
|
| - // border-top-style
|
| - EBorderStyle BorderTopStyle() const {
|
| - return surround_data_->border_.Top().Style();
|
| - }
|
| - void SetBorderTopStyle(EBorderStyle v) {
|
| - SET_VAR(surround_data_, border_.top_.style_, v);
|
| - }
|
| -
|
| - // border-right-style
|
| - EBorderStyle BorderRightStyle() const {
|
| - return surround_data_->border_.Right().Style();
|
| - }
|
| - void SetBorderRightStyle(EBorderStyle v) {
|
| - SET_VAR(surround_data_, border_.right_.style_, v);
|
| - }
|
| -
|
| - // border-left-style
|
| - EBorderStyle BorderLeftStyle() const {
|
| - return surround_data_->border_.Left().Style();
|
| - }
|
| - void SetBorderLeftStyle(EBorderStyle v) {
|
| - SET_VAR(surround_data_, border_.left_.style_, v);
|
| + bool BorderRightNonZero() const {
|
| + return BorderRightWidth() && (BorderRightStyle() != EBorderStyle::kNone);
|
| }
|
|
|
| - // border-bottom-style
|
| - EBorderStyle BorderBottomStyle() const {
|
| - return surround_data_->border_.Bottom().Style();
|
| - }
|
| - void SetBorderBottomStyle(EBorderStyle v) {
|
| - SET_VAR(surround_data_, border_.bottom_.style_, v);
|
| - }
|
| + static EBorderStyle InitialColumnRuleStyle() { return EBorderStyle::kNone; }
|
|
|
| // Border color properties.
|
| // border-left-color
|
| @@ -663,7 +642,8 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
|
| return rare_non_inherited_data_->multi_col_->rule_.Style();
|
| }
|
| void SetColumnRuleStyle(EBorderStyle b) {
|
| - SET_NESTED_VAR(rare_non_inherited_data_, multi_col_, rule_.style_, b);
|
| + SET_NESTED_VAR(rare_non_inherited_data_, multi_col_, rule_.style_,
|
| + static_cast<unsigned>(b));
|
| }
|
|
|
| // column-rule-width (aka -webkit-column-rule-width)
|
| @@ -1153,7 +1133,8 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
|
| return rare_non_inherited_data_->outline_.Style();
|
| }
|
| void SetOutlineStyle(EBorderStyle v) {
|
| - SET_VAR(rare_non_inherited_data_, outline_.style_, v);
|
| + SET_VAR(rare_non_inherited_data_, outline_.style_,
|
| + static_cast<unsigned>(v));
|
| }
|
| static OutlineIsAuto InitialOutlineStyleIsAuto() { return kOutlineIsAutoOff; }
|
| OutlineIsAuto OutlineStyleIsAuto() const {
|
| @@ -1167,7 +1148,7 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
|
| // outline-width
|
| static unsigned short InitialOutlineWidth() { return 3; }
|
| unsigned short OutlineWidth() const {
|
| - if (rare_non_inherited_data_->outline_.Style() == kBorderStyleNone)
|
| + if (rare_non_inherited_data_->outline_.Style() == EBorderStyle::kNone)
|
| return 0;
|
| return rare_non_inherited_data_->outline_.Width();
|
| }
|
| @@ -1178,7 +1159,7 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
|
| // outline-offset
|
| static int InitialOutlineOffset() { return 0; }
|
| int OutlineOffset() const {
|
| - if (rare_non_inherited_data_->outline_.Style() == kBorderStyleNone)
|
| + if (rare_non_inherited_data_->outline_.Style() == EBorderStyle::kNone)
|
| return 0;
|
| return rare_non_inherited_data_->outline_.Offset();
|
| }
|
| @@ -2824,28 +2805,28 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
|
|
|
| void SetBorderImageSlicesFill(bool);
|
| const BorderData& Border() const { return surround_data_->border_; }
|
| - BorderValue BorderLeft() const {
|
| - return BorderValue(surround_data_->border_.Left(), BorderLeftColor(),
|
| - BorderLeftWidth());
|
| + const BorderValue BorderLeft() const {
|
| + return BorderValue(BorderLeftStyle(), BorderLeftColor(), BorderLeftWidth());
|
| }
|
| - BorderValue BorderRight() const {
|
| - return BorderValue(surround_data_->border_.Right(), BorderRightColor(),
|
| + const BorderValue BorderRight() const {
|
| + return BorderValue(BorderRightStyle(), BorderRightColor(),
|
| BorderRightWidth());
|
| }
|
| - BorderValue BorderTop() const {
|
| - return BorderValue(surround_data_->border_.Top(), BorderTopColor(),
|
| - BorderTopWidth());
|
| + const BorderValue BorderTop() const {
|
| + return BorderValue(BorderTopStyle(), BorderTopColor(), BorderTopWidth());
|
| }
|
| - BorderValue BorderBottom() const {
|
| - return BorderValue(surround_data_->border_.Bottom(), BorderBottomColor(),
|
| + const BorderValue BorderBottom() const {
|
| + return BorderValue(BorderBottomStyle(), BorderBottomColor(),
|
| BorderBottomWidth());
|
| }
|
| +
|
| bool BorderSizeEquals(const ComputedStyle& o) const {
|
| return BorderWidthEquals(BorderLeftWidth(), o.BorderLeftWidth()) &&
|
| BorderWidthEquals(BorderTopWidth(), o.BorderTopWidth()) &&
|
| BorderWidthEquals(BorderRightWidth(), o.BorderRightWidth()) &&
|
| BorderWidthEquals(BorderBottomWidth(), o.BorderBottomWidth());
|
| }
|
| +
|
| BorderValue BorderBefore() const;
|
| BorderValue BorderAfter() const;
|
| BorderValue BorderStart() const;
|
| @@ -2859,8 +2840,8 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
|
|
|
| bool HasBorderFill() const { return Border().HasBorderFill(); }
|
| bool HasBorder() const {
|
| - return Border().HasBorder() || BorderLeftWidth() || BorderRightWidth() ||
|
| - BorderTopWidth() || BorderBottomWidth();
|
| + return BorderLeftNonZero() || BorderRightNonZero() || BorderTopNonZero() ||
|
| + BorderBottomNonZero();
|
| }
|
| bool HasBorderDecoration() const { return HasBorder() || HasBorderFill(); }
|
| bool HasBorderRadius() const {
|
| @@ -2888,41 +2869,84 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
|
| BorderBottomRightRadius() == o.BorderBottomRightRadius();
|
| }
|
|
|
| - bool BorderColorEquals(const ComputedStyle& o) const {
|
| - return (BorderLeftColorInternal() == o.BorderLeftColorInternal() &&
|
| - BorderRightColorInternal() == o.BorderRightColorInternal() &&
|
| - BorderTopColorInternal() == o.BorderTopColorInternal() &&
|
| - BorderBottomColorInternal() == o.BorderBottomColorInternal()) &&
|
| - (BorderLeftColorIsCurrentColor() ==
|
| - o.BorderLeftColorIsCurrentColor() &&
|
| - BorderRightColorIsCurrentColor() ==
|
| - o.BorderRightColorIsCurrentColor() &&
|
| - BorderTopColorIsCurrentColor() ==
|
| - o.BorderTopColorIsCurrentColor() &&
|
| - BorderBottomColorIsCurrentColor() ==
|
| - o.BorderBottomColorIsCurrentColor());
|
| - }
|
| -
|
| - bool BorderColorVisuallyEquals(const ComputedStyle& o) const {
|
| - if ((BorderLeftStyle() == kBorderStyleNone &&
|
| - o.BorderLeftStyle() == kBorderStyleNone) &&
|
| - (BorderRightStyle() == kBorderStyleNone &&
|
| - o.BorderRightStyle() == kBorderStyleNone) &&
|
| - (BorderTopStyle() == kBorderStyleNone &&
|
| - o.BorderTopStyle() == kBorderStyleNone) &&
|
| - (BorderBottomStyle() == kBorderStyleNone &&
|
| - o.BorderBottomStyle() == kBorderStyleNone))
|
| + bool BorderLeftEquals(const ComputedStyle& o) const {
|
| + return BorderLeftWidthInternal() == o.BorderLeftWidthInternal() &&
|
| + BorderLeftStyle() == o.BorderLeftStyle() &&
|
| + BorderLeftColor() == o.BorderLeftColor() &&
|
| + BorderLeftColorIsCurrentColor() == o.BorderLeftColorIsCurrentColor();
|
| + }
|
| +
|
| + bool BorderLeftVisuallyEqual(const ComputedStyle& o) const {
|
| + if (BorderLeftStyle() == EBorderStyle::kNone &&
|
| + o.BorderLeftStyle() == EBorderStyle::kNone)
|
| + return true;
|
| + if (BorderLeftStyle() == EBorderStyle::kHidden &&
|
| + o.BorderLeftStyle() == EBorderStyle::kHidden)
|
| + return true;
|
| + return BorderLeftEquals(o);
|
| + }
|
| +
|
| + bool BorderRightEquals(const ComputedStyle& o) const {
|
| + return BorderRightWidthInternal() == o.BorderRightWidthInternal() &&
|
| + BorderRightStyle() == o.BorderRightStyle() &&
|
| + BorderRightColor() == o.BorderRightColor() &&
|
| + BorderRightColorIsCurrentColor() ==
|
| + o.BorderRightColorIsCurrentColor();
|
| + }
|
| +
|
| + bool BorderRightVisuallyEqual(const ComputedStyle& o) const {
|
| + if (BorderRightStyle() == EBorderStyle::kNone &&
|
| + o.BorderRightStyle() == EBorderStyle::kNone)
|
| + return true;
|
| + if (BorderRightStyle() == EBorderStyle::kHidden &&
|
| + o.BorderRightStyle() == EBorderStyle::kHidden)
|
| + return true;
|
| + return BorderRightEquals(o);
|
| + }
|
| +
|
| + bool BorderTopVisuallyEqual(const ComputedStyle& o) const {
|
| + if (BorderTopStyle() == EBorderStyle::kNone &&
|
| + o.BorderTopStyle() == EBorderStyle::kNone)
|
| + return true;
|
| + if (BorderTopStyle() == EBorderStyle::kHidden &&
|
| + o.BorderTopStyle() == EBorderStyle::kHidden)
|
| + return true;
|
| + return BorderTopEquals(o);
|
| + }
|
| +
|
| + bool BorderTopEquals(const ComputedStyle& o) const {
|
| + return BorderTopWidthInternal() == o.BorderTopWidthInternal() &&
|
| + BorderTopStyle() == o.BorderTopStyle() &&
|
| + BorderTopColor() == o.BorderTopColor() &&
|
| + BorderTopColorIsCurrentColor() == o.BorderTopColorIsCurrentColor();
|
| + }
|
| +
|
| + bool BorderBottomVisuallyEqual(const ComputedStyle& o) const {
|
| + if (BorderBottomStyle() == EBorderStyle::kNone &&
|
| + o.BorderBottomStyle() == EBorderStyle::kNone)
|
| return true;
|
| - if ((BorderLeftStyle() == kBorderStyleHidden &&
|
| - o.BorderLeftStyle() == kBorderStyleHidden) &&
|
| - (BorderRightStyle() == kBorderStyleHidden &&
|
| - o.BorderRightStyle() == kBorderStyleHidden) &&
|
| - (BorderTopStyle() == kBorderStyleHidden &&
|
| - o.BorderTopStyle() == kBorderStyleHidden) &&
|
| - (BorderBottomStyle() == kBorderStyleHidden &&
|
| - o.BorderBottomStyle() == kBorderStyleHidden))
|
| + if (BorderBottomStyle() == EBorderStyle::kHidden &&
|
| + o.BorderBottomStyle() == EBorderStyle::kHidden)
|
| return true;
|
| - return BorderColorEquals(o);
|
| + return BorderBottomEquals(o);
|
| + }
|
| +
|
| + bool BorderBottomEquals(const ComputedStyle& o) const {
|
| + return BorderBottomWidthInternal() == o.BorderBottomWidthInternal() &&
|
| + BorderBottomStyle() == o.BorderBottomStyle() &&
|
| + BorderBottomColor() == o.BorderBottomColor() &&
|
| + BorderBottomColorIsCurrentColor() ==
|
| + o.BorderBottomColorIsCurrentColor();
|
| + }
|
| +
|
| + bool BorderEquals(const ComputedStyle& o) const {
|
| + return BorderLeftEquals(o) && BorderRightEquals(o) && BorderTopEquals(o) &&
|
| + BorderBottomEquals(o) && BorderImage() != o.BorderImage();
|
| + }
|
| +
|
| + bool BorderVisuallyEqual(const ComputedStyle& o) const {
|
| + return BorderLeftVisuallyEqual(o) && BorderRightVisuallyEqual(o) &&
|
| + BorderTopVisuallyEqual(o) && BorderBottomVisuallyEqual(o);
|
| }
|
|
|
| void ResetBorder() {
|
| @@ -2938,28 +2962,32 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
|
| }
|
|
|
| void ResetBorderTop() {
|
| - SET_VAR(surround_data_, border_.top_, BorderStyle());
|
| + SetBorderTopStyle(EBorderStyle::kNone);
|
| SetBorderTopWidth(3);
|
| SetBorderTopColorInternal(0);
|
| SetBorderTopColorInternal(true);
|
| + SetBorderTopStyle(EBorderStyle::kNone);
|
| }
|
| void ResetBorderRight() {
|
| - SET_VAR(surround_data_, border_.right_, BorderStyle());
|
| + SetBorderRightStyle(EBorderStyle::kNone);
|
| SetBorderRightWidth(3);
|
| SetBorderRightColorInternal(0);
|
| SetBorderRightColorInternal(true);
|
| + SetBorderRightStyle(EBorderStyle::kNone);
|
| }
|
| void ResetBorderBottom() {
|
| - SET_VAR(surround_data_, border_.bottom_, BorderStyle());
|
| + SetBorderBottomStyle(EBorderStyle::kNone);
|
| SetBorderBottomWidth(3);
|
| SetBorderBottomColorInternal(0);
|
| SetBorderBottomColorInternal(true);
|
| + SetBorderBottomStyle(EBorderStyle::kNone);
|
| }
|
| void ResetBorderLeft() {
|
| - SET_VAR(surround_data_, border_.left_, BorderStyle());
|
| + SetBorderLeftStyle(EBorderStyle::kNone);
|
| SetBorderLeftWidth(3);
|
| SetBorderLeftColorInternal(0);
|
| SetBorderLeftColorInternal(true);
|
| + SetBorderLeftStyle(EBorderStyle::kNone);
|
| }
|
| void ResetBorderImage() {
|
| SET_VAR(surround_data_, border_.image_, NinePieceImage());
|
| @@ -3018,7 +3046,7 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
|
|
|
| // Outline utility functions.
|
| bool HasOutline() const {
|
| - return OutlineWidth() > 0 && OutlineStyle() > kBorderStyleHidden;
|
| + return OutlineWidth() > 0 && OutlineStyle() > EBorderStyle::kHidden;
|
| }
|
| int OutlineOutsetExtent() const;
|
| float GetOutlineStrokeWidthForFocusRing() const;
|
|
|