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

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

Issue 2906253003: Replace call sites to BorderValue functions to save the BorderValue construction cost (Closed)
Patch Set: rune@ renames Created 3 years, 7 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 b93502c9ef0a9272bc002d045a8774fa4d8d3c84..57acd09c8e2ef8a60369a44053d46883994d344e 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.h
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.h
@@ -2665,6 +2665,7 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
BorderValue BorderAfter() const;
BorderValue BorderStart() const;
BorderValue BorderEnd() const;
+
float BorderAfterWidth() const;
float BorderBeforeWidth() const;
float BorderEndWidth() const;
@@ -2672,6 +2673,11 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
float BorderOverWidth() const;
float BorderUnderWidth() const;
+ EBorderStyle BorderAfterStyle() const;
+ EBorderStyle BorderBeforeStyle() const;
+ EBorderStyle BorderEndStyle() const;
+ EBorderStyle BorderStartStyle() const;
+
bool HasBorderFill() const {
return BorderImage().HasImage() && BorderImage().Fill();
}
@@ -2692,10 +2698,10 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
return false;
}
bool HasBorderColorReferencingCurrentColor() const {
- return (BorderLeft().NonZero() && BorderLeftColor().IsCurrentColor()) ||
- (BorderRight().NonZero() && BorderRightColor().IsCurrentColor()) ||
- (BorderTop().NonZero() && BorderTopColor().IsCurrentColor()) ||
- (BorderBottom().NonZero() && BorderBottomColor().IsCurrentColor());
+ return (BorderLeftNonZero() && BorderLeftColor().IsCurrentColor()) ||
+ (BorderRightNonZero() && BorderRightColor().IsCurrentColor()) ||
+ (BorderTopNonZero() && BorderTopColor().IsCurrentColor()) ||
+ (BorderBottomNonZero() && BorderBottomColor().IsCurrentColor());
}
bool RadiiEqual(const ComputedStyle& o) const {
@@ -2711,6 +2717,12 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
BorderLeftColor() == o.BorderLeftColor() &&
BorderLeftColorIsCurrentColor() == o.BorderLeftColorIsCurrentColor();
}
+ bool BorderLeftEquals(const BorderValue& o) const {
+ return BorderLeftWidthInternal().ToFloat() == o.Width() &&
+ BorderLeftStyle() == o.Style() &&
+ BorderLeftColor() == o.GetColor() &&
+ BorderLeftColorIsCurrentColor() == o.ColorIsCurrentColor();
+ }
bool BorderLeftVisuallyEqual(const ComputedStyle& o) const {
if (BorderLeftStyle() == EBorderStyle::kNone &&
@@ -2729,6 +2741,12 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
BorderRightColorIsCurrentColor() ==
o.BorderRightColorIsCurrentColor();
}
+ bool BorderRightEquals(const BorderValue& o) const {
+ return BorderRightWidthInternal().ToFloat() == o.Width() &&
+ BorderRightStyle() == o.Style() &&
+ BorderRightColor() == o.GetColor() &&
+ BorderRightColorIsCurrentColor() == o.ColorIsCurrentColor();
+ }
bool BorderRightVisuallyEqual(const ComputedStyle& o) const {
if (BorderRightStyle() == EBorderStyle::kNone &&
@@ -2756,6 +2774,11 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
BorderTopColor() == o.BorderTopColor() &&
BorderTopColorIsCurrentColor() == o.BorderTopColorIsCurrentColor();
}
+ bool BorderTopEquals(const BorderValue& o) const {
+ return BorderTopWidthInternal().ToFloat() == o.Width() &&
+ BorderTopStyle() == o.Style() && BorderTopColor() == o.GetColor() &&
+ BorderTopColorIsCurrentColor() == o.ColorIsCurrentColor();
+ }
bool BorderBottomVisuallyEqual(const ComputedStyle& o) const {
if (BorderBottomStyle() == EBorderStyle::kNone &&
@@ -2774,6 +2797,12 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
BorderBottomColorIsCurrentColor() ==
o.BorderBottomColorIsCurrentColor();
}
+ bool BorderBottomEquals(const BorderValue& o) const {
+ return BorderBottomWidthInternal().ToFloat() == o.Width() &&
+ BorderBottomStyle() == o.Style() &&
+ BorderBottomColor() == o.GetColor() &&
+ BorderBottomColorIsCurrentColor() == o.ColorIsCurrentColor();
+ }
bool BorderEquals(const ComputedStyle& o) const {
return BorderLeftEquals(o) && BorderRightEquals(o) && BorderTopEquals(o) &&
@@ -2806,25 +2835,25 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
SetBorderTopStyle(EBorderStyle::kNone);
SetBorderTopWidth(3);
SetBorderTopColorInternal(0);
- SetBorderTopColorInternal(true);
+ SetBorderTopColorIsCurrentColor(true);
}
void ResetBorderRight() {
SetBorderRightStyle(EBorderStyle::kNone);
SetBorderRightWidth(3);
SetBorderRightColorInternal(0);
- SetBorderRightColorInternal(true);
+ SetBorderRightColorIsCurrentColor(true);
}
void ResetBorderBottom() {
SetBorderBottomStyle(EBorderStyle::kNone);
SetBorderBottomWidth(3);
SetBorderBottomColorInternal(0);
- SetBorderBottomColorInternal(true);
+ SetBorderBottomColorIsCurrentColor(true);
}
void ResetBorderLeft() {
SetBorderLeftStyle(EBorderStyle::kNone);
SetBorderLeftWidth(3);
SetBorderLeftColorInternal(0);
- SetBorderLeftColorInternal(true);
+ SetBorderLeftColorIsCurrentColor(true);
}
void SetBorderRadius(const LengthSize& s) {
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTreeAsText.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