Changeset 104919 in webkit
- Timestamp:
- Jan 13, 2012 5:04:58 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 17 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r104917 r104919 1 2012-01-13 Shinya Kawanaka <shinyak@google.com> 2 3 ShadowContentElement should be able to use query. 4 https://bugs.webkit.org/show_bug.cgi?id=75302 5 6 Reviewed by Hajime Morita. 7 8 Tests for ShadowContentElement query. 9 10 * fast/dom/shadow/shadow-contents-select-expected.html: Added. 11 * fast/dom/shadow/shadow-contents-select.html: Added. 12 1 13 2012-01-13 Renata Hodovan <reni@webkit.org> 2 14 -
trunk/Source/WebCore/CMakeLists.txt
r104827 r104919 595 595 dom/SelectorQuery.cpp 596 596 dom/ShadowContentElement.cpp 597 dom/ShadowContentSelectorQuery.cpp 597 598 dom/ShadowInclusionSelector.cpp 598 599 dom/ShadowRoot.cpp -
trunk/Source/WebCore/ChangeLog
r104916 r104919 1 2012-01-13 Shinya Kawanaka <shinyak@google.com> 2 3 ShadowContentElement should be able to use query. 4 https://bugs.webkit.org/show_bug.cgi?id=75302 5 6 Reviewed by Hajime Morita. 7 8 This patch introduces a selector to query elements in ShadowContentElement. 9 This can be used instead of ShadowContentElement::shouldInclude in more sophisticated ways. 10 11 Tests: fast/dom/shadow/shadow-contents-select-expected.html 12 fast/dom/shadow/shadow-contents-select.html 13 14 * CMakeLists.txt: 15 * GNUmakefile.list.am: 16 * Target.pri: 17 * WebCore.gypi: 18 * WebCore.vcproj/WebCore.vcproj: 19 * WebCore.xcodeproj/project.pbxproj: 20 * dom/DOMAllInOne.cpp: 21 * dom/SelectorQuery.cpp: 22 (WebCore::SelectorDataList::SelectorDataList): 23 Extracted from SelectorQueryto share codes with ShadowContentSelectorQuery. 24 (WebCore::SelectorDataList::initialize): 25 (WebCore::SelectorDataList::matches): 26 (WebCore::SelectorDataList::queryAll): 27 (WebCore::SelectorDataList::queryFirst): 28 (WebCore::SelectorDataList::canUseIdLookup): 29 (WebCore::SelectorDataList::execute): 30 (WebCore::SelectorQuery::SelectorQuery): 31 (WebCore::SelectorQuery::queryAll): 32 (WebCore::SelectorQuery::queryFirst): 33 * dom/SelectorQuery.h: 34 (WebCore::SelectorDataList::size): 35 * dom/ShadowContentElement.cpp: 36 (WebCore::ShadowContentElement::select): 37 (WebCore::ShadowContentElement::setSelect): 38 * dom/ShadowContentElement.h: 39 * dom/ShadowContentSelectorQuery.cpp: Added. 40 (WebCore::ShadowContentSelectorQuery::ShadowContentSelectorQuery): 41 (WebCore::ShadowContentSelectorQuery::matches): 42 Returns true if Node is matched by the query. 43 * dom/ShadowContentSelectorQuery.h: Copied from Source/WebCore/dom/ShadowContentElement.h. 44 * dom/ShadowInclusionSelector.cpp: 45 (WebCore::ShadowInclusionSelector::select): 46 * dom/ShadowInclusionSelector.h: 47 * html/HTMLAttributeNames.in: 48 * html/HTMLDetailsElement.cpp: 49 (WebCore::summaryQuerySelector): 50 (WebCore::DetailsContentElement::DetailsContentElement): Re-implemented using query. 51 (WebCore::DetailsSummaryElement::DetailsSummaryElement): ditto. 52 1 53 2012-01-13 Ilya Tikhonovsky <loislo@chromium.org> 2 54 -
trunk/Source/WebCore/GNUmakefile.list.am
r104896 r104919 1646 1646 Source/WebCore/dom/ShadowContentElement.cpp \ 1647 1647 Source/WebCore/dom/ShadowContentElement.h \ 1648 Source/WebCore/dom/ShadowContentSelectorQuery.cpp \ 1649 Source/WebCore/dom/ShadowContentSelectorQuery.h \ 1648 1650 Source/WebCore/dom/ShadowInclusionSelector.cpp \ 1649 1651 Source/WebCore/dom/ShadowInclusionSelector.h \ -
trunk/Source/WebCore/Target.pri
r104896 r104919 561 561 dom/SelectorQuery.cpp \ 562 562 dom/ShadowContentElement.cpp \ 563 dom/ShadowContentSelectorQuery.cpp \ 563 564 dom/ShadowInclusionSelector.cpp \ 564 565 dom/ShadowRoot.cpp \ … … 1661 1662 dom/SelectorQuery.h \ 1662 1663 dom/ShadowContentElement.h \ 1664 dom/ShadowContentSelectorQuery.h \ 1663 1665 dom/ShadowInclusionSelector.h \ 1664 1666 dom/ShadowRoot.h \ -
trunk/Source/WebCore/WebCore.gypi
r104913 r104919 1048 1048 'dom/ShadowRoot.h', 1049 1049 'dom/ShadowContentElement.h', 1050 'dom/ShadowContentSelectorQuery.h', 1050 1051 'dom/SpaceSplitString.h', 1051 1052 'dom/StyledElement.h', … … 5460 5461 'dom/ShadowContentElement.cpp', 5461 5462 'dom/ShadowContentElement.h', 5463 'dom/ShadowContentSelectorQuery.cpp', 5464 'dom/ShadowContentSelectorQuery.h', 5462 5465 'dom/ShadowInclusionSelector.cpp', 5463 5466 'dom/ShadowInclusionSelector.h', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r104827 r104919 51107 51107 </File> 51108 51108 <File 51109 RelativePath="..\dom\ShadowContentSelectorQuery.cpp" 51110 > 51111 </File> 51112 <File 51113 RelativePath="..\dom\ShadowContentSelectorQuery.h" 51114 > 51115 </File> 51116 <File 51109 51117 RelativePath="..\dom\ShadowInclusionSelector.cpp" 51110 51118 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r104896 r104919 1563 1563 550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 550A0BC7085F6039007353D6 /* QualifiedName.cpp */; }; 1564 1564 550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* QualifiedName.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1565 570DBA8114B5804900DAEFA0 /* ShadowContentSelectorQuery.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 570DB7A814B5696A00DAEFA0 /* ShadowContentSelectorQuery.cpp */; }; 1566 570DBA8214B5804B00DAEFA0 /* ShadowContentSelectorQuery.h in Headers */ = {isa = PBXBuildFile; fileRef = 570DB7A914B5696A00DAEFA0 /* ShadowContentSelectorQuery.h */; }; 1565 1567 5905ADBF1302F3CE00F116DF /* XMLTreeViewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5905ADBD1302F3CE00F116DF /* XMLTreeViewer.cpp */; }; 1566 1568 5905ADC01302F3CE00F116DF /* XMLTreeViewer.h in Headers */ = {isa = PBXBuildFile; fileRef = 5905ADBE1302F3CE00F116DF /* XMLTreeViewer.h */; }; … … 8376 8378 550A0BC7085F6039007353D6 /* QualifiedName.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = QualifiedName.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 8377 8379 550A0BC8085F6039007353D6 /* QualifiedName.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = QualifiedName.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 8380 570DB7A814B5696A00DAEFA0 /* ShadowContentSelectorQuery.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShadowContentSelectorQuery.cpp; sourceTree = "<group>"; }; 8381 570DB7A914B5696A00DAEFA0 /* ShadowContentSelectorQuery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShadowContentSelectorQuery.h; sourceTree = "<group>"; }; 8378 8382 5905ADBD1302F3CE00F116DF /* XMLTreeViewer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLTreeViewer.cpp; sourceTree = "<group>"; }; 8379 8383 5905ADBE1302F3CE00F116DF /* XMLTreeViewer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLTreeViewer.h; sourceTree = "<group>"; }; … … 20511 20515 A766CF8B13810E0C0011A0B3 /* ShadowContentElement.cpp */, 20512 20516 A74C2D3B13811E0D00F83572 /* ShadowContentElement.h */, 20517 570DB7A814B5696A00DAEFA0 /* ShadowContentSelectorQuery.cpp */, 20518 570DB7A914B5696A00DAEFA0 /* ShadowContentSelectorQuery.h */, 20513 20519 A71C30B61381265E00DBC351 /* ShadowInclusionSelector.cpp */, 20514 20520 A71C30B71381265E00DBC351 /* ShadowInclusionSelector.h */, … … 23367 23373 0F3DD45012F5EA1B000D9190 /* ShadowBlur.h in Headers */, 23368 23374 A74C2D3C13811E0D00F83572 /* ShadowContentElement.h in Headers */, 23375 570DBA8214B5804B00DAEFA0 /* ShadowContentSelectorQuery.h in Headers */, 23369 23376 BC5EB8C40E82031B00B25965 /* ShadowData.h in Headers */, 23370 23377 A71C30B91381265E00DBC351 /* ShadowInclusionSelector.h in Headers */, … … 26401 26408 0F3DD44F12F5EA1B000D9190 /* ShadowBlur.cpp in Sources */, 26402 26409 A766CF8C13810E0C0011A0B3 /* ShadowContentElement.cpp in Sources */, 26410 570DBA8114B5804900DAEFA0 /* ShadowContentSelectorQuery.cpp in Sources */, 26403 26411 BC5EB8C30E82031B00B25965 /* ShadowData.cpp in Sources */, 26404 26412 A71C30B81381265E00DBC351 /* ShadowInclusionSelector.cpp in Sources */, -
trunk/Source/WebCore/dom/DOMAllInOne.cpp
r104827 r104919 114 114 #include "SelectorQuery.cpp" 115 115 #include "ShadowContentElement.cpp" 116 #include "ShadowContentSelectorQuery.cpp" 116 117 #include "ShadowInclusionSelector.cpp" 117 118 #include "ShadowRoot.cpp" -
trunk/Source/WebCore/dom/SelectorQuery.cpp
r104827 r104919 34 34 namespace WebCore { 35 35 36 SelectorQuery::SelectorQuery(Node* rootNode, const CSSSelectorList& selectorList) 37 : m_rootNode(rootNode) 38 , m_selectorChecker(rootNode->document(), !rootNode->document()->inQuirksMode()) 36 SelectorDataList::SelectorDataList() 39 37 { 40 m_selectorChecker.setCollectingRulesOnly(true); 38 } 39 40 SelectorDataList::SelectorDataList(const CSSSelectorList& selectorList) 41 { 42 initialize(selectorList); 43 } 44 45 void SelectorDataList::initialize(const CSSSelectorList& selectorList) 46 { 47 ASSERT(m_selectors.isEmpty()); 41 48 42 49 for (CSSSelector* selector = selectorList.first(); selector; selector = CSSSelectorList::next(selector)) 43 50 m_selectors.append(SelectorData(selector, SelectorChecker::isFastCheckableSelector(selector))); 44 51 } 45 46 PassRefPtr<NodeList> SelectorQuery::queryAll() const 52 53 bool SelectorDataList::matches(const SelectorChecker& selectorChecker, Element* targetElement) const 54 { 55 ASSERT(targetElement); 56 57 unsigned selectorCount = m_selectors.size(); 58 for (unsigned i = 0; i < selectorCount; ++i) { 59 if (selectorChecker.checkSelector(m_selectors[i].selector, targetElement, m_selectors[i].isFastCheckable)) 60 return true; 61 } 62 63 return false; 64 } 65 66 PassRefPtr<NodeList> SelectorDataList::queryAll(const SelectorChecker& selectorChecker, Node* rootNode) const 47 67 { 48 68 Vector<RefPtr<Node> > result; 49 execute<false>( result);69 execute<false>(selectorChecker, rootNode, result); 50 70 return StaticNodeList::adopt(result); 51 71 } 52 72 53 PassRefPtr<Element> Selector Query::queryFirst() const54 { 73 PassRefPtr<Element> SelectorDataList::queryFirst(const SelectorChecker& selectorChecker, Node* rootNode) const 74 { 55 75 Vector<RefPtr<Node> > result; 56 execute<true>( result);76 execute<true>(selectorChecker, rootNode, result); 57 77 if (result.isEmpty()) 58 78 return 0; … … 62 82 } 63 83 64 bool Selector Query::canUseIdLookup() const84 bool SelectorDataList::canUseIdLookup(Node* rootNode) const 65 85 { 66 86 // We need to return the matches in document order. To use id lookup while there is possiblity of multiple matches … … 70 90 if (m_selectors[0].selector->m_match != CSSSelector::Id) 71 91 return false; 72 if (! m_rootNode->inDocument())92 if (!rootNode->inDocument()) 73 93 return false; 74 if ( m_rootNode->document()->inQuirksMode())94 if (rootNode->document()->inQuirksMode()) 75 95 return false; 76 if ( m_rootNode->document()->containsMultipleElementsWithId(m_selectors[0].selector->value()))96 if (rootNode->document()->containsMultipleElementsWithId(m_selectors[0].selector->value())) 77 97 return false; 78 98 return true; … … 80 100 81 101 template <bool firstMatchOnly> 82 void Selector Query::execute(Vector<RefPtr<Node> >& matchedElements) const102 void SelectorDataList::execute(const SelectorChecker& selectorChecker, Node* rootNode, Vector<RefPtr<Node> >& matchedElements) const 83 103 { 84 if (canUseIdLookup( )) {104 if (canUseIdLookup(rootNode)) { 85 105 ASSERT(m_selectors.size() == 1); 86 106 CSSSelector* selector = m_selectors[0].selector; 87 Element* element = m_rootNode->document()->getElementById(selector->value());88 if (!element || !( m_rootNode->isDocumentNode() || element->isDescendantOf(m_rootNode)))107 Element* element = rootNode->document()->getElementById(selector->value()); 108 if (!element || !(rootNode->isDocumentNode() || element->isDescendantOf(rootNode))) 89 109 return; 90 if ( m_selectorChecker.checkSelector(selector, element, m_selectors[0].isFastCheckable))110 if (selectorChecker.checkSelector(m_selectors[0].selector, element, m_selectors[0].isFastCheckable)) 91 111 matchedElements.append(element); 92 112 return; 93 113 } 94 114 95 115 unsigned selectorCount = m_selectors.size(); 96 97 Node* n = m_rootNode->firstChild();116 117 Node* n = rootNode->firstChild(); 98 118 while (n) { 99 119 if (n->isElementNode()) { 100 120 Element* element = static_cast<Element*>(n); 101 121 for (unsigned i = 0; i < selectorCount; ++i) { 102 if ( m_selectorChecker.checkSelector(m_selectors[i].selector, element, m_selectors[i].isFastCheckable)) {122 if (selectorChecker.checkSelector(m_selectors[i].selector, element, m_selectors[i].isFastCheckable)) { 103 123 matchedElements.append(element); 104 124 if (firstMatchOnly) … … 114 134 while (!n->nextSibling()) { 115 135 n = n->parentNode(); 116 if (n == m_rootNode)136 if (n == rootNode) 117 137 return; 118 138 } … … 121 141 } 122 142 143 SelectorQuery::SelectorQuery(Node* rootNode, const CSSSelectorList& selectorList) 144 : m_rootNode(rootNode) 145 , m_selectorChecker(rootNode->document(), !rootNode->document()->inQuirksMode()) 146 , m_selectors(selectorList) 147 { 148 m_selectorChecker.setCollectingRulesOnly(true); 123 149 } 150 151 PassRefPtr<NodeList> SelectorQuery::queryAll() const 152 { 153 return m_selectors.queryAll(m_selectorChecker, m_rootNode); 154 } 155 156 PassRefPtr<Element> SelectorQuery::queryFirst() const 157 { 158 return m_selectors.queryFirst(m_selectorChecker, m_rootNode); 159 } 160 161 } -
trunk/Source/WebCore/dom/SelectorQuery.h
r104827 r104919 38 38 class CSSSelectorList; 39 39 40 class SelectorQuery { 41 WTF_MAKE_NONCOPYABLE(SelectorQuery); 40 class SelectorDataList { 42 41 public: 43 SelectorQuery(Node* rootNode, const CSSSelectorList&); 44 45 PassRefPtr<NodeList> queryAll() const; 46 PassRefPtr<Element> queryFirst() const; 42 SelectorDataList(); 43 explicit SelectorDataList(const CSSSelectorList&); 44 45 void initialize(const CSSSelectorList&); 46 47 int size() const { return m_selectors.size(); } 48 49 bool matches(const SelectorChecker&, Element*) const; 50 PassRefPtr<NodeList> queryAll(const SelectorChecker&, Node* rootNode) const; 51 PassRefPtr<Element> queryFirst(const SelectorChecker&, Node* rootNode) const; 47 52 48 53 private: 49 bool canUseIdLookup() const;50 51 template <bool firstMatchOnly>52 void execute(Vector<RefPtr<Node> >&) const;53 54 54 struct SelectorData { 55 55 SelectorData(CSSSelector* selector, bool isFastCheckable) : selector(selector), isFastCheckable(isFastCheckable) { } … … 57 57 bool isFastCheckable; 58 58 }; 59 60 bool canUseIdLookup(Node* rootNode) const; 61 template <bool firstMatchOnly> 62 void execute(const SelectorChecker&, Node* rootNode, Vector<RefPtr<Node> >&) const; 63 64 Vector<SelectorData> m_selectors; 65 }; 66 67 class SelectorQuery { 68 WTF_MAKE_NONCOPYABLE(SelectorQuery); 69 public: 70 SelectorQuery(Node* rootNode, const CSSSelectorList&); 71 72 PassRefPtr<NodeList> queryAll() const; 73 PassRefPtr<Element> queryFirst() const; 74 private: 59 75 Node* m_rootNode; 60 Vector<SelectorData> m_selectors;61 76 SelectorChecker m_selectorChecker; 77 SelectorDataList m_selectors; 62 78 }; 63 79 -
trunk/Source/WebCore/dom/ShadowContentElement.cpp
r104827 r104919 29 29 30 30 #include "HTMLNames.h" 31 #include "QualifiedName.h" 32 #include "ShadowContentSelectorQuery.h" 31 33 #include "ShadowInclusionSelector.h" 32 34 #include "ShadowRoot.h" 35 #include <wtf/StdLibExtras.h> 33 36 34 37 namespace WebCore { 38 39 using HTMLNames::selectAttr; 35 40 36 41 PassRefPtr<ShadowContentElement> ShadowContentElement::create(Document* document) … … 77 82 } 78 83 79 bool ShadowContentElement::shouldInclude(Node*) 84 const AtomicString& ShadowContentElement::select() const 80 85 { 81 return true;86 return getAttribute(selectAttr); 82 87 } 83 88 89 void ShadowContentElement::setSelect(const AtomicString& selectValue) 90 { 91 setAttribute(selectAttr, selectValue); 92 } 84 93 85 94 } -
trunk/Source/WebCore/dom/ShadowContentElement.h
r104827 r104919 37 37 namespace WebCore { 38 38 39 class ShadowContentSelectorQuery; 39 40 class ShadowInclusionList; 40 41 … … 46 47 47 48 virtual ~ShadowContentElement(); 48 virtual bool shouldInclude(Node*);49 49 virtual void attach(); 50 50 virtual void detach(); 51 52 const AtomicString& select() const; 53 54 // FIXME: Currently this constructor accepts wider query than shadow dom spec. 55 // For example, a selector query should not include contextual selectors. 56 // See https://bugs.webkit.org/show_bug.cgi?id=75946 57 // FIXME: Currently we don't support setting select value dynamically. 58 // See https://bugs.webkit.org/show_bug.cgi?id=76261 59 void setSelect(const AtomicString&); 51 60 52 61 const ShadowInclusionList* inclusions() const { return m_inclusions.get(); } -
trunk/Source/WebCore/dom/ShadowContentSelectorQuery.h
r104918 r104919 29 29 */ 30 30 31 #ifndef ShadowContent Element_h32 #define ShadowContent Element_h31 #ifndef ShadowContentSelectorQuery_h 32 #define ShadowContentSelectorQuery_h 33 33 34 #include "StyledElement.h" 34 #include "CSSSelectorList.h" 35 #include "SelectorChecker.h" 36 #include "SelectorQuery.h" 35 37 #include <wtf/Forward.h> 38 #include <wtf/Vector.h> 36 39 37 40 namespace WebCore { 38 41 39 class ShadowInclusionList; 42 class Document; 43 class Node; 44 class ShadowContentElement; 40 45 41 // NOTE: Current implementation doesn't support dynamic insertion/deletion of ShadowContentElement. 42 // You should create ShadowContentElement during the host construction. 43 class ShadowContentElement : public StyledElement { 46 class ShadowContentSelectorQuery { 47 WTF_MAKE_NONCOPYABLE(ShadowContentSelectorQuery); 44 48 public: 45 static PassRefPtr<ShadowContentElement> create(Document*);49 explicit ShadowContentSelectorQuery(ShadowContentElement*); 46 50 47 virtual ~ShadowContentElement(); 48 virtual bool shouldInclude(Node*); 49 virtual void attach(); 50 virtual void detach(); 51 52 const ShadowInclusionList* inclusions() const { return m_inclusions.get(); } 53 54 protected: 55 ShadowContentElement(const QualifiedName&, Document*); 51 bool matches(Node*) const; 56 52 57 53 private: 58 virtual bool isContentElement() const { return true; } 59 virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; } 60 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) { return 0; } 61 62 OwnPtr<ShadowInclusionList> m_inclusions; 54 ShadowContentElement* m_contentElement; 55 SelectorDataList m_selectors; 56 CSSSelectorList m_selectorList; 57 SelectorChecker m_selectorChecker; 63 58 }; 64 65 inline ShadowContentElement* toShadowContentElement(Node* node)66 {67 ASSERT(!node || node->isContentElement());68 return static_cast<ShadowContentElement*>(node);69 }70 59 71 60 } 72 61 62 63 73 64 #endif -
trunk/Source/WebCore/dom/ShadowInclusionSelector.cpp
r104827 r104919 29 29 30 30 #include "ShadowContentElement.h" 31 #include "ShadowContentSelectorQuery.h" 31 32 #include "ShadowRoot.h" 32 33 … … 112 113 ASSERT(inclusions->isEmpty()); 113 114 115 ShadowContentSelectorQuery query(contentElement); 114 116 for (size_t i = 0; i < m_candidates.size(); ++i) { 115 117 Node* child = m_candidates[i].get(); 116 118 if (!child) 117 119 continue; 118 if (! contentElement->shouldInclude(child))120 if (!query.matches(child)) 119 121 continue; 120 122 -
trunk/Source/WebCore/dom/ShadowInclusionSelector.h
r104827 r104919 138 138 bool hasCandidates() const { return !m_candidates.isEmpty(); } 139 139 140 141 140 private: 142 141 void removeFromSet(ShadowInclusionList*); -
trunk/Source/WebCore/html/HTMLAttributeNames.in
r104838 r104919 280 280 scrolldelay 281 281 scrolling 282 select 282 283 selected 283 284 shape -
trunk/Source/WebCore/html/HTMLDetailsElement.cpp
r104827 r104919 37 37 using namespace HTMLNames; 38 38 39 static const AtomicString& summaryQuerySelector() 40 { 41 DEFINE_STATIC_LOCAL(AtomicString, selector, ("summary:first-of-type")); 42 return selector; 43 }; 44 39 45 class DetailsContentElement : public ShadowContentElement { 40 46 public: … … 46 52 { 47 53 } 48 49 virtual bool shouldInclude(Node*);50 54 }; 51 55 … … 54 58 return adoptRef(new DetailsContentElement(document)); 55 59 } 56 57 bool DetailsContentElement::shouldInclude(Node* node)58 {59 HTMLDetailsElement* details = static_cast<HTMLDetailsElement*>(shadowAncestorNode());60 return details->mainSummary() != node;61 }62 63 60 64 61 class DetailsSummaryElement : public ShadowContentElement { … … 70 67 : ShadowContentElement(HTMLNames::divTag, document) 71 68 { 72 } 73 74 virtual bool shouldInclude(Node*); 69 setSelect(summaryQuerySelector()); 70 } 75 71 }; 76 72 … … 79 75 return adoptRef(new DetailsSummaryElement(document)); 80 76 } 81 82 bool DetailsSummaryElement::shouldInclude(Node* node)83 {84 HTMLDetailsElement* details = static_cast<HTMLDetailsElement*>(shadowAncestorNode());85 return details->mainSummary() == node;86 }87 88 77 89 78 PassRefPtr<HTMLDetailsElement> HTMLDetailsElement::create(const QualifiedName& tagName, Document* document)
Note: See TracChangeset
for help on using the changeset viewer.