| 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 3059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3070 } | 3070 } |
| 3071 | 3071 |
| 3072 return getUncachedPseudoStyle(PseudoStyleRequest(SELECTION)); | 3072 return getUncachedPseudoStyle(PseudoStyleRequest(SELECTION)); |
| 3073 } | 3073 } |
| 3074 | 3074 |
| 3075 bool RenderObject::hasBlendMode() const | 3075 bool RenderObject::hasBlendMode() const |
| 3076 { | 3076 { |
| 3077 return RuntimeEnabledFeatures::cssCompositingEnabled() && style() && style()
->hasBlendMode(); | 3077 return RuntimeEnabledFeatures::cssCompositingEnabled() && style() && style()
->hasBlendMode(); |
| 3078 } | 3078 } |
| 3079 | 3079 |
| 3080 static Color decorationColor(const RenderObject* object, RenderStyle* style) | |
| 3081 { | |
| 3082 // Check for text decoration color first. | |
| 3083 StyleColor result = style->visitedDependentDecorationColor(); | |
| 3084 if (!result.isCurrentColor()) | |
| 3085 return result.color(); | |
| 3086 | |
| 3087 if (style->textStrokeWidth() > 0) { | |
| 3088 // Prefer stroke color if possible but not if it's fully transparent. | |
| 3089 Color textStrokeColor = object->resolveColor(style, CSSPropertyWebkitTex
tStrokeColor); | |
| 3090 if (textStrokeColor.alpha()) | |
| 3091 return textStrokeColor; | |
| 3092 } | |
| 3093 | |
| 3094 return object->resolveColor(style, CSSPropertyWebkitTextFillColor); | |
| 3095 } | |
| 3096 | |
| 3097 void RenderObject::getTextDecorations(unsigned decorations, AppliedTextDecoratio
n& underline, AppliedTextDecoration& overline, AppliedTextDecoration& linethroug
h, bool quirksMode, bool firstlineStyle) | 3080 void RenderObject::getTextDecorations(unsigned decorations, AppliedTextDecoratio
n& underline, AppliedTextDecoration& overline, AppliedTextDecoration& linethroug
h, bool quirksMode, bool firstlineStyle) |
| 3098 { | 3081 { |
| 3099 RenderObject* curr = this; | 3082 RenderObject* curr = this; |
| 3100 RenderStyle* styleToUse = 0; | 3083 RenderStyle* styleToUse = 0; |
| 3101 unsigned currDecs = TextDecorationNone; | 3084 unsigned currDecs = TextDecorationNone; |
| 3102 Color resultColor; | 3085 Color resultColor; |
| 3103 TextDecorationStyle resultStyle; | 3086 TextDecorationStyle resultStyle; |
| 3104 do { | 3087 do { |
| 3105 styleToUse = curr->style(firstlineStyle); | 3088 styleToUse = curr->style(firstlineStyle); |
| 3106 currDecs = styleToUse->textDecoration(); | 3089 currDecs = styleToUse->textDecoration(); |
| 3107 currDecs &= decorations; | 3090 currDecs &= decorations; |
| 3108 resultColor = decorationColor(this, styleToUse); | 3091 resultColor = styleToUse->visitedDependentDecorationColor(); |
| 3109 resultStyle = styleToUse->textDecorationStyle(); | 3092 resultStyle = styleToUse->textDecorationStyle(); |
| 3110 // Parameter 'decorations' is cast as an int to enable the bitwise opera
tions below. | 3093 // Parameter 'decorations' is cast as an int to enable the bitwise opera
tions below. |
| 3111 if (currDecs) { | 3094 if (currDecs) { |
| 3112 if (currDecs & TextDecorationUnderline) { | 3095 if (currDecs & TextDecorationUnderline) { |
| 3113 decorations &= ~TextDecorationUnderline; | 3096 decorations &= ~TextDecorationUnderline; |
| 3114 underline.color = resultColor; | 3097 underline.color = resultColor; |
| 3115 underline.style = resultStyle; | 3098 underline.style = resultStyle; |
| 3116 } | 3099 } |
| 3117 if (currDecs & TextDecorationOverline) { | 3100 if (currDecs & TextDecorationOverline) { |
| 3118 decorations &= ~TextDecorationOverline; | 3101 decorations &= ~TextDecorationOverline; |
| 3119 overline.color = resultColor; | 3102 overline.color = resultColor; |
| 3120 overline.style = resultStyle; | 3103 overline.style = resultStyle; |
| 3121 } | 3104 } |
| 3122 if (currDecs & TextDecorationLineThrough) { | 3105 if (currDecs & TextDecorationLineThrough) { |
| 3123 decorations &= ~TextDecorationLineThrough; | 3106 decorations &= ~TextDecorationLineThrough; |
| 3124 linethrough.color = resultColor; | 3107 linethrough.color = resultColor; |
| 3125 linethrough.style = resultStyle; | 3108 linethrough.style = resultStyle; |
| 3126 } | 3109 } |
| 3127 } | 3110 } |
| 3128 if (curr->isRubyText()) | 3111 if (curr->isRubyText()) |
| 3129 return; | 3112 return; |
| 3130 curr = curr->parent(); | 3113 curr = curr->parent(); |
| 3131 if (curr && curr->isAnonymousBlock() && toRenderBlock(curr)->continuatio
n()) | 3114 if (curr && curr->isAnonymousBlock() && toRenderBlock(curr)->continuatio
n()) |
| 3132 curr = toRenderBlock(curr)->continuation(); | 3115 curr = toRenderBlock(curr)->continuation(); |
| 3133 } while (curr && decorations && (!quirksMode || !curr->node() || (!isHTMLAnc
horElement(*curr->node()) && !isHTMLFontElement(*curr->node())))); | 3116 } while (curr && decorations && (!quirksMode || !curr->node() || (!isHTMLAnc
horElement(*curr->node()) && !isHTMLFontElement(*curr->node())))); |
| 3134 | 3117 |
| 3135 // If we bailed out, use the element we bailed out at (typically a <font> or
<a> element). | 3118 // If we bailed out, use the element we bailed out at (typically a <font> or
<a> element). |
| 3136 if (decorations && curr) { | 3119 if (decorations && curr) { |
| 3137 styleToUse = curr->style(firstlineStyle); | 3120 styleToUse = curr->style(firstlineStyle); |
| 3138 resultColor = decorationColor(this, styleToUse); | 3121 resultColor = styleToUse->visitedDependentDecorationColor(); |
| 3139 if (decorations & TextDecorationUnderline) { | 3122 if (decorations & TextDecorationUnderline) { |
| 3140 underline.color = resultColor; | 3123 underline.color = resultColor; |
| 3141 underline.style = resultStyle; | 3124 underline.style = resultStyle; |
| 3142 } | 3125 } |
| 3143 if (decorations & TextDecorationOverline) { | 3126 if (decorations & TextDecorationOverline) { |
| 3144 overline.color = resultColor; | 3127 overline.color = resultColor; |
| 3145 overline.style = resultStyle; | 3128 overline.style = resultStyle; |
| 3146 } | 3129 } |
| 3147 if (decorations & TextDecorationLineThrough) { | 3130 if (decorations & TextDecorationLineThrough) { |
| 3148 linethrough.color = resultColor; | 3131 linethrough.color = resultColor; |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3478 { | 3461 { |
| 3479 if (object1) { | 3462 if (object1) { |
| 3480 const WebCore::RenderObject* root = object1; | 3463 const WebCore::RenderObject* root = object1; |
| 3481 while (root->parent()) | 3464 while (root->parent()) |
| 3482 root = root->parent(); | 3465 root = root->parent(); |
| 3483 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3466 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
| 3484 } | 3467 } |
| 3485 } | 3468 } |
| 3486 | 3469 |
| 3487 #endif | 3470 #endif |
| OLD | NEW |