Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: third_party/WebKit/Source/core/style/ComputedStyle.h

Issue 2834603003: Split StyleSurroundData::padding into four individual Lengths. (Closed)
Patch Set: Split StyleSurroundData::padding into four individual Lengths. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 return rare_non_inherited_data_->outline_.Offset(); 1289 return rare_non_inherited_data_->outline_.Offset();
1290 } 1290 }
1291 void SetOutlineOffset(int v) { 1291 void SetOutlineOffset(int v) {
1292 SET_VAR(rare_non_inherited_data_, outline_.offset_, v); 1292 SET_VAR(rare_non_inherited_data_, outline_.offset_, v);
1293 } 1293 }
1294 1294
1295 // Padding properties. 1295 // Padding properties.
1296 1296
1297 // padding-bottom 1297 // padding-bottom
1298 static Length InitialPaddingBottom() { return Length(kFixed); } 1298 static Length InitialPaddingBottom() { return Length(kFixed); }
1299 const Length& PaddingBottom() const { return surround_->padding_.Bottom(); } 1299 const Length& PaddingBottom() const { return surround_->padding_bottom_; }
1300 void SetPaddingBottom(const Length& v) { 1300 void SetPaddingBottom(const Length& v) {
1301 SET_VAR(surround_, padding_.bottom_, v); 1301 SET_VAR(surround_, padding_bottom_, v);
1302 } 1302 }
1303 1303
1304 // padding-left 1304 // padding-left
1305 static Length InitialPaddingLeft() { return Length(kFixed); } 1305 static Length InitialPaddingLeft() { return Length(kFixed); }
1306 const Length& PaddingLeft() const { return surround_->padding_.Left(); } 1306 const Length& PaddingLeft() const { return surround_->padding_left_; }
1307 void SetPaddingLeft(const Length& v) { 1307 void SetPaddingLeft(const Length& v) { SET_VAR(surround_, padding_left_, v); }
1308 SET_VAR(surround_, padding_.left_, v);
1309 }
1310 1308
1311 // padding-right 1309 // padding-right
1312 static Length InitialPaddingRight() { return Length(kFixed); } 1310 static Length InitialPaddingRight() { return Length(kFixed); }
1313 const Length& PaddingRight() const { return surround_->padding_.Right(); } 1311 const Length& PaddingRight() const { return surround_->padding_right_; }
1314 void SetPaddingRight(const Length& v) { 1312 void SetPaddingRight(const Length& v) {
1315 SET_VAR(surround_, padding_.right_, v); 1313 SET_VAR(surround_, padding_right_, v);
1316 } 1314 }
1317 1315
1318 // padding-top 1316 // padding-top
1319 static Length InitialPaddingTop() { return Length(kFixed); } 1317 static Length InitialPaddingTop() { return Length(kFixed); }
1320 const Length& PaddingTop() const { return surround_->padding_.Top(); } 1318 const Length& PaddingTop() const { return surround_->padding_top_; }
1321 void SetPaddingTop(const Length& v) { SET_VAR(surround_, padding_.top_, v); } 1319 void SetPaddingTop(const Length& v) { SET_VAR(surround_, padding_top_, v); }
1322 1320
1323 // perspective (aka -webkit-perspective) 1321 // perspective (aka -webkit-perspective)
1324 static float InitialPerspective() { return 0; } 1322 static float InitialPerspective() { return 0; }
1325 float Perspective() const { return rare_non_inherited_data_->perspective_; } 1323 float Perspective() const { return rare_non_inherited_data_->perspective_; }
1326 void SetPerspective(float p) { 1324 void SetPerspective(float p) {
1327 SET_VAR(rare_non_inherited_data_, perspective_, p); 1325 SET_VAR(rare_non_inherited_data_, perspective_, p);
1328 } 1326 }
1329 1327
1330 // perspective-origin (aka -webkit-perspective-origin) 1328 // perspective-origin (aka -webkit-perspective-origin)
1331 static LengthPoint InitialPerspectiveOrigin() { 1329 static LengthPoint InitialPerspectiveOrigin() {
(...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after
2866 void SetMarginStart(const Length&); 2864 void SetMarginStart(const Length&);
2867 void SetMarginEnd(const Length&); 2865 void SetMarginEnd(const Length&);
2868 bool MarginEqual(const ComputedStyle& other) const { 2866 bool MarginEqual(const ComputedStyle& other) const {
2869 return MarginTop() == other.MarginTop() && 2867 return MarginTop() == other.MarginTop() &&
2870 MarginLeft() == other.MarginLeft() && 2868 MarginLeft() == other.MarginLeft() &&
2871 MarginRight() == other.MarginRight() && 2869 MarginRight() == other.MarginRight() &&
2872 MarginBottom() == other.MarginBottom(); 2870 MarginBottom() == other.MarginBottom();
2873 } 2871 }
2874 2872
2875 // Padding utility functions. 2873 // Padding utility functions.
2876 const LengthBox& Padding() const { return surround_->padding_; }
2877 const Length& PaddingBefore() const { 2874 const Length& PaddingBefore() const {
2878 return Padding().Before(GetWritingMode()); 2875 return LengthBox::Before(GetWritingMode(), PaddingTop(), PaddingLeft(),
2876 PaddingRight());
2879 } 2877 }
2880 const Length& PaddingAfter() const { 2878 const Length& PaddingAfter() const {
2881 return Padding().After(GetWritingMode()); 2879 return LengthBox::After(GetWritingMode(), PaddingBottom(), PaddingLeft(),
2880 PaddingRight());
2882 } 2881 }
2883 const Length& PaddingStart() const { 2882 const Length& PaddingStart() const {
2884 return Padding().Start(GetWritingMode(), Direction()); 2883 return LengthBox::Start(GetWritingMode(), Direction(), PaddingTop(),
2884 PaddingLeft(), PaddingRight(), PaddingBottom());
2885 } 2885 }
2886 const Length& PaddingEnd() const { 2886 const Length& PaddingEnd() const {
2887 return Padding().end(GetWritingMode(), Direction()); 2887 return LengthBox::End(GetWritingMode(), Direction(), PaddingTop(),
2888 PaddingLeft(), PaddingRight(), PaddingBottom());
2888 } 2889 }
2889 const Length& PaddingOver() const { return Padding().Over(GetWritingMode()); } 2890 const Length& PaddingOver() const {
2891 return LengthBox::Over(GetWritingMode(), PaddingTop(), PaddingRight());
2892 }
2890 const Length& PaddingUnder() const { 2893 const Length& PaddingUnder() const {
2891 return Padding().Under(GetWritingMode()); 2894 return LengthBox::Under(GetWritingMode(), PaddingBottom(), PaddingLeft());
2892 } 2895 }
2893 bool HasPadding() const { return Padding().NonZero(); } 2896 bool HasPadding() const {
2894 void ResetPadding() { SET_VAR(surround_, padding_, LengthBox(kFixed)); } 2897 return !PaddingLeft().IsZero() || !PaddingRight().IsZero() ||
2895 void SetPadding(const LengthBox& b) { SET_VAR(surround_, padding_, b); } 2898 !PaddingTop().IsZero() || !PaddingBottom().IsZero();
2899 }
2900 void ResetPadding() {
2901 SET_VAR(surround_, padding_top_, kFixed);
2902 SET_VAR(surround_, padding_bottom_, kFixed);
2903 SET_VAR(surround_, padding_left_, kFixed);
2904 SET_VAR(surround_, padding_right_, kFixed);
2905 }
2906 void SetPadding(const LengthBox& b) {
2907 SET_VAR(surround_, padding_top_, b.top_);
2908 SET_VAR(surround_, padding_bottom_, b.bottom_);
2909 SET_VAR(surround_, padding_left_, b.left_);
2910 SET_VAR(surround_, padding_right_, b.right_);
2911 }
2912 bool PaddingEqual(const ComputedStyle& other) const {
2913 return PaddingTop() == other.PaddingTop() &&
2914 PaddingLeft() == other.PaddingLeft() &&
2915 PaddingRight() == other.PaddingRight() &&
2916 PaddingBottom() == other.PaddingBottom();
2917 }
2918 bool PaddingEqual(const LengthBox& other) const {
2919 return PaddingTop() == other.Top() && PaddingLeft() == other.Left() &&
2920 PaddingRight() == other.Right() && PaddingBottom() == other.Bottom();
2921 }
2896 2922
2897 // Border utility functions 2923 // Border utility functions
2898 LayoutRectOutsets ImageOutsets(const NinePieceImage&) const; 2924 LayoutRectOutsets ImageOutsets(const NinePieceImage&) const;
2899 bool HasBorderImageOutsets() const { 2925 bool HasBorderImageOutsets() const {
2900 return BorderImage().HasImage() && BorderImage().Outset().NonZero(); 2926 return BorderImage().HasImage() && BorderImage().Outset().NonZero();
2901 } 2927 }
2902 LayoutRectOutsets BorderImageOutsets() const { 2928 LayoutRectOutsets BorderImageOutsets() const {
2903 return ImageOutsets(BorderImage()); 2929 return ImageOutsets(BorderImage());
2904 } 2930 }
2905 bool BorderImageSlicesFill() const { return Border().GetImage().Fill(); } 2931 bool BorderImageSlicesFill() const { return Border().GetImage().Fill(); }
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
3715 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId))); 3741 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId)));
3716 } 3742 }
3717 3743
3718 inline bool ComputedStyle::HasPseudoElementStyle() const { 3744 inline bool ComputedStyle::HasPseudoElementStyle() const {
3719 return PseudoBitsInternal() & kElementPseudoIdMask; 3745 return PseudoBitsInternal() & kElementPseudoIdMask;
3720 } 3746 }
3721 3747
3722 } // namespace blink 3748 } // namespace blink
3723 3749
3724 #endif // ComputedStyle_h 3750 #endif // ComputedStyle_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTheme.cpp ('k') | third_party/WebKit/Source/core/style/ComputedStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698