| 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. | 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 Loading... |
| 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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 } | 433 } |
| 423 | 434 |
| 424 if (style.overflowX() != OverflowVisible || | 435 if (style.overflowX() != OverflowVisible || |
| 425 style.overflowY() != OverflowVisible) | 436 style.overflowY() != OverflowVisible) |
| 426 adjustOverflow(style); | 437 adjustOverflow(style); |
| 427 | 438 |
| 428 if (doesNotInheritTextDecoration(style, element)) | 439 if (doesNotInheritTextDecoration(style, element)) |
| 429 style.clearAppliedTextDecorations(); | 440 style.clearAppliedTextDecorations(); |
| 430 else | 441 else |
| 431 style.restoreParentTextDecorations(parentStyle); | 442 style.restoreParentTextDecorations(parentStyle); |
| 432 style.applyTextDecorations(); | 443 style.applyTextDecorations( |
| 444 parentStyle.visitedDependentColor(CSSPropertyTextDecorationColor), |
| 445 overridesTextDecorationColors(element)); |
| 433 | 446 |
| 434 // Cull out any useless layers and also repeat patterns into additional | 447 // Cull out any useless layers and also repeat patterns into additional |
| 435 // layers. | 448 // layers. |
| 436 style.adjustBackgroundLayers(); | 449 style.adjustBackgroundLayers(); |
| 437 style.adjustMaskLayers(); | 450 style.adjustMaskLayers(); |
| 438 | 451 |
| 439 // Let the theme also have a crack at adjusting the style. | 452 // Let the theme also have a crack at adjusting the style. |
| 440 if (style.hasAppearance()) | 453 if (style.hasAppearance()) |
| 441 LayoutTheme::theme().adjustStyle(style, element); | 454 LayoutTheme::theme().adjustStyle(style, element); |
| 442 | 455 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 462 style.setDisplay(EDisplay::Block); | 475 style.setDisplay(EDisplay::Block); |
| 463 | 476 |
| 464 // Columns don't apply to svg text elements. | 477 // Columns don't apply to svg text elements. |
| 465 if (isSVGTextElement(*element)) | 478 if (isSVGTextElement(*element)) |
| 466 style.clearMultiCol(); | 479 style.clearMultiCol(); |
| 467 } | 480 } |
| 468 adjustStyleForAlignment(style, parentStyle); | 481 adjustStyleForAlignment(style, parentStyle); |
| 469 } | 482 } |
| 470 | 483 |
| 471 } // namespace blink | 484 } // namespace blink |
| OLD | NEW |