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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 #include "core/rendering/RenderMarquee.h" | 67 #include "core/rendering/RenderMarquee.h" |
68 #include "core/rendering/RenderScrollbarPart.h" | 68 #include "core/rendering/RenderScrollbarPart.h" |
69 #include "core/rendering/RenderTableCaption.h" | 69 #include "core/rendering/RenderTableCaption.h" |
70 #include "core/rendering/RenderTableCell.h" | 70 #include "core/rendering/RenderTableCell.h" |
71 #include "core/rendering/RenderTableCol.h" | 71 #include "core/rendering/RenderTableCol.h" |
72 #include "core/rendering/RenderTableRow.h" | 72 #include "core/rendering/RenderTableRow.h" |
73 #include "core/rendering/RenderTheme.h" | 73 #include "core/rendering/RenderTheme.h" |
74 #include "core/rendering/RenderView.h" | 74 #include "core/rendering/RenderView.h" |
75 #include "core/rendering/compositing/CompositedLayerMapping.h" | 75 #include "core/rendering/compositing/CompositedLayerMapping.h" |
76 #include "core/rendering/compositing/RenderLayerCompositor.h" | 76 #include "core/rendering/compositing/RenderLayerCompositor.h" |
| 77 #include "core/rendering/style/AppliedTextDecoration.h" |
77 #include "core/rendering/style/ContentData.h" | 78 #include "core/rendering/style/ContentData.h" |
78 #include "core/rendering/style/CursorList.h" | 79 #include "core/rendering/style/CursorList.h" |
79 #include "core/rendering/style/ShadowList.h" | 80 #include "core/rendering/style/ShadowList.h" |
80 #include "core/rendering/svg/SVGRenderSupport.h" | 81 #include "core/rendering/svg/SVGRenderSupport.h" |
81 #include "platform/JSONValues.h" | 82 #include "platform/JSONValues.h" |
82 #include "platform/Partitions.h" | 83 #include "platform/Partitions.h" |
83 #include "platform/TraceEvent.h" | 84 #include "platform/TraceEvent.h" |
84 #include "platform/TracedValue.h" | 85 #include "platform/TracedValue.h" |
85 #include "platform/geometry/TransformState.h" | 86 #include "platform/geometry/TransformState.h" |
86 #include "platform/graphics/GraphicsContext.h" | 87 #include "platform/graphics/GraphicsContext.h" |
(...skipping 2974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3061 if (style->textStrokeWidth() > 0) { | 3062 if (style->textStrokeWidth() > 0) { |
3062 // Prefer stroke color if possible but not if it's fully transparent. | 3063 // Prefer stroke color if possible but not if it's fully transparent. |
3063 Color textStrokeColor = object->resolveColor(style, CSSPropertyWebkitTex
tStrokeColor); | 3064 Color textStrokeColor = object->resolveColor(style, CSSPropertyWebkitTex
tStrokeColor); |
3064 if (textStrokeColor.alpha()) | 3065 if (textStrokeColor.alpha()) |
3065 return textStrokeColor; | 3066 return textStrokeColor; |
3066 } | 3067 } |
3067 | 3068 |
3068 return object->resolveColor(style, CSSPropertyWebkitTextFillColor); | 3069 return object->resolveColor(style, CSSPropertyWebkitTextFillColor); |
3069 } | 3070 } |
3070 | 3071 |
3071 void RenderObject::getTextDecorations(unsigned decorations, AppliedTextDecoratio
n& underline, AppliedTextDecoration& overline, AppliedTextDecoration& linethroug
h, bool quirksMode, bool firstlineStyle) | 3072 RenderObject::ResolvedDecoration::ResolvedDecoration() |
| 3073 : line(TextDecorationUnderline) |
| 3074 , style(TextDecorationStyleSolid) |
3072 { | 3075 { |
| 3076 } |
| 3077 |
| 3078 RenderObject::ResolvedDecoration::ResolvedDecoration(const AppliedTextDecoration
& decoration, const Color& color) |
| 3079 : line(decoration.line()) |
| 3080 , style(decoration.style()) |
| 3081 , color(color) |
| 3082 { |
| 3083 } |
| 3084 |
| 3085 static RenderStyle* decorationStyle(RenderObject* renderObject, bool firstlineSt
yle, TextDecoration decoration) |
| 3086 { |
| 3087 RenderStyle* styleToUse = renderObject->style(firstlineStyle); |
| 3088 |
| 3089 if (styleToUse->textDecoration() == decoration) |
| 3090 return styleToUse; |
| 3091 if (!firstlineStyle) |
| 3092 return nullptr; |
| 3093 |
| 3094 styleToUse = renderObject->style(false); |
| 3095 return styleToUse->textDecoration() == decoration ? styleToUse : nullptr; |
| 3096 } |
| 3097 |
| 3098 void RenderObject::resolvedDecorations(bool firstlineStyle, const Vector<Applied
TextDecoration>& decorations, ResolvedDecorationVector& resolved) |
| 3099 { |
| 3100 ASSERT(decorations.size()); |
| 3101 |
| 3102 bool quirksMode = document().inQuirksMode(); |
| 3103 |
3073 RenderObject* curr = this; | 3104 RenderObject* curr = this; |
3074 RenderStyle* styleToUse = 0; | 3105 Vector<AppliedTextDecoration>::const_reverse_iterator decoration = decoratio
ns.rbegin(); |
3075 unsigned currDecs = TextDecorationNone; | 3106 |
3076 Color resultColor; | |
3077 TextDecorationStyle resultStyle; | |
3078 do { | 3107 do { |
3079 styleToUse = curr->style(firstlineStyle); | 3108 if (!curr->isText()) { |
3080 currDecs = styleToUse->textDecoration(); | 3109 RenderStyle* styleToUse = decorationStyle(curr, firstlineStyle, deco
ration->line()); |
3081 currDecs &= decorations; | 3110 if (styleToUse) { |
3082 resultColor = decorationColor(this, styleToUse); | 3111 resolved.append(RenderObject::ResolvedDecoration(*decoration, st
yleToUse->visitedDependentDecorationColor())); |
3083 resultStyle = styleToUse->textDecorationStyle(); | 3112 ++decoration; |
3084 // Parameter 'decorations' is cast as an int to enable the bitwise opera
tions below. | |
3085 if (currDecs) { | |
3086 if (currDecs & TextDecorationUnderline) { | |
3087 decorations &= ~TextDecorationUnderline; | |
3088 underline.color = resultColor; | |
3089 underline.style = resultStyle; | |
3090 } | |
3091 if (currDecs & TextDecorationOverline) { | |
3092 decorations &= ~TextDecorationOverline; | |
3093 overline.color = resultColor; | |
3094 overline.style = resultStyle; | |
3095 } | |
3096 if (currDecs & TextDecorationLineThrough) { | |
3097 decorations &= ~TextDecorationLineThrough; | |
3098 linethrough.color = resultColor; | |
3099 linethrough.style = resultStyle; | |
3100 } | 3113 } |
3101 } | 3114 } |
3102 if (curr->isRubyText()) | |
3103 return; | |
3104 curr = curr->parent(); | 3115 curr = curr->parent(); |
3105 if (curr && curr->isAnonymousBlock() && toRenderBlock(curr)->continuatio
n()) | 3116 if (curr && curr->isAnonymousBlock() && toRenderBlock(curr)->continuatio
n()) |
3106 curr = toRenderBlock(curr)->continuation(); | 3117 curr = toRenderBlock(curr)->continuation(); |
3107 } while (curr && decorations && (!quirksMode || !curr->node() || (!isHTMLAnc
horElement(*curr->node()) && !isHTMLFontElement(*curr->node())))); | 3118 } while (curr && (decoration != decorations.rend()) && (!quirksMode || !curr
->node() || (!isHTMLAnchorElement(*curr->node()) && !isHTMLFontElement(*curr->no
de())))); |
3108 | 3119 |
3109 // If we bailed out, use the element we bailed out at (typically a <font> or
<a> element). | 3120 // If we bailed out, use the element we bailed out at (typically a <font> or
<a> element). |
3110 if (decorations && curr) { | 3121 if (curr && (decoration != decorations.rend())) { |
3111 styleToUse = curr->style(firstlineStyle); | 3122 RenderStyle* styleToUse = decorationStyle(curr, firstlineStyle, decorati
on->line()); |
3112 resultColor = decorationColor(this, styleToUse); | 3123 if (styleToUse) |
3113 if (decorations & TextDecorationUnderline) { | 3124 resolved.append(RenderObject::ResolvedDecoration(*decoration, styleT
oUse->visitedDependentDecorationColor())); |
3114 underline.color = resultColor; | |
3115 underline.style = resultStyle; | |
3116 } | |
3117 if (decorations & TextDecorationOverline) { | |
3118 overline.color = resultColor; | |
3119 overline.style = resultStyle; | |
3120 } | |
3121 if (decorations & TextDecorationLineThrough) { | |
3122 linethrough.color = resultColor; | |
3123 linethrough.style = resultStyle; | |
3124 } | |
3125 } | 3125 } |
3126 } | 3126 } |
3127 | 3127 |
3128 void RenderObject::addAnnotatedRegions(Vector<AnnotatedRegionValue>& regions) | 3128 void RenderObject::addAnnotatedRegions(Vector<AnnotatedRegionValue>& regions) |
3129 { | 3129 { |
3130 // Convert the style regions to absolute coordinates. | 3130 // Convert the style regions to absolute coordinates. |
3131 if (style()->visibility() != VISIBLE || !isBox()) | 3131 if (style()->visibility() != VISIBLE || !isBox()) |
3132 return; | 3132 return; |
3133 | 3133 |
3134 if (style()->getDraggableRegionMode() == DraggableRegionNone) | 3134 if (style()->getDraggableRegionMode() == DraggableRegionNone) |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3436 { | 3436 { |
3437 if (object1) { | 3437 if (object1) { |
3438 const WebCore::RenderObject* root = object1; | 3438 const WebCore::RenderObject* root = object1; |
3439 while (root->parent()) | 3439 while (root->parent()) |
3440 root = root->parent(); | 3440 root = root->parent(); |
3441 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3441 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3442 } | 3442 } |
3443 } | 3443 } |
3444 | 3444 |
3445 #endif | 3445 #endif |
OLD | NEW |