Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Side by Side Diff: Source/core/rendering/RenderObject.cpp

Issue 195093002: Support multiple text decoration styles. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2950 matching lines...) Expand 10 before | Expand all | Expand 10 after
2961 if (style->textStrokeWidth() > 0) { 2961 if (style->textStrokeWidth() > 0) {
2962 // Prefer stroke color if possible but not if it's fully transparent. 2962 // Prefer stroke color if possible but not if it's fully transparent.
2963 Color textStrokeColor = object->resolveColor(style, CSSPropertyWebkitTex tStrokeColor); 2963 Color textStrokeColor = object->resolveColor(style, CSSPropertyWebkitTex tStrokeColor);
2964 if (textStrokeColor.alpha()) 2964 if (textStrokeColor.alpha())
2965 return textStrokeColor; 2965 return textStrokeColor;
2966 } 2966 }
2967 2967
2968 return object->resolveColor(style, CSSPropertyWebkitTextFillColor); 2968 return object->resolveColor(style, CSSPropertyWebkitTextFillColor);
2969 } 2969 }
2970 2970
2971 void RenderObject::getTextDecorationColors(unsigned decorations, Color& underlin e, Color& overline, 2971 void RenderObject::getTextDecorations(unsigned decorations, AppliedTextDecoratio n& underline, AppliedTextDecoration& overline, AppliedTextDecoration& linethroug h, bool quirksMode, bool firstlineStyle)
2972 Color& linethrough, bool quirksMode, bool firstlineStyle)
2973 { 2972 {
2974 RenderObject* curr = this; 2973 RenderObject* curr = this;
2975 RenderStyle* styleToUse = 0; 2974 RenderStyle* styleToUse = 0;
2976 unsigned currDecs = TextDecorationNone; 2975 unsigned currDecs = TextDecorationNone;
2977 Color resultColor; 2976 Color resultColor;
2977 TextDecorationStyle resultStyle;
2978 do { 2978 do {
2979 styleToUse = curr->style(firstlineStyle); 2979 styleToUse = curr->style(firstlineStyle);
2980 currDecs = styleToUse->textDecoration(); 2980 currDecs = styleToUse->textDecoration();
2981 currDecs &= decorations; 2981 currDecs &= decorations;
2982 resultColor = decorationColor(this, styleToUse); 2982 resultColor = decorationColor(this, styleToUse);
2983 resultStyle = styleToUse->textDecorationStyle();
2983 // Parameter 'decorations' is cast as an int to enable the bitwise opera tions below. 2984 // Parameter 'decorations' is cast as an int to enable the bitwise opera tions below.
2984 if (currDecs) { 2985 if (currDecs) {
2985 if (currDecs & TextDecorationUnderline) { 2986 if (currDecs & TextDecorationUnderline) {
2986 decorations &= ~TextDecorationUnderline; 2987 decorations &= ~TextDecorationUnderline;
2987 underline = resultColor; 2988 underline.color = resultColor;
2989 underline.style = resultStyle;
2988 } 2990 }
2989 if (currDecs & TextDecorationOverline) { 2991 if (currDecs & TextDecorationOverline) {
2990 decorations &= ~TextDecorationOverline; 2992 decorations &= ~TextDecorationOverline;
2991 overline = resultColor; 2993 overline.color = resultColor;
2994 overline.style = resultStyle;
2992 } 2995 }
2993 if (currDecs & TextDecorationLineThrough) { 2996 if (currDecs & TextDecorationLineThrough) {
2994 decorations &= ~TextDecorationLineThrough; 2997 decorations &= ~TextDecorationLineThrough;
2995 linethrough = resultColor; 2998 linethrough.color = resultColor;
2999 linethrough.style = resultStyle;
2996 } 3000 }
2997 } 3001 }
2998 if (curr->isRubyText()) 3002 if (curr->isRubyText())
2999 return; 3003 return;
3000 curr = curr->parent(); 3004 curr = curr->parent();
3001 if (curr && curr->isAnonymousBlock() && toRenderBlock(curr)->continuatio n()) 3005 if (curr && curr->isAnonymousBlock() && toRenderBlock(curr)->continuatio n())
3002 curr = toRenderBlock(curr)->continuation(); 3006 curr = toRenderBlock(curr)->continuation();
3003 } while (curr && decorations && (!quirksMode || !curr->node() || (!curr->nod e()->hasTagName(aTag) && !curr->node()->hasTagName(fontTag)))); 3007 } while (curr && decorations && (!quirksMode || !curr->node() || (!curr->nod e()->hasTagName(aTag) && !curr->node()->hasTagName(fontTag))));
3004 3008
3005 // If we bailed out, use the element we bailed out at (typically a <font> or <a> element). 3009 // If we bailed out, use the element we bailed out at (typically a <font> or <a> element).
3006 if (decorations && curr) { 3010 if (decorations && curr) {
3007 styleToUse = curr->style(firstlineStyle); 3011 styleToUse = curr->style(firstlineStyle);
3008 resultColor = decorationColor(this, styleToUse); 3012 resultColor = decorationColor(this, styleToUse);
3009 if (decorations & TextDecorationUnderline) 3013 if (decorations & TextDecorationUnderline) {
3010 underline = resultColor; 3014 underline.color = resultColor;
3011 if (decorations & TextDecorationOverline) 3015 underline.style = resultStyle;
3012 overline = resultColor; 3016 }
3013 if (decorations & TextDecorationLineThrough) 3017 if (decorations & TextDecorationOverline) {
3014 linethrough = resultColor; 3018 overline.color = resultColor;
3019 overline.style = resultStyle;
3020 }
3021 if (decorations & TextDecorationLineThrough) {
3022 linethrough.color = resultColor;
3023 linethrough.style = resultStyle;
3024 }
3015 } 3025 }
3016 } 3026 }
3017 3027
3018 void RenderObject::addAnnotatedRegions(Vector<AnnotatedRegionValue>& regions) 3028 void RenderObject::addAnnotatedRegions(Vector<AnnotatedRegionValue>& regions)
3019 { 3029 {
3020 // Convert the style regions to absolute coordinates. 3030 // Convert the style regions to absolute coordinates.
3021 if (style()->visibility() != VISIBLE || !isBox()) 3031 if (style()->visibility() != VISIBLE || !isBox())
3022 return; 3032 return;
3023 3033
3024 if (style()->getDraggableRegionMode() == DraggableRegionNone) 3034 if (style()->getDraggableRegionMode() == DraggableRegionNone)
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
3314 { 3324 {
3315 if (object1) { 3325 if (object1) {
3316 const WebCore::RenderObject* root = object1; 3326 const WebCore::RenderObject* root = object1;
3317 while (root->parent()) 3327 while (root->parent())
3318 root = root->parent(); 3328 root = root->parent();
3319 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3329 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3320 } 3330 }
3321 } 3331 }
3322 3332
3323 #endif 3333 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698