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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/StyleAdjuster.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) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/) 10 * (http://www.torchmobile.com/)
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // CSS requires text-decoration to be reset at each DOM element for 101 // CSS requires text-decoration to be reset at each DOM element for
102 // inline blocks, inline tables, shadow DOM crossings, floating elements, 102 // inline blocks, inline tables, shadow DOM crossings, floating elements,
103 // and absolute or relatively positioned elements. Outermost <svg> roots are 103 // and absolute or relatively positioned elements. Outermost <svg> roots are
104 // considered to be atomic inline-level. 104 // considered to be atomic inline-level.
105 static bool doesNotInheritTextDecoration(const ComputedStyle& style, 105 static bool doesNotInheritTextDecoration(const ComputedStyle& style,
106 const Element* element) { 106 const Element* element) {
107 return style.display() == EDisplay::InlineTable || 107 return style.display() == EDisplay::InlineTable ||
108 style.display() == EDisplay::InlineBlock || 108 style.display() == EDisplay::InlineBlock ||
109 style.display() == EDisplay::InlineBox || 109 style.display() == EDisplay::InlineBox ||
110 isAtShadowBoundary(element) || style.isFloating() || 110 isAtShadowBoundary(element) || style.isFloating() ||
111 style.hasOutOfFlowPosition() || isOutermostSVGElement(element); 111 style.hasOutOfFlowPosition() || isOutermostSVGElement(element) ||
112 isHTMLRTElement(element);
113 }
114
115 // Certain elements (<a>, <font>) override text decoration colors. "The font
116 // element is expected to override the color of any text decoration that spans
117 // the text of the element to the used value of the element's 'color' property."
118 // (https://html.spec.whatwg.org/multipage/rendering.html#phrasing-content-3)
119 // The <a> behavior is non-standard.
120 static bool overridesTextDecorationColors(const Element* element) {
121 return element &&
122 (isHTMLFontElement(element) || isHTMLAnchorElement(element));
112 } 123 }
113 124
114 // FIXME: This helper is only needed because pseudoStyleForElement passes a null 125 // FIXME: This helper is only needed because pseudoStyleForElement passes a null
115 // element to adjustComputedStyle, so we can't just use element->isInTopLayer(). 126 // element to adjustComputedStyle, so we can't just use element->isInTopLayer().
116 static bool isInTopLayer(const Element* element, const ComputedStyle& style) { 127 static bool isInTopLayer(const Element* element, const ComputedStyle& style) {
117 return (element && element->isInTopLayer()) || 128 return (element && element->isInTopLayer()) ||
118 style.styleType() == PseudoIdBackdrop; 129 style.styleType() == PseudoIdBackdrop;
119 } 130 }
120 131
121 static bool parentStyleForcesZIndexToCreateStackingContext( 132 static bool parentStyleForcesZIndexToCreateStackingContext(
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 } 434 }
424 435
425 if (style.overflowX() != OverflowVisible || 436 if (style.overflowX() != OverflowVisible ||
426 style.overflowY() != OverflowVisible) 437 style.overflowY() != OverflowVisible)
427 adjustOverflow(style); 438 adjustOverflow(style);
428 439
429 if (doesNotInheritTextDecoration(style, element)) 440 if (doesNotInheritTextDecoration(style, element))
430 style.clearAppliedTextDecorations(); 441 style.clearAppliedTextDecorations();
431 else 442 else
432 style.restoreParentTextDecorations(parentStyle); 443 style.restoreParentTextDecorations(parentStyle);
433 style.applyTextDecorations(); 444 style.applyTextDecorations(
445 parentStyle.visitedDependentColor(CSSPropertyTextDecorationColor),
446 overridesTextDecorationColors(element));
434 447
435 // Cull out any useless layers and also repeat patterns into additional 448 // Cull out any useless layers and also repeat patterns into additional
436 // layers. 449 // layers.
437 style.adjustBackgroundLayers(); 450 style.adjustBackgroundLayers();
438 style.adjustMaskLayers(); 451 style.adjustMaskLayers();
439 452
440 // Let the theme also have a crack at adjusting the style. 453 // Let the theme also have a crack at adjusting the style.
441 if (style.hasAppearance()) 454 if (style.hasAppearance())
442 LayoutTheme::theme().adjustStyle(style, element); 455 LayoutTheme::theme().adjustStyle(style, element);
443 456
(...skipping 19 matching lines...) Expand all
463 style.setDisplay(EDisplay::Block); 476 style.setDisplay(EDisplay::Block);
464 477
465 // Columns don't apply to svg text elements. 478 // Columns don't apply to svg text elements.
466 if (isSVGTextElement(*element)) 479 if (isSVGTextElement(*element))
467 style.clearMultiCol(); 480 style.clearMultiCol();
468 } 481 }
469 adjustStyleForAlignment(style, parentStyle); 482 adjustStyleForAlignment(style, parentStyle);
470 } 483 }
471 484
472 } // namespace blink 485 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698