Changeset 107525 in webkit
- Timestamp:
- Feb 12, 2012 8:15:49 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 2 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r107514 r107525 1 2012-02-12 Shinya Kawanaka <shinyak@google.com> 2 3 Introduce ShadowRootList. 4 https://bugs.webkit.org/show_bug.cgi?id=78069 5 6 Reviewed by Hajime Morita. 7 8 DoublyLinkedList should have tail() method to take the last element. 9 10 * wtf/DoublyLinkedList.h: 11 (DoublyLinkedList): 12 (WTF::::tail): 13 (WTF): 14 1 15 2012-02-12 Raphael Kubo da Costa <kubo@profusion.mobi> 2 16 -
trunk/Source/JavaScriptCore/wtf/DoublyLinkedList.h
r105442 r107525 78 78 T* removeHead(); 79 79 80 T* tail() const; 81 80 82 void push(T*); 81 83 void append(T*); … … 115 117 { 116 118 return m_head; 119 } 120 121 template<typename T> inline T* DoublyLinkedList<T>::tail() const 122 { 123 return m_tail; 117 124 } 118 125 -
trunk/Source/WebCore/CMakeLists.txt
r107518 r107525 601 601 dom/SelectorQuery.cpp 602 602 dom/ShadowRoot.cpp 603 dom/ShadowRootList.cpp 603 604 dom/SpaceSplitString.cpp 604 605 dom/StaticHashSetNodeList.cpp -
trunk/Source/WebCore/ChangeLog
r107524 r107525 1 2012-02-12 Shinya Kawanaka <shinyak@google.com> 2 3 Introduce ShadowRootList. 4 https://bugs.webkit.org/show_bug.cgi?id=78069 5 6 Reviewed by Hajime Morita. 7 8 This is a step to implement multiple shadow subtrees. 9 10 This patch introduces a shadow root list. ShadowRootList is a doubly linked list, 11 and each shadow root now has a younger shadow root and older shadow root, 12 which are a previous element and a next element respectively. 13 Since a visual tree traversal, which will be introduced in coming patches, will need a older shadow root, 14 we make a shadow root list a doubly linked list. 15 16 However, ShadowRootList does not have more than one shadow root now. 17 This will be changed in a series of coming patches. 18 19 Element::shadowRoot(), setShadowRoot(), ensureShadowRoot(), and removeShadowRoot() are 20 emulated using ShadowRootList for a while. These API will be replaced to ShadowRootList API later. 21 22 No new tests, no change in behavior. 23 24 * CMakeLists.txt: 25 * GNUmakefile.list.am: 26 * Target.pri: 27 * WebCore.gypi: 28 * WebCore.xcodeproj/project.pbxproj: 29 * dom/DOMAllInOne.cpp: 30 * dom/Element.cpp: 31 (WebCore::Element::hasShadowRoot): 32 Retruns true if an element has a shadowRoot. 33 (WebCore::Element::shadowRootList): 34 Gets shadow root list if any. 35 (WebCore::Element::shadowRoot): 36 Gets the first shadow root from the shadow root list. 37 (WebCore::Element::setShadowRoot): 38 Sets the first shadow root to the shadow root list. 39 (WebCore::Element::removeShadowRoot): 40 Removes all the shadow roots in the shadow root list. 41 * dom/Element.h: 42 (WebCore): 43 (Element): 44 * dom/ElementRareData.h: 45 (ElementRareData): 46 (WebCore::ElementRareData::ElementRareData): 47 Has shadow root lists instead of shadow root. 48 (WebCore::ElementRareData::~ElementRareData): 49 * dom/ShadowRoot.cpp: 50 (WebCore::ShadowRoot::ShadowRoot): 51 (WebCore::ShadowRoot::~ShadowRoot): 52 * dom/ShadowRoot.h: 53 (ShadowRoot): 54 (WebCore::ShadowRoot::youngerShadowRoot): 55 (WebCore::ShadowRoot::olderShadowRoot): 56 * dom/ShadowRootList.cpp: Added. 57 (WebCore): 58 (WebCore::ShadowRootList::ShadowRootList): 59 (WebCore::ShadowRootList::~ShadowRootList): 60 (WebCore::ShadowRootList::pushShadowRoot): 61 Adds a shadow root into the list. Currently we limit the list can have only one shadow root. 62 (WebCore::ShadowRootList::popShadowRoot): 63 Removes and returns the youngest shadow root if any. 64 * dom/ShadowRootList.h: Added. 65 (WebCore): 66 (ShadowRootList): 67 (WebCore::ShadowRootList::hasShadowRoot): 68 (WebCore::ShadowRootList::youngestShadowRoot): 69 (WebCore::ShadowRootList::oldestShadowRoot): 70 1 71 2012-02-12 Shinya Kawanaka <shinyak@google.com> 2 72 -
trunk/Source/WebCore/GNUmakefile.list.am
r107518 r107525 1660 1660 Source/WebCore/dom/ShadowRoot.cpp \ 1661 1661 Source/WebCore/dom/ShadowRoot.h \ 1662 Source/WebCore/dom/ShadowRootList.cpp \ 1663 Source/WebCore/dom/ShadowRootList.h \ 1662 1664 Source/WebCore/dom/SpaceSplitString.cpp \ 1663 1665 Source/WebCore/dom/SpaceSplitString.h \ -
trunk/Source/WebCore/Target.pri
r107518 r107525 567 567 dom/SelectorQuery.cpp \ 568 568 dom/ShadowRoot.cpp \ 569 dom/ShadowRootList.cpp \ 569 570 dom/SpaceSplitString.cpp \ 570 571 dom/StaticNodeList.cpp \ … … 1671 1672 dom/SelectorQuery.h \ 1672 1673 dom/ShadowRoot.h \ 1674 dom/ShadowRootList.h \ 1673 1675 dom/SpaceSplitString.h \ 1674 1676 dom/StaticNodeList.h \ -
trunk/Source/WebCore/WebCore.gypi
r107518 r107525 620 620 'dom/ScriptRunner.h', 621 621 'dom/ShadowRoot.h', 622 'dom/ShadowRootList.h', 622 623 'dom/SpaceSplitString.h', 623 624 'dom/StyledElement.h', … … 5102 5103 'dom/ShadowRoot.cpp', 5103 5104 'dom/ShadowRoot.h', 5105 'dom/ShadowRootList.cpp', 5106 'dom/ShadowRootList.h', 5104 5107 'dom/SpaceSplitString.cpp', 5105 5108 'dom/StaticHashSetNodeList.cpp', -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r107518 r107525 1603 1603 550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 550A0BC7085F6039007353D6 /* QualifiedName.cpp */; }; 1604 1604 550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* QualifiedName.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1605 572E92FB14E540580087FFBA /* ShadowRootList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 572E92F914E540580087FFBA /* ShadowRootList.cpp */; }; 1606 572E92FC14E540580087FFBA /* ShadowRootList.h in Headers */ = {isa = PBXBuildFile; fileRef = 572E92FA14E540580087FFBA /* ShadowRootList.h */; }; 1605 1607 573D134714CE39FF0057ABCA /* InspectorTypeBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 573D134514CE39FF0057ABCA /* InspectorTypeBuilder.cpp */; }; 1606 1608 57B791A314C6A62900F202D1 /* ContentInclusionSelector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57B7919F14C6A62900F202D1 /* ContentInclusionSelector.cpp */; }; … … 8465 8467 550A0BC7085F6039007353D6 /* QualifiedName.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = QualifiedName.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 8466 8468 550A0BC8085F6039007353D6 /* QualifiedName.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = QualifiedName.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 8469 572E92F914E540580087FFBA /* ShadowRootList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ShadowRootList.cpp; path = dom/ShadowRootList.cpp; sourceTree = "<group>"; }; 8470 572E92FA14E540580087FFBA /* ShadowRootList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ShadowRootList.h; path = dom/ShadowRootList.h; sourceTree = "<group>"; }; 8467 8471 573D134514CE39FF0057ABCA /* InspectorTypeBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorTypeBuilder.cpp; sourceTree = "<group>"; }; 8468 8472 573D134614CE39FF0057ABCA /* InspectorTypeBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorTypeBuilder.h; sourceTree = "<group>"; }; … … 13396 13400 isa = PBXGroup; 13397 13401 children = ( 13402 572E92F914E540580087FFBA /* ShadowRootList.cpp */, 13403 572E92FA14E540580087FFBA /* ShadowRootList.h */, 13398 13404 65C97AF208EA908800ACD273 /* config.h */, 13399 13405 EDEC98020AED7E170059137F /* WebCorePrefix.h */, … … 24181 24187 4A957F0714E241300049DBFB /* WebSocketExtensionDispatcher.h in Headers */, 24182 24188 4ADE25FA14E3BB4C004C2213 /* WebSocketExtensionProcessor.h in Headers */, 24189 572E92FC14E540580087FFBA /* ShadowRootList.h in Headers */, 24183 24190 ); 24184 24191 runOnlyForDeploymentPostprocessing = 0; … … 27121 27128 7A54881814E432A1006AE05A /* DOMPatchSupport.cpp in Sources */, 27122 27129 4A957F0614E2412A0049DBFB /* WebSocketExtensionDispatcher.cpp in Sources */, 27130 572E92FB14E540580087FFBA /* ShadowRootList.cpp in Sources */, 27123 27131 ); 27124 27132 runOnlyForDeploymentPostprocessing = 0; -
trunk/Source/WebCore/dom/DOMAllInOne.cpp
r107454 r107525 118 118 #include "SelectorQuery.cpp" 119 119 #include "ShadowRoot.cpp" 120 #include "ShadowRootList.cpp" 120 121 #include "SpaceSplitString.cpp" 121 122 #include "StaticHashSetNodeList.cpp" -
trunk/Source/WebCore/dom/Element.cpp
r107509 r107525 1153 1153 } 1154 1154 1155 bool Element::hasShadowRoot() const 1156 { 1157 if (ShadowRootList* list = shadowRootList()) 1158 return list->hasShadowRoot(); 1159 return false; 1160 } 1161 1162 ShadowRootList* Element::shadowRootList() const 1163 { 1164 if (!hasRareData()) 1165 return 0; 1166 1167 return &rareData()->m_shadowRootList; 1168 } 1169 1155 1170 ShadowRoot* Element::shadowRoot() const 1156 1171 { 1157 return hasRareData() ? rareData()->m_shadowRoot : 0; 1172 if (ShadowRootList* list = shadowRootList()) 1173 return list->youngestShadowRoot(); 1174 return 0; 1158 1175 } 1159 1176 … … 1176 1193 } 1177 1194 1178 void Element::setShadowRoot(PassRefPtr<ShadowRoot> prpShadowRoot, ExceptionCode& ec) 1179 { 1180 RefPtr<ShadowRoot> shadowRoot = prpShadowRoot; 1195 void Element::setShadowRoot(PassRefPtr<ShadowRoot> shadowRoot, ExceptionCode& ec) 1196 { 1181 1197 if (!validateShadowRoot(document(), shadowRoot.get(), ec)) 1182 1198 return; 1183 1199 1200 if (!hasRareData()) 1201 ensureRareData(); 1202 1184 1203 removeShadowRoot(); 1185 1204 1186 ensureRareData()->m_shadowRoot = shadowRoot.get();1187 1205 shadowRoot->setShadowHost(this); 1206 shadowRootList()->pushShadowRoot(shadowRoot.get()); 1207 1188 1208 if (inDocument()) 1189 1209 shadowRoot->insertedIntoDocument(); … … 1205 1225 void Element::removeShadowRoot() 1206 1226 { 1207 if (!hasRareData()) 1208 return; 1209 1210 ElementRareData* data = rareData(); 1211 if (RefPtr<ShadowRoot> oldRoot = data->m_shadowRoot) { 1212 data->m_shadowRoot = 0; 1227 if (!hasShadowRoot()) 1228 return; 1229 1230 while (RefPtr<ShadowRoot> oldRoot = shadowRootList()->popShadowRoot()) { 1213 1231 document()->removeFocusedNodeOfSubtree(oldRoot.get()); 1214 1232 1215 // Remove from rendering tree1216 1233 if (oldRoot->attached()) 1217 1234 oldRoot->detach(); … … 1224 1241 oldRoot->removedFromTree(true); 1225 1242 if (attached()) { 1226 for (Node* child = firstChild(); child; child = child->nextSibling()) 1243 for (Node* child = firstChild(); child; child = child->nextSibling()) { 1227 1244 if (!child->attached()) 1228 1245 child->lazyAttach(); 1246 } 1229 1247 } 1230 1248 } -
trunk/Source/WebCore/dom/Element.h
r107477 r107525 43 43 class IntSize; 44 44 class ShadowRoot; 45 class ShadowRootList; 45 46 class WebKitAnimationList; 46 47 … … 257 258 void recalcStyle(StyleChange = NoChange); 258 259 260 bool hasShadowRoot() const; 261 ShadowRootList* shadowRootList() const; 262 263 // FIXME: These API will be moved to ShadowRootList. 264 // https://bugs.webkit.org/show_bug.cgi?id=78313 259 265 ShadowRoot* shadowRoot() const; 260 266 void setShadowRoot(PassRefPtr<ShadowRoot>, ExceptionCode&); -
trunk/Source/WebCore/dom/ElementRareData.h
r105849 r107525 28 28 #include "HTMLCollection.h" 29 29 #include "NodeRareData.h" 30 #include "ShadowRootList.h" 30 31 #include <wtf/OwnPtr.h> 31 32 32 33 namespace WebCore { 33 34 class ShadowRoot;35 34 36 35 class ElementRareData : public NodeRareData { … … 73 72 LayoutSize m_minimumSizeForResizing; 74 73 RefPtr<RenderStyle> m_computedStyle; 75 ShadowRoot * m_shadowRoot;74 ShadowRootList m_shadowRootList; 76 75 AtomicString m_shadowPseudoId; 77 76 … … 97 96 inline ElementRareData::ElementRareData() 98 97 : m_minimumSizeForResizing(defaultMinimumSizeForResizing()) 99 , m_shadowRoot(0)100 98 #if ENABLE(STYLE_SCOPED) 101 99 , m_numberOfScopedHTMLStyleChildren(0) … … 110 108 inline ElementRareData::~ElementRareData() 111 109 { 112 ASSERT(!m_shadowRoot );110 ASSERT(!m_shadowRootList.hasShadowRoot()); 113 111 } 114 112 -
trunk/Source/WebCore/dom/ShadowRoot.cpp
r107509 r107525 42 42 : DocumentFragment(document, CreateShadowRoot) 43 43 , TreeScope(this) 44 , m_prev(0) 45 , m_next(0) 44 46 , m_applyAuthorSheets(false) 45 47 , m_needsRecalculateContent(false) … … 56 58 ShadowRoot::~ShadowRoot() 57 59 { 60 ASSERT(!m_prev); 61 ASSERT(!m_next); 62 58 63 // We must call clearRareData() here since a ShadowRoot class inherits TreeScope 59 64 // as well as Node. See a comment on TreeScope.h for the reason. -
trunk/Source/WebCore/dom/ShadowRoot.h
r107202 r107525 31 31 #include "ExceptionCode.h" 32 32 #include "TreeScope.h" 33 #include <wtf/DoublyLinkedList.h> 33 34 34 35 namespace WebCore { … … 38 39 class HTMLContentElement; 39 40 40 class ShadowRoot : public DocumentFragment, public TreeScope { 41 class ShadowRoot : public DocumentFragment, public TreeScope, public DoublyLinkedListNode<ShadowRoot> { 42 friend class WTF::DoublyLinkedListNode<ShadowRoot>; 41 43 public: 42 44 static PassRefPtr<ShadowRoot> create(Document*); … … 74 76 ContentInclusionSelector* ensureInclusions(); 75 77 78 ShadowRoot* youngerShadowRoot() const { return prev(); } 79 ShadowRoot* olderShadowRoot() const { return next(); } 80 76 81 private: 77 82 ShadowRoot(Document*); … … 85 90 bool hasContentElement() const; 86 91 92 ShadowRoot* m_prev; 93 ShadowRoot* m_next; 87 94 bool m_applyAuthorSheets : 1; 88 95 bool m_needsRecalculateContent : 1;
Note: See TracChangeset
for help on using the changeset viewer.