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 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1317 } | 1317 } |
1318 | 1318 |
1319 list->append(decoration); | 1319 list->append(decoration); |
1320 } | 1320 } |
1321 | 1321 |
1322 void RenderStyle::applyTextDecorations() | 1322 void RenderStyle::applyTextDecorations() |
1323 { | 1323 { |
1324 if (textDecoration() == TextDecorationNone) | 1324 if (textDecoration() == TextDecorationNone) |
1325 return; | 1325 return; |
1326 | 1326 |
1327 TextDecorationStyle style = textDecorationStyle(); | |
1328 StyleColor styleColor = visitedDependentDecorationStyleColor(); | |
1329 | |
1327 int decorations = textDecoration(); | 1330 int decorations = textDecoration(); |
1328 | 1331 |
1329 if (decorations & TextDecorationUnderline) { | 1332 if (decorations & TextDecorationUnderline) { |
1330 // To save memory, we don't use AppliedTextDecoration objects in the | 1333 // To save memory, we don't use AppliedTextDecoration objects in the |
1331 // common case of a single underline. | 1334 // common case of a single simple underline. |
1332 if (!rareInheritedData->appliedTextDecorations) | 1335 AppliedTextDecoration underline(TextDecorationUnderline, style, styleCol or); |
1336 | |
1337 if (!rareInheritedData->appliedTextDecorations && underline.isSimple()) | |
1333 inherited_flags.m_textUnderline = true; | 1338 inherited_flags.m_textUnderline = true; |
1334 else | 1339 else |
1335 addAppliedTextDecoration(AppliedTextDecoration(TextDecorationUnderli ne)); | 1340 addAppliedTextDecoration(underline); |
1336 } | 1341 } |
1337 if (decorations & TextDecorationOverline) | 1342 if (decorations & TextDecorationOverline) |
1338 addAppliedTextDecoration(AppliedTextDecoration(TextDecorationOverline)); | 1343 addAppliedTextDecoration(AppliedTextDecoration(TextDecorationOverline, s tyle, styleColor)); |
1339 if (decorations & TextDecorationLineThrough) | 1344 if (decorations & TextDecorationLineThrough) |
1340 addAppliedTextDecoration(AppliedTextDecoration(TextDecorationLineThrough )); | 1345 addAppliedTextDecoration(AppliedTextDecoration(TextDecorationLineThrough , style, styleColor)); |
1341 } | 1346 } |
1342 | 1347 |
1343 void RenderStyle::clearAppliedTextDecorations() | 1348 void RenderStyle::clearAppliedTextDecorations() |
1344 { | 1349 { |
1345 inherited_flags.m_textUnderline = false; | 1350 inherited_flags.m_textUnderline = false; |
1346 | 1351 |
1347 if (rareInheritedData->appliedTextDecorations) | 1352 if (rareInheritedData->appliedTextDecorations) |
1348 rareInheritedData.access()->appliedTextDecorations = nullptr; | 1353 rareInheritedData.access()->appliedTextDecorations = nullptr; |
1349 } | 1354 } |
1350 | 1355 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1418 const ShadowData& shadow = shadowList->shadows()[i]; | 1423 const ShadowData& shadow = shadowList->shadows()[i]; |
1419 if (shadow.style() == Inset) | 1424 if (shadow.style() == Inset) |
1420 continue; | 1425 continue; |
1421 float blurAndSpread = shadow.blur() + shadow.spread(); | 1426 float blurAndSpread = shadow.blur() + shadow.spread(); |
1422 | 1427 |
1423 top = min<LayoutUnit>(top, shadow.y() - blurAndSpread); | 1428 top = min<LayoutUnit>(top, shadow.y() - blurAndSpread); |
1424 bottom = max<LayoutUnit>(bottom, shadow.y() + blurAndSpread); | 1429 bottom = max<LayoutUnit>(bottom, shadow.y() + blurAndSpread); |
1425 } | 1430 } |
1426 } | 1431 } |
1427 | 1432 |
1428 StyleColor RenderStyle::visitedDependentDecorationColor() const | 1433 StyleColor RenderStyle::visitedDependentDecorationStyleColor() const |
1429 { | 1434 { |
1430 // Text decoration color fallback is handled in RenderObject::decorationColo r. | 1435 bool isVisited = insideLink() == InsideVisitedLink; |
1431 return insideLink() == InsideVisitedLink ? visitedLinkTextDecorationColor() : textDecorationColor(); | 1436 |
1437 StyleColor styleColor = isVisited ? visitedLinkTextDecorationColor() : textD ecorationColor(); | |
1438 | |
1439 if (!styleColor.isCurrentColor()) | |
Julien - ping for review
2014/05/19 10:30:18
Shouldn't we also make sure that |styleColor| is n
andersr
2014/05/19 12:54:02
Hmm, I don't think so, because then we would fall
| |
1440 return styleColor; | |
1441 | |
1442 if (textStrokeWidth()) { | |
1443 // Prefer stroke color if possible, but not if it's fully transparent. | |
1444 StyleColor textStrokeStyleColor = isVisited ? visitedLinkTextStrokeColor () : textStrokeColor(); | |
1445 if (!textStrokeStyleColor.isCurrentColor() && textStrokeStyleColor.color ().alpha()) | |
1446 return textStrokeStyleColor; | |
1447 } | |
1448 | |
1449 return isVisited ? visitedLinkTextFillColor() : textFillColor(); | |
1450 } | |
1451 | |
1452 Color RenderStyle::visitedDependentDecorationColor() const | |
1453 { | |
1454 bool isVisited = insideLink() == InsideVisitedLink; | |
1455 return visitedDependentDecorationStyleColor().resolve(isVisited ? visitedLin kColor() : color()); | |
1432 } | 1456 } |
1433 | 1457 |
1434 Color RenderStyle::colorIncludingFallback(int colorProperty, bool visitedLink) c onst | 1458 Color RenderStyle::colorIncludingFallback(int colorProperty, bool visitedLink) c onst |
1435 { | 1459 { |
1436 StyleColor result(StyleColor::currentColor()); | 1460 StyleColor result(StyleColor::currentColor()); |
1437 EBorderStyle borderStyle = BNONE; | 1461 EBorderStyle borderStyle = BNONE; |
1438 switch (colorProperty) { | 1462 switch (colorProperty) { |
1439 case CSSPropertyBackgroundColor: | 1463 case CSSPropertyBackgroundColor: |
1440 result = visitedLink ? visitedLinkBackgroundColor() : backgroundColor(); | 1464 result = visitedLink ? visitedLinkBackgroundColor() : backgroundColor(); |
1441 break; | 1465 break; |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1721 // right | 1745 // right |
1722 radiiSum = radii.topRight().height() + radii.bottomRight().height(); | 1746 radiiSum = radii.topRight().height() + radii.bottomRight().height(); |
1723 if (radiiSum > rect.height()) | 1747 if (radiiSum > rect.height()) |
1724 factor = std::min(rect.height() / radiiSum, factor); | 1748 factor = std::min(rect.height() / radiiSum, factor); |
1725 | 1749 |
1726 ASSERT(factor <= 1); | 1750 ASSERT(factor <= 1); |
1727 return factor; | 1751 return factor; |
1728 } | 1752 } |
1729 | 1753 |
1730 } // namespace WebCore | 1754 } // namespace WebCore |
OLD | NEW |