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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 * rights reserved. 6 * rights reserved.
7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 group.access()->base.access()->variable = value 96 group.access()->base.access()->variable = value
97 97
98 #define SET_VAR_WITH_SETTER(group, getter, setter, value) \ 98 #define SET_VAR_WITH_SETTER(group, getter, setter, value) \
99 if (!compareEqual(group->getter(), value)) \ 99 if (!compareEqual(group->getter(), value)) \
100 group.access()->setter(value) 100 group.access()->setter(value)
101 101
102 #define SET_BORDERVALUE_COLOR(group, variable, value) \ 102 #define SET_BORDERVALUE_COLOR(group, variable, value) \
103 if (!compareEqual(group->variable.color(), value)) \ 103 if (!compareEqual(group->variable.color(), value)) \
104 group.access()->variable.setColor(value) 104 group.access()->variable.setColor(value)
105 105
106 #define SET_BORDER_WIDTH(group, variable, value) \
107 if (!group->variable.widthEquals(value)) \
108 group.access()->variable.setWidth(value)
109
110 #define SET_NESTED_BORDER_WIDTH(group, base, variable, value) \
111 if (!group->base->variable.widthEquals(value)) \
112 group.access()->base.access()->variable.setWidth(value)
113
106 namespace blink { 114 namespace blink {
107 115
108 using std::max; 116 using std::max;
109 117
110 class FilterOperations; 118 class FilterOperations;
111 119
112 class AppliedTextDecoration; 120 class AppliedTextDecoration;
113 class BorderData; 121 class BorderData;
114 struct BorderEdge; 122 struct BorderEdge;
115 class CSSAnimationData; 123 class CSSAnimationData;
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 } 606 }
599 void setBorderImageWidth(const BorderImageLengthBox&); 607 void setBorderImageWidth(const BorderImageLengthBox&);
600 608
601 // border-image-outset 609 // border-image-outset
602 const BorderImageLengthBox& borderImageOutset() const { 610 const BorderImageLengthBox& borderImageOutset() const {
603 return m_surround->border.image().outset(); 611 return m_surround->border.image().outset();
604 } 612 }
605 void setBorderImageOutset(const BorderImageLengthBox&); 613 void setBorderImageOutset(const BorderImageLengthBox&);
606 614
607 // Border width properties. 615 // Border width properties.
608 static unsigned initialBorderWidth() { return 3; } 616 static float initialBorderWidth() { return 3; }
609 617
610 // border-top-width 618 // border-top-width
611 int borderTopWidth() const { return m_surround->border.borderTopWidth(); } 619 float borderTopWidth() const { return m_surround->border.borderTopWidth(); }
612 void setBorderTopWidth(unsigned v) { 620 void setBorderTopWidth(float v) {
613 SET_VAR(m_surround, border.m_top.m_width, v); 621 SET_BORDER_WIDTH(m_surround, border.m_top, v);
614 } 622 }
615 623
616 // border-bottom-width 624 // border-bottom-width
617 int borderBottomWidth() const { 625 float borderBottomWidth() const {
618 return m_surround->border.borderBottomWidth(); 626 return m_surround->border.borderBottomWidth();
619 } 627 }
620 void setBorderBottomWidth(unsigned v) { 628 void setBorderBottomWidth(float v) {
621 SET_VAR(m_surround, border.m_bottom.m_width, v); 629 SET_BORDER_WIDTH(m_surround, border.m_bottom, v);
622 } 630 }
623 631
624 // border-left-width 632 // border-left-width
625 int borderLeftWidth() const { return m_surround->border.borderLeftWidth(); } 633 float borderLeftWidth() const { return m_surround->border.borderLeftWidth(); }
626 void setBorderLeftWidth(unsigned v) { 634 void setBorderLeftWidth(float v) {
627 SET_VAR(m_surround, border.m_left.m_width, v); 635 SET_BORDER_WIDTH(m_surround, border.m_left, v);
628 } 636 }
629 637
630 // border-right-width 638 // border-right-width
631 int borderRightWidth() const { return m_surround->border.borderRightWidth(); } 639 float borderRightWidth() const {
632 void setBorderRightWidth(unsigned v) { 640 return m_surround->border.borderRightWidth();
633 SET_VAR(m_surround, border.m_right.m_width, v); 641 }
642 void setBorderRightWidth(float v) {
643 SET_BORDER_WIDTH(m_surround, border.m_right, v);
634 } 644 }
635 645
636 // Border style properties. 646 // Border style properties.
637 static EBorderStyle initialBorderStyle() { return BorderStyleNone; } 647 static EBorderStyle initialBorderStyle() { return BorderStyleNone; }
638 648
639 // border-top-style 649 // border-top-style
640 EBorderStyle borderTopStyle() const { 650 EBorderStyle borderTopStyle() const {
641 return m_surround->border.top().style(); 651 return m_surround->border.top().style();
642 } 652 }
643 void setBorderTopStyle(EBorderStyle v) { 653 void setBorderTopStyle(EBorderStyle v) {
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 void setColumnRuleStyle(EBorderStyle b) { 870 void setColumnRuleStyle(EBorderStyle b) {
861 SET_NESTED_VAR(m_rareNonInheritedData, m_multiCol, m_rule.m_style, b); 871 SET_NESTED_VAR(m_rareNonInheritedData, m_multiCol, m_rule.m_style, b);
862 } 872 }
863 873
864 // column-rule-width (aka -webkit-column-rule-width) 874 // column-rule-width (aka -webkit-column-rule-width)
865 static unsigned short initialColumnRuleWidth() { return 3; } 875 static unsigned short initialColumnRuleWidth() { return 3; }
866 unsigned short columnRuleWidth() const { 876 unsigned short columnRuleWidth() const {
867 return m_rareNonInheritedData->m_multiCol->ruleWidth(); 877 return m_rareNonInheritedData->m_multiCol->ruleWidth();
868 } 878 }
869 void setColumnRuleWidth(unsigned short w) { 879 void setColumnRuleWidth(unsigned short w) {
870 SET_NESTED_VAR(m_rareNonInheritedData, m_multiCol, m_rule.m_width, w); 880 SET_NESTED_BORDER_WIDTH(m_rareNonInheritedData, m_multiCol, m_rule, w);
871 } 881 }
872 882
873 // column-span (aka -webkit-column-span) 883 // column-span (aka -webkit-column-span)
874 static ColumnSpan initialColumnSpan() { return ColumnSpanNone; } 884 static ColumnSpan initialColumnSpan() { return ColumnSpanNone; }
875 ColumnSpan getColumnSpan() const { 885 ColumnSpan getColumnSpan() const {
876 return static_cast<ColumnSpan>( 886 return static_cast<ColumnSpan>(
877 m_rareNonInheritedData->m_multiCol->m_columnSpan); 887 m_rareNonInheritedData->m_multiCol->m_columnSpan);
878 } 888 }
879 void setColumnSpan(ColumnSpan columnSpan) { 889 void setColumnSpan(ColumnSpan columnSpan) {
880 SET_NESTED_VAR(m_rareNonInheritedData, m_multiCol, m_columnSpan, 890 SET_NESTED_VAR(m_rareNonInheritedData, m_multiCol, m_columnSpan,
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 OutlineIsAuto outlineStyleIsAuto() const { 1446 OutlineIsAuto outlineStyleIsAuto() const {
1437 return static_cast<OutlineIsAuto>( 1447 return static_cast<OutlineIsAuto>(
1438 m_rareNonInheritedData->m_outline.isAuto()); 1448 m_rareNonInheritedData->m_outline.isAuto());
1439 } 1449 }
1440 void setOutlineStyleIsAuto(OutlineIsAuto isAuto) { 1450 void setOutlineStyleIsAuto(OutlineIsAuto isAuto) {
1441 SET_VAR(m_rareNonInheritedData, m_outline.m_isAuto, isAuto); 1451 SET_VAR(m_rareNonInheritedData, m_outline.m_isAuto, isAuto);
1442 } 1452 }
1443 1453
1444 // outline-width 1454 // outline-width
1445 static unsigned short initialOutlineWidth() { return 3; } 1455 static unsigned short initialOutlineWidth() { return 3; }
1446 int outlineWidth() const { 1456 unsigned short outlineWidth() const {
1447 if (m_rareNonInheritedData->m_outline.style() == BorderStyleNone) 1457 if (m_rareNonInheritedData->m_outline.style() == BorderStyleNone)
1448 return 0; 1458 return 0;
1449 return m_rareNonInheritedData->m_outline.width(); 1459 return m_rareNonInheritedData->m_outline.width();
1450 } 1460 }
1451 void setOutlineWidth(unsigned short v) { 1461 void setOutlineWidth(unsigned short v) {
1452 SET_VAR(m_rareNonInheritedData, m_outline.m_width, v); 1462 SET_BORDER_WIDTH(m_rareNonInheritedData, m_outline, v);
1453 } 1463 }
1454 1464
1455 // outline-offset 1465 // outline-offset
1456 static int initialOutlineOffset() { return 0; } 1466 static int initialOutlineOffset() { return 0; }
1457 int outlineOffset() const { 1467 int outlineOffset() const {
1458 if (m_rareNonInheritedData->m_outline.style() == BorderStyleNone) 1468 if (m_rareNonInheritedData->m_outline.style() == BorderStyleNone)
1459 return 0; 1469 return 0;
1460 return m_rareNonInheritedData->m_outline.offset(); 1470 return m_rareNonInheritedData->m_outline.offset();
1461 } 1471 }
1462 void setOutlineOffset(int v) { 1472 void setOutlineOffset(int v) {
(...skipping 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after
3143 const BorderValue& borderLeft() const { return m_surround->border.left(); } 3153 const BorderValue& borderLeft() const { return m_surround->border.left(); }
3144 const BorderValue& borderRight() const { return m_surround->border.right(); } 3154 const BorderValue& borderRight() const { return m_surround->border.right(); }
3145 const BorderValue& borderTop() const { return m_surround->border.top(); } 3155 const BorderValue& borderTop() const { return m_surround->border.top(); }
3146 const BorderValue& borderBottom() const { 3156 const BorderValue& borderBottom() const {
3147 return m_surround->border.bottom(); 3157 return m_surround->border.bottom();
3148 } 3158 }
3149 const BorderValue& borderBefore() const; 3159 const BorderValue& borderBefore() const;
3150 const BorderValue& borderAfter() const; 3160 const BorderValue& borderAfter() const;
3151 const BorderValue& borderStart() const; 3161 const BorderValue& borderStart() const;
3152 const BorderValue& borderEnd() const; 3162 const BorderValue& borderEnd() const;
3153 int borderAfterWidth() const; 3163 float borderAfterWidth() const;
3154 int borderBeforeWidth() const; 3164 float borderBeforeWidth() const;
3155 int borderEndWidth() const; 3165 float borderEndWidth() const;
3156 int borderStartWidth() const; 3166 float borderStartWidth() const;
3157 int borderOverWidth() const; 3167 float borderOverWidth() const;
3158 int borderUnderWidth() const; 3168 float borderUnderWidth() const;
3159 3169
3160 bool hasBorderFill() const { return m_surround->border.hasBorderFill(); } 3170 bool hasBorderFill() const { return m_surround->border.hasBorderFill(); }
3161 bool hasBorder() const { return m_surround->border.hasBorder(); } 3171 bool hasBorder() const { return m_surround->border.hasBorder(); }
3162 bool hasBorderDecoration() const { return hasBorder() || hasBorderFill(); } 3172 bool hasBorderDecoration() const { return hasBorder() || hasBorderFill(); }
3163 bool hasBorderRadius() const { return m_surround->border.hasBorderRadius(); } 3173 bool hasBorderRadius() const { return m_surround->border.hasBorderRadius(); }
3164 3174
3165 void resetBorder() { 3175 void resetBorder() {
3166 resetBorderImage(); 3176 resetBorderImage();
3167 resetBorderTop(); 3177 resetBorderTop();
3168 resetBorderRight(); 3178 resetBorderRight();
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
3916 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1); 3926 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1);
3917 } 3927 }
3918 3928
3919 inline bool ComputedStyle::hasPseudoElementStyle() const { 3929 inline bool ComputedStyle::hasPseudoElementStyle() const {
3920 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; 3930 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask;
3921 } 3931 }
3922 3932
3923 } // namespace blink 3933 } // namespace blink
3924 3934
3925 #endif // ComputedStyle_h 3935 #endif // ComputedStyle_h
OLDNEW
« 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