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

Unified 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 side-by-side diff with in-line comments
Download patch
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 acf2ae1901a900af59bd9a9abeb7ef82bc6c5211..840807efafc28841032b7312a96c91a507dffabf 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.h
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.h
@@ -1296,29 +1296,27 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
// padding-bottom
static Length InitialPaddingBottom() { return Length(kFixed); }
- const Length& PaddingBottom() const { return surround_->padding_.Bottom(); }
+ const Length& PaddingBottom() const { return surround_->padding_bottom_; }
void SetPaddingBottom(const Length& v) {
- SET_VAR(surround_, padding_.bottom_, v);
+ SET_VAR(surround_, padding_bottom_, v);
}
// padding-left
static Length InitialPaddingLeft() { return Length(kFixed); }
- const Length& PaddingLeft() const { return surround_->padding_.Left(); }
- void SetPaddingLeft(const Length& v) {
- SET_VAR(surround_, padding_.left_, v);
- }
+ const Length& PaddingLeft() const { return surround_->padding_left_; }
+ void SetPaddingLeft(const Length& v) { SET_VAR(surround_, padding_left_, v); }
// padding-right
static Length InitialPaddingRight() { return Length(kFixed); }
- const Length& PaddingRight() const { return surround_->padding_.Right(); }
+ const Length& PaddingRight() const { return surround_->padding_right_; }
void SetPaddingRight(const Length& v) {
- SET_VAR(surround_, padding_.right_, v);
+ SET_VAR(surround_, padding_right_, v);
}
// padding-top
static Length InitialPaddingTop() { return Length(kFixed); }
- const Length& PaddingTop() const { return surround_->padding_.Top(); }
- void SetPaddingTop(const Length& v) { SET_VAR(surround_, padding_.top_, v); }
+ const Length& PaddingTop() const { return surround_->padding_top_; }
+ void SetPaddingTop(const Length& v) { SET_VAR(surround_, padding_top_, v); }
// perspective (aka -webkit-perspective)
static float InitialPerspective() { return 0; }
@@ -2873,26 +2871,54 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
}
// Padding utility functions.
- const LengthBox& Padding() const { return surround_->padding_; }
const Length& PaddingBefore() const {
- return Padding().Before(GetWritingMode());
+ return LengthBox::Before(GetWritingMode(), PaddingTop(), PaddingLeft(),
+ PaddingRight());
}
const Length& PaddingAfter() const {
- return Padding().After(GetWritingMode());
+ return LengthBox::After(GetWritingMode(), PaddingBottom(), PaddingLeft(),
+ PaddingRight());
}
const Length& PaddingStart() const {
- return Padding().Start(GetWritingMode(), Direction());
+ return LengthBox::Start(GetWritingMode(), Direction(), PaddingTop(),
+ PaddingLeft(), PaddingRight(), PaddingBottom());
}
const Length& PaddingEnd() const {
- return Padding().end(GetWritingMode(), Direction());
+ return LengthBox::End(GetWritingMode(), Direction(), PaddingTop(),
+ PaddingLeft(), PaddingRight(), PaddingBottom());
+ }
+ const Length& PaddingOver() const {
+ return LengthBox::Over(GetWritingMode(), PaddingTop(), PaddingRight());
}
- const Length& PaddingOver() const { return Padding().Over(GetWritingMode()); }
const Length& PaddingUnder() const {
- return Padding().Under(GetWritingMode());
+ return LengthBox::Under(GetWritingMode(), PaddingBottom(), PaddingLeft());
+ }
+ bool HasPadding() const {
+ return !PaddingLeft().IsZero() || !PaddingRight().IsZero() ||
+ !PaddingTop().IsZero() || !PaddingBottom().IsZero();
+ }
+ void ResetPadding() {
+ SET_VAR(surround_, padding_top_, kFixed);
+ SET_VAR(surround_, padding_bottom_, kFixed);
+ SET_VAR(surround_, padding_left_, kFixed);
+ SET_VAR(surround_, padding_right_, kFixed);
+ }
+ void SetPadding(const LengthBox& b) {
+ SET_VAR(surround_, padding_top_, b.top_);
+ SET_VAR(surround_, padding_bottom_, b.bottom_);
+ SET_VAR(surround_, padding_left_, b.left_);
+ SET_VAR(surround_, padding_right_, b.right_);
+ }
+ bool PaddingEqual(const ComputedStyle& other) const {
+ return PaddingTop() == other.PaddingTop() &&
+ PaddingLeft() == other.PaddingLeft() &&
+ PaddingRight() == other.PaddingRight() &&
+ PaddingBottom() == other.PaddingBottom();
+ }
+ bool PaddingEqual(const LengthBox& other) const {
+ return PaddingTop() == other.Top() && PaddingLeft() == other.Left() &&
+ PaddingRight() == other.Right() && PaddingBottom() == other.Bottom();
}
- bool HasPadding() const { return Padding().NonZero(); }
- void ResetPadding() { SET_VAR(surround_, padding_, LengthBox(kFixed)); }
- void SetPadding(const LengthBox& b) { SET_VAR(surround_, padding_, b); }
// Border utility functions
LayoutRectOutsets ImageOutsets(const NinePieceImage&) const;
« 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