Chromium Code Reviews| 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) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. |
| 7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 2959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2970 if (style->textStrokeWidth() > 0) { | 2970 if (style->textStrokeWidth() > 0) { |
| 2971 // Prefer stroke color if possible but not if it's fully transparent. | 2971 // Prefer stroke color if possible but not if it's fully transparent. |
| 2972 Color textStrokeColor = object->resolveColor(style, CSSPropertyWebkitTex tStrokeColor); | 2972 Color textStrokeColor = object->resolveColor(style, CSSPropertyWebkitTex tStrokeColor); |
| 2973 if (textStrokeColor.alpha()) | 2973 if (textStrokeColor.alpha()) |
| 2974 return textStrokeColor; | 2974 return textStrokeColor; |
| 2975 } | 2975 } |
| 2976 | 2976 |
| 2977 return object->resolveColor(style, CSSPropertyWebkitTextFillColor); | 2977 return object->resolveColor(style, CSSPropertyWebkitTextFillColor); |
| 2978 } | 2978 } |
| 2979 | 2979 |
| 2980 void RenderObject::getTextDecorations(unsigned decorations, AppliedTextDecoratio n& underline, AppliedTextDecoration& overline, AppliedTextDecoration& linethroug h, bool quirksMode, bool firstlineStyle) | 2980 static bool hasSimpleUnderline(RenderStyle* style) |
| 2981 { | |
| 2982 return style->textDecoration() & TextDecorationUnderline | |
| 2983 && style->textDecorationStyle() == TextDecorationStyleSolid; | |
|
esprehn
2014/03/31 17:41:24
This should be a method on RenderStyle.
| |
| 2984 } | |
| 2985 | |
| 2986 Color RenderObject::getUnderlineColor(bool quirksMode, bool firstlineStyle) | |
| 2981 { | 2987 { |
| 2982 RenderObject* curr = this; | 2988 RenderObject* curr = this; |
| 2983 RenderStyle* styleToUse = 0; | |
| 2984 unsigned currDecs = TextDecorationNone; | |
| 2985 Color resultColor; | |
| 2986 TextDecorationStyle resultStyle; | |
| 2987 do { | 2989 do { |
| 2988 styleToUse = curr->style(firstlineStyle); | 2990 RenderStyle* styleToUse = curr->style(firstlineStyle); |
| 2989 currDecs = styleToUse->textDecoration(); | 2991 if (hasSimpleUnderline(styleToUse)) |
| 2990 currDecs &= decorations; | 2992 return styleToUse->visitedDependentDecorationColor(); |
| 2991 resultColor = decorationColor(this, styleToUse); | |
| 2992 resultStyle = styleToUse->textDecorationStyle(); | |
| 2993 // Parameter 'decorations' is cast as an int to enable the bitwise opera tions below. | |
| 2994 if (currDecs) { | |
| 2995 if (currDecs & TextDecorationUnderline) { | |
| 2996 decorations &= ~TextDecorationUnderline; | |
| 2997 underline.color = resultColor; | |
| 2998 underline.style = resultStyle; | |
| 2999 } | |
| 3000 if (currDecs & TextDecorationOverline) { | |
| 3001 decorations &= ~TextDecorationOverline; | |
| 3002 overline.color = resultColor; | |
| 3003 overline.style = resultStyle; | |
| 3004 } | |
| 3005 if (currDecs & TextDecorationLineThrough) { | |
| 3006 decorations &= ~TextDecorationLineThrough; | |
| 3007 linethrough.color = resultColor; | |
| 3008 linethrough.style = resultStyle; | |
| 3009 } | |
| 3010 } | |
| 3011 if (curr->isRubyText()) | |
| 3012 return; | |
| 3013 curr = curr->parent(); | 2993 curr = curr->parent(); |
| 3014 if (curr && curr->isAnonymousBlock() && toRenderBlock(curr)->continuatio n()) | 2994 if (curr && curr->isAnonymousBlock() && toRenderBlock(curr)->continuatio n()) |
| 3015 curr = toRenderBlock(curr)->continuation(); | 2995 curr = toRenderBlock(curr)->continuation(); |
| 3016 } while (curr && decorations && (!quirksMode || !curr->node() || (!isHTMLAnc horElement(*curr->node()) && !isHTMLFontElement(*curr->node())))); | 2996 } while (curr && (!quirksMode || !curr->node() || (!isHTMLAnchorElement(*cur r->node()) && !isHTMLFontElement(*curr->node())))); |
| 3017 | 2997 |
| 3018 // If we bailed out, use the element we bailed out at (typically a <font> or <a> element). | 2998 // If we bailed out, use the element we bailed out at (typically a <font> or <a> element). |
| 3019 if (decorations && curr) { | 2999 if (curr) |
| 3020 styleToUse = curr->style(firstlineStyle); | 3000 return curr->style(firstlineStyle)->visitedDependentDecorationColor(); |
| 3021 resultColor = decorationColor(this, styleToUse); | 3001 |
| 3022 if (decorations & TextDecorationUnderline) { | 3002 // If we can't find the originating element in the first-line styles, try ag ain |
| 3023 underline.color = resultColor; | 3003 // with the regular styles. |
| 3024 underline.style = resultStyle; | 3004 if (firstlineStyle) |
| 3025 } | 3005 return getUnderlineColor(quirksMode, false); |
| 3026 if (decorations & TextDecorationOverline) { | 3006 |
| 3027 overline.color = resultColor; | 3007 // If we reach this, it means we can't find the originating element for |
| 3028 overline.style = resultStyle; | 3008 // the applied underline. It's probably incorrect that the underline is |
| 3029 } | 3009 // applied. |
| 3030 if (decorations & TextDecorationLineThrough) { | 3010 ASSERT_NOT_REACHED(); |
| 3031 linethrough.color = resultColor; | 3011 return Color(); |
| 3032 linethrough.style = resultStyle; | |
| 3033 } | |
| 3034 } | |
| 3035 } | 3012 } |
| 3036 | 3013 |
| 3037 void RenderObject::addAnnotatedRegions(Vector<AnnotatedRegionValue>& regions) | 3014 void RenderObject::addAnnotatedRegions(Vector<AnnotatedRegionValue>& regions) |
| 3038 { | 3015 { |
| 3039 // Convert the style regions to absolute coordinates. | 3016 // Convert the style regions to absolute coordinates. |
| 3040 if (style()->visibility() != VISIBLE || !isBox()) | 3017 if (style()->visibility() != VISIBLE || !isBox()) |
| 3041 return; | 3018 return; |
| 3042 | 3019 |
| 3043 if (style()->getDraggableRegionMode() == DraggableRegionNone) | 3020 if (style()->getDraggableRegionMode() == DraggableRegionNone) |
| 3044 return; | 3021 return; |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3329 { | 3306 { |
| 3330 if (object1) { | 3307 if (object1) { |
| 3331 const WebCore::RenderObject* root = object1; | 3308 const WebCore::RenderObject* root = object1; |
| 3332 while (root->parent()) | 3309 while (root->parent()) |
| 3333 root = root->parent(); | 3310 root = root->parent(); |
| 3334 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3311 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
| 3335 } | 3312 } |
| 3336 } | 3313 } |
| 3337 | 3314 |
| 3338 #endif | 3315 #endif |
| OLD | NEW |