OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
9 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 9 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
10 * Copyright (C) 2013 Google Inc. All rights reserved. | 10 * Copyright (C) 2013 Google Inc. All rights reserved. |
(...skipping 10 matching lines...) Expand all Loading... |
21 * | 21 * |
22 * You should have received a copy of the GNU Library General Public License | 22 * You should have received a copy of the GNU Library General Public License |
23 * along with this library; see the file COPYING.LIB. If not, write to | 23 * along with this library; see the file COPYING.LIB. If not, write to |
24 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 24 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 * Boston, MA 02110-1301, USA. | 25 * Boston, MA 02110-1301, USA. |
26 */ | 26 */ |
27 | 27 |
28 #include "core/dom/TextLinkColors.h" | 28 #include "core/dom/TextLinkColors.h" |
29 | 29 |
30 #include "core/css/CSSColorValue.h" | 30 #include "core/css/CSSColorValue.h" |
31 #include "core/css/CSSPrimitiveValue.h" | 31 #include "core/css/CSSIdentifierValue.h" |
32 #include "core/css/StyleColor.h" | 32 #include "core/css/StyleColor.h" |
33 #include "core/layout/LayoutTheme.h" | 33 #include "core/layout/LayoutTheme.h" |
34 #include "wtf/text/WTFString.h" | 34 #include "wtf/text/WTFString.h" |
35 | 35 |
36 namespace blink { | 36 namespace blink { |
37 | 37 |
38 TextLinkColors::TextLinkColors() | 38 TextLinkColors::TextLinkColors() |
39 : m_textColor(Color::black) | 39 : m_textColor(Color::black) |
40 { | 40 { |
41 resetLinkColor(); | 41 resetLinkColor(); |
(...skipping 14 matching lines...) Expand all Loading... |
56 void TextLinkColors::resetActiveLinkColor() | 56 void TextLinkColors::resetActiveLinkColor() |
57 { | 57 { |
58 m_activeLinkColor = Color(255, 0, 0); | 58 m_activeLinkColor = Color(255, 0, 0); |
59 } | 59 } |
60 | 60 |
61 Color TextLinkColors::colorFromCSSValue(const CSSValue& value, Color currentColo
r, bool forVisitedLink) const | 61 Color TextLinkColors::colorFromCSSValue(const CSSValue& value, Color currentColo
r, bool forVisitedLink) const |
62 { | 62 { |
63 if (value.isColorValue()) | 63 if (value.isColorValue()) |
64 return toCSSColorValue(value).value(); | 64 return toCSSColorValue(value).value(); |
65 | 65 |
66 CSSValueID valueID = toCSSPrimitiveValue(value).getValueID(); | 66 CSSValueID valueID = toCSSIdentifierValue(value).getValueID(); |
67 switch (valueID) { | 67 switch (valueID) { |
68 case CSSValueInvalid: | 68 case CSSValueInvalid: |
69 NOTREACHED(); | 69 NOTREACHED(); |
70 return Color(); | 70 return Color(); |
71 case CSSValueInternalQuirkInherit: | 71 case CSSValueInternalQuirkInherit: |
72 return textColor(); | 72 return textColor(); |
73 case CSSValueWebkitLink: | 73 case CSSValueWebkitLink: |
74 return forVisitedLink ? visitedLinkColor() : linkColor(); | 74 return forVisitedLink ? visitedLinkColor() : linkColor(); |
75 case CSSValueWebkitActivelink: | 75 case CSSValueWebkitActivelink: |
76 return activeLinkColor(); | 76 return activeLinkColor(); |
77 case CSSValueWebkitFocusRingColor: | 77 case CSSValueWebkitFocusRingColor: |
78 return LayoutTheme::theme().focusRingColor(); | 78 return LayoutTheme::theme().focusRingColor(); |
79 case CSSValueCurrentcolor: | 79 case CSSValueCurrentcolor: |
80 return currentColor; | 80 return currentColor; |
81 default: | 81 default: |
82 return StyleColor::colorFromKeyword(valueID); | 82 return StyleColor::colorFromKeyword(valueID); |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 } // namespace blink | 86 } // namespace blink |
OLD | NEW |