Chromium Code Reviews| OLD | NEW |
|---|---|
| 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. All rights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. |
| 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) |
| 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 } | 104 } |
| 105 | 105 |
| 106 // CSS requires text-decoration to be reset at each DOM element for | 106 // CSS requires text-decoration to be reset at each DOM element for |
| 107 // inline blocks, inline tables, shadow DOM crossings, floating elements, | 107 // inline blocks, inline tables, shadow DOM crossings, floating elements, |
| 108 // and absolute or relatively positioned elements. Outermost <svg> roots are | 108 // and absolute or relatively positioned elements. Outermost <svg> roots are |
| 109 // considered to be atomic inline-level. | 109 // considered to be atomic inline-level. |
| 110 static bool doesNotInheritTextDecoration(const ComputedStyle& style, const Eleme nt* e) | 110 static bool doesNotInheritTextDecoration(const ComputedStyle& style, const Eleme nt* e) |
| 111 { | 111 { |
| 112 return style.display() == INLINE_TABLE | 112 return style.display() == INLINE_TABLE |
| 113 || style.display() == INLINE_BLOCK || style.display() == INLINE_BOX || i sAtShadowBoundary(e) | 113 || style.display() == INLINE_BLOCK || style.display() == INLINE_BOX || i sAtShadowBoundary(e) |
| 114 || style.isFloating() || style.hasOutOfFlowPosition() || isOutermostSVGE lement(e); | 114 || style.isFloating() || style.hasOutOfFlowPosition() || isOutermostSVGE lement(e) |
| 115 || isHTMLRTElement(e); | |
|
Timothy Loh
2015/10/01 01:51:43
Is this a separate bug fix? If so, put it in a sep
sashab
2015/10/02 02:45:41
No? Both code paths now use this function, so it n
| |
| 116 } | |
| 117 | |
| 118 // Certain elements (<a>, <font>) bind strongly to text decoration colors. | |
| 119 // "The font element is expected to override the color of any text decoration th at | |
| 120 // spans the text of the element to the used value of the element's 'color' prop erty." | |
| 121 // (from https://html.spec.whatwg.org/multipage/rendering.html#phrasing-content- 3) | |
| 122 // The <a> behavior is non-standard. | |
| 123 static bool overridesTextDecorationColors(const Element* e) | |
| 124 { | |
| 125 return e && (isHTMLFontElement(e) || isHTMLAnchorElement(e)); | |
| 115 } | 126 } |
| 116 | 127 |
| 117 // FIXME: This helper is only needed because pseudoStyleForElement passes a null | 128 // FIXME: This helper is only needed because pseudoStyleForElement passes a null |
| 118 // element to adjustComputedStyle, so we can't just use element->isInTopLayer(). | 129 // element to adjustComputedStyle, so we can't just use element->isInTopLayer(). |
| 119 static bool isInTopLayer(const Element* element, const ComputedStyle& style) | 130 static bool isInTopLayer(const Element* element, const ComputedStyle& style) |
| 120 { | 131 { |
| 121 return (element && element->isInTopLayer()) || style.styleType() == BACKDROP ; | 132 return (element && element->isInTopLayer()) || style.styleType() == BACKDROP ; |
| 122 } | 133 } |
| 123 | 134 |
| 124 static bool parentStyleForcesZIndexToCreateStackingContext(const ComputedStyle& parentStyle) | 135 static bool parentStyleForcesZIndexToCreateStackingContext(const ComputedStyle& parentStyle) |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 || style.hasFilter() | 208 || style.hasFilter() |
| 198 || style.hasBlendMode() | 209 || style.hasBlendMode() |
| 199 || style.hasIsolation() | 210 || style.hasIsolation() |
| 200 || style.position() == FixedPosition | 211 || style.position() == FixedPosition |
| 201 || isInTopLayer(e, style) | 212 || isInTopLayer(e, style) |
| 202 || hasWillChangeThatCreatesStackingContext(style))) | 213 || hasWillChangeThatCreatesStackingContext(style))) |
| 203 style.setZIndex(0); | 214 style.setZIndex(0); |
| 204 | 215 |
| 205 if (doesNotInheritTextDecoration(style, e)) | 216 if (doesNotInheritTextDecoration(style, e)) |
| 206 style.clearAppliedTextDecorations(); | 217 style.clearAppliedTextDecorations(); |
| 207 | 218 style.applyTextDecorations(parentStyle, overridesTextDecorationColors(e)); |
| 208 style.applyTextDecorations(); | |
| 209 | 219 |
| 210 if (style.overflowX() != OVISIBLE || style.overflowY() != OVISIBLE) | 220 if (style.overflowX() != OVISIBLE || style.overflowY() != OVISIBLE) |
| 211 adjustOverflow(style); | 221 adjustOverflow(style); |
| 212 | 222 |
| 213 // Cull out any useless layers and also repeat patterns into additional laye rs. | 223 // Cull out any useless layers and also repeat patterns into additional laye rs. |
| 214 style.adjustBackgroundLayers(); | 224 style.adjustBackgroundLayers(); |
| 215 style.adjustMaskLayers(); | 225 style.adjustMaskLayers(); |
| 216 | 226 |
| 217 // Let the theme also have a crack at adjusting the style. | 227 // Let the theme also have a crack at adjusting the style. |
| 218 if (style.hasAppearance()) | 228 if (style.hasAppearance()) |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 484 // We want to count vertical percentage paddings/margins on flex items b ecause our current | 494 // We want to count vertical percentage paddings/margins on flex items b ecause our current |
| 485 // behavior is different from the spec and we want to gather compatibili ty data. | 495 // behavior is different from the spec and we want to gather compatibili ty data. |
| 486 if (style.paddingBefore().hasPercent() || style.paddingAfter().hasPercen t()) | 496 if (style.paddingBefore().hasPercent() || style.paddingAfter().hasPercen t()) |
| 487 UseCounter::count(document, UseCounter::FlexboxPercentagePaddingVert ical); | 497 UseCounter::count(document, UseCounter::FlexboxPercentagePaddingVert ical); |
| 488 if (style.marginBefore().hasPercent() || style.marginAfter().hasPercent( )) | 498 if (style.marginBefore().hasPercent() || style.marginAfter().hasPercent( )) |
| 489 UseCounter::count(document, UseCounter::FlexboxPercentageMarginVerti cal); | 499 UseCounter::count(document, UseCounter::FlexboxPercentageMarginVerti cal); |
| 490 } | 500 } |
| 491 } | 501 } |
| 492 | 502 |
| 493 } | 503 } |
| OLD | NEW |