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

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: Redo LayoutTable/LayoutTableSection 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 e0fb7a0e5bf0b68c0be6285ae49b5083478de214..3c6502b2532e966a9f4a579a137dc5eecdc4b105 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.h
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.h
@@ -2762,6 +2762,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;
@@ -2769,6 +2770,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();
}
@@ -2789,10 +2795,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 {
@@ -2808,6 +2814,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 &&
@@ -2826,6 +2838,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 &&
@@ -2853,6 +2871,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 &&
@@ -2871,6 +2894,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) &&
@@ -2903,25 +2932,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) {

Powered by Google App Engine
This is Rietveld 408576698