Changeset 109313 in webkit
- Timestamp:
- Feb 29, 2012 10:39:22 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r109311 r109313 1 2012-02-29 Shinya Kawanaka <shinyak@chromium.org> 2 3 Refactoring: HTMLContentSelector should be InsertionPoint-aware. 4 https://bugs.webkit.org/show_bug.cgi?id=79901 5 6 Reviewed by Hajime Morita. 7 8 ContentSelectorQuery took HTMLContentElement as argument, but patch changes it to take InsertionPoint instead. 9 If InsertionPoint is not HTMLContentElement, ContentSelectorQuery will selects the rest of light children. 10 11 Now InsertionPoint has pure virtual method 'select'. <shadow> will implement this as a method returning empty string. 12 13 * dom/ShadowRoot.cpp: 14 (WebCore::ShadowRoot::hasInsertionPoint): 15 * dom/ShadowRoot.h: 16 (ShadowRoot): 17 * dom/ShadowTree.cpp: 18 (WebCore::ShadowTree::needsReattachHostChildrenAndShadow): 19 (WebCore::ShadowTree::hostChildrenChanged): 20 * html/shadow/ContentSelectorQuery.cpp: 21 (WebCore::ContentSelectorQuery::ContentSelectorQuery): 22 (WebCore::ContentSelectorQuery::matches): 23 * html/shadow/ContentSelectorQuery.h: 24 (WebCore): 25 (ContentSelectorQuery): 26 * html/shadow/HTMLContentElement.cpp: 27 (WebCore::HTMLContentElement::detach): 28 * html/shadow/HTMLContentElement.h: 29 (WebCore::toHTMLContentElement): 30 (WebCore): 31 * html/shadow/HTMLContentSelector.cpp: 32 (WebCore::HTMLContentSelector::select): 33 * html/shadow/HTMLContentSelector.h: 34 (HTMLContentSelector): 35 * html/shadow/InsertionPoint.h: 36 (InsertionPoint): 37 1 38 2012-02-29 Luke Macpherson <macpherson@chromium.org> 2 39 -
trunk/Source/WebCore/dom/ShadowRoot.cpp
r109251 r109313 179 179 } 180 180 181 bool ShadowRoot::has ContentElement() const181 bool ShadowRoot::hasInsertionPoint() const 182 182 { 183 183 for (Node* n = firstChild(); n; n = n->traverseNextNode(this)) { 184 if ( n->isContentElement())184 if (isInsertionPoint(n)) 185 185 return true; 186 186 } -
trunk/Source/WebCore/dom/ShadowRoot.h
r109251 r109313 80 80 bool isOldest() const { return !olderShadowRoot(); } 81 81 82 bool has ContentElement() const;82 bool hasInsertionPoint() const; 83 83 84 84 private: -
trunk/Source/WebCore/dom/ShadowTree.cpp
r109290 r109313 263 263 bool ShadowTree::needsReattachHostChildrenAndShadow() 264 264 { 265 return m_needsRecalculateContent || (youngestShadowRoot() && youngestShadowRoot()->has ContentElement());265 return m_needsRecalculateContent || (youngestShadowRoot() && youngestShadowRoot()->hasInsertionPoint()); 266 266 } 267 267 … … 270 270 ASSERT(youngestShadowRoot()); 271 271 272 if (!youngestShadowRoot()->has ContentElement())272 if (!youngestShadowRoot()->hasInsertionPoint()) 273 273 return; 274 274 -
trunk/Source/WebCore/html/shadow/ContentSelectorQuery.cpp
r106225 r109313 30 30 #include "CSSParser.h" 31 31 #include "CSSSelectorList.h" 32 #include " HTMLContentElement.h"32 #include "InsertionPoint.h" 33 33 34 34 namespace WebCore { 35 35 36 ContentSelectorQuery::ContentSelectorQuery(const HTMLContentElement* element)37 : m_ contentElement(element)38 , m_selectorChecker( element->document(), !element->document()->inQuirksMode())36 ContentSelectorQuery::ContentSelectorQuery(const InsertionPoint* insertionPoint) 37 : m_insertionPoint(insertionPoint) 38 , m_selectorChecker(insertionPoint->document(), !insertionPoint->document()->inQuirksMode()) 39 39 { 40 40 m_selectorChecker.setCollectingRulesOnly(true); 41 41 42 if ( element->select().isNull() || element->select().isEmpty()) {42 if (insertionPoint->select().isNull() || insertionPoint->select().isEmpty()) { 43 43 m_isValidSelector = true; 44 44 return; … … 46 46 47 47 CSSParser parser(true); 48 parser.parseSelector( element->select(), element->document(), m_selectorList);48 parser.parseSelector(insertionPoint->select(), insertionPoint->document(), m_selectorList); 49 49 50 50 m_isValidSelector = ContentSelectorQuery::validateSelectorList(); … … 64 64 return false; 65 65 66 ASSERT(node->parentNode() == m_ contentElement->shadowTreeRootNode()->shadowHost());66 ASSERT(node->parentNode() == m_insertionPoint->shadowTreeRootNode()->shadowHost()); 67 67 68 if (m_ contentElement->select().isNull() || m_contentElement->select().isEmpty())68 if (m_insertionPoint->select().isNull() || m_insertionPoint->select().isEmpty()) 69 69 return true; 70 70 -
trunk/Source/WebCore/html/shadow/ContentSelectorQuery.h
r106225 r109313 42 42 class Document; 43 43 class Node; 44 class HTMLContentElement;44 class InsertionPoint; 45 45 46 46 class ContentSelectorQuery { 47 47 WTF_MAKE_NONCOPYABLE(ContentSelectorQuery); 48 48 public: 49 explicit ContentSelectorQuery(const HTMLContentElement*);49 explicit ContentSelectorQuery(const InsertionPoint*); 50 50 51 51 bool isValidSelector() const; … … 54 54 bool validateSelectorList(); 55 55 56 const HTMLContentElement* m_contentElement;56 const InsertionPoint* m_insertionPoint; 57 57 SelectorDataList m_selectors; 58 58 CSSSelectorList m_selectorList; -
trunk/Source/WebCore/html/shadow/HTMLContentElement.cpp
r108959 r109313 95 95 96 96 // When content element is detached, shadow tree should be recreated to re-calculate selector for 97 // other content elements.97 // other insertion points. 98 98 root->tree()->setNeedsReattachHostChildrenAndShadow(); 99 99 } -
trunk/Source/WebCore/html/shadow/HTMLContentElement.h
r109179 r109313 67 67 }; 68 68 69 inline const HTMLContentElement* toHTMLContentElement(const Node* node) 70 { 71 ASSERT(!node || node->isContentElement()); 72 return static_cast<const HTMLContentElement*>(node); 73 } 74 69 75 inline HTMLContentElement* toHTMLContentElement(Node* node) 70 76 { -
trunk/Source/WebCore/html/shadow/HTMLContentSelector.cpp
r108605 r109313 109 109 } 110 110 111 void HTMLContentSelector::select( HTMLContentElement* contentElement, HTMLContentSelectionList* selections)111 void HTMLContentSelector::select(InsertionPoint* insertionPoint, HTMLContentSelectionList* selections) 112 112 { 113 113 ASSERT(selections->isEmpty()); 114 114 115 ContentSelectorQuery query(contentElement); 115 ContentSelectorQuery query(insertionPoint); 116 116 117 for (size_t i = 0; i < m_candidates.size(); ++i) { 117 118 Node* child = m_candidates[i].get(); … … 121 122 continue; 122 123 123 RefPtr<HTMLContentSelection> selection = HTMLContentSelection::create( contentElement, child);124 RefPtr<HTMLContentSelection> selection = HTMLContentSelection::create(insertionPoint, child); 124 125 125 126 selections->append(selection); -
trunk/Source/WebCore/html/shadow/HTMLContentSelector.h
r108605 r109313 131 131 ~HTMLContentSelector(); 132 132 133 void select( HTMLContentElement*, HTMLContentSelectionList*);133 void select(InsertionPoint*, HTMLContentSelectionList*); 134 134 void unselect(HTMLContentSelectionList*); 135 135 HTMLContentSelection* findFor(Node* key) const; -
trunk/Source/WebCore/html/shadow/InsertionPoint.h
r109179 r109313 34 34 #include "HTMLContentSelector.h" 35 35 #include "HTMLElement.h" 36 #include <wtf/Forward.h> 36 37 37 38 namespace WebCore { … … 44 45 bool hasSelection() const { return m_selections.first(); } 45 46 bool isShadowBoundary() const; 47 48 virtual const AtomicString& select() const = 0; 46 49 47 50 protected:
Note: See TracChangeset
for help on using the changeset viewer.