Changeset 274170 in webkit
- Timestamp:
- Mar 9, 2021, 1:17:43 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/animation/animation-display-style-adjustment-expected.html (added)
-
LayoutTests/fast/animation/animation-display-style-adjustment.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/rendering/RenderTheme.cpp (modified) (1 diff)
-
Source/WebCore/rendering/style/RenderStyle.h (modified) (1 diff)
-
Source/WebCore/style/StyleAdjuster.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r274165 r274170 1 2021-03-09 Antti Koivisto <antti@apple.com> 2 3 REGRESSION (r273003): Animated style may lose original display property value 4 https://bugs.webkit.org/show_bug.cgi?id=222979 5 rdar://75056684 6 7 Reviewed by Zalan Bujtas. 8 9 * fast/animation/animation-display-style-adjustment-expected.html: Added. 10 * fast/animation/animation-display-style-adjustment.html: Added. 11 1 12 2021-03-09 Antoine Quint <graouts@webkit.org> 2 13 -
trunk/Source/WebCore/ChangeLog
r274168 r274170 1 2021-03-09 Antti Koivisto <antti@apple.com> 2 3 REGRESSION (r273003): Animated style may lose original display property value 4 https://bugs.webkit.org/show_bug.cgi?id=222979 5 rdar://75056684 6 7 Reviewed by Zalan Bujtas. 8 9 Test: fast/animation/animation-display-style-adjustment.html 10 11 The original (non-blockified) display property value is saved in the beginning of Style::Adjuster::adjust. 12 It is needed to implement absolute positioning correctly in some situations. However with animations 13 the style adjustment code may run twice on the same style and the second run will clobber the saved original value. 14 15 * rendering/RenderTheme.cpp: 16 (WebCore::RenderTheme::adjustStyle): 17 * rendering/style/RenderStyle.h: 18 (WebCore::RenderStyle::setDisplay): 19 20 Always save the original value when setting the property normally. 21 22 (WebCore::RenderStyle::setEffectiveDisplay): 23 (WebCore::RenderStyle::setOriginalDisplay): Deleted. 24 25 Add setEffectiveDisplay that doesn't affect the original value for adjuster use. 26 27 * style/StyleAdjuster.cpp: 28 (WebCore::Style::Adjuster::adjust const): 29 30 Remove the saving of the original value. 31 Use setEffectiveDisplay in all adjuster code, preserving the original value. 32 33 (WebCore::Style::Adjuster::adjustDisplayContentsStyle const): 34 (WebCore::Style::Adjuster::adjustSVGElementStyle): 35 (WebCore::Style::Adjuster::adjustForSiteSpecificQuirks const): 36 1 37 2021-03-09 Sam Weinig <weinig@apple.com> 2 38 -
trunk/Source/WebCore/rendering/RenderTheme.cpp
r273683 r274170 83 83 || style.display() == DisplayType::TableRow || style.display() == DisplayType::TableColumnGroup || style.display() == DisplayType::TableColumn 84 84 || style.display() == DisplayType::TableCell || style.display() == DisplayType::TableCaption) 85 style.set Display(DisplayType::InlineBlock);85 style.setEffectiveDisplay(DisplayType::InlineBlock); 86 86 else if (style.display() == DisplayType::ListItem || style.display() == DisplayType::Table) 87 style.set Display(DisplayType::Block);87 style.setEffectiveDisplay(DisplayType::Block); 88 88 89 89 if (userAgentAppearanceStyle && isControlStyled(style, *userAgentAppearanceStyle)) { -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r274050 r274170 843 843 // attribute setter methods 844 844 845 void setDisplay(DisplayType v) { m_nonInheritedFlags.effectiveDisplay = static_cast<unsigned>(v); } 846 void setOriginalDisplay(DisplayType v) { m_nonInheritedFlags.originalDisplay = static_cast<unsigned>(v); } 845 void setDisplay(DisplayType value) 846 { 847 m_nonInheritedFlags.originalDisplay = static_cast<unsigned>(value); 848 m_nonInheritedFlags.effectiveDisplay = m_nonInheritedFlags.originalDisplay; 849 } 850 void setEffectiveDisplay(DisplayType v) { m_nonInheritedFlags.effectiveDisplay = static_cast<unsigned>(v); } 847 851 void setPosition(PositionType v) { m_nonInheritedFlags.position = static_cast<unsigned>(v); } 848 852 void setFloating(Float v) { m_nonInheritedFlags.floating = static_cast<unsigned>(v); } -
trunk/Source/WebCore/style/StyleAdjuster.cpp
r273003 r274170 244 244 void Adjuster::adjust(RenderStyle& style, const RenderStyle* userAgentAppearanceStyle) const 245 245 { 246 // Cache our original display.247 style.setOriginalDisplay(style.display());248 249 246 if (style.display() == DisplayType::Contents) 250 247 adjustDisplayContentsStyle(style); … … 258 255 if (m_document.inQuirksMode()) { 259 256 if (m_element->hasTagName(tdTag)) { 260 style.set Display(DisplayType::TableCell);257 style.setEffectiveDisplay(DisplayType::TableCell); 261 258 style.setFloating(Float::No); 262 259 } else if (is<HTMLTableElement>(*m_element)) 263 style.set Display(style.isDisplayInlineType() ? DisplayType::InlineTable : DisplayType::Table);260 style.setEffectiveDisplay(style.isDisplayInlineType() ? DisplayType::InlineTable : DisplayType::Table); 264 261 } 265 262 … … 284 281 if (m_element->hasTagName(frameTag) || m_element->hasTagName(framesetTag)) { 285 282 style.setPosition(PositionType::Static); 286 style.set Display(DisplayType::Block);283 style.setEffectiveDisplay(DisplayType::Block); 287 284 } 288 285 … … 301 298 302 299 if (m_element->hasTagName(legendTag)) 303 style.set Display(DisplayType::Block);300 style.setEffectiveDisplay(DisplayType::Block); 304 301 } 305 302 306 303 // Absolute/fixed positioned elements, floating elements and the document element need block-like outside display. 307 304 if (style.hasOutOfFlowPosition() || style.isFloating() || (m_element && m_document.documentElement() == m_element)) 308 style.set Display(equivalentBlockDisplay(style, m_document));305 style.setEffectiveDisplay(equivalentBlockDisplay(style, m_document)); 309 306 310 307 // FIXME: Don't support this mutation for pseudo styles like first-letter or first-line, since it's not completely 311 308 // clear how that should work. 312 309 if (style.display() == DisplayType::Inline && style.styleType() == PseudoId::None && style.writingMode() != m_parentStyle.writingMode()) 313 style.set Display(DisplayType::InlineBlock);310 style.setEffectiveDisplay(DisplayType::InlineBlock); 314 311 315 312 // After performing the display mutation, check table rows. We do not honor position:relative or position:sticky on … … 338 335 if (m_parentBoxStyle.isDisplayFlexibleOrGridBox()) { 339 336 style.setFloating(Float::No); 340 style.set Display(equivalentBlockDisplay(style, m_document));337 style.setEffectiveDisplay(equivalentBlockDisplay(style, m_document)); 341 338 } 342 339 } … … 545 542 if (!m_element) { 546 543 if (style.styleType() != PseudoId::Before && style.styleType() != PseudoId::After) 547 style.set Display(DisplayType::None);544 style.setEffectiveDisplay(DisplayType::None); 548 545 return; 549 546 } 550 547 551 548 if (m_document.documentElement() == m_element) { 552 style.set Display(DisplayType::Block);549 style.setEffectiveDisplay(DisplayType::Block); 553 550 return; 554 551 } 555 552 556 553 if (hasEffectiveDisplayNoneForDisplayContents(*m_element)) 557 style.set Display(DisplayType::None);554 style.setEffectiveDisplay(DisplayType::None); 558 555 } 559 556 … … 572 569 // SVG text layout code expects us to be a block-level style element. 573 570 if ((svgElement.hasTagName(SVGNames::foreignObjectTag) || svgElement.hasTagName(SVGNames::textTag)) && style.isDisplayInlineType()) 574 style.set Display(DisplayType::Block);571 style.setEffectiveDisplay(DisplayType::Block); 575 572 } 576 573 … … 631 628 auto* video = div.treeScope().getElementById(videoElementID); 632 629 if (is<HTMLVideoElement>(video) && downcast<HTMLVideoElement>(*video).isFullscreen()) 633 style.set Display(DisplayType::Block);630 style.setEffectiveDisplay(DisplayType::Block); 634 631 } 635 632 }
Note:
See TracChangeset
for help on using the changeset viewer.