Changeset 91235 in webkit
- Timestamp:
- Jul 18, 2011 7:55:22 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r91078 r91235 1 2011-07-18 MORITA Hajime <morrita@google.com> 2 3 [ShadowContentElement] forwarded node should be able to access its hosting content element. 4 https://bugs.webkit.org/show_bug.cgi?id=64251 5 6 Reviewed by Dimitri Glazkov. 7 8 Added GTK symbols for new window.internals methods. 9 10 * Source/autotools/symbols.filter: 11 1 12 2011-07-15 Martin Robinson <mrobinson@igalia.com> 2 13 -
trunk/LayoutTests/ChangeLog
r91234 r91235 1 2011-07-18 MORITA Hajime <morrita@google.com> 2 3 [ShadowContentElement] forwarded node should be able to access its hosting content element. 4 https://bugs.webkit.org/show_bug.cgi?id=64251 5 6 Reviewed by Dimitri Glazkov. 7 8 - Added a new test. 9 - Updated expectations. This change make ShadowContentElement availability on NodeRenderingContext 10 more strict. that makes some redundant node disappeared. 11 12 * fast/dom/shadow/content-element-includer-expected.txt: Added. 13 * fast/dom/shadow/content-element-includer.html: Added. 14 * platform/chromium-win/fast/html/details-nested-2-expected.txt: 15 * platform/gtk/fast/html/details-nested-2-expected.txt: 16 * platform/mac/fast/html/details-nested-2-expected.txt: 17 * platform/qt/fast/html/details-nested-2-expected.txt: 18 1 19 2011-07-18 Ryosuke Niwa <rniwa@webkit.org> 2 20 -
trunk/LayoutTests/platform/chromium-win/fast/html/details-nested-2-expected.txt
r90987 r91235 10 10 text run at (24,8) width 4: " " 11 11 text run at (28,8) width 54: "summary" 12 RenderBlock (anonymous) at (8,44) size 768x013 12 RenderDetails {DETAILS} at (8,44) size 768x72 [border: (8px solid #995555)] 14 13 RenderSummary {SUMMARY} at (8,8) size 752x36 [border: (8px solid #CC9999)] -
trunk/LayoutTests/platform/gtk/fast/html/details-nested-2-expected.txt
r90987 r91235 10 10 text run at (24,8) width 4: " " 11 11 text run at (28,8) width 58: "summary" 12 RenderBlock (anonymous) at (8,43) size 768x013 12 RenderDetails {DETAILS} at (8,43) size 768x70 [border: (8px solid #995555)] 14 13 RenderSummary {SUMMARY} at (8,8) size 752x35 [border: (8px solid #CC9999)] -
trunk/LayoutTests/platform/mac/fast/html/details-nested-2-expected.txt
r90987 r91235 10 10 text run at (24,8) width 4: " " 11 11 text run at (28,8) width 58: "summary" 12 RenderBlock (anonymous) at (8,42) size 768x013 12 RenderDetails {DETAILS} at (8,42) size 768x68 [border: (8px solid #995555)] 14 13 RenderSummary {SUMMARY} at (8,8) size 752x34 [border: (8px solid #CC9999)] -
trunk/LayoutTests/platform/qt/fast/html/details-nested-2-expected.txt
r90987 r91235 10 10 text run at (24,8) width 4: " " 11 11 text run at (28,8) width 64: "summary" 12 RenderBlock (anonymous) at (8,46) size 768x013 12 RenderDetails {DETAILS} at (8,46) size 768x76 [border: (8px solid #995555)] 14 13 RenderSummary {SUMMARY} at (8,8) size 752x38 [border: (8px solid #CC9999)] -
trunk/Source/WebCore/ChangeLog
r91232 r91235 1 2011-07-18 MORITA Hajime <morrita@google.com> 2 3 [ShadowContentElement] forwarded node should be able to access its hosting content element. 4 https://bugs.webkit.org/show_bug.cgi?id=64251 5 6 Reviewed by Dimitri Glazkov. 7 8 - Introduced ShadowInclusionSet to manage included nodes to its includer content element. 9 ShadowInclusionSet instance is owned by ShadowRoot. 10 - Updated the set on inclusion list changes. 11 - Used the set to retrieve the content element of NodeRenderingContext. 12 13 There are also related refactoring and cleanup: 14 - Renamed NodeRenderingContext::m_contentElement to m_includer 15 - ShadowContentSelector::m_activeElement is no longer used, thus removed. 16 17 Test: fast/dom/shadow/content-element-includer.html 18 19 * WebCore.exp.in: 20 * dom/NodeRenderingContext.cpp: 21 (WebCore::NodeRenderingContext::NodeRenderingContext): 22 (WebCore::NodeRenderingContext::nextRenderer): 23 (WebCore::NodeRenderingContext::previousRenderer): 24 * dom/NodeRenderingContext.h: 25 (WebCore::NodeRenderingContext::includer): 26 * dom/ShadowContentElement.cpp: 27 (WebCore::removeFromSet): 28 (WebCore::addToSet): 29 (WebCore::ShadowContentElement::attach): 30 (WebCore::ShadowContentElement::detach): 31 * dom/ShadowContentElement.h: 32 (WebCore::ShadowInclusionSet::add): 33 (WebCore::ShadowInclusionSet::remove): 34 (WebCore::ShadowInclusionSet::isEmpty): 35 (WebCore::ShadowInclusionSet::Translator::hash): 36 (WebCore::ShadowInclusionSet::Translator::equal): 37 (WebCore::ShadowInclusionSet::Hash::hash): 38 (WebCore::ShadowInclusionSet::Hash::equal): 39 (WebCore::ShadowInclusionSet::find): 40 * dom/ShadowContentSelector.cpp: 41 (WebCore::ShadowContentSelector::ShadowContentSelector): 42 (WebCore::ShadowContentSelector::selectInclusion): 43 * dom/ShadowContentSelector.h: 44 * dom/ShadowRoot.cpp: 45 (WebCore::ShadowRoot::~ShadowRoot): 46 (WebCore::ShadowRoot::includerFor): 47 (WebCore::ShadowRoot::inclusions): 48 (WebCore::ShadowRoot::ensureInclusions): 49 * dom/ShadowRoot.h: 50 (WebCore::toShadowRoot): 51 * testing/Internals.cpp: 52 (WebCore::Internals::includerFor): 53 * testing/Internals.h: 54 * testing/Internals.idl: 55 1 56 2011-07-18 Dean Jackson <dino@apple.com> 2 57 -
trunk/Source/WebCore/WebCore.exp.in
r91198 r91235 542 542 __ZN7WebCore19TextResourceDecoderD1Ev 543 543 __ZN7WebCore19applicationIsSafariEv 544 __ZN7WebCore20NodeRenderingContextC1EPNS_4NodeE 545 __ZN7WebCore20NodeRenderingContextD1Ev 544 546 __ZN7WebCore20RenderEmbeddedObject30setShowsCrashedPluginIndicatorEv 545 547 __ZN7WebCore20ResourceResponseBase24setExpectedContentLengthEx -
trunk/Source/WebCore/dom/NodeRenderingContext.cpp
r90987 r91235 42 42 , m_parentNodeForRenderingAndStyle(0) 43 43 , m_visualParentShadowRoot(0) 44 , m_ contentElement(0)44 , m_includer(0) 45 45 , m_style(0) 46 46 { … … 61 61 62 62 if (m_visualParentShadowRoot) { 63 if ((m_ contentElement = m_visualParentShadowRoot->activeContentElement())) {63 if ((m_includer = m_visualParentShadowRoot->includerFor(m_node))) { 64 64 m_phase = AttachContentForwarded; 65 m_parentNodeForRenderingAndStyle = NodeRenderingContext(m_ contentElement).parentNodeForRenderingAndStyle();65 m_parentNodeForRenderingAndStyle = NodeRenderingContext(m_includer).parentNodeForRenderingAndStyle(); 66 66 return; 67 67 } … … 82 82 , m_parentNodeForRenderingAndStyle(0) 83 83 , m_visualParentShadowRoot(0) 84 , m_ contentElement(0)84 , m_includer(0) 85 85 , m_style(style) 86 86 { … … 156 156 157 157 if (m_phase == AttachContentForwarded) { 158 if (RenderObject* found = nextRendererOf(m_ contentElement, m_node))158 if (RenderObject* found = nextRendererOf(m_includer, m_node)) 159 159 return found; 160 return NodeRenderingContext(m_ contentElement).nextRenderer();160 return NodeRenderingContext(m_includer).nextRenderer(); 161 161 } 162 162 … … 185 185 186 186 if (m_phase == AttachContentForwarded) { 187 if (RenderObject* found = previousRendererOf(m_ contentElement, m_node))187 if (RenderObject* found = previousRendererOf(m_includer, m_node)) 188 188 return found; 189 return NodeRenderingContext(m_ contentElement).previousRenderer();189 return NodeRenderingContext(m_includer).previousRenderer(); 190 190 } 191 191 -
trunk/Source/WebCore/dom/NodeRenderingContext.h
r90987 r91235 51 51 RenderObject* nextRenderer() const; 52 52 RenderObject* previousRenderer() const; 53 ShadowContentElement* includer() const; 53 54 54 55 RenderStyle* style() const; … … 80 81 ContainerNode* m_parentNodeForRenderingAndStyle; 81 82 ShadowRoot* m_visualParentShadowRoot; 82 ShadowContentElement* m_ contentElement;83 ShadowContentElement* m_includer; 83 84 RefPtr<RenderStyle> m_style; 84 85 }; … … 98 99 { 99 100 return m_style.get(); 101 } 102 103 inline ShadowContentElement* NodeRenderingContext::includer() const 104 { 105 return m_includer; 100 106 } 101 107 -
trunk/Source/WebCore/dom/ShadowContentElement.cpp
r90987 r91235 30 30 #include "HTMLNames.h" 31 31 #include "ShadowContentSelector.h" 32 #include "ShadowRoot.h" 32 33 33 34 namespace WebCore { … … 98 99 } 99 100 100 101 101 PassRefPtr<ShadowContentElement> ShadowContentElement::create(Document* document) 102 102 { … … 114 114 } 115 115 116 static void removeFromSet(ShadowInclusionList* list, ShadowInclusionSet* set) 117 { 118 for (ShadowInclusion* inclusion = list->first(); inclusion; inclusion = inclusion->next()) 119 set->remove(inclusion); 120 } 121 122 static void addToSet(ShadowInclusionList* list, ShadowInclusionSet* set) 123 { 124 for (ShadowInclusion* inclusion = list->first(); inclusion; inclusion = inclusion->next()) 125 set->add(inclusion); 126 } 127 116 128 void ShadowContentElement::attach() 117 129 { … … 119 131 StyledElement::attach(); 120 132 if (ShadowContentSelector* selector = ShadowContentSelector::currentInstance()) { 121 selector->willAttachContentFor(this); 122 selector->selectInclusion(&m_inclusions); 133 134 removeFromSet(&m_inclusions, selector->shadowRoot()->ensureInclusions()); 135 m_inclusions.clear(); 136 selector->selectInclusion(this, &m_inclusions); 137 addToSet(&m_inclusions, selector->shadowRoot()->ensureInclusions()); 138 123 139 for (ShadowInclusion* inclusion = m_inclusions.first(); inclusion; inclusion = inclusion->next()) 124 140 inclusion->content()->detach(); 125 141 for (ShadowInclusion* inclusion = m_inclusions.first(); inclusion; inclusion = inclusion->next()) 126 142 inclusion->content()->attach(); 127 selector->didAttachContent();128 143 } 129 144 } … … 131 146 void ShadowContentElement::detach() 132 147 { 133 m_inclusions.clear(); 148 if (ShadowRoot* root = toShadowRoot(shadowTreeRootNode())) { 149 removeFromSet(&m_inclusions, root->ensureInclusions()); 150 m_inclusions.clear(); 151 } 152 153 ASSERT(m_inclusions.isEmpty()); 134 154 StyledElement::detach(); 135 155 } -
trunk/Source/WebCore/dom/ShadowContentElement.h
r90987 r91235 34 34 #include "StyledElement.h" 35 35 #include <wtf/Forward.h> 36 #include <wtf/HashSet.h> 36 37 37 38 namespace WebCore { … … 67 68 } 68 69 69 70 70 class ShadowInclusionList { 71 71 public: … … 92 92 } 93 93 94 class ShadowInclusionSet { 95 public: 96 void add(ShadowInclusion* value) { m_set.add(value); } 97 void remove(ShadowInclusion* value) { m_set.remove(value); } 98 bool isEmpty() const { return m_set.isEmpty(); } 99 ShadowInclusion* find(Node* key) const; 100 101 private: 102 struct Translator { 103 public: 104 static unsigned hash(const Node* key) { return PtrHash<const Node*>::hash(key); } 105 static bool equal(const ShadowInclusion* inclusion, const Node* content) { return inclusion->content() == content; } 106 }; 107 108 struct Hash { 109 static unsigned hash(ShadowInclusion* key) { return PtrHash<const Node*>::hash(key->content()); } 110 static bool equal(ShadowInclusion* a, ShadowInclusion* b) { return a->content() == b->content(); } 111 static const bool safeToCompareToEmptyOrDeleted = false; 112 }; 113 114 typedef HashSet<ShadowInclusion*, Hash> PointerSet; 115 116 PointerSet m_set; 117 }; 118 119 inline ShadowInclusion* ShadowInclusionSet::find(Node* key) const 120 { 121 PointerSet::iterator found = m_set.find<Node*, ShadowInclusionSet::Translator>(key); 122 return found != m_set.end() ? *found : 0; 123 } 94 124 95 125 // NOTE: Current implementation doesn't support dynamic insertion/deletion of ShadowContentElement. -
trunk/Source/WebCore/dom/ShadowContentSelector.cpp
r90987 r91235 39 39 : m_parent(s_currentInstance) 40 40 , m_shadowRoot(shadowRoot) 41 , m_activeElement(0)42 41 { 43 42 s_currentInstance = this; … … 52 51 } 53 52 54 void ShadowContentSelector::selectInclusion(Shadow InclusionList* inclusions)53 void ShadowContentSelector::selectInclusion(ShadowContentElement* contentElement, ShadowInclusionList* inclusions) 55 54 { 56 inclusions->clear();55 ASSERT(inclusions->isEmpty()); 57 56 58 57 for (size_t i = 0; i < m_children.size(); ++i) { … … 60 59 if (!child) 61 60 continue; 62 if (! m_activeElement->shouldInclude(child))61 if (!contentElement->shouldInclude(child)) 63 62 continue; 64 63 65 inclusions->append( m_activeElement, child);64 inclusions->append(contentElement, child); 66 65 m_children[i] = 0; 67 66 } 68 69 }70 71 void ShadowContentSelector::willAttachContentFor(ShadowContentElement* element)72 {73 ASSERT(!m_activeElement);74 m_activeElement = element;75 }76 77 void ShadowContentSelector::didAttachContent()78 {79 ASSERT(m_activeElement);80 m_activeElement = 0;81 }82 83 ShadowContentElement* ShadowContentSelector::activeElement() const84 {85 return m_activeElement;86 67 } 87 68 -
trunk/Source/WebCore/dom/ShadowContentSelector.h
r90987 r91235 50 50 ~ShadowContentSelector(); 51 51 52 void willAttachContentFor(ShadowContentElement*); 53 void didAttachContent(); 54 void selectInclusion(ShadowInclusionList*); 52 void selectInclusion(ShadowContentElement*, ShadowInclusionList*); 55 53 56 54 ShadowRoot* shadowRoot() const { return m_shadowRoot; } 57 ShadowContentElement* activeElement() const;58 55 static ShadowContentSelector* currentInstance() { return s_currentInstance; } 59 56 … … 61 58 ShadowContentSelector* m_parent; 62 59 ShadowRoot* m_shadowRoot; 63 ShadowContentElement* m_activeElement;64 60 Vector<RefPtr<Node> > m_children; 65 61 -
trunk/Source/WebCore/dom/ShadowRoot.cpp
r90987 r91235 31 31 #include "Document.h" 32 32 #include "NodeRareData.h" 33 #include "ShadowContentElement.h" 33 34 #include "ShadowContentSelector.h" 34 35 … … 50 51 ShadowRoot::~ShadowRoot() 51 52 { 53 ASSERT(!m_inclusions || m_inclusions->isEmpty()); 52 54 } 53 55 … … 96 98 } 97 99 98 ShadowContentElement* ShadowRoot:: activeContentElement()100 ShadowContentElement* ShadowRoot::includerFor(Node* node) const 99 101 { 100 ShadowContentSelector* selector = ShadowContentSelector::currentInstance(); 101 if (!selector || selector->shadowRoot() != this) 102 if (!m_inclusions) 102 103 return 0; 103 return selector->activeElement(); 104 ShadowInclusion* found = m_inclusions->find(node); 105 if (!found) 106 return 0; 107 return found->includer(); 104 108 } 105 109 … … 138 142 } 139 143 144 ShadowInclusionSet* ShadowRoot::inclusions() const 145 { 146 return m_inclusions.get(); 140 147 } 148 149 ShadowInclusionSet* ShadowRoot::ensureInclusions() 150 { 151 if (!m_inclusions) 152 m_inclusions = adoptPtr(new ShadowInclusionSet()); 153 return m_inclusions.get(); 154 } 155 156 157 } -
trunk/Source/WebCore/dom/ShadowRoot.h
r90987 r91235 34 34 class Document; 35 35 class ShadowContentElement; 36 class ShadowInclusionSet; 36 37 37 38 class ShadowRoot : public TreeScope { … … 41 42 virtual void recalcStyle(StyleChange = NoChange); 42 43 43 ShadowContentElement* activeContentElement();44 ShadowContentElement* includerFor(Node*) const; 44 45 void hostChildrenChanged(); 45 46 … … 48 49 virtual bool applyAuthorSheets() const; 49 50 void setApplyAuthorSheets(bool); 51 52 ShadowInclusionSet* inclusions() const; 53 ShadowInclusionSet* ensureInclusions(); 50 54 51 55 private: … … 61 65 62 66 bool m_applyAuthorSheets; 67 OwnPtr<ShadowInclusionSet> m_inclusions; 63 68 }; 64 69 … … 68 73 } 69 74 75 inline ShadowRoot* toShadowRoot(Node* node) 76 { 77 ASSERT(!node || node->nodeType() == Node::SHADOW_ROOT_NODE); 78 return static_cast<ShadowRoot*>(node); 79 } 80 70 81 } // namespace 71 82 -
trunk/Source/WebCore/testing/Internals.cpp
r90987 r91235 32 32 #include "ExceptionCode.h" 33 33 #include "InspectorController.h" 34 #include "NodeRenderingContext.h" 34 35 #include "Page.h" 35 36 #include "RenderTreeAsText.h" … … 116 117 } 117 118 119 Element* Internals::includerFor(Node* node, ExceptionCode& ec) 120 { 121 if (!node) { 122 ec = INVALID_ACCESS_ERR; 123 return 0; 124 } 125 126 return NodeRenderingContext(node).includer(); 127 } 128 118 129 String Internals::shadowPseudoId(Element* element, ExceptionCode& ec) 119 130 { -
trunk/Source/WebCore/testing/Internals.h
r90987 r91235 51 51 Node* shadowRoot(Element* host, ExceptionCode&); 52 52 void removeShadowRoot(Element* host, ExceptionCode&); 53 Element* includerFor(Node*, ExceptionCode&); 53 54 String shadowPseudoId(Element*, ExceptionCode&); 54 55 PassRefPtr<Element> createShadowContentElement(Document*, ExceptionCode&); -
trunk/Source/WebCore/testing/Internals.idl
r90987 r91235 33 33 Node ensureShadowRoot(in Element host) raises (DOMException); 34 34 Node shadowRoot(in Element host) raises (DOMException); 35 Element includerFor(in Node node) raises (DOMException); 35 36 void removeShadowRoot(in Element host) raises (DOMException); 36 37 DOMString shadowPseudoId(in Element element) raises (DOMException); -
trunk/Source/WebKit2/ChangeLog
r91232 r91235 1 2011-07-18 MORITA Hajime <morrita@google.com> 2 3 [ShadowContentElement] forwarded node should be able to access its hosting content element. 4 https://bugs.webkit.org/show_bug.cgi?id=64251 5 6 Reviewed by Dimitri Glazkov. 7 8 Exported additional symbols for window.internals object. 9 10 * win/WebKit2.def: 11 * win/WebKit2CFLite.def: 12 1 13 2011-07-18 Dean Jackson <dino@apple.com> 2 14 -
trunk/Source/WebKit2/win/WebKit2.def
r90987 r91235 136 136 137 137 ; Re-exports from WebCore for test harnesses 138 ??0NodeRenderingContext@WebCore@@QAE@PAVNode@1@@Z 139 ??1NodeRenderingContext@WebCore@@QAE@XZ 140 ?toNode@WebCore@@YAPAVNode@1@VJSValue@JSC@@@Z 138 141 ??0String@WTF@@QAE@PBD@Z 139 142 ??0String@WTF@@QAE@PB_W@Z -
trunk/Source/WebKit2/win/WebKit2CFLite.def
r90987 r91235 129 129 130 130 ; Re-exports from WebCore for test harnesses 131 ??0NodeRenderingContext@WebCore@@QAE@PAVNode@1@@Z 131 132 ??0String@WTF@@QAE@PBD@Z 132 133 ??0String@WTF@@QAE@PB_W@Z 134 ??1NodeRenderingContext@WebCore@@QAE@XZ 133 135 ?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBD@Z 134 136 ?addSlowCase@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PAVStringImpl@2@@Z … … 149 151 ?toElement@WebCore@@YAPAVElement@1@VJSValue@JSC@@@Z 150 152 ?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVNode@1@@Z 153 ?toNode@WebCore@@YAPAVNode@1@VJSValue@JSC@@@Z 151 154 ?virtualFunctionToPreventWeakVtable@JSDOMWrapper@WebCore@@MAEXXZ -
trunk/Source/autotools/symbols.filter
r90987 r91235 38 38 _ZN7WebCore17cacheDOMStructureEPNS_17JSDOMGlobalObjectEPN3JSC9StructureEPKNS2_9ClassInfoE; 39 39 _ZN7WebCore19InspectorController39setResourcesDataSizeLimitsFromInternalsEii; 40 _ZN7WebCore20NodeRenderingContextC1EPNS_4NodeE; 41 _ZN7WebCore20NodeRenderingContextD1Ev; 40 42 _ZN7WebCore20ShadowContentElement6createEPNS_8DocumentE; 41 43 _ZN7WebCore21getCachedDOMStructureEPNS_17JSDOMGlobalObjectEPKN3JSC9ClassInfoE; … … 44 46 _ZN7WebCore6JSNode3putEPN3JSC9ExecStateERKNS1_10IdentifierENS1_7JSValueERNS1_15PutPropertySlotE; 45 47 _ZN7WebCore6JSNode6s_infoE; 48 _ZN7WebCore6toNodeEN3JSC7JSValueE; 46 49 _ZN7WebCore7Element16ensureShadowRootEv; 47 50 _ZN7WebCore7Element16removeShadowRootEv;
Note: See TracChangeset
for help on using the changeset viewer.