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

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

Issue 2904453002: Use LayoutUnit for all border-*-width logic (Closed)
Patch Set: Change to using LayoutUnit 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
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSProperties.json5 ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 47b9ef1d86569dea828c489b9976435e14c62562..ceef2a24c509a7741f468a50e122f2b34da87357 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.h
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.h
@@ -512,12 +512,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
*
@@ -717,12 +711,9 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase<ComputedStyle>,
if (BorderTopStyle() == EBorderStyle::kNone ||
BorderTopStyle() == EBorderStyle::kHidden)
return 0;
- return static_cast<float>(BorderTopWidthInternal()) /
- kBorderWidthDenominator;
- }
- void SetBorderTopWidth(float v) {
- SetBorderTopWidthInternal(WidthToFixedPoint(v));
+ return BorderTopWidthInternal().ToFloat();
}
+ void SetBorderTopWidth(float v) { SetBorderTopWidthInternal(LayoutUnit(v)); }
bool BorderTopNonZero() const {
return BorderTopWidth() && (BorderTopStyle() != EBorderStyle::kNone);
}
@@ -732,11 +723,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().ToFloat();
}
void SetBorderBottomWidth(float v) {
- SetBorderBottomWidthInternal(WidthToFixedPoint(v));
+ SetBorderBottomWidthInternal(LayoutUnit(v));
}
bool BorderBottomNonZero() const {
return BorderBottomWidth() && (BorderBottomStyle() != EBorderStyle::kNone);
@@ -747,11 +737,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().ToFloat();
}
void SetBorderLeftWidth(float v) {
- SetBorderLeftWidthInternal(WidthToFixedPoint(v));
+ SetBorderLeftWidthInternal(LayoutUnit(v));
}
bool BorderLeftNonZero() const {
return BorderLeftWidth() && (BorderLeftStyle() != EBorderStyle::kNone);
@@ -762,11 +751,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().ToFloat();
}
void SetBorderRightWidth(float v) {
- SetBorderRightWidthInternal(WidthToFixedPoint(v));
+ SetBorderRightWidthInternal(LayoutUnit(v));
}
bool BorderRightNonZero() const {
return BorderRightWidth() && (BorderRightStyle() != EBorderStyle::kNone);
@@ -3038,35 +3026,31 @@ 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().ToFloat(),
+ OutlineStyleIsAuto());
}
const BorderValue BorderRight() const {
return BorderValue(BorderRightStyle(), BorderRightColor(),
- static_cast<float>(BorderRightWidthInternal()) /
- kBorderWidthDenominator,
+ BorderRightWidthInternal().ToFloat(),
OutlineStyleIsAuto());
}
const BorderValue BorderTop() const {
- return BorderValue(
- BorderTopStyle(), BorderTopColor(),
- static_cast<float>(BorderTopWidthInternal()) / kBorderWidthDenominator,
- OutlineStyleIsAuto());
+ return BorderValue(BorderTopStyle(), BorderTopColor(),
+ BorderTopWidthInternal().ToFloat(),
+ OutlineStyleIsAuto());
}
const BorderValue BorderBottom() const {
return BorderValue(BorderBottomStyle(), BorderBottomColor(),
- static_cast<float>(BorderBottomWidthInternal()) /
- kBorderWidthDenominator,
+ BorderBottomWidthInternal().ToFloat(),
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() == o.BorderLeftWidthInternal() &&
+ BorderTopWidthInternal() == o.BorderTopWidthInternal() &&
+ BorderRightWidthInternal() == o.BorderRightWidthInternal() &&
+ BorderBottomWidthInternal() == o.BorderBottomWidthInternal();
}
BorderValue BorderBefore() const;
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSProperties.json5 ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698