| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) | 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. |
| 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1221 // FIXME: This should depend on locale. | 1221 // FIXME: This should depend on locale. |
| 1222 DEFINE_STATIC_LOCAL(AtomicString, hyphenMinusString, (&hyphenMinusCharacter,
1)); | 1222 DEFINE_STATIC_LOCAL(AtomicString, hyphenMinusString, (&hyphenMinusCharacter,
1)); |
| 1223 DEFINE_STATIC_LOCAL(AtomicString, hyphenString, (&hyphenCharacter, 1)); | 1223 DEFINE_STATIC_LOCAL(AtomicString, hyphenString, (&hyphenCharacter, 1)); |
| 1224 const SimpleFontData* primaryFont = font().primaryFont(); | 1224 const SimpleFontData* primaryFont = font().primaryFont(); |
| 1225 ASSERT(primaryFont); | 1225 ASSERT(primaryFont); |
| 1226 return primaryFont->glyphForCharacter(hyphenCharacter) ? hyphenString : hyph
enMinusString; | 1226 return primaryFont->glyphForCharacter(hyphenCharacter) ? hyphenString : hyph
enMinusString; |
| 1227 } | 1227 } |
| 1228 | 1228 |
| 1229 const AtomicString& ComputedStyle::textEmphasisMarkString() const | 1229 const AtomicString& ComputedStyle::textEmphasisMarkString() const |
| 1230 { | 1230 { |
| 1231 switch (textEmphasisMark()) { | 1231 switch (getTextEmphasisMark()) { |
| 1232 case TextEmphasisMarkNone: | 1232 case TextEmphasisMarkNone: |
| 1233 return nullAtom; | 1233 return nullAtom; |
| 1234 case TextEmphasisMarkCustom: | 1234 case TextEmphasisMarkCustom: |
| 1235 return textEmphasisCustomMark(); | 1235 return textEmphasisCustomMark(); |
| 1236 case TextEmphasisMarkDot: { | 1236 case TextEmphasisMarkDot: { |
| 1237 DEFINE_STATIC_LOCAL(AtomicString, filledDotString, (&bulletCharacter, 1)
); | 1237 DEFINE_STATIC_LOCAL(AtomicString, filledDotString, (&bulletCharacter, 1)
); |
| 1238 DEFINE_STATIC_LOCAL(AtomicString, openDotString, (&whiteBulletCharacter,
1)); | 1238 DEFINE_STATIC_LOCAL(AtomicString, openDotString, (&whiteBulletCharacter,
1)); |
| 1239 return textEmphasisFill() == TextEmphasisFillFilled ? filledDotString :
openDotString; | 1239 return getTextEmphasisFill() == TextEmphasisFillFilled ? filledDotString
: openDotString; |
| 1240 } | 1240 } |
| 1241 case TextEmphasisMarkCircle: { | 1241 case TextEmphasisMarkCircle: { |
| 1242 DEFINE_STATIC_LOCAL(AtomicString, filledCircleString, (&blackCircleChara
cter, 1)); | 1242 DEFINE_STATIC_LOCAL(AtomicString, filledCircleString, (&blackCircleChara
cter, 1)); |
| 1243 DEFINE_STATIC_LOCAL(AtomicString, openCircleString, (&whiteCircleCharact
er, 1)); | 1243 DEFINE_STATIC_LOCAL(AtomicString, openCircleString, (&whiteCircleCharact
er, 1)); |
| 1244 return textEmphasisFill() == TextEmphasisFillFilled ? filledCircleString
: openCircleString; | 1244 return getTextEmphasisFill() == TextEmphasisFillFilled ? filledCircleStr
ing : openCircleString; |
| 1245 } | 1245 } |
| 1246 case TextEmphasisMarkDoubleCircle: { | 1246 case TextEmphasisMarkDoubleCircle: { |
| 1247 DEFINE_STATIC_LOCAL(AtomicString, filledDoubleCircleString, (&fisheyeCha
racter, 1)); | 1247 DEFINE_STATIC_LOCAL(AtomicString, filledDoubleCircleString, (&fisheyeCha
racter, 1)); |
| 1248 DEFINE_STATIC_LOCAL(AtomicString, openDoubleCircleString, (&bullseyeChar
acter, 1)); | 1248 DEFINE_STATIC_LOCAL(AtomicString, openDoubleCircleString, (&bullseyeChar
acter, 1)); |
| 1249 return textEmphasisFill() == TextEmphasisFillFilled ? filledDoubleCircle
String : openDoubleCircleString; | 1249 return getTextEmphasisFill() == TextEmphasisFillFilled ? filledDoubleCir
cleString : openDoubleCircleString; |
| 1250 } | 1250 } |
| 1251 case TextEmphasisMarkTriangle: { | 1251 case TextEmphasisMarkTriangle: { |
| 1252 DEFINE_STATIC_LOCAL(AtomicString, filledTriangleString, (&blackUpPointin
gTriangleCharacter, 1)); | 1252 DEFINE_STATIC_LOCAL(AtomicString, filledTriangleString, (&blackUpPointin
gTriangleCharacter, 1)); |
| 1253 DEFINE_STATIC_LOCAL(AtomicString, openTriangleString, (&whiteUpPointingT
riangleCharacter, 1)); | 1253 DEFINE_STATIC_LOCAL(AtomicString, openTriangleString, (&whiteUpPointingT
riangleCharacter, 1)); |
| 1254 return textEmphasisFill() == TextEmphasisFillFilled ? filledTriangleStri
ng : openTriangleString; | 1254 return getTextEmphasisFill() == TextEmphasisFillFilled ? filledTriangleS
tring : openTriangleString; |
| 1255 } | 1255 } |
| 1256 case TextEmphasisMarkSesame: { | 1256 case TextEmphasisMarkSesame: { |
| 1257 DEFINE_STATIC_LOCAL(AtomicString, filledSesameString, (&sesameDotCharact
er, 1)); | 1257 DEFINE_STATIC_LOCAL(AtomicString, filledSesameString, (&sesameDotCharact
er, 1)); |
| 1258 DEFINE_STATIC_LOCAL(AtomicString, openSesameString, (&whiteSesameDotChar
acter, 1)); | 1258 DEFINE_STATIC_LOCAL(AtomicString, openSesameString, (&whiteSesameDotChar
acter, 1)); |
| 1259 return textEmphasisFill() == TextEmphasisFillFilled ? filledSesameString
: openSesameString; | 1259 return getTextEmphasisFill() == TextEmphasisFillFilled ? filledSesameStr
ing : openSesameString; |
| 1260 } | 1260 } |
| 1261 case TextEmphasisMarkAuto: | 1261 case TextEmphasisMarkAuto: |
| 1262 ASSERT_NOT_REACHED(); | 1262 ASSERT_NOT_REACHED(); |
| 1263 return nullAtom; | 1263 return nullAtom; |
| 1264 } | 1264 } |
| 1265 | 1265 |
| 1266 ASSERT_NOT_REACHED(); | 1266 ASSERT_NOT_REACHED(); |
| 1267 return nullAtom; | 1267 return nullAtom; |
| 1268 } | 1268 } |
| 1269 | 1269 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1449 if (inherited_flags.m_textUnderline) { | 1449 if (inherited_flags.m_textUnderline) { |
| 1450 inherited_flags.m_textUnderline = false; | 1450 inherited_flags.m_textUnderline = false; |
| 1451 list->append(AppliedTextDecoration(TextDecorationUnderline)); | 1451 list->append(AppliedTextDecoration(TextDecorationUnderline)); |
| 1452 } | 1452 } |
| 1453 | 1453 |
| 1454 list->append(decoration); | 1454 list->append(decoration); |
| 1455 } | 1455 } |
| 1456 | 1456 |
| 1457 void ComputedStyle::applyTextDecorations() | 1457 void ComputedStyle::applyTextDecorations() |
| 1458 { | 1458 { |
| 1459 if (textDecoration() == TextDecorationNone) | 1459 if (getTextDecoration() == TextDecorationNone) |
| 1460 return; | 1460 return; |
| 1461 | 1461 |
| 1462 TextDecorationStyle style = textDecorationStyle(); | 1462 TextDecorationStyle style = getTextDecorationStyle(); |
| 1463 StyleColor styleColor = decorationColorIncludingFallback(insideLink() == Ins
ideVisitedLink); | 1463 StyleColor styleColor = decorationColorIncludingFallback(insideLink() == Ins
ideVisitedLink); |
| 1464 | 1464 |
| 1465 int decorations = textDecoration(); | 1465 int decorations = getTextDecoration(); |
| 1466 | 1466 |
| 1467 if (decorations & TextDecorationUnderline) { | 1467 if (decorations & TextDecorationUnderline) { |
| 1468 // To save memory, we don't use AppliedTextDecoration objects in the | 1468 // To save memory, we don't use AppliedTextDecoration objects in the |
| 1469 // common case of a single simple underline. | 1469 // common case of a single simple underline. |
| 1470 AppliedTextDecoration underline(TextDecorationUnderline, style, styleCol
or); | 1470 AppliedTextDecoration underline(TextDecorationUnderline, style, styleCol
or); |
| 1471 | 1471 |
| 1472 if (!rareInheritedData->appliedTextDecorations && underline.isSimpleUnde
rline()) | 1472 if (!rareInheritedData->appliedTextDecorations && underline.isSimpleUnde
rline()) |
| 1473 inherited_flags.m_textUnderline = true; | 1473 inherited_flags.m_textUnderline = true; |
| 1474 else | 1474 else |
| 1475 addAppliedTextDecoration(underline); | 1475 addAppliedTextDecoration(underline); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1598 // does to return black. This behavior matches what Firefox 4 does as well. | 1598 // does to return black. This behavior matches what Firefox 4 does as well. |
| 1599 if (colorProperty == CSSPropertyBackgroundColor && visitedColor == Color::tr
ansparent) | 1599 if (colorProperty == CSSPropertyBackgroundColor && visitedColor == Color::tr
ansparent) |
| 1600 return unvisitedColor; | 1600 return unvisitedColor; |
| 1601 | 1601 |
| 1602 // Take the alpha from the unvisited color, but get the RGB values from the
visited color. | 1602 // Take the alpha from the unvisited color, but get the RGB values from the
visited color. |
| 1603 return Color(visitedColor.red(), visitedColor.green(), visitedColor.blue(),
unvisitedColor.alpha()); | 1603 return Color(visitedColor.red(), visitedColor.green(), visitedColor.blue(),
unvisitedColor.alpha()); |
| 1604 } | 1604 } |
| 1605 | 1605 |
| 1606 const BorderValue& ComputedStyle::borderBefore() const | 1606 const BorderValue& ComputedStyle::borderBefore() const |
| 1607 { | 1607 { |
| 1608 switch (writingMode()) { | 1608 switch (getWritingMode()) { |
| 1609 case TopToBottomWritingMode: | 1609 case TopToBottomWritingMode: |
| 1610 return borderTop(); | 1610 return borderTop(); |
| 1611 case LeftToRightWritingMode: | 1611 case LeftToRightWritingMode: |
| 1612 return borderLeft(); | 1612 return borderLeft(); |
| 1613 case RightToLeftWritingMode: | 1613 case RightToLeftWritingMode: |
| 1614 return borderRight(); | 1614 return borderRight(); |
| 1615 } | 1615 } |
| 1616 ASSERT_NOT_REACHED(); | 1616 ASSERT_NOT_REACHED(); |
| 1617 return borderTop(); | 1617 return borderTop(); |
| 1618 } | 1618 } |
| 1619 | 1619 |
| 1620 const BorderValue& ComputedStyle::borderAfter() const | 1620 const BorderValue& ComputedStyle::borderAfter() const |
| 1621 { | 1621 { |
| 1622 switch (writingMode()) { | 1622 switch (getWritingMode()) { |
| 1623 case TopToBottomWritingMode: | 1623 case TopToBottomWritingMode: |
| 1624 return borderBottom(); | 1624 return borderBottom(); |
| 1625 case LeftToRightWritingMode: | 1625 case LeftToRightWritingMode: |
| 1626 return borderRight(); | 1626 return borderRight(); |
| 1627 case RightToLeftWritingMode: | 1627 case RightToLeftWritingMode: |
| 1628 return borderLeft(); | 1628 return borderLeft(); |
| 1629 } | 1629 } |
| 1630 ASSERT_NOT_REACHED(); | 1630 ASSERT_NOT_REACHED(); |
| 1631 return borderBottom(); | 1631 return borderBottom(); |
| 1632 } | 1632 } |
| 1633 | 1633 |
| 1634 const BorderValue& ComputedStyle::borderStart() const | 1634 const BorderValue& ComputedStyle::borderStart() const |
| 1635 { | 1635 { |
| 1636 if (isHorizontalWritingMode()) | 1636 if (isHorizontalWritingMode()) |
| 1637 return isLeftToRightDirection() ? borderLeft() : borderRight(); | 1637 return isLeftToRightDirection() ? borderLeft() : borderRight(); |
| 1638 return isLeftToRightDirection() ? borderTop() : borderBottom(); | 1638 return isLeftToRightDirection() ? borderTop() : borderBottom(); |
| 1639 } | 1639 } |
| 1640 | 1640 |
| 1641 const BorderValue& ComputedStyle::borderEnd() const | 1641 const BorderValue& ComputedStyle::borderEnd() const |
| 1642 { | 1642 { |
| 1643 if (isHorizontalWritingMode()) | 1643 if (isHorizontalWritingMode()) |
| 1644 return isLeftToRightDirection() ? borderRight() : borderLeft(); | 1644 return isLeftToRightDirection() ? borderRight() : borderLeft(); |
| 1645 return isLeftToRightDirection() ? borderBottom() : borderTop(); | 1645 return isLeftToRightDirection() ? borderBottom() : borderTop(); |
| 1646 } | 1646 } |
| 1647 | 1647 |
| 1648 int ComputedStyle::borderBeforeWidth() const | 1648 int ComputedStyle::borderBeforeWidth() const |
| 1649 { | 1649 { |
| 1650 switch (writingMode()) { | 1650 switch (getWritingMode()) { |
| 1651 case TopToBottomWritingMode: | 1651 case TopToBottomWritingMode: |
| 1652 return borderTopWidth(); | 1652 return borderTopWidth(); |
| 1653 case LeftToRightWritingMode: | 1653 case LeftToRightWritingMode: |
| 1654 return borderLeftWidth(); | 1654 return borderLeftWidth(); |
| 1655 case RightToLeftWritingMode: | 1655 case RightToLeftWritingMode: |
| 1656 return borderRightWidth(); | 1656 return borderRightWidth(); |
| 1657 } | 1657 } |
| 1658 ASSERT_NOT_REACHED(); | 1658 ASSERT_NOT_REACHED(); |
| 1659 return borderTopWidth(); | 1659 return borderTopWidth(); |
| 1660 } | 1660 } |
| 1661 | 1661 |
| 1662 int ComputedStyle::borderAfterWidth() const | 1662 int ComputedStyle::borderAfterWidth() const |
| 1663 { | 1663 { |
| 1664 switch (writingMode()) { | 1664 switch (getWritingMode()) { |
| 1665 case TopToBottomWritingMode: | 1665 case TopToBottomWritingMode: |
| 1666 return borderBottomWidth(); | 1666 return borderBottomWidth(); |
| 1667 case LeftToRightWritingMode: | 1667 case LeftToRightWritingMode: |
| 1668 return borderRightWidth(); | 1668 return borderRightWidth(); |
| 1669 case RightToLeftWritingMode: | 1669 case RightToLeftWritingMode: |
| 1670 return borderLeftWidth(); | 1670 return borderLeftWidth(); |
| 1671 } | 1671 } |
| 1672 ASSERT_NOT_REACHED(); | 1672 ASSERT_NOT_REACHED(); |
| 1673 return borderBottomWidth(); | 1673 return borderBottomWidth(); |
| 1674 } | 1674 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1741 return std::max(0, outlineWidth() + outlineOffset()); | 1741 return std::max(0, outlineWidth() + outlineOffset()); |
| 1742 } | 1742 } |
| 1743 | 1743 |
| 1744 bool ComputedStyle::columnRuleEquivalent(const ComputedStyle* otherStyle) const | 1744 bool ComputedStyle::columnRuleEquivalent(const ComputedStyle* otherStyle) const |
| 1745 { | 1745 { |
| 1746 return columnRuleStyle() == otherStyle->columnRuleStyle() | 1746 return columnRuleStyle() == otherStyle->columnRuleStyle() |
| 1747 && columnRuleWidth() == otherStyle->columnRuleWidth() | 1747 && columnRuleWidth() == otherStyle->columnRuleWidth() |
| 1748 && visitedDependentColor(CSSPropertyColumnRuleColor) == otherStyle->visi
tedDependentColor(CSSPropertyColumnRuleColor); | 1748 && visitedDependentColor(CSSPropertyColumnRuleColor) == otherStyle->visi
tedDependentColor(CSSPropertyColumnRuleColor); |
| 1749 } | 1749 } |
| 1750 | 1750 |
| 1751 TextEmphasisMark ComputedStyle::textEmphasisMark() const | 1751 TextEmphasisMark ComputedStyle::getTextEmphasisMark() const |
| 1752 { | 1752 { |
| 1753 TextEmphasisMark mark = static_cast<TextEmphasisMark>(rareInheritedData->tex
tEmphasisMark); | 1753 TextEmphasisMark mark = static_cast<TextEmphasisMark>(rareInheritedData->tex
tEmphasisMark); |
| 1754 if (mark != TextEmphasisMarkAuto) | 1754 if (mark != TextEmphasisMarkAuto) |
| 1755 return mark; | 1755 return mark; |
| 1756 | 1756 |
| 1757 if (isHorizontalWritingMode()) | 1757 if (isHorizontalWritingMode()) |
| 1758 return TextEmphasisMarkDot; | 1758 return TextEmphasisMarkDot; |
| 1759 | 1759 |
| 1760 return TextEmphasisMarkSesame; | 1760 return TextEmphasisMarkSesame; |
| 1761 } | 1761 } |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1881 if (!shadowList) | 1881 if (!shadowList) |
| 1882 return false; | 1882 return false; |
| 1883 for (size_t i = shadowList->shadows().size(); i--; ) { | 1883 for (size_t i = shadowList->shadows().size(); i--; ) { |
| 1884 if (shadowList->shadows()[i].color().isCurrentColor()) | 1884 if (shadowList->shadows()[i].color().isCurrentColor()) |
| 1885 return true; | 1885 return true; |
| 1886 } | 1886 } |
| 1887 return false; | 1887 return false; |
| 1888 } | 1888 } |
| 1889 | 1889 |
| 1890 } // namespace blink | 1890 } // namespace blink |
| OLD | NEW |