Changeset 110161 in webkit
- Timestamp:
- Mar 8, 2012 3:25:33 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r110155 r110161 1 2012-03-08 Shinya Kawanaka <shinyak@chromium.org> 2 3 <shadow> should be rendered correctly. 4 https://bugs.webkit.org/show_bug.cgi?id=78596 5 6 Reviewed by Hajime Morita. 7 8 Contains tests both in case <shadow> appears in the oldest shadow root and 9 non-olderst shadow tree. 10 11 * fast/dom/shadow/shadow-element-rendering-multiple-expected.txt: Added. 12 * fast/dom/shadow/shadow-element-rendering-multiple.html: Added. 13 * fast/dom/shadow/shadow-element-rendering-single-expected.txt: Added. 14 * fast/dom/shadow/shadow-element-rendering-single.html: Added. 15 * platform/efl/Skipped: 16 * platform/mac/Skipped: 17 * platform/qt/Skipped: 18 * platform/win/Skipped: 19 * platform/wincairo/Skipped: 20 * platform/wk2/Skipped: 21 1 22 2012-03-08 Yoshifumi Inoue <yosin@chromium.org> 2 23 -
trunk/LayoutTests/platform/efl/Skipped
r110028 r110161 2081 2081 fast/dom/shadow/shadow-root-new.html 2082 2082 fast/dom/shadow/shadow-root-append.html 2083 fast/dom/shadow/shadow-element-rendering-single.html 2084 fast/dom/shadow/shadow-element-rendering-multiple.html 2083 2085 fast/dom/shadow/multiple-shadowroot.html 2084 2086 fast/dom/shadow/multiple-shadowroot-rendering.html -
trunk/LayoutTests/platform/mac/Skipped
r109359 r110161 437 437 fast/dom/shadow/shadow-ul-li.html 438 438 fast/dom/shadow/shadow-root-append.html 439 fast/dom/shadow/shadow-element-rendering-single.html 440 fast/dom/shadow/shadow-element-rendering-multiple.html 439 441 fast/dom/shadow/multiple-shadowroot.html 440 442 fast/dom/shadow/multiple-shadowroot-rendering.html -
trunk/LayoutTests/platform/qt/Skipped
r109891 r110161 176 176 fast/dom/shadow/shadow-ul-li.html 177 177 fast/dom/shadow/shadow-root-append.html 178 fast/dom/shadow/shadow-element-rendering-single.html 179 fast/dom/shadow/shadow-element-rendering-multiple.html 178 180 fast/dom/shadow/multiple-shadowroot.html 179 181 fast/dom/shadow/multiple-shadowroot-rendering.html -
trunk/LayoutTests/platform/win/Skipped
r110090 r110161 1463 1463 fast/dom/shadow/shadow-ul-li.html 1464 1464 fast/dom/shadow/shadow-root-append.html 1465 fast/dom/shadow/shadow-element-rendering-single.html 1466 fast/dom/shadow/shadow-element-rendering-multiple.html 1465 1467 fast/dom/shadow/multiple-shadowroot.html 1466 1468 fast/dom/shadow/multiple-shadowroot-rendering.html -
trunk/LayoutTests/platform/wincairo/Skipped
r109359 r110161 1976 1976 fast/dom/shadow/shadow-root-new.html 1977 1977 fast/dom/shadow/shadow-root-append.html 1978 fast/dom/shadow/shadow-element-rendering-single.html 1979 fast/dom/shadow/shadow-element-rendering-multiple.html 1978 1980 fast/dom/shadow/multiple-shadowroot.html 1979 1981 fast/dom/shadow/multiple-shadowroot-rendering.html -
trunk/LayoutTests/platform/wk2/Skipped
r109792 r110161 1074 1074 fast/dom/shadow/shadow-ul-li.html 1075 1075 fast/dom/shadow/shadow-root-append.html 1076 fast/dom/shadow/shadow-element-rendering-single.html 1077 fast/dom/shadow/shadow-element-rendering-multiple.html 1076 1078 fast/dom/shadow/multiple-shadowroot.html 1077 1079 fast/dom/shadow/multiple-shadowroot-rendering.html -
trunk/Source/WebCore/ChangeLog
r110160 r110161 1 2012-03-08 Shinya Kawanaka <shinyak@chromium.org> 2 3 <shadow> should be rendered correctly. 4 https://bugs.webkit.org/show_bug.cgi?id=78596 5 6 Reviewed by Hajime Morita. 7 8 This patch supports <shadow> element rendering. 9 10 When attaching <shadow> element, if it is in the oldest shadow tree, it runs a part of 11 distribution algorithm. If it is in non-oldest shadow tree, it runs tree a part of 12 tree composition algorithm to assign a older shadow root. In this patch, InsertionPonit 13 try to treat the distributed host children and the assigned shadow children similarly. 14 15 NodeRenderingContext supports rendering <shadow> element. Since the assigned shadow children 16 are treated like distributed host children, that change is to consider non-youngest shadow 17 tree basically also. 18 19 Tests: fast/dom/shadow/shadow-element-rendering-multiple.html 20 fast/dom/shadow/shadow-element-rendering-single.html 21 22 * dom/NodeRenderingContext.cpp: 23 (WebCore): 24 (WebCore::NodeRenderingContext::NodeRenderingContext): 25 Does not ignore non-youngest shadow tree. 26 * dom/ShadowRoot.cpp: 27 (WebCore::ShadowRoot::ShadowRoot): 28 * dom/ShadowRoot.h: 29 (ShadowRoot): 30 (WebCore::ShadowRoot::assignedTo): 31 (WebCore): 32 (WebCore::ShadowRoot::setAssignedTo): 33 (WebCore::ShadowRoot::isUsedForRendering): 34 Returns true if ShadowRoot is youngest or assigned to some InsertionPoint. 35 (WebCore::toShadowRoot): 36 * dom/ShadowTree.cpp: 37 (WebCore::ShadowTree::insertionPointFor): 38 Returns InsertionPoint to which node is distributed. 39 * dom/ShadowTree.h: 40 (ShadowTree): 41 * html/shadow/HTMLContentElement.h: 42 (WebCore::HTMLContentElement::doesSelectFromHostChildren): 43 (HTMLContentElement): 44 * html/shadow/HTMLShadowElement.cpp: 45 (WebCore::HTMLShadowElement::HTMLShadowElement): 46 (WebCore::HTMLShadowElement::select): 47 (WebCore::HTMLShadowElement::doesSelectFromHostChildren): 48 (WebCore): 49 * html/shadow/HTMLShadowElement.h: 50 (HTMLShadowElement): 51 * html/shadow/InsertionPoint.cpp: 52 (WebCore::InsertionPoint::attach): 53 (WebCore::InsertionPoint::detach): 54 (WebCore::InsertionPoint::assignedFrom): 55 (WebCore): 56 (WebCore::InsertionPoint::assignShadowRoot): 57 (WebCore::InsertionPoint::clearAssignment): 58 * html/shadow/InsertionPoint.h: 59 (InsertionPoint): 60 1 61 2012-03-06 Hans Wennborg <hans@chromium.org> 2 62 -
trunk/Source/WebCore/dom/NodeRenderingContext.cpp
r109704 r110161 30 30 #include "HTMLContentElement.h" 31 31 #include "HTMLContentSelector.h" 32 #include "HTMLNames.h" 33 #include "HTMLShadowElement.h" 32 34 #include "Node.h" 33 35 #include "RenderFlowThread.h" … … 43 45 44 46 namespace WebCore { 47 48 using namespace HTMLNames; 45 49 46 50 static RenderObject* firstRendererOf(Node*); … … 60 64 return; 61 65 62 if (parent->isShadowRoot()) { 63 // FIXME: We don't support <shadow> yet, so the non-youngest shadow won't be rendered. 64 // https://bugs.webkit.org/shod_bugs.cgi?id=78596 65 if (toShadowRoot(parent)->isYoungest()) 66 m_phase = AttachingShadowChild; 67 else 68 m_phase = AttachingNotDistributed; 66 if (parent->isShadowRoot() && toShadowRoot(parent)->isYoungest()) { 67 m_phase = AttachingShadowChild; 69 68 m_parentNodeForRenderingAndStyle = parent->shadowHost(); 70 69 return; 71 70 } 72 71 73 if (parent->isElementNode() ) {74 if ( toElement(parent)->hasShadowRoot()) {72 if (parent->isElementNode() || parent->isShadowRoot()) { 73 if (parent->isElementNode() && toElement(parent)->hasShadowRoot()) 75 74 m_visualParentShadowTree = toElement(parent)->shadowTree(); 76 if ((m_insertionPoint = m_visualParentShadowTree->insertionPointFor(m_node))77 && m_visualParentShadowTree->isSelectorActive()) {78 79 // FIXME: We don't support <shadow> yet, so the non-youngest shadow won't be rendered.80 // https://bugs.webkit.org/show_bugs.cgi?id=7859681 if (toShadowRoot(m_insertionPoint->shadowTreeRootNode())->is Youngest()) {75 else if (parent->isShadowRoot()) 76 m_visualParentShadowTree = toShadowRoot(parent)->tree(); 77 78 if (m_visualParentShadowTree) { 79 if ((m_insertionPoint = m_visualParentShadowTree->insertionPointFor(m_node))) { 80 if (toShadowRoot(m_insertionPoint->shadowTreeRootNode())->isUsedForRendering()) { 82 81 m_phase = AttachingDistributed; 83 82 m_parentNodeForRenderingAndStyle = NodeRenderingContext(m_insertionPoint).parentNodeForRenderingAndStyle(); … … 92 91 93 92 if (isShadowBoundary(parent)) { 94 // FIXME: We don't support <shadow> yet, so the non-youngest shadow won't be rendered. 95 // https://bugs.webkit.org/show_bugs.cgi?id=78596 96 if (!toShadowRoot(parent->shadowTreeRootNode())->isYoungest()) { 93 if (!toShadowRoot(parent->shadowTreeRootNode())->isUsedForRendering()) { 97 94 m_phase = AttachingNotDistributed; 98 95 m_parentNodeForRenderingAndStyle = parent; -
trunk/Source/WebCore/dom/ShadowRoot.cpp
r109563 r110161 53 53 , m_next(0) 54 54 , m_applyAuthorSheets(false) 55 , m_insertionPointAssignedTo(0) 55 56 { 56 57 ASSERT(document); -
trunk/Source/WebCore/dom/ShadowRoot.h
r109563 r110161 84 84 virtual void attach(); 85 85 86 bool isUsedForRendering() const; 87 InsertionPoint* assignedTo() const; 88 void setAssignedTo(InsertionPoint*); 89 86 90 private: 87 91 ShadowRoot(Document*); … … 95 99 ShadowRoot* m_next; 96 100 bool m_applyAuthorSheets : 1; 101 InsertionPoint* m_insertionPointAssignedTo; 97 102 }; 103 104 inline InsertionPoint* ShadowRoot::assignedTo() const 105 { 106 return m_insertionPointAssignedTo; 107 } 108 109 inline void ShadowRoot::setAssignedTo(InsertionPoint* insertionPoint) 110 { 111 ASSERT(!m_insertionPointAssignedTo || !insertionPoint); 112 m_insertionPointAssignedTo = insertionPoint; 113 } 114 115 inline bool ShadowRoot::isUsedForRendering() const 116 { 117 return isYoungest() || assignedTo(); 118 } 98 119 99 120 inline const ShadowRoot* toShadowRoot(const Node* node) … … 108 129 } 109 130 131 inline ShadowRoot* toShadowRoot(TreeScope* scope) 132 { 133 ASSERT(!scope || scope->isShadowRoot()); 134 return static_cast<ShadowRoot*>(scope); 135 } 136 110 137 // Put this TreeScope method here to inline it. 111 138 inline bool TreeScope::isShadowRoot() const -
trunk/Source/WebCore/dom/ShadowTree.cpp
r109563 r110161 32 32 #include "Element.h" 33 33 #include "HTMLContentSelector.h" 34 #include "HTMLShadowElement.h" 34 35 #include "InspectorInstrumentation.h" 35 36 #include "RuntimeEnabledFeatures.h" … … 199 200 InsertionPoint* ShadowTree::insertionPointFor(Node* node) const 200 201 { 202 ASSERT(node && node->parentNode()); 203 204 if (node->parentNode()->isShadowRoot()) { 205 if (InsertionPoint* insertionPoint = toShadowRoot(node->parentNode())->assignedTo()) 206 return insertionPoint; 207 208 return 0; 209 } 210 201 211 if (!m_selector) 202 212 return 0; … … 205 215 return 0; 206 216 return found->insertionPoint(); 207 }208 209 bool ShadowTree::isSelectorActive() const210 {211 return m_selector && m_selector->hasCandidates();212 217 } 213 218 -
trunk/Source/WebCore/dom/ShadowTree.h
r109290 r110161 83 83 HTMLContentSelector* ensureSelector(); 84 84 85 bool isSelectorActive() const;86 87 85 private: 88 86 Element* host() const; -
trunk/Source/WebCore/html/shadow/HTMLContentElement.h
r110151 r110161 48 48 virtual bool isSelectValid() const; 49 49 50 bool doesSelectFromHostChildren() const { return true; } 51 50 52 protected: 51 53 HTMLContentElement(const QualifiedName&, Document*); -
trunk/Source/WebCore/html/shadow/HTMLShadowElement.cpp
r106794 r110161 30 30 31 31 #include "config.h" 32 33 #if ENABLE(SHADOW_DOM)34 35 32 #include "HTMLShadowElement.h" 36 33 37 34 #include "HTMLNames.h" 35 #include "ShadowRoot.h" 36 #include <wtf/text/AtomicString.h> 38 37 39 38 namespace WebCore { … … 42 41 43 42 inline HTMLShadowElement::HTMLShadowElement(const QualifiedName& tagName, Document* document) 44 : HTMLElement(tagName, document)43 : InsertionPoint(tagName, document) 45 44 { 46 45 ASSERT(hasTagName(HTMLNames::shadowTag)); … … 56 55 } 57 56 57 const AtomicString& HTMLShadowElement::select() const 58 { 59 return nullAtom; 60 } 61 62 bool HTMLShadowElement::doesSelectFromHostChildren() const 63 { 64 TreeScope* scope = treeScope(); 65 66 if (scope->isShadowRoot()) 67 return toShadowRoot(scope)->isOldest(); 68 return false; 69 } 70 58 71 } // namespace WebCore 59 60 #endif // ENABLE(SHADOW_DOM) -
trunk/Source/WebCore/html/shadow/HTMLShadowElement.h
r107347 r110161 32 32 #define HTMLShadowElement_h 33 33 34 #if ENABLE(SHADOW_DOM) 35 36 #include "HTMLElement.h" 34 #include "InsertionPoint.h" 35 #include <wtf/Forward.h> 37 36 38 37 namespace WebCore { 39 38 40 class HTMLShadowElement : public HTMLElement {39 class HTMLShadowElement : public InsertionPoint { 41 40 public: 42 41 static PassRefPtr<HTMLShadowElement> create(const QualifiedName&, Document*); … … 44 43 virtual ~HTMLShadowElement(); 45 44 45 const AtomicString& select() const; 46 bool isSelectValid() const OVERRIDE { return true; } 47 bool doesSelectFromHostChildren() const; 48 46 49 private: 47 50 HTMLShadowElement(const QualifiedName&, Document*); 48 virtual bool isShadowElement() const { return true; }49 51 }; 50 52 51 53 } // namespace WebCore 52 54 53 #endif // ENABLE(SHADOW_DOM)54 55 55 #endif // HTMLShadowElement_h -
trunk/Source/WebCore/html/shadow/InsertionPoint.cpp
r109864 r110161 49 49 void InsertionPoint::attach() 50 50 { 51 if (ShadowRoot* root = toShadowRoot(shadowTreeRootNode())) { 52 distributeHostChildren(root->tree()); 53 attachDistributedNode(); 51 TreeScope* scope = treeScope(); 52 if (scope->isShadowRoot()) { 53 ShadowRoot* root = toShadowRoot(scope); 54 if (doesSelectFromHostChildren()) { 55 distributeHostChildren(root->tree()); 56 attachDistributedNode(); 57 } else if (!root->olderShadowRoot()->assignedTo()) { 58 ASSERT(!root->olderShadowRoot()->attached()); 59 assignShadowRoot(root->olderShadowRoot()); 60 root->olderShadowRoot()->attach(); 61 } 54 62 } 55 63 … … 61 69 if (ShadowRoot* root = toShadowRoot(shadowTreeRootNode())) { 62 70 ShadowTree* tree = root->tree(); 63 clearDistribution(tree); 71 72 if (doesSelectFromHostChildren()) 73 clearDistribution(tree); 74 else if (ShadowRoot* assignedShadowRoot = assignedFrom()) 75 clearAssignment(assignedShadowRoot); 64 76 65 77 // When shadow element is detached, shadow tree should be recreated to re-calculate selector for … … 70 82 ASSERT(m_selections.isEmpty()); 71 83 HTMLElement::detach(); 84 } 85 86 ShadowRoot* InsertionPoint::assignedFrom() const 87 { 88 TreeScope* scope = treeScope(); 89 if (!scope->isShadowRoot()) 90 return 0; 91 92 ShadowRoot* olderShadowRoot = toShadowRoot(scope)->olderShadowRoot(); 93 if (olderShadowRoot && olderShadowRoot->assignedTo() == this) 94 return olderShadowRoot; 95 return 0; 72 96 } 73 97 … … 103 127 } 104 128 129 inline void InsertionPoint::assignShadowRoot(ShadowRoot* shadowRoot) 130 { 131 shadowRoot->setAssignedTo(this); 132 m_selections.clear(); 133 for (Node* node = shadowRoot->firstChild(); node; node = node->nextSibling()) 134 m_selections.append(HTMLContentSelection::create(this, node)); 135 } 136 137 inline void InsertionPoint::clearAssignment(ShadowRoot* shadowRoot) 138 { 139 shadowRoot->setAssignedTo(0); 140 m_selections.clear(); 141 } 142 105 143 } // namespace WebCore -
trunk/Source/WebCore/html/shadow/InsertionPoint.h
r110151 r110161 34 34 #include "HTMLContentSelector.h" 35 35 #include "HTMLElement.h" 36 #include "HTMLNames.h" 36 37 #include <wtf/Forward.h> 37 38 … … 48 49 virtual const AtomicString& select() const = 0; 49 50 virtual bool isSelectValid() const = 0; 51 virtual bool doesSelectFromHostChildren() const = 0; 50 52 51 53 virtual void attach(); … … 53 55 54 56 virtual bool isInsertionPoint() const OVERRIDE { return true; } 57 ShadowRoot* assignedFrom() const; 55 58 56 59 protected: … … 62 65 void clearDistribution(ShadowTree*); 63 66 void attachDistributedNode(); 67 68 void assignShadowRoot(ShadowRoot*); 69 void clearAssignment(ShadowRoot*); 64 70 65 71 HTMLContentSelectionList m_selections;
Note: See TracChangeset
for help on using the changeset viewer.