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

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

Issue 2904453002: Use LayoutUnit for all border-*-width logic (Closed)
Patch Set: shend@ suggestions 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 e1a644aec1cfadd6e0f158bb1855a4fbc661971f..6b5da7383365ba63662dada8bab3aca002588262 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.h
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.h
@@ -253,12 +253,6 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
return cached_pseudo_styles_.get();
}
- bool BorderWidthEquals(float border_width_first,
- float border_width_second) const {
- return WidthToFixedPoint(border_width_first) ==
- WidthToFixedPoint(border_width_second);
- }
-
/**
* ComputedStyle properties
*
@@ -458,11 +452,10 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
if (BorderTopStyle() == EBorderStyle::kNone ||
BorderTopStyle() == EBorderStyle::kHidden)
return 0;
- return static_cast<float>(BorderTopWidthInternal()) /
- kBorderWidthDenominator;
+ return BorderTopWidthInternal().Width();
}
void SetBorderTopWidth(float v) {
- SetBorderTopWidthInternal(WidthToFixedPoint(v));
+ MutableBorderTopWidthInternal().SetWidth(v);
}
bool BorderTopNonZero() const {
return BorderTopWidth() && (BorderTopStyle() != EBorderStyle::kNone);
@@ -473,11 +466,10 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
if (BorderBottomStyle() == EBorderStyle::kNone ||
BorderBottomStyle() == EBorderStyle::kHidden)
return 0;
- return static_cast<float>(BorderBottomWidthInternal()) /
- kBorderWidthDenominator;
+ return BorderBottomWidthInternal().Width();
}
void SetBorderBottomWidth(float v) {
- SetBorderBottomWidthInternal(WidthToFixedPoint(v));
+ MutableBorderBottomWidthInternal().SetWidth(v);
}
bool BorderBottomNonZero() const {
return BorderBottomWidth() && (BorderBottomStyle() != EBorderStyle::kNone);
@@ -488,11 +480,10 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
if (BorderLeftStyle() == EBorderStyle::kNone ||
BorderLeftStyle() == EBorderStyle::kHidden)
return 0;
- return static_cast<float>(BorderLeftWidthInternal()) /
- kBorderWidthDenominator;
+ return BorderLeftWidthInternal().Width();
}
void SetBorderLeftWidth(float v) {
- SetBorderLeftWidthInternal(WidthToFixedPoint(v));
+ MutableBorderLeftWidthInternal().SetWidth(v);
}
bool BorderLeftNonZero() const {
return BorderLeftWidth() && (BorderLeftStyle() != EBorderStyle::kNone);
@@ -503,11 +494,10 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
if (BorderRightStyle() == EBorderStyle::kNone ||
BorderRightStyle() == EBorderStyle::kHidden)
return 0;
- return static_cast<float>(BorderRightWidthInternal()) /
- kBorderWidthDenominator;
+ return BorderRightWidthInternal().Width();
}
void SetBorderRightWidth(float v) {
- SetBorderRightWidthInternal(WidthToFixedPoint(v));
+ MutableBorderRightWidthInternal().SetWidth(v);
}
bool BorderRightNonZero() const {
return BorderRightWidth() && (BorderRightStyle() != EBorderStyle::kNone);
@@ -2779,35 +2769,33 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
void SetBorderImageSlicesFill(bool);
const BorderValue BorderLeft() const {
- return BorderValue(
- BorderLeftStyle(), BorderLeftColor(),
- static_cast<float>(BorderLeftWidthInternal()) / kBorderWidthDenominator,
- OutlineStyleIsAuto());
+ return BorderValue(BorderLeftStyle(), BorderLeftColor(),
+ BorderLeftWidthInternal().Width(), OutlineStyleIsAuto());
}
const BorderValue BorderRight() const {
return BorderValue(BorderRightStyle(), BorderRightColor(),
- static_cast<float>(BorderRightWidthInternal()) /
- kBorderWidthDenominator,
+ BorderRightWidthInternal().Width(),
OutlineStyleIsAuto());
}
const BorderValue BorderTop() const {
- return BorderValue(
- BorderTopStyle(), BorderTopColor(),
- static_cast<float>(BorderTopWidthInternal()) / kBorderWidthDenominator,
- OutlineStyleIsAuto());
+ return BorderValue(BorderTopStyle(), BorderTopColor(),
+ BorderTopWidthInternal().Width(), OutlineStyleIsAuto());
}
const BorderValue BorderBottom() const {
return BorderValue(BorderBottomStyle(), BorderBottomColor(),
- static_cast<float>(BorderBottomWidthInternal()) /
- kBorderWidthDenominator,
+ BorderBottomWidthInternal().Width(),
OutlineStyleIsAuto());
}
bool BorderSizeEquals(const ComputedStyle& o) const {
- return BorderWidthEquals(BorderLeftWidth(), o.BorderLeftWidth()) &&
- BorderWidthEquals(BorderTopWidth(), o.BorderTopWidth()) &&
- BorderWidthEquals(BorderRightWidth(), o.BorderRightWidth()) &&
- BorderWidthEquals(BorderBottomWidth(), o.BorderBottomWidth());
+ return BorderLeftWidthInternal().WidthEquals(
+ o.BorderLeftWidthInternal().Width()) &&
+ BorderTopWidthInternal().WidthEquals(
+ o.BorderTopWidthInternal().Width()) &&
+ BorderRightWidthInternal().WidthEquals(
+ o.BorderRightWidthInternal().Width()) &&
+ BorderBottomWidthInternal().WidthEquals(
+ o.BorderBottomWidthInternal().Width());
}
BorderValue BorderBefore() const;

Powered by Google App Engine
This is Rietveld 408576698