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

Side by Side Diff: third_party/WebKit/Source/core/style/ComputedStyle.h

Issue 1574933002: Changed type of border-width longhands from unsigned to float. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made transitions use fractional border widths, added assert that border widths are positive, and r… Created 4 years, 11 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 r ights reserved. 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 bool borderImageSlicesFill() const { return surround->border.image().fill(); } 514 bool borderImageSlicesFill() const { return surround->border.image().fill(); }
515 const BorderImageLengthBox& borderImageWidth() const { return surround->bord er.image().borderSlices(); } 515 const BorderImageLengthBox& borderImageWidth() const { return surround->bord er.image().borderSlices(); }
516 const BorderImageLengthBox& borderImageOutset() const { return surround->bor der.image().outset(); } 516 const BorderImageLengthBox& borderImageOutset() const { return surround->bor der.image().outset(); }
517 517
518 const LengthSize& borderTopLeftRadius() const { return surround->border.topL eft(); } 518 const LengthSize& borderTopLeftRadius() const { return surround->border.topL eft(); }
519 const LengthSize& borderTopRightRadius() const { return surround->border.top Right(); } 519 const LengthSize& borderTopRightRadius() const { return surround->border.top Right(); }
520 const LengthSize& borderBottomLeftRadius() const { return surround->border.b ottomLeft(); } 520 const LengthSize& borderBottomLeftRadius() const { return surround->border.b ottomLeft(); }
521 const LengthSize& borderBottomRightRadius() const { return surround->border. bottomRight(); } 521 const LengthSize& borderBottomRightRadius() const { return surround->border. bottomRight(); }
522 bool hasBorderRadius() const { return surround->border.hasBorderRadius(); } 522 bool hasBorderRadius() const { return surround->border.hasBorderRadius(); }
523 523
524 int borderLeftWidth() const { return surround->border.borderLeftWidth(); } 524 float borderLeftWidth() const { return surround->border.borderLeftWidth(); }
525 EBorderStyle borderLeftStyle() const { return surround->border.left().style( ); } 525 EBorderStyle borderLeftStyle() const { return surround->border.left().style( ); }
526 int borderRightWidth() const { return surround->border.borderRightWidth(); } 526 float borderRightWidth() const { return surround->border.borderRightWidth(); }
527 EBorderStyle borderRightStyle() const { return surround->border.right().styl e(); } 527 EBorderStyle borderRightStyle() const { return surround->border.right().styl e(); }
528 int borderTopWidth() const { return surround->border.borderTopWidth(); } 528 float borderTopWidth() const { return surround->border.borderTopWidth(); }
529 EBorderStyle borderTopStyle() const { return surround->border.top().style(); } 529 EBorderStyle borderTopStyle() const { return surround->border.top().style(); }
530 int borderBottomWidth() const { return surround->border.borderBottomWidth(); } 530 float borderBottomWidth() const { return surround->border.borderBottomWidth( ); }
531 EBorderStyle borderBottomStyle() const { return surround->border.bottom().st yle(); } 531 EBorderStyle borderBottomStyle() const { return surround->border.bottom().st yle(); }
532 532
533 int borderBeforeWidth() const; 533 float borderBeforeWidth() const;
534 int borderAfterWidth() const; 534 float borderAfterWidth() const;
535 int borderStartWidth() const; 535 float borderStartWidth() const;
536 int borderEndWidth() const; 536 float borderEndWidth() const;
537 int borderOverWidth() const; 537 float borderOverWidth() const;
538 int borderUnderWidth() const; 538 float borderUnderWidth() const;
539 539
540 // TODO(bugsnash): change return type to float when outline offset is change d to float
540 int outlineWidth() const 541 int outlineWidth() const
541 { 542 {
542 if (m_background->outline().style() == BNONE) 543 if (m_background->outline().style() == BNONE)
543 return 0; 544 return 0;
544 return m_background->outline().width(); 545 return m_background->outline().width();
545 } 546 }
546 bool hasOutline() const { return outlineWidth() > 0 && outlineStyle() > BHID DEN; } 547 bool hasOutline() const { return outlineWidth() > 0 && outlineStyle() > BHID DEN; }
547 EBorderStyle outlineStyle() const { return m_background->outline().style(); } 548 EBorderStyle outlineStyle() const { return m_background->outline().style(); }
548 OutlineIsAuto outlineStyleIsAuto() const { return static_cast<OutlineIsAuto> (m_background->outline().isAuto()); } 549 OutlineIsAuto outlineStyleIsAuto() const { return static_cast<OutlineIsAuto> (m_background->outline().isAuto()); }
549 int outlineOutsetExtent() const; 550 int outlineOutsetExtent() const;
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 setBorderRadius(LengthSize(Length(s.width(), Fixed), Length(s.height(), Fixed))); 1094 setBorderRadius(LengthSize(Length(s.width(), Fixed), Length(s.height(), Fixed)));
1094 } 1095 }
1095 1096
1096 FloatRoundedRect getRoundedBorderFor(const LayoutRect& borderRect, bool incl udeLogicalLeftEdge = true, 1097 FloatRoundedRect getRoundedBorderFor(const LayoutRect& borderRect, bool incl udeLogicalLeftEdge = true,
1097 bool includeLogicalRightEdge = true) const; 1098 bool includeLogicalRightEdge = true) const;
1098 FloatRoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const; 1099 FloatRoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
1099 1100
1100 FloatRoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, 1101 FloatRoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect,
1101 const LayoutRectOutsets insets, bool includeLogicalLeftEdge, bool includ eLogicalRightEdge) const; 1102 const LayoutRectOutsets insets, bool includeLogicalLeftEdge, bool includ eLogicalRightEdge) const;
1102 1103
1103 void setBorderLeftWidth(unsigned v) { SET_VAR(surround, border.m_left.m_widt h, v); } 1104 void setBorderLeftWidth(float v)
1105 {
1106 ASSERT(v >= 0);
1107 SET_VAR(surround, border.m_left.m_width, v);
1108 }
1104 void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.m_left.m_ style, v); } 1109 void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.m_left.m_ style, v); }
1105 void setBorderLeftColor(const StyleColor& v) { SET_BORDERVALUE_COLOR(surroun d, border.m_left, v); } 1110 void setBorderLeftColor(const StyleColor& v) { SET_BORDERVALUE_COLOR(surroun d, border.m_left, v); }
1106 void setBorderRightWidth(unsigned v) { SET_VAR(surround, border.m_right.m_wi dth, v); } 1111 void setBorderRightWidth(float v)
1112 {
1113 ASSERT(v >= 0);
1114 SET_VAR(surround, border.m_right.m_width, v);
1115 }
1107 void setBorderRightStyle(EBorderStyle v) { SET_VAR(surround, border.m_right. m_style, v); } 1116 void setBorderRightStyle(EBorderStyle v) { SET_VAR(surround, border.m_right. m_style, v); }
1108 void setBorderRightColor(const StyleColor& v) { SET_BORDERVALUE_COLOR(surrou nd, border.m_right, v); } 1117 void setBorderRightColor(const StyleColor& v) { SET_BORDERVALUE_COLOR(surrou nd, border.m_right, v); }
1109 void setBorderTopWidth(unsigned v) { SET_VAR(surround, border.m_top.m_width, v); } 1118 void setBorderTopWidth(float v)
1119 {
1120 ASSERT(v >= 0);
1121 SET_VAR(surround, border.m_top.m_width, v);
1122 }
1110 void setBorderTopStyle(EBorderStyle v) { SET_VAR(surround, border.m_top.m_st yle, v); } 1123 void setBorderTopStyle(EBorderStyle v) { SET_VAR(surround, border.m_top.m_st yle, v); }
1111 void setBorderTopColor(const StyleColor& v) { SET_BORDERVALUE_COLOR(surround , border.m_top, v); } 1124 void setBorderTopColor(const StyleColor& v) { SET_BORDERVALUE_COLOR(surround , border.m_top, v); }
1112 void setBorderBottomWidth(unsigned v) { SET_VAR(surround, border.m_bottom.m_ width, v); } 1125 void setBorderBottomWidth(float v)
1126 {
1127 ASSERT(v >= 0);
1128 SET_VAR(surround, border.m_bottom.m_width, v);
1129 }
1113 void setBorderBottomStyle(EBorderStyle v) { SET_VAR(surround, border.m_botto m.m_style, v); } 1130 void setBorderBottomStyle(EBorderStyle v) { SET_VAR(surround, border.m_botto m.m_style, v); }
1114 void setBorderBottomColor(const StyleColor& v) { SET_BORDERVALUE_COLOR(surro und, border.m_bottom, v); } 1131 void setBorderBottomColor(const StyleColor& v) { SET_BORDERVALUE_COLOR(surro und, border.m_bottom, v); }
1115 1132
1116 void setOutlineWidth(unsigned short v) { SET_VAR(m_background, m_outline.m_w idth, v); } 1133 void setOutlineWidth(unsigned short v) { SET_VAR(m_background, m_outline.m_w idth, v); }
1117 void setOutlineStyleIsAuto(OutlineIsAuto isAuto) { SET_VAR(m_background, m_o utline.m_isAuto, isAuto); } 1134 void setOutlineStyleIsAuto(OutlineIsAuto isAuto) { SET_VAR(m_background, m_o utline.m_isAuto, isAuto); }
1118 void setOutlineStyle(EBorderStyle v) { SET_VAR(m_background, m_outline.m_sty le, v); } 1135 void setOutlineStyle(EBorderStyle v) { SET_VAR(m_background, m_outline.m_sty le, v); }
1119 void setOutlineColor(const StyleColor& v) { SET_BORDERVALUE_COLOR(m_backgrou nd, m_outline, v); } 1136 void setOutlineColor(const StyleColor& v) { SET_BORDERVALUE_COLOR(m_backgrou nd, m_outline, v); }
1120 bool isOutlineEquivalent(const ComputedStyle* otherStyle) const 1137 bool isOutlineEquivalent(const ComputedStyle* otherStyle) const
1121 { 1138 {
1122 // No other style, so we don't have an outline then we consider them to be the same. 1139 // No other style, so we don't have an outline then we consider them to be the same.
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 static ETableLayout initialTableLayout() { return TAUTO; } 1672 static ETableLayout initialTableLayout() { return TAUTO; }
1656 static EUnicodeBidi initialUnicodeBidi() { return UBNormal; } 1673 static EUnicodeBidi initialUnicodeBidi() { return UBNormal; }
1657 static ETextTransform initialTextTransform() { return TTNONE; } 1674 static ETextTransform initialTextTransform() { return TTNONE; }
1658 static EVisibility initialVisibility() { return VISIBLE; } 1675 static EVisibility initialVisibility() { return VISIBLE; }
1659 static EWhiteSpace initialWhiteSpace() { return NORMAL; } 1676 static EWhiteSpace initialWhiteSpace() { return NORMAL; }
1660 static short initialHorizontalBorderSpacing() { return 0; } 1677 static short initialHorizontalBorderSpacing() { return 0; }
1661 static short initialVerticalBorderSpacing() { return 0; } 1678 static short initialVerticalBorderSpacing() { return 0; }
1662 static ECursor initialCursor() { return CURSOR_AUTO; } 1679 static ECursor initialCursor() { return CURSOR_AUTO; }
1663 static Color initialColor() { return Color::black; } 1680 static Color initialColor() { return Color::black; }
1664 static StyleImage* initialListStyleImage() { return 0; } 1681 static StyleImage* initialListStyleImage() { return 0; }
1665 static unsigned initialBorderWidth() { return 3; } 1682 static float initialBorderWidth() { return 3.0f; }
1666 static unsigned short initialColumnRuleWidth() { return 3; } 1683 static unsigned short initialColumnRuleWidth() { return 3; }
1667 static unsigned short initialOutlineWidth() { return 3; } 1684 static unsigned short initialOutlineWidth() { return 3; }
1668 static float initialLetterWordSpacing() { return 0.0f; } 1685 static float initialLetterWordSpacing() { return 0.0f; }
1669 static Length initialSize() { return Length(); } 1686 static Length initialSize() { return Length(); }
1670 static Length initialMinSize() { return Length(); } 1687 static Length initialMinSize() { return Length(); }
1671 static Length initialMaxSize() { return Length(MaxSizeNone); } 1688 static Length initialMaxSize() { return Length(MaxSizeNone); }
1672 static Length initialOffset() { return Length(); } 1689 static Length initialOffset() { return Length(); }
1673 static Length initialMargin() { return Length(Fixed); } 1690 static Length initialMargin() { return Length(Fixed); }
1674 static Length initialPadding() { return Length(Fixed); } 1691 static Length initialPadding() { return Length(Fixed); }
1675 static Length initialTextIndent() { return Length(Fixed); } 1692 static Length initialTextIndent() { return Length(Fixed); }
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
2008 } 2025 }
2009 2026
2010 inline bool ComputedStyle::hasPseudoElementStyle() const 2027 inline bool ComputedStyle::hasPseudoElementStyle() const
2011 { 2028 {
2012 return noninherited_flags.pseudoBits & PSEUDO_ELEMENT_MASK; 2029 return noninherited_flags.pseudoBits & PSEUDO_ELEMENT_MASK;
2013 } 2030 }
2014 2031
2015 } // namespace blink 2032 } // namespace blink
2016 2033
2017 #endif // ComputedStyle_h 2034 #endif // ComputedStyle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698