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

Unified Diff: third_party/WebKit/Source/core/layout/CollapsedBorderValue.h

Issue 2858143003: Move condition in CollapsedBorderValue::Width() into constructor (Closed)
Patch Set: - 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/layout/CollapsedBorderValue.h
diff --git a/third_party/WebKit/Source/core/layout/CollapsedBorderValue.h b/third_party/WebKit/Source/core/layout/CollapsedBorderValue.h
index d555c97fd2f81c6c81e1ea07a76c5e68eb75edc0..816fcf65aa9f791b6d339728f49bc4eb83986801 100644
--- a/third_party/WebKit/Source/core/layout/CollapsedBorderValue.h
+++ b/third_party/WebKit/Source/core/layout/CollapsedBorderValue.h
@@ -49,25 +49,23 @@ class CollapsedBorderValue {
: color_(0),
width_(0),
style_(kBorderStyleNone),
- precedence_(kBorderPrecedenceOff),
- transparent_(false) {}
+ precedence_(kBorderPrecedenceOff) {}
CollapsedBorderValue(const BorderValue& border,
const Color& color,
EBorderPrecedence precedence)
: color_(color),
- width_(border.NonZero() ? border.Width() : 0),
+ width_(border.Style() > kBorderStyleHidden ? border.Width() : 0),
style_(border.Style()),
- precedence_(precedence),
- transparent_(border.IsTransparent()) {
+ precedence_(precedence) {
DCHECK(precedence != kBorderPrecedenceOff);
}
- unsigned Width() const { return style_ > kBorderStyleHidden ? width_ : 0; }
+ unsigned Width() const { return width_; }
EBorderStyle Style() const { return static_cast<EBorderStyle>(style_); }
bool Exists() const { return precedence_ != kBorderPrecedenceOff; }
Color GetColor() const { return color_; }
- bool IsTransparent() const { return transparent_; }
+ bool IsTransparent() const { return !color_.Alpha(); }
EBorderPrecedence Precedence() const {
return static_cast<EBorderPrecedence>(precedence_);
}
@@ -80,8 +78,8 @@ class CollapsedBorderValue {
bool VisuallyEquals(const CollapsedBorderValue& o) const {
if (!IsVisible() && !o.IsVisible())
return true;
- return GetColor() == o.GetColor() && IsTransparent() == o.IsTransparent() &&
- IsSameIgnoringColor(o);
+ return GetColor() == o.GetColor() && Width() == o.Width() &&
+ Style() == o.Style();
}
bool IsVisible() const { return Width() && !IsTransparent(); }
@@ -93,10 +91,9 @@ class CollapsedBorderValue {
private:
Color color_;
- unsigned width_ : 24;
+ unsigned width_ : 25;
unsigned style_ : 4; // EBorderStyle
unsigned precedence_ : 3; // EBorderPrecedence
- unsigned transparent_ : 1;
};
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/BUILD.gn ('k') | third_party/WebKit/Source/core/layout/CollapsedBorderValueTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698