Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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) | |
|
pdr.
2017/01/27 20:28:44
Nit: should this line be indented?
Karl Øygard
2017/02/10 12:53:18
I agree, but the formatter disagrees...
| |
| 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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 604 } | 612 } |
| 605 void setBorderImageWidth(const BorderImageLengthBox&); | 613 void setBorderImageWidth(const BorderImageLengthBox&); |
| 606 | 614 |
| 607 // border-image-outset | 615 // border-image-outset |
| 608 const BorderImageLengthBox& borderImageOutset() const { | 616 const BorderImageLengthBox& borderImageOutset() const { |
| 609 return m_surround->border.image().outset(); | 617 return m_surround->border.image().outset(); |
| 610 } | 618 } |
| 611 void setBorderImageOutset(const BorderImageLengthBox&); | 619 void setBorderImageOutset(const BorderImageLengthBox&); |
| 612 | 620 |
| 613 // Border width properties. | 621 // Border width properties. |
| 614 static unsigned initialBorderWidth() { return 3; } | 622 static float initialBorderWidth() { return 3; } |
| 615 | 623 |
| 616 // border-top-width | 624 // border-top-width |
| 617 int borderTopWidth() const { return m_surround->border.borderTopWidth(); } | 625 float borderTopWidth() const { return m_surround->border.borderTopWidth(); } |
| 618 void setBorderTopWidth(unsigned v) { | 626 void setBorderTopWidth(float v) { |
| 619 SET_VAR(m_surround, border.m_top.m_width, v); | 627 SET_BORDER_WIDTH(m_surround, border.m_top, v); |
| 620 } | 628 } |
| 621 | 629 |
| 622 // border-bottom-width | 630 // border-bottom-width |
| 623 int borderBottomWidth() const { | 631 float borderBottomWidth() const { |
| 624 return m_surround->border.borderBottomWidth(); | 632 return m_surround->border.borderBottomWidth(); |
| 625 } | 633 } |
| 626 void setBorderBottomWidth(unsigned v) { | 634 void setBorderBottomWidth(float v) { |
| 627 SET_VAR(m_surround, border.m_bottom.m_width, v); | 635 SET_BORDER_WIDTH(m_surround, border.m_bottom, v); |
| 628 } | 636 } |
| 629 | 637 |
| 630 // border-left-width | 638 // border-left-width |
| 631 int borderLeftWidth() const { return m_surround->border.borderLeftWidth(); } | 639 float borderLeftWidth() const { return m_surround->border.borderLeftWidth(); } |
| 632 void setBorderLeftWidth(unsigned v) { | 640 void setBorderLeftWidth(float v) { |
| 633 SET_VAR(m_surround, border.m_left.m_width, v); | 641 SET_BORDER_WIDTH(m_surround, border.m_left, v); |
| 634 } | 642 } |
| 635 | 643 |
| 636 // border-right-width | 644 // border-right-width |
| 637 int borderRightWidth() const { return m_surround->border.borderRightWidth(); } | 645 float borderRightWidth() const { |
| 638 void setBorderRightWidth(unsigned v) { | 646 return m_surround->border.borderRightWidth(); |
| 639 SET_VAR(m_surround, border.m_right.m_width, v); | 647 } |
| 648 void setBorderRightWidth(float v) { | |
| 649 SET_BORDER_WIDTH(m_surround, border.m_right, v); | |
| 640 } | 650 } |
| 641 | 651 |
| 642 // Border style properties. | 652 // Border style properties. |
| 643 static EBorderStyle initialBorderStyle() { return BorderStyleNone; } | 653 static EBorderStyle initialBorderStyle() { return BorderStyleNone; } |
| 644 | 654 |
| 645 // border-top-style | 655 // border-top-style |
| 646 EBorderStyle borderTopStyle() const { | 656 EBorderStyle borderTopStyle() const { |
| 647 return m_surround->border.top().style(); | 657 return m_surround->border.top().style(); |
| 648 } | 658 } |
| 649 void setBorderTopStyle(EBorderStyle v) { | 659 void setBorderTopStyle(EBorderStyle v) { |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 873 void setColumnRuleStyle(EBorderStyle b) { | 883 void setColumnRuleStyle(EBorderStyle b) { |
| 874 SET_NESTED_VAR(m_rareNonInheritedData, m_multiCol, m_rule.m_style, b); | 884 SET_NESTED_VAR(m_rareNonInheritedData, m_multiCol, m_rule.m_style, b); |
| 875 } | 885 } |
| 876 | 886 |
| 877 // column-rule-width (aka -webkit-column-rule-width) | 887 // column-rule-width (aka -webkit-column-rule-width) |
| 878 static unsigned short initialColumnRuleWidth() { return 3; } | 888 static unsigned short initialColumnRuleWidth() { return 3; } |
| 879 unsigned short columnRuleWidth() const { | 889 unsigned short columnRuleWidth() const { |
| 880 return m_rareNonInheritedData->m_multiCol->ruleWidth(); | 890 return m_rareNonInheritedData->m_multiCol->ruleWidth(); |
| 881 } | 891 } |
| 882 void setColumnRuleWidth(unsigned short w) { | 892 void setColumnRuleWidth(unsigned short w) { |
| 883 SET_NESTED_VAR(m_rareNonInheritedData, m_multiCol, m_rule.m_width, w); | 893 SET_NESTED_BORDER_WIDTH(m_rareNonInheritedData, m_multiCol, m_rule, w); |
| 884 } | 894 } |
| 885 | 895 |
| 886 // column-span (aka -webkit-column-span) | 896 // column-span (aka -webkit-column-span) |
| 887 static ColumnSpan initialColumnSpan() { return ColumnSpanNone; } | 897 static ColumnSpan initialColumnSpan() { return ColumnSpanNone; } |
| 888 ColumnSpan getColumnSpan() const { | 898 ColumnSpan getColumnSpan() const { |
| 889 return static_cast<ColumnSpan>( | 899 return static_cast<ColumnSpan>( |
| 890 m_rareNonInheritedData->m_multiCol->m_columnSpan); | 900 m_rareNonInheritedData->m_multiCol->m_columnSpan); |
| 891 } | 901 } |
| 892 void setColumnSpan(ColumnSpan columnSpan) { | 902 void setColumnSpan(ColumnSpan columnSpan) { |
| 893 SET_NESTED_VAR(m_rareNonInheritedData, m_multiCol, m_columnSpan, | 903 SET_NESTED_VAR(m_rareNonInheritedData, m_multiCol, m_columnSpan, |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1449 OutlineIsAuto outlineStyleIsAuto() const { | 1459 OutlineIsAuto outlineStyleIsAuto() const { |
| 1450 return static_cast<OutlineIsAuto>( | 1460 return static_cast<OutlineIsAuto>( |
| 1451 m_rareNonInheritedData->m_outline.isAuto()); | 1461 m_rareNonInheritedData->m_outline.isAuto()); |
| 1452 } | 1462 } |
| 1453 void setOutlineStyleIsAuto(OutlineIsAuto isAuto) { | 1463 void setOutlineStyleIsAuto(OutlineIsAuto isAuto) { |
| 1454 SET_VAR(m_rareNonInheritedData, m_outline.m_isAuto, isAuto); | 1464 SET_VAR(m_rareNonInheritedData, m_outline.m_isAuto, isAuto); |
| 1455 } | 1465 } |
| 1456 | 1466 |
| 1457 // outline-width | 1467 // outline-width |
| 1458 static unsigned short initialOutlineWidth() { return 3; } | 1468 static unsigned short initialOutlineWidth() { return 3; } |
| 1459 int outlineWidth() const { | 1469 unsigned short outlineWidth() const { |
| 1460 if (m_rareNonInheritedData->m_outline.style() == BorderStyleNone) | 1470 if (m_rareNonInheritedData->m_outline.style() == BorderStyleNone) |
| 1461 return 0; | 1471 return 0; |
| 1462 return m_rareNonInheritedData->m_outline.width(); | 1472 return m_rareNonInheritedData->m_outline.width(); |
| 1463 } | 1473 } |
| 1464 void setOutlineWidth(unsigned short v) { | 1474 void setOutlineWidth(unsigned short v) { |
| 1465 SET_VAR(m_rareNonInheritedData, m_outline.m_width, v); | 1475 SET_BORDER_WIDTH(m_rareNonInheritedData, m_outline, v); |
| 1466 } | 1476 } |
| 1467 | 1477 |
| 1468 // outline-offset | 1478 // outline-offset |
| 1469 static int initialOutlineOffset() { return 0; } | 1479 static int initialOutlineOffset() { return 0; } |
| 1470 int outlineOffset() const { | 1480 int outlineOffset() const { |
| 1471 if (m_rareNonInheritedData->m_outline.style() == BorderStyleNone) | 1481 if (m_rareNonInheritedData->m_outline.style() == BorderStyleNone) |
| 1472 return 0; | 1482 return 0; |
| 1473 return m_rareNonInheritedData->m_outline.offset(); | 1483 return m_rareNonInheritedData->m_outline.offset(); |
| 1474 } | 1484 } |
| 1475 void setOutlineOffset(int v) { | 1485 void setOutlineOffset(int v) { |
| (...skipping 1698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3174 const BorderValue& borderLeft() const { return m_surround->border.left(); } | 3184 const BorderValue& borderLeft() const { return m_surround->border.left(); } |
| 3175 const BorderValue& borderRight() const { return m_surround->border.right(); } | 3185 const BorderValue& borderRight() const { return m_surround->border.right(); } |
| 3176 const BorderValue& borderTop() const { return m_surround->border.top(); } | 3186 const BorderValue& borderTop() const { return m_surround->border.top(); } |
| 3177 const BorderValue& borderBottom() const { | 3187 const BorderValue& borderBottom() const { |
| 3178 return m_surround->border.bottom(); | 3188 return m_surround->border.bottom(); |
| 3179 } | 3189 } |
| 3180 const BorderValue& borderBefore() const; | 3190 const BorderValue& borderBefore() const; |
| 3181 const BorderValue& borderAfter() const; | 3191 const BorderValue& borderAfter() const; |
| 3182 const BorderValue& borderStart() const; | 3192 const BorderValue& borderStart() const; |
| 3183 const BorderValue& borderEnd() const; | 3193 const BorderValue& borderEnd() const; |
| 3184 int borderAfterWidth() const; | 3194 float borderAfterWidth() const; |
| 3185 int borderBeforeWidth() const; | 3195 float borderBeforeWidth() const; |
| 3186 int borderEndWidth() const; | 3196 float borderEndWidth() const; |
| 3187 int borderStartWidth() const; | 3197 float borderStartWidth() const; |
| 3188 int borderOverWidth() const; | 3198 float borderOverWidth() const; |
| 3189 int borderUnderWidth() const; | 3199 float borderUnderWidth() const; |
| 3190 | 3200 |
| 3191 bool hasBorderFill() const { return m_surround->border.hasBorderFill(); } | 3201 bool hasBorderFill() const { return m_surround->border.hasBorderFill(); } |
| 3192 bool hasBorder() const { return m_surround->border.hasBorder(); } | 3202 bool hasBorder() const { return m_surround->border.hasBorder(); } |
| 3193 bool hasBorderDecoration() const { return hasBorder() || hasBorderFill(); } | 3203 bool hasBorderDecoration() const { return hasBorder() || hasBorderFill(); } |
| 3194 bool hasBorderRadius() const { return m_surround->border.hasBorderRadius(); } | 3204 bool hasBorderRadius() const { return m_surround->border.hasBorderRadius(); } |
| 3195 | 3205 |
| 3196 void resetBorder() { | 3206 void resetBorder() { |
| 3197 resetBorderImage(); | 3207 resetBorderImage(); |
| 3198 resetBorderTop(); | 3208 resetBorderTop(); |
| 3199 resetBorderRight(); | 3209 resetBorderRight(); |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3944 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1); | 3954 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1); |
| 3945 } | 3955 } |
| 3946 | 3956 |
| 3947 inline bool ComputedStyle::hasPseudoElementStyle() const { | 3957 inline bool ComputedStyle::hasPseudoElementStyle() const { |
| 3948 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; | 3958 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; |
| 3949 } | 3959 } |
| 3950 | 3960 |
| 3951 } // namespace blink | 3961 } // namespace blink |
| 3952 | 3962 |
| 3953 #endif // ComputedStyle_h | 3963 #endif // ComputedStyle_h |
| OLD | NEW |