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

Unified Diff: third_party/WebKit/Source/core/style/ComputedStyle.h

Issue 2861773004: Move border-*-width out of BorderValue and store on SurroundData in ComputedStyle instead (Closed)
Patch Set: 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 c6033b5c88d6be9c45320c2ed0013d840fb9b8b5..6d1e265d13a74151b31fe33c87a279d140f1ad4c 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.h
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.h
@@ -500,38 +500,6 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
// Border width properties.
static float InitialBorderWidth() { return 3; }
- // border-top-width
- float BorderTopWidth() const {
- return surround_data_->border_.BorderTopWidth();
- }
- void SetBorderTopWidth(float v) {
- SET_BORDER_WIDTH(surround_data_, border_.top_, v);
- }
-
- // border-bottom-width
- float BorderBottomWidth() const {
- return surround_data_->border_.BorderBottomWidth();
- }
- void SetBorderBottomWidth(float v) {
- SET_BORDER_WIDTH(surround_data_, border_.bottom_, v);
- }
-
- // border-left-width
- float BorderLeftWidth() const {
- return surround_data_->border_.BorderLeftWidth();
- }
- void SetBorderLeftWidth(float v) {
- SET_BORDER_WIDTH(surround_data_, border_.left_, v);
- }
-
- // border-right-width
- float BorderRightWidth() const {
- return surround_data_->border_.BorderRightWidth();
- }
- void SetBorderRightWidth(float v) {
- SET_BORDER_WIDTH(surround_data_, border_.right_, v);
- }
-
// Border style properties.
static EBorderStyle InitialBorderStyle() { return kBorderStyleNone; }
@@ -2853,14 +2821,30 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
void SetBorderImageSlicesFill(bool);
const BorderData& Border() const { return surround_data_->border_; }
const BorderValue& BorderLeft() const {
- return surround_data_->border_.Left();
+ BorderValue* border_value =
+ new BorderValue(surround_data_->border_.Left(), BorderLeftWidth());
+ return *border_value;
}
const BorderValue& BorderRight() const {
- return surround_data_->border_.Right();
+ BorderValue* border_value =
+ new BorderValue(surround_data_->border_.Right(), BorderRightWidth());
+ return *border_value;
+ }
+ const BorderValue& BorderTop() const {
+ BorderValue* border_value =
+ new BorderValue(surround_data_->border_.Top(), BorderTopWidth());
+ return *border_value;
}
- const BorderValue& BorderTop() const { return surround_data_->border_.Top(); }
const BorderValue& BorderBottom() const {
- return surround_data_->border_.Bottom();
+ BorderValue* border_value =
+ new BorderValue(surround_data_->border_.Bottom(), BorderBottomWidth());
+ return *border_value;
+ }
+ bool BorderSizeEquals(const ComputedStyle& o) const {
+ return BorderLeftWidth() == o.BorderLeftWidth() &&
+ BorderTopWidth() == o.BorderTopWidth() &&
+ BorderRightWidth() == o.BorderRightWidth() &&
+ BorderBottomWidth() == o.BorderBottomWidth();
}
const BorderValue& BorderBefore() const;
const BorderValue& BorderAfter() const;
@@ -2874,7 +2858,10 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
float BorderUnderWidth() const;
bool HasBorderFill() const { return Border().HasBorderFill(); }
- bool HasBorder() const { return Border().HasBorder(); }
+ bool HasBorder() const {
+ return Border().HasBorder() || BorderLeftWidth() || BorderRightWidth() ||
+ BorderTopWidth() || BorderBottomWidth();
+ }
bool HasBorderDecoration() const { return HasBorder() || HasBorderFill(); }
bool HasBorderRadius() const {
if (!BorderTopLeftRadius().Width().IsZero())
@@ -2910,16 +2897,16 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
ResetBorderBottomRightRadius();
}
void ResetBorderTop() {
- SET_VAR(surround_data_, border_.top_, BorderValue());
+ SET_VAR(surround_data_, border_.top_, BorderColorAndStyle());
}
void ResetBorderRight() {
- SET_VAR(surround_data_, border_.right_, BorderValue());
+ SET_VAR(surround_data_, border_.right_, BorderColorAndStyle());
}
void ResetBorderBottom() {
- SET_VAR(surround_data_, border_.bottom_, BorderValue());
+ SET_VAR(surround_data_, border_.bottom_, BorderColorAndStyle());
}
void ResetBorderLeft() {
- SET_VAR(surround_data_, border_.left_, BorderValue());
+ SET_VAR(surround_data_, border_.left_, BorderColorAndStyle());
}
void ResetBorderImage() {
SET_VAR(surround_data_, border_.image_, NinePieceImage());

Powered by Google App Engine
This is Rietveld 408576698