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

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

Issue 2640143005: Support subpixel layout for borders. (Closed)
Patch Set: Rebaselined tests. Created 3 years, 10 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 cdd718355c9fef5ad7527d175a275408ea725ee1..7087095f737df23e8589fd3f2158eb5de44ac45f 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.h
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.h
@@ -103,6 +103,14 @@ inline bool compareEqual(const T& a, const T& b) {
if (!compareEqual(group->variable.color(), value)) \
group.access()->variable.setColor(value)
+#define SET_BORDER_WIDTH(group, variable, value) \
+ if (!group->variable.widthEquals(value)) \
+ group.access()->variable.setWidth(value)
+
+#define SET_NESTED_BORDER_WIDTH(group, base, variable, value) \
+ if (!group->base->variable.widthEquals(value)) \
+ group.access()->base.access()->variable.setWidth(value)
+
namespace blink {
using std::max;
@@ -605,32 +613,34 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
void setBorderImageOutset(const BorderImageLengthBox&);
// Border width properties.
- static unsigned initialBorderWidth() { return 3; }
+ static float initialBorderWidth() { return 3; }
// border-top-width
- int borderTopWidth() const { return m_surround->border.borderTopWidth(); }
- void setBorderTopWidth(unsigned v) {
- SET_VAR(m_surround, border.m_top.m_width, v);
+ float borderTopWidth() const { return m_surround->border.borderTopWidth(); }
+ void setBorderTopWidth(float v) {
+ SET_BORDER_WIDTH(m_surround, border.m_top, v);
}
// border-bottom-width
- int borderBottomWidth() const {
+ float borderBottomWidth() const {
return m_surround->border.borderBottomWidth();
}
- void setBorderBottomWidth(unsigned v) {
- SET_VAR(m_surround, border.m_bottom.m_width, v);
+ void setBorderBottomWidth(float v) {
+ SET_BORDER_WIDTH(m_surround, border.m_bottom, v);
}
// border-left-width
- int borderLeftWidth() const { return m_surround->border.borderLeftWidth(); }
- void setBorderLeftWidth(unsigned v) {
- SET_VAR(m_surround, border.m_left.m_width, v);
+ float borderLeftWidth() const { return m_surround->border.borderLeftWidth(); }
+ void setBorderLeftWidth(float v) {
+ SET_BORDER_WIDTH(m_surround, border.m_left, v);
}
// border-right-width
- int borderRightWidth() const { return m_surround->border.borderRightWidth(); }
- void setBorderRightWidth(unsigned v) {
- SET_VAR(m_surround, border.m_right.m_width, v);
+ float borderRightWidth() const {
+ return m_surround->border.borderRightWidth();
+ }
+ void setBorderRightWidth(float v) {
+ SET_BORDER_WIDTH(m_surround, border.m_right, v);
}
// Border style properties.
@@ -867,7 +877,7 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
return m_rareNonInheritedData->m_multiCol->ruleWidth();
}
void setColumnRuleWidth(unsigned short w) {
- SET_NESTED_VAR(m_rareNonInheritedData, m_multiCol, m_rule.m_width, w);
+ SET_NESTED_BORDER_WIDTH(m_rareNonInheritedData, m_multiCol, m_rule, w);
}
// column-span (aka -webkit-column-span)
@@ -1443,13 +1453,13 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
// outline-width
static unsigned short initialOutlineWidth() { return 3; }
- int outlineWidth() const {
+ unsigned short outlineWidth() const {
if (m_rareNonInheritedData->m_outline.style() == BorderStyleNone)
return 0;
return m_rareNonInheritedData->m_outline.width();
}
void setOutlineWidth(unsigned short v) {
- SET_VAR(m_rareNonInheritedData, m_outline.m_width, v);
+ SET_BORDER_WIDTH(m_rareNonInheritedData, m_outline, v);
}
// outline-offset
@@ -3150,12 +3160,12 @@ class CORE_EXPORT ComputedStyle : public ComputedStyleBase,
const BorderValue& borderAfter() const;
const BorderValue& borderStart() const;
const BorderValue& borderEnd() const;
- int borderAfterWidth() const;
- int borderBeforeWidth() const;
- int borderEndWidth() const;
- int borderStartWidth() const;
- int borderOverWidth() const;
- int borderUnderWidth() const;
+ float borderAfterWidth() const;
+ float borderBeforeWidth() const;
+ float borderEndWidth() const;
+ float borderStartWidth() const;
+ float borderOverWidth() const;
+ float borderUnderWidth() const;
bool hasBorderFill() const { return m_surround->border.hasBorderFill(); }
bool hasBorder() const { return m_surround->border.hasBorder(); }
« no previous file with comments | « third_party/WebKit/Source/core/style/BorderValueTest.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