OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All | 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
6 * rights reserved. | 6 * rights reserved. |
7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1087 return static_cast<EIsolation>(rare_non_inherited_data_->isolation_); | 1087 return static_cast<EIsolation>(rare_non_inherited_data_->isolation_); |
1088 } | 1088 } |
1089 void SetIsolation(EIsolation v) { | 1089 void SetIsolation(EIsolation v) { |
1090 rare_non_inherited_data_.Access()->isolation_ = v; | 1090 rare_non_inherited_data_.Access()->isolation_ = v; |
1091 } | 1091 } |
1092 | 1092 |
1093 // Margin properties. | 1093 // Margin properties. |
1094 static Length InitialMargin() { return Length(kFixed); } | 1094 static Length InitialMargin() { return Length(kFixed); } |
1095 | 1095 |
1096 // margin-top | 1096 // margin-top |
1097 const Length& MarginTop() const { return surround_->margin_.Top(); } | 1097 const Length& MarginTop() const { return surround_->margin_top_; } |
1098 void SetMarginTop(const Length& v) { SET_VAR(surround_, margin_.top_, v); } | 1098 void SetMarginTop(const Length& v) { SET_VAR(surround_, margin_top_, v); } |
1099 | 1099 |
1100 // margin-bottom | 1100 // margin-bottom |
1101 const Length& MarginBottom() const { return surround_->margin_.Bottom(); } | 1101 const Length& MarginBottom() const { return surround_->margin_bottom_; } |
1102 void SetMarginBottom(const Length& v) { | 1102 void SetMarginBottom(const Length& v) { |
1103 SET_VAR(surround_, margin_.bottom_, v); | 1103 SET_VAR(surround_, margin_bottom_, v); |
1104 } | 1104 } |
1105 | 1105 |
1106 // margin-left | 1106 // margin-left |
1107 const Length& MarginLeft() const { return surround_->margin_.Left(); } | 1107 const Length& MarginLeft() const { return surround_->margin_left_; } |
1108 void SetMarginLeft(const Length& v) { SET_VAR(surround_, margin_.left_, v); } | 1108 void SetMarginLeft(const Length& v) { SET_VAR(surround_, margin_left_, v); } |
1109 | 1109 |
1110 // margin-right | 1110 // margin-right |
1111 const Length& MarginRight() const { return surround_->margin_.Right(); } | 1111 const Length& MarginRight() const { return surround_->margin_right_; } |
1112 void SetMarginRight(const Length& v) { | 1112 void SetMarginRight(const Length& v) { SET_VAR(surround_, margin_right_, v); } |
1113 SET_VAR(surround_, margin_.right_, v); | |
1114 } | |
1115 | 1113 |
1116 // -webkit-margin-before-collapse (aka -webkit-margin-top-collapse) | 1114 // -webkit-margin-before-collapse (aka -webkit-margin-top-collapse) |
1117 static EMarginCollapse InitialMarginBeforeCollapse() { | 1115 static EMarginCollapse InitialMarginBeforeCollapse() { |
1118 return kMarginCollapseCollapse; | 1116 return kMarginCollapseCollapse; |
1119 } | 1117 } |
1120 EMarginCollapse MarginAfterCollapse() const { | 1118 EMarginCollapse MarginAfterCollapse() const { |
1121 return static_cast<EMarginCollapse>( | 1119 return static_cast<EMarginCollapse>( |
1122 rare_non_inherited_data_->margin_after_collapse); | 1120 rare_non_inherited_data_->margin_after_collapse); |
1123 } | 1121 } |
1124 void SetMarginBeforeCollapse(EMarginCollapse c) { | 1122 void SetMarginBeforeCollapse(EMarginCollapse c) { |
(...skipping 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2822 return IsHorizontalWritingMode() ? MaxHeight() : MaxWidth(); | 2820 return IsHorizontalWritingMode() ? MaxHeight() : MaxWidth(); |
2823 } | 2821 } |
2824 const Length& LogicalMinWidth() const { | 2822 const Length& LogicalMinWidth() const { |
2825 return IsHorizontalWritingMode() ? MinWidth() : MinHeight(); | 2823 return IsHorizontalWritingMode() ? MinWidth() : MinHeight(); |
2826 } | 2824 } |
2827 const Length& LogicalMinHeight() const { | 2825 const Length& LogicalMinHeight() const { |
2828 return IsHorizontalWritingMode() ? MinHeight() : MinWidth(); | 2826 return IsHorizontalWritingMode() ? MinHeight() : MinWidth(); |
2829 } | 2827 } |
2830 | 2828 |
2831 // Margin utility functions. | 2829 // Margin utility functions. |
2832 bool HasMargin() const { return Margin().NonZero(); } | 2830 bool HasMargin() const { |
2831 return !MarginLeft().IsZero() || !MarginRight().IsZero() || | |
2832 !MarginTop().IsZero() || !MarginBottom().IsZero(); | |
2833 } | |
2833 bool HasMarginBeforeQuirk() const { return MarginBefore().Quirk(); } | 2834 bool HasMarginBeforeQuirk() const { return MarginBefore().Quirk(); } |
2834 bool HasMarginAfterQuirk() const { return MarginAfter().Quirk(); } | 2835 bool HasMarginAfterQuirk() const { return MarginAfter().Quirk(); } |
2835 const LengthBox& Margin() const { return surround_->margin_; } | 2836 const Length& MarginBefore() const { return MarginBeforeUsing(this); } |
2836 const Length& MarginBefore() const { | 2837 const Length& MarginAfter() const { return MarginAfterUsing(this); } |
2837 return Margin().Before(GetWritingMode()); | 2838 const Length& MarginStart() const { return MarginStartUsing(this); } |
2839 const Length& MarginEnd() const { return MarginEndUsing(this); } | |
2840 const Length& MarginOver() const { | |
2841 return LengthBox::Over(GetWritingMode(), MarginTop(), MarginRight()); | |
2838 } | 2842 } |
2839 const Length& MarginAfter() const { return Margin().After(GetWritingMode()); } | 2843 const Length& MarginUnder() const { |
2840 const Length& MarginStart() const { | 2844 return LengthBox::Under(GetWritingMode(), MarginBottom(), MarginLeft()); |
2841 return Margin().Start(GetWritingMode(), Direction()); | |
2842 } | 2845 } |
2843 const Length& MarginEnd() const { | 2846 const Length& MarginStartUsing(const ComputedStyle* other) const { |
2844 return Margin().end(GetWritingMode(), Direction()); | 2847 return LengthBox::Start(other->GetWritingMode(), other->Direction(), |
2848 MarginTop(), MarginLeft(), MarginRight(), | |
2849 MarginBottom()); | |
2845 } | 2850 } |
2846 const Length& MarginOver() const { return Margin().Over(GetWritingMode()); } | 2851 const Length& MarginEndUsing(const ComputedStyle* other) const { |
2847 const Length& MarginUnder() const { return Margin().Under(GetWritingMode()); } | 2852 return LengthBox::End(other->GetWritingMode(), other->Direction(), |
2848 const Length& MarginStartUsing(const ComputedStyle* other_style) const { | 2853 MarginTop(), MarginLeft(), MarginRight(), |
2849 return Margin().Start(other_style->GetWritingMode(), | 2854 MarginBottom()); |
2850 other_style->Direction()); | |
2851 } | 2855 } |
2852 const Length& MarginEndUsing(const ComputedStyle* other_style) const { | 2856 const Length& MarginBeforeUsing(const ComputedStyle* other) const { |
2853 return Margin().end(other_style->GetWritingMode(), | 2857 return LengthBox::Before(other->GetWritingMode(), MarginTop(), MarginLeft(), |
2854 other_style->Direction()); | 2858 MarginRight()); |
2855 } | 2859 } |
2856 const Length& MarginBeforeUsing(const ComputedStyle* other_style) const { | 2860 const Length& MarginAfterUsing(const ComputedStyle* other) const { |
2857 return Margin().Before(other_style->GetWritingMode()); | 2861 return LengthBox::After(other->GetWritingMode(), MarginBottom(), |
2858 } | 2862 MarginLeft(), MarginRight()); |
2859 const Length& MarginAfterUsing(const ComputedStyle* other_style) const { | |
2860 return Margin().After(other_style->GetWritingMode()); | |
2861 } | 2863 } |
2862 void SetMarginStart(const Length&); | 2864 void SetMarginStart(const Length&); |
2863 void SetMarginEnd(const Length&); | 2865 void SetMarginEnd(const Length&); |
2866 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.
| |
2867 return MarginTop() == other.MarginTop() && | |
2868 MarginLeft() == other.MarginLeft() && | |
2869 MarginRight() == other.MarginRight() && | |
2870 MarginBottom() == other.MarginBottom(); | |
2871 } | |
2864 | 2872 |
2865 // Padding utility functions. | 2873 // Padding utility functions. |
2866 const LengthBox& Padding() const { return surround_->padding_; } | 2874 const LengthBox& Padding() const { return surround_->padding_; } |
2867 const Length& PaddingBefore() const { | 2875 const Length& PaddingBefore() const { |
2868 return Padding().Before(GetWritingMode()); | 2876 return Padding().Before(GetWritingMode()); |
2869 } | 2877 } |
2870 const Length& PaddingAfter() const { | 2878 const Length& PaddingAfter() const { |
2871 return Padding().After(GetWritingMode()); | 2879 return Padding().After(GetWritingMode()); |
2872 } | 2880 } |
2873 const Length& PaddingStart() const { | 2881 const Length& PaddingStart() const { |
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3703 pseudo_bits_ |= 1 << (pseudo - kFirstPublicPseudoId); | 3711 pseudo_bits_ |= 1 << (pseudo - kFirstPublicPseudoId); |
3704 } | 3712 } |
3705 | 3713 |
3706 inline bool ComputedStyle::HasPseudoElementStyle() const { | 3714 inline bool ComputedStyle::HasPseudoElementStyle() const { |
3707 return pseudo_bits_ & kElementPseudoIdMask; | 3715 return pseudo_bits_ & kElementPseudoIdMask; |
3708 } | 3716 } |
3709 | 3717 |
3710 } // namespace blink | 3718 } // namespace blink |
3711 | 3719 |
3712 #endif // ComputedStyle_h | 3720 #endif // ComputedStyle_h |
OLD | NEW |