| Index: third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp
|
| diff --git a/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp b/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp
|
| index 127e05c930c7092e5c882155c9ac68d0d255469f..dc21e25edac0fcf4d09c08933395faf70e5057f6 100644
|
| --- a/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp
|
| +++ b/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp
|
| @@ -75,6 +75,7 @@ static EDisplay equivalentBlockDisplay(EDisplay display) {
|
| case EDisplay::InlineGrid:
|
| return EDisplay::Grid;
|
|
|
| + case EDisplay::Contents:
|
| case EDisplay::Inline:
|
| case EDisplay::InlineBlock:
|
| case EDisplay::TableRowGroup:
|
| @@ -87,7 +88,6 @@ static EDisplay equivalentBlockDisplay(EDisplay display) {
|
| case EDisplay::TableCaption:
|
| return EDisplay::Block;
|
| case EDisplay::None:
|
| - case EDisplay::Contents:
|
| ASSERT_NOT_REACHED();
|
| return display;
|
| }
|
| @@ -131,9 +131,9 @@ static bool isInTopLayer(const Element* element, const ComputedStyle& style) {
|
| style.styleType() == PseudoIdBackdrop;
|
| }
|
|
|
| -static bool parentStyleForcesZIndexToCreateStackingContext(
|
| - const ComputedStyle& parentStyle) {
|
| - return parentStyle.isDisplayFlexibleOrGridBox();
|
| +static bool layoutParentStyleForcesZIndexToCreateStackingContext(
|
| + const ComputedStyle& layoutParentStyle) {
|
| + return layoutParentStyle.isDisplayFlexibleOrGridBox();
|
| }
|
|
|
| void StyleAdjuster::adjustStyleForEditing(ComputedStyle& style) {
|
| @@ -324,16 +324,19 @@ static void adjustOverflow(ComputedStyle& style) {
|
| }
|
|
|
| static void adjustStyleForDisplay(ComputedStyle& style,
|
| - const ComputedStyle& parentStyle,
|
| + const ComputedStyle& layoutParentStyle,
|
| Document* document) {
|
| if (style.display() == EDisplay::Block && !style.isFloating())
|
| return;
|
|
|
| + if (style.display() == EDisplay::Contents)
|
| + return;
|
| +
|
| // FIXME: Don't support this mutation for pseudo styles like first-letter or
|
| // first-line, since it's not completely clear how that should work.
|
| if (style.display() == EDisplay::Inline &&
|
| style.styleType() == PseudoIdNone &&
|
| - style.getWritingMode() != parentStyle.getWritingMode())
|
| + style.getWritingMode() != layoutParentStyle.getWritingMode())
|
| style.setDisplay(EDisplay::InlineBlock);
|
|
|
| // After performing the display mutation, check table rows. We do not honor
|
| @@ -365,7 +368,7 @@ static void adjustStyleForDisplay(ComputedStyle& style,
|
| style.display() == EDisplay::TableRow ||
|
| style.display() == EDisplay::TableRowGroup ||
|
| style.display() == EDisplay::TableCell)
|
| - style.setWritingMode(parentStyle.getWritingMode());
|
| + style.setWritingMode(layoutParentStyle.getWritingMode());
|
|
|
| // FIXME: Since we don't support block-flow on flexible boxes yet, disallow
|
| // setting of block-flow to anything other than TopToBottomWritingMode.
|
| @@ -375,7 +378,7 @@ static void adjustStyleForDisplay(ComputedStyle& style,
|
| style.display() == EDisplay::WebkitInlineBox))
|
| style.setWritingMode(WritingMode::kHorizontalTb);
|
|
|
| - if (parentStyle.isDisplayFlexibleOrGridBox()) {
|
| + if (layoutParentStyle.isDisplayFlexibleOrGridBox()) {
|
| style.setFloating(EFloat::kNone);
|
| style.setDisplay(equivalentBlockDisplay(style.display()));
|
|
|
| @@ -393,9 +396,9 @@ static void adjustStyleForDisplay(ComputedStyle& style,
|
|
|
| void StyleAdjuster::adjustComputedStyle(ComputedStyle& style,
|
| const ComputedStyle& parentStyle,
|
| + const ComputedStyle& layoutParentStyle,
|
| Element* element) {
|
| - if (style.display() != EDisplay::None &&
|
| - style.display() != EDisplay::Contents) {
|
| + if (style.display() != EDisplay::None) {
|
| if (element && element->isHTMLElement())
|
| adjustStyleForHTMLElement(style, toHTMLElement(*element));
|
|
|
| @@ -408,15 +411,18 @@ void StyleAdjuster::adjustComputedStyle(ComputedStyle& style,
|
|
|
| // Absolute/fixed positioned elements, floating elements and the document
|
| // element need block-like outside display.
|
| - if (style.hasOutOfFlowPosition() || style.isFloating() ||
|
| - (element && element->document().documentElement() == element))
|
| + if (style.display() != EDisplay::Contents &&
|
| + (style.hasOutOfFlowPosition() || style.isFloating()))
|
| + style.setDisplay(equivalentBlockDisplay(style.display()));
|
| +
|
| + if (element && element->document().documentElement() == element)
|
| style.setDisplay(equivalentBlockDisplay(style.display()));
|
|
|
| // We don't adjust the first letter style earlier because we may change the
|
| // display setting in adjustStyeForTagName() above.
|
| adjustStyleForFirstLetter(style);
|
|
|
| - adjustStyleForDisplay(style, parentStyle,
|
| + adjustStyleForDisplay(style, layoutParentStyle,
|
| element ? &element->document() : 0);
|
|
|
| // Paint containment forces a block formatting context, so we must coerce
|
| @@ -432,7 +438,8 @@ void StyleAdjuster::adjustComputedStyle(ComputedStyle& style,
|
|
|
| // Make sure our z-index value is only applied if the object is positioned.
|
| if (style.position() == EPosition::kStatic &&
|
| - !parentStyleForcesZIndexToCreateStackingContext(parentStyle)) {
|
| + !layoutParentStyleForcesZIndexToCreateStackingContext(
|
| + layoutParentStyle)) {
|
| style.setIsStackingContext(false);
|
| // TODO(alancutter): Avoid altering z-index here.
|
| if (!style.hasAutoZIndex())
|
|
|