Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Text nodes with display:contents parent should render as if they were…
… wrapped in an unstyled <span> https://bugs.webkit.org/show_bug.cgi?id=178332 Reviewed by Ryosuke Niwa. Source/WebCore: According to w3c/csswg-drafts#1118 <div style="display:contents;color:green">text</div> must result in green text even though div doesn't generate a box. This patch implements the behavior by wrapping text renderers with display:contents parent element in an anonymous inline box that receives its style by inheriting from the parent element. * dom/Document.cpp: (WebCore::Document::updateTextRenderer): * rendering/RenderElement.cpp: (WebCore::RenderElement::computeFirstLineStyle const): Synthesize the first line style in display:contents parent case. * rendering/RenderObject.cpp: (WebCore::findDestroyRootIncludingAnonymous): Factor into a function. (WebCore::RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers): Get rid of the anonymous wrapper if it exists. * rendering/RenderText.cpp: (WebCore::inlineWrapperForDisplayContentsMap): (WebCore::RenderText::RenderText): (WebCore::RenderText::willBeDestroyed): (WebCore::RenderText::inlineWrapperForDisplayContents): (WebCore::RenderText::setInlineWrapperForDisplayContents): Add a weak member (implemented as a rare data map) for holding the wrapper pointer. (WebCore::RenderText::findByDisplayContentsInlineWrapperCandidate): Helper to get the text renderer for a wrapper. * rendering/RenderText.h: * style/RenderTreeUpdater.cpp: (WebCore::createTextRenderer): (WebCore::RenderTreeUpdater::updateTextRenderer): Create the wrapper if needed. * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::resolveComposedTree): Compute the wrapper style by inheriting from the display:contents parent. * style/StyleUpdate.h: (WebCore::Style::TextUpdate::TextUpdate): LayoutTests: * TestExpectations: 10 more display:contents tests pass. Canonical link: https://commits.webkit.org/194608@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
11 changed files
with
212 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.