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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 2497963002: Add support for multiple text decorations with same line positioning (Closed)
Patch Set: Update slimming paint expectations Created 4 years, 1 month 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
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. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2009 Google Inc. All rights reserved. 8 * Copyright (C) 2009 Google Inc. All rights reserved.
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/) 10 * (http://www.torchmobile.com/)
(...skipping 3036 matching lines...) Expand 10 before | Expand all | Expand 10 after
3047 if (Element* shadowHost = node()->ownerShadowHost()) { 3047 if (Element* shadowHost = node()->ownerShadowHost()) {
3048 return shadowHost->layoutObject()->getUncachedPseudoStyle( 3048 return shadowHost->layoutObject()->getUncachedPseudoStyle(
3049 PseudoStyleRequest(PseudoIdSelection)); 3049 PseudoStyleRequest(PseudoIdSelection));
3050 } 3050 }
3051 } 3051 }
3052 } 3052 }
3053 3053
3054 return getUncachedPseudoStyle(PseudoStyleRequest(PseudoIdSelection)); 3054 return getUncachedPseudoStyle(PseudoStyleRequest(PseudoIdSelection));
3055 } 3055 }
3056 3056
3057 void LayoutObject::getTextDecorations(unsigned decorations,
3058 AppliedTextDecoration& underline,
3059 AppliedTextDecoration& overline,
3060 AppliedTextDecoration& linethrough,
3061 bool quirksMode,
3062 bool firstlineStyle) {
3063 LayoutObject* curr = this;
3064 const ComputedStyle* styleToUse = nullptr;
3065 unsigned currDecs = TextDecorationNone;
3066 Color resultColor;
3067 TextDecorationStyle resultStyle;
3068 do {
3069 styleToUse = curr->style(firstlineStyle);
3070 currDecs = styleToUse->getTextDecoration();
3071 currDecs &= decorations;
3072 resultColor =
3073 styleToUse->visitedDependentColor(CSSPropertyTextDecorationColor);
3074 resultStyle = styleToUse->getTextDecorationStyle();
3075 // Parameter 'decorations' is cast as an int to enable the bitwise
3076 // operations below.
3077 if (currDecs) {
3078 if (currDecs & TextDecorationUnderline) {
3079 decorations &= ~TextDecorationUnderline;
3080 underline.color = resultColor;
3081 underline.style = resultStyle;
3082 }
3083 if (currDecs & TextDecorationOverline) {
3084 decorations &= ~TextDecorationOverline;
3085 overline.color = resultColor;
3086 overline.style = resultStyle;
3087 }
3088 if (currDecs & TextDecorationLineThrough) {
3089 decorations &= ~TextDecorationLineThrough;
3090 linethrough.color = resultColor;
3091 linethrough.style = resultStyle;
3092 }
3093 }
3094 if (curr->isRubyText())
3095 return;
3096 curr = curr->parent();
3097 if (curr && curr->isAnonymousBlock() && curr->isLayoutBlockFlow() &&
3098 toLayoutBlockFlow(curr)->continuation())
3099 curr = toLayoutBlockFlow(curr)->continuation();
3100 } while (curr && decorations && (!quirksMode || !curr->node() ||
3101 (!isHTMLAnchorElement(*curr->node()) &&
3102 !isHTMLFontElement(*curr->node()))));
3103
3104 // If we bailed out, use the element we bailed out at (typically a <font> or
3105 // <a> element).
3106 if (decorations && curr) {
3107 styleToUse = curr->style(firstlineStyle);
3108 resultColor =
3109 styleToUse->visitedDependentColor(CSSPropertyTextDecorationColor);
3110 if (decorations & TextDecorationUnderline) {
3111 underline.color = resultColor;
3112 underline.style = resultStyle;
3113 }
3114 if (decorations & TextDecorationOverline) {
3115 overline.color = resultColor;
3116 overline.style = resultStyle;
3117 }
3118 if (decorations & TextDecorationLineThrough) {
3119 linethrough.color = resultColor;
3120 linethrough.style = resultStyle;
3121 }
3122 }
3123 }
3124
3125 void LayoutObject::addAnnotatedRegions(Vector<AnnotatedRegionValue>& regions) { 3057 void LayoutObject::addAnnotatedRegions(Vector<AnnotatedRegionValue>& regions) {
3126 // Convert the style regions to absolute coordinates. 3058 // Convert the style regions to absolute coordinates.
3127 if (style()->visibility() != EVisibility::Visible || !isBox()) 3059 if (style()->visibility() != EVisibility::Visible || !isBox())
3128 return; 3060 return;
3129 3061
3130 if (style()->getDraggableRegionMode() == DraggableRegionNone) 3062 if (style()->getDraggableRegionMode() == DraggableRegionNone)
3131 return; 3063 return;
3132 3064
3133 LayoutBox* box = toLayoutBox(this); 3065 LayoutBox* box = toLayoutBox(this);
3134 FloatRect localBounds(FloatPoint(), FloatSize(box->size())); 3066 FloatRect localBounds(FloatPoint(), FloatSize(box->size()));
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
3547 const blink::LayoutObject* root = object1; 3479 const blink::LayoutObject* root = object1;
3548 while (root->parent()) 3480 while (root->parent())
3549 root = root->parent(); 3481 root = root->parent();
3550 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3482 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3551 } else { 3483 } else {
3552 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3484 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3553 } 3485 }
3554 } 3486 }
3555 3487
3556 #endif 3488 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/paint/InlineTextBoxPainter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698