| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |    2  * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 
|    3  * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
      All rights reserved. |    3  * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
      All rights reserved. | 
|    4  * |    4  * | 
|    5  * This library is free software; you can redistribute it and/or |    5  * This library is free software; you can redistribute it and/or | 
|    6  * modify it under the terms of the GNU Library General Public |    6  * modify it under the terms of the GNU Library General Public | 
|    7  * License as published by the Free Software Foundation; either |    7  * License as published by the Free Software Foundation; either | 
|    8  * version 2 of the License, or (at your option) any later version. |    8  * version 2 of the License, or (at your option) any later version. | 
|    9  * |    9  * | 
|   10  * This library is distributed in the hope that it will be useful, |   10  * This library is distributed in the hope that it will be useful, | 
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   81     Node* docElement = e ? e->document()->documentElement() : 0; |   81     Node* docElement = e ? e->document()->documentElement() : 0; | 
|   82     RenderStyle* docStyle = document->renderStyle(); |   82     RenderStyle* docStyle = document->renderStyle(); | 
|   83     m_rootElementStyle = docElement && e != docElement ? docElement->renderStyle
     () : docStyle; |   83     m_rootElementStyle = docElement && e != docElement ? docElement->renderStyle
     () : docStyle; | 
|   84  |   84  | 
|   85     m_style = 0; |   85     m_style = 0; | 
|   86     m_pendingImageProperties.clear(); |   86     m_pendingImageProperties.clear(); | 
|   87     m_fontDirty = false; |   87     m_fontDirty = false; | 
|   88 } |   88 } | 
|   89  |   89  | 
|   90  |   90  | 
|   91 static Color colorForCSSValue(int cssValueId) |   91 static Color colorForCSSValue(CSSValueID cssValueId) | 
|   92 { |   92 { | 
|   93     struct ColorValue { |   93     struct ColorValue { | 
|   94         int cssValueId; |   94         CSSValueID cssValueId; | 
|   95         RGBA32 color; |   95         RGBA32 color; | 
|   96     }; |   96     }; | 
|   97  |   97  | 
|   98     static const ColorValue colorValues[] = { |   98     static const ColorValue colorValues[] = { | 
|   99         { CSSValueAqua, 0xFF00FFFF }, |   99         { CSSValueAqua, 0xFF00FFFF }, | 
|  100         { CSSValueBlack, 0xFF000000 }, |  100         { CSSValueBlack, 0xFF000000 }, | 
|  101         { CSSValueBlue, 0xFF0000FF }, |  101         { CSSValueBlue, 0xFF0000FF }, | 
|  102         { CSSValueFuchsia, 0xFFFF00FF }, |  102         { CSSValueFuchsia, 0xFFFF00FF }, | 
|  103         { CSSValueGray, 0xFF808080 }, |  103         { CSSValueGray, 0xFF808080 }, | 
|  104         { CSSValueGreen, 0xFF008000  }, |  104         { CSSValueGreen, 0xFF008000  }, | 
|  105         { CSSValueGrey, 0xFF808080 }, |  105         { CSSValueGrey, 0xFF808080 }, | 
|  106         { CSSValueLime, 0xFF00FF00 }, |  106         { CSSValueLime, 0xFF00FF00 }, | 
|  107         { CSSValueMaroon, 0xFF800000 }, |  107         { CSSValueMaroon, 0xFF800000 }, | 
|  108         { CSSValueNavy, 0xFF000080 }, |  108         { CSSValueNavy, 0xFF000080 }, | 
|  109         { CSSValueOlive, 0xFF808000  }, |  109         { CSSValueOlive, 0xFF808000  }, | 
|  110         { CSSValueOrange, 0xFFFFA500 }, |  110         { CSSValueOrange, 0xFFFFA500 }, | 
|  111         { CSSValuePurple, 0xFF800080 }, |  111         { CSSValuePurple, 0xFF800080 }, | 
|  112         { CSSValueRed, 0xFFFF0000 }, |  112         { CSSValueRed, 0xFFFF0000 }, | 
|  113         { CSSValueSilver, 0xFFC0C0C0 }, |  113         { CSSValueSilver, 0xFFC0C0C0 }, | 
|  114         { CSSValueTeal, 0xFF008080  }, |  114         { CSSValueTeal, 0xFF008080  }, | 
|  115         { CSSValueTransparent, 0x00000000 }, |  115         { CSSValueTransparent, 0x00000000 }, | 
|  116         { CSSValueWhite, 0xFFFFFFFF }, |  116         { CSSValueWhite, 0xFFFFFFFF }, | 
|  117         { CSSValueYellow, 0xFFFFFF00 }, |  117         { CSSValueYellow, 0xFFFFFF00 }, | 
|  118         { 0, 0 } |  118         { CSSValueInvalid, CSSValueInvalid } | 
|  119     }; |  119     }; | 
|  120  |  120  | 
|  121     for (const ColorValue* col = colorValues; col->cssValueId; ++col) { |  121     for (const ColorValue* col = colorValues; col->cssValueId; ++col) { | 
|  122         if (col->cssValueId == cssValueId) |  122         if (col->cssValueId == cssValueId) | 
|  123             return col->color; |  123             return col->color; | 
|  124     } |  124     } | 
|  125     return RenderTheme::defaultTheme()->systemColor(cssValueId); |  125     return RenderTheme::defaultTheme()->systemColor(cssValueId); | 
|  126 } |  126 } | 
|  127  |  127  | 
|  128 Color StyleResolverState::colorFromPrimitiveValue(CSSPrimitiveValue* value, bool
      forVisitedLink) const |  128 Color StyleResolverState::colorFromPrimitiveValue(CSSPrimitiveValue* value, bool
      forVisitedLink) const | 
|  129 { |  129 { | 
|  130     if (value->isRGBColor()) |  130     if (value->isRGBColor()) | 
|  131         return Color(value->getRGBA32Value()); |  131         return Color(value->getRGBA32Value()); | 
|  132  |  132  | 
|  133     int ident = value->getIdent(); |  133     CSSValueID valueID = value->getValueID(); | 
|  134     switch (ident) { |  134     switch (valueID) { | 
|  135     case 0: |  135     case 0: | 
|  136         return Color(); |  136         return Color(); | 
|  137     case CSSValueWebkitText: |  137     case CSSValueWebkitText: | 
|  138         return document()->textColor(); |  138         return document()->textColor(); | 
|  139     case CSSValueWebkitLink: |  139     case CSSValueWebkitLink: | 
|  140         return (element()->isLink() && forVisitedLink) ? document()->visitedLink
     Color() : document()->linkColor(); |  140         return (element()->isLink() && forVisitedLink) ? document()->visitedLink
     Color() : document()->linkColor(); | 
|  141     case CSSValueWebkitActivelink: |  141     case CSSValueWebkitActivelink: | 
|  142         return document()->activeLinkColor(); |  142         return document()->activeLinkColor(); | 
|  143     case CSSValueWebkitFocusRingColor: |  143     case CSSValueWebkitFocusRingColor: | 
|  144         return RenderTheme::focusRingColor(); |  144         return RenderTheme::focusRingColor(); | 
|  145     case CSSValueCurrentcolor: |  145     case CSSValueCurrentcolor: | 
|  146         return style()->color(); |  146         return style()->color(); | 
|  147     default: |  147     default: | 
|  148         return colorForCSSValue(ident); |  148         return colorForCSSValue(valueID); | 
|  149     } |  149     } | 
|  150 } |  150 } | 
|  151  |  151  | 
|  152  |  152  | 
|  153 } // namespace WebCore |  153 } // namespace WebCore | 
| OLD | NEW |