Changeset 105387 in webkit
- Timestamp:
- Jan 18, 2012 11:05:58 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r105386 r105387 1 2012-01-18 Shinya Kawanaka <shinyak@google.com> 2 3 ShadowContent query should be able to have fallback elements. 4 https://bugs.webkit.org/show_bug.cgi?id=75306 5 6 Reviewed by Hajime Morita. 7 8 * fast/dom/shadow/shadow-contents-fallback-expected.txt: Added. 9 * fast/dom/shadow/shadow-contents-fallback.html: Added. 10 1 11 2012-01-18 Kent Tamura <tkent@chromium.org> 2 12 -
trunk/Source/WebCore/ChangeLog
r105386 r105387 1 2012-01-18 Shinya Kawanaka <shinyak@google.com> 2 3 ShadowContent query should be able to have fallback elements. 4 https://bugs.webkit.org/show_bug.cgi?id=75306 5 6 Reviewed by Hajime Morita. 7 8 When no elements are selected by a shadow content element selector query, 9 light children are selected as a fallback elements. 10 11 Test: fast/dom/shadow/shadow-contents-fallback.html 12 13 * dom/NodeRenderingContext.cpp: 14 (WebCore::NodeRenderingContext::NodeRenderingContext): 15 Considers fallback phase. When no elements are chosen, the phase is set to 'fallback'. 16 (WebCore::NodeRenderingContext::nextRenderer): 17 Takes fallback phase into account. 18 (WebCore::NodeRenderingContext::previousRenderer): ditto. 19 * dom/NodeRenderingContext.h: 20 * html/shadow/HTMLContentElement.cpp: 21 (WebCore::HTMLContentElement::attach): 22 Calculates inclusions before attaching light children. 23 * html/shadow/HTMLContentElement.h: 24 (WebCore::HTMLContentElement::hasInclusion): 25 1 26 2012-01-18 Kent Tamura <tkent@chromium.org> 2 27 -
trunk/Source/WebCore/dom/NodeRenderingContext.cpp
r105249 r105387 74 74 m_parentNodeForRenderingAndStyle = NodeRenderingContext(m_includer).parentNodeForRenderingAndStyle(); 75 75 return; 76 } 77 76 } 77 78 78 m_phase = AttachContentLight; 79 79 m_parentNodeForRenderingAndStyle = parent; 80 80 return; 81 } 82 83 if (parent->isContentElement()) { 84 HTMLContentElement* shadowContentElement = toHTMLContentElement(parent); 85 if (!shadowContentElement->hasInclusion()) { 86 m_phase = AttachContentFallback; 87 m_parentNodeForRenderingAndStyle = NodeRenderingContext(parent).parentNodeForRenderingAndStyle(); 88 return; 89 } 81 90 } 82 91 } … … 177 186 // Avoid an O(n^2) problem with this function by not checking for 178 187 // nextRenderer() when the parent element hasn't attached yet. 179 if (m_node->parentOrHostNode() && !m_node->parentOrHostNode()->attached() )188 if (m_node->parentOrHostNode() && !m_node->parentOrHostNode()->attached() && m_phase != AttachContentFallback) 180 189 return 0; 181 190 … … 192 201 } 193 202 } 203 204 if (m_phase == AttachContentFallback) 205 return NodeRenderingContext(m_node->parentNode()).nextRenderer(); 194 206 195 207 return 0; … … 226 238 } 227 239 240 if (m_phase == AttachContentFallback) 241 return NodeRenderingContext(m_node->parentNode()).previousRenderer(); 242 228 243 return 0; 229 244 } -
trunk/Source/WebCore/dom/NodeRenderingContext.h
r105249 r105387 80 80 AttachContentLight, 81 81 AttachContentForwarded, 82 AttachContentFallback, 82 83 }; 83 84 -
trunk/Source/WebCore/html/shadow/HTMLContentElement.cpp
r105249 r105387 57 57 void HTMLContentElement::attach() 58 58 { 59 ASSERT(!firstChild()); // Currently doesn't support any light child. 60 HTMLElement::attach(); 59 ShadowRoot* root = toShadowRoot(shadowTreeRootNode()); 61 60 62 if (ShadowRoot* root = toShadowRoot(shadowTreeRootNode())) { 61 // Before calling StyledElement::attach, selector must be calculated. 62 if (root) { 63 63 ContentInclusionSelector* selector = root->ensureInclusions(); 64 64 selector->unselect(m_inclusions.get()); 65 65 selector->select(this, m_inclusions.get()); 66 } 67 68 HTMLElement::attach(); 69 70 if (root) { 66 71 for (ShadowInclusion* inclusion = m_inclusions->first(); inclusion; inclusion = inclusion->next()) 67 72 inclusion->content()->detach(); -
trunk/Source/WebCore/html/shadow/HTMLContentElement.h
r105249 r105387 32 32 #define HTMLContentElement_h 33 33 34 #include "ContentInclusionSelector.h" 34 35 #include "HTMLElement.h" 35 36 #include <wtf/Forward.h> … … 60 61 61 62 const ShadowInclusionList* inclusions() const { return m_inclusions.get(); } 63 bool hasInclusion() const { return inclusions()->first(); } 62 64 63 65 protected:
Note: See TracChangeset
for help on using the changeset viewer.