-
shinyak@chromium.org authored
https://bugs.webkit.org/show_bug.cgi?id=99228 Reviewed by Dimitri Glazkov. Source/WebCore: We support shadow reprojection; elements distributed to <shadow> element can be reprojected to <content> now. First, we have a distribution vector for each InsertionPoint, even if InsertionPoint is a shadow insertion point. And we update a node-distribution map. Basically We're creating a map from node to InsertionPoint in ElementShadow. If a node can be distributed to several InsertionPoint (e.g. in case reprojection happens), the InsertionPoint in older ShadowDOM is chosen. We also fix ComposedShadowTreeWalker to consider shadow reprojection. Tests: fast/dom/shadow/composed-shadow-tree-walker-shadow-reprojection.html fast/dom/shadow/shadow-reprojection-click.html fast/dom/shadow/shadow-reprojection-dynamic.html fast/dom/shadow/shadow-reprojection-fallback.html fast/dom/shadow/shadow-reprojection.html fast/dom/shadow/shadow-reprojection2.html * css/StyleResolver.cpp: (WebCore::shouldResetStyleInheritance): Now context.insertionPoint() returns the final insertion point where a node is distributed. So we don't have to trace shadow insertion point anymore here. (WebCore::StyleResolver::styleForElement): Since a direct child of ShadowRoot can be distributed now. In that case, we don't have any parentElement. The parent node is a ShadowRoot in that case. * dom/ComposedShadowTreeWalker.cpp: (WebCore::nodeCanBeDistributed): If a node can be distributed, returns true. (WebCore): (WebCore::resolveReprojection): Resolves content-reprojection and shadow-reprojection both. (WebCore::ComposedShadowTreeWalker::traverseSiblingOrBackToInsertionPoint): (WebCore::ComposedShadowTreeWalker::traverseParent): (WebCore::ComposedShadowTreeWalker::traverseParentBackToYoungerShadowRootOrHost): A case ShadowRoot is assigned to some InsertionPoint should be handled with in traverseSiblingOrBackToInsertionPoint. So we remove it. (WebCore::AncestorChainWalker::parent): Now we have a case that a direct child of ShadowRoot can be distributed. In that case, we should not update m_distributedNode. * dom/ElementShadow.cpp: (WebCore::ElementShadow::insertionPointFor): Since we have a distribution vector for each InsertionPoint, we don't have a special case that a ShadowRoot is assigned to some InsertionPoint. Actually the existing code is not correct now due to shadow reprojection. * html/shadow/ContentDistributor.cpp: (WebCore::ContentDistributor::populate): Populate a POOL. If a node is InsertionPoint, we fill it with the distributed nodes. (WebCore): (WebCore::ContentDistributor::distribute): Since we want to make a distribution vector for each InsertionPoint, we have to resolve a shadow InsertionPoint (WebCore::ContentDistributor::distributeNodeChildrenTo): * html/shadow/ContentDistributor.h: (ContentDistributor): * html/shadow/HTMLShadowElement.h: (WebCore::toHTMLShadowElement): (WebCore): * html/shadow/InsertionPoint.h: (WebCore::parentNodeForDistribution): (WebCore::parentElementForDistribution): (WebCore): LayoutTests: * fast/dom/shadow/composed-shadow-tree-walker-shadow-reprojection-expected.txt: Added. * fast/dom/shadow/composed-shadow-tree-walker-shadow-reprojection.html: Added. A walker test case for elements distributed to shadow element are reprojected. * fast/dom/shadow/composed-shadow-tree-walker.html: * fast/dom/shadow/content-reprojection-complex.html: * fast/dom/shadow/content-reprojection-fallback-expected.html: * fast/dom/shadow/content-reprojection-fallback-reprojection-expected.html: * fast/dom/shadow/shadow-reprojection-click-expected.txt: Added. * fast/dom/shadow/shadow-reprojection-click.html: Added. Does some interactive with a shadow-reprojected node. * fast/dom/shadow/shadow-reprojection-dynamic-expected.html: Added. * fast/dom/shadow/shadow-reprojection-dynamic.html: Added. Adds dynamically elements shadow-reprojected. * fast/dom/shadow/shadow-reprojection-expected.html: Added. * fast/dom/shadow/shadow-reprojection-fallback-expected.html: Added. * fast/dom/shadow/shadow-reprojection-fallback.html: Added. A test case for fallback elements of a shadow element are reprojected. * fast/dom/shadow/shadow-reprojection-prohibited-expected.html: Removed. * fast/dom/shadow/shadow-reprojection-prohibited.html: Removed. * fast/dom/shadow/shadow-reprojection.html: Added. A basic test case. * fast/dom/shadow/shadow-reprojection2-expected.html: Added. * fast/dom/shadow/shadow-reprojection2.html: Added. Another basic test case. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132760 268f45cc-cd09-0410-ab3c-d52691b4dbfc
d972dbe0