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 3f8e4e33caa43ccc019c79550cc500cf6744b6ec..4b61a900759da94aadb15aa426e46726738e9d57 100644 |
| --- a/third_party/WebKit/Source/core/style/ComputedStyle.h |
| +++ b/third_party/WebKit/Source/core/style/ComputedStyle.h |
| @@ -1094,24 +1094,22 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase, |
| static Length InitialMargin() { return Length(kFixed); } |
| // margin-top |
| - const Length& MarginTop() const { return surround_->margin_.Top(); } |
| - void SetMarginTop(const Length& v) { SET_VAR(surround_, margin_.top_, v); } |
| + const Length& MarginTop() const { return surround_->margin_top_; } |
| + void SetMarginTop(const Length& v) { SET_VAR(surround_, margin_top_, v); } |
| // margin-bottom |
| - const Length& MarginBottom() const { return surround_->margin_.Bottom(); } |
| + const Length& MarginBottom() const { return surround_->margin_bottom_; } |
| void SetMarginBottom(const Length& v) { |
| - SET_VAR(surround_, margin_.bottom_, v); |
| + SET_VAR(surround_, margin_bottom_, v); |
| } |
| // margin-left |
| - const Length& MarginLeft() const { return surround_->margin_.Left(); } |
| - void SetMarginLeft(const Length& v) { SET_VAR(surround_, margin_.left_, v); } |
| + const Length& MarginLeft() const { return surround_->margin_left_; } |
| + void SetMarginLeft(const Length& v) { SET_VAR(surround_, margin_left_, v); } |
| // margin-right |
| - const Length& MarginRight() const { return surround_->margin_.Right(); } |
| - void SetMarginRight(const Length& v) { |
| - SET_VAR(surround_, margin_.right_, v); |
| - } |
| + const Length& MarginRight() const { return surround_->margin_right_; } |
| + void SetMarginRight(const Length& v) { SET_VAR(surround_, margin_right_, v); } |
| // -webkit-margin-before-collapse (aka -webkit-margin-top-collapse) |
| static EMarginCollapse InitialMarginBeforeCollapse() { |
| @@ -2829,38 +2827,48 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase, |
| } |
| // Margin utility functions. |
| - bool HasMargin() const { return Margin().NonZero(); } |
| + bool HasMargin() const { |
| + return !MarginLeft().IsZero() || !MarginRight().IsZero() || |
| + !MarginTop().IsZero() || !MarginBottom().IsZero(); |
| + } |
| bool HasMarginBeforeQuirk() const { return MarginBefore().Quirk(); } |
| bool HasMarginAfterQuirk() const { return MarginAfter().Quirk(); } |
| - const LengthBox& Margin() const { return surround_->margin_; } |
| - const Length& MarginBefore() const { |
| - return Margin().Before(GetWritingMode()); |
| - } |
| - const Length& MarginAfter() const { return Margin().After(GetWritingMode()); } |
| - const Length& MarginStart() const { |
| - return Margin().Start(GetWritingMode(), Direction()); |
| - } |
| - const Length& MarginEnd() const { |
| - return Margin().end(GetWritingMode(), Direction()); |
| - } |
| - const Length& MarginOver() const { return Margin().Over(GetWritingMode()); } |
| - const Length& MarginUnder() const { return Margin().Under(GetWritingMode()); } |
| - const Length& MarginStartUsing(const ComputedStyle* other_style) const { |
| - return Margin().Start(other_style->GetWritingMode(), |
| - other_style->Direction()); |
| - } |
| - const Length& MarginEndUsing(const ComputedStyle* other_style) const { |
| - return Margin().end(other_style->GetWritingMode(), |
| - other_style->Direction()); |
| - } |
| - const Length& MarginBeforeUsing(const ComputedStyle* other_style) const { |
| - return Margin().Before(other_style->GetWritingMode()); |
| - } |
| - const Length& MarginAfterUsing(const ComputedStyle* other_style) const { |
| - return Margin().After(other_style->GetWritingMode()); |
| + const Length& MarginBefore() const { return MarginBeforeUsing(this); } |
| + const Length& MarginAfter() const { return MarginAfterUsing(this); } |
| + const Length& MarginStart() const { return MarginStartUsing(this); } |
| + const Length& MarginEnd() const { return MarginEndUsing(this); } |
| + const Length& MarginOver() const { |
| + return LengthBox::Over(GetWritingMode(), MarginTop(), MarginRight()); |
| + } |
| + const Length& MarginUnder() const { |
| + return LengthBox::Under(GetWritingMode(), MarginBottom(), MarginLeft()); |
| + } |
| + const Length& MarginStartUsing(const ComputedStyle* other) const { |
| + return LengthBox::Start(other->GetWritingMode(), other->Direction(), |
| + MarginTop(), MarginLeft(), MarginRight(), |
| + MarginBottom()); |
| + } |
| + const Length& MarginEndUsing(const ComputedStyle* other) const { |
| + return LengthBox::End(other->GetWritingMode(), other->Direction(), |
| + MarginTop(), MarginLeft(), MarginRight(), |
| + MarginBottom()); |
| + } |
| + const Length& MarginBeforeUsing(const ComputedStyle* other) const { |
| + return LengthBox::Before(other->GetWritingMode(), MarginTop(), MarginLeft(), |
| + MarginRight()); |
| + } |
| + const Length& MarginAfterUsing(const ComputedStyle* other) const { |
| + return LengthBox::After(other->GetWritingMode(), MarginBottom(), |
| + MarginLeft(), MarginRight()); |
| } |
| void SetMarginStart(const Length&); |
| void SetMarginEnd(const Length&); |
| + bool MarginEqual(const ComputedStyle& other) const { |
|
nainar
2017/04/18 06:58:49
Please mention in the description that you are add
shend
2017/04/18 07:54:25
Done.
|
| + return MarginTop() == other.MarginTop() && |
| + MarginLeft() == other.MarginLeft() && |
| + MarginRight() == other.MarginRight() && |
| + MarginBottom() == other.MarginBottom(); |
| + } |
| // Padding utility functions. |
| const LengthBox& Padding() const { return surround_->padding_; } |