WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Fixed some bug
bug-73961-20111206165611.patch (text/plain), 9.55 KB, created by
Ryosuke Niwa
on 2011-12-06 16:56:12 PST
(
hide
)
Description:
Fixed some bug
Filename:
MIME Type:
Creator:
Ryosuke Niwa
Created:
2011-12-06 16:56:12 PST
Size:
9.55 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 102188) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,26 @@ >+2011-12-06 Ryosuke Niwa <rniwa@webkit.org> >+ >+ The code to create a NodeListsNodeData is duplicated everywhere >+ https://bugs.webkit.org/show_bug.cgi?id=73961 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Extracted the logic to create NodeListsNodeData as NodeRareData::ensureNodeLists. >+ >+ * dom/Document.cpp: >+ (WebCore::Document::getItems): >+ * dom/Node.cpp: >+ (WebCore::Node::childNodes): >+ (WebCore::Node::registerDynamicNodeList): >+ (WebCore::Node::getElementsByTagName): >+ (WebCore::Node::getElementsByTagNameNS): >+ (WebCore::Node::getElementsByName): >+ (WebCore::Node::getElementsByClassName): >+ * dom/NodeRareData.h: >+ (WebCore::NodeRareData::ensureNodeLists): >+ * html/HTMLFormControlElement.cpp: >+ (WebCore::HTMLFormControlElement::labels): >+ > 2011-12-06 Luke Macpherson <macpherson@chromium.org> > > Implement remaining border-image and webkit-maskbox-image properties in CSSStyleApplyProperty. >Index: Source/WebCore/dom/Document.cpp >=================================================================== >--- Source/WebCore/dom/Document.cpp (revision 102183) >+++ Source/WebCore/dom/Document.cpp (working copy) >@@ -5156,17 +5156,13 @@ DocumentLoader* Document::loader() const > #if ENABLE(MICRODATA) > PassRefPtr<NodeList> Document::getItems(const String& typeNames) > { >- NodeRareData* data = ensureRareData(); >- if (!data->nodeLists()) { >- data->setNodeLists(NodeListsNodeData::create()); >- treeScope()->addNodeListCache(); >- } >+ NodeListsNodeData* nodeLists = ensureRareData()->ensureNodeLists(); > > // Since documet.getItem() is allowed for microdata, typeNames will be null string. > // In this case we need to create an unique string identifier to map such request in the cache. > String localTypeNames = typeNames.isNull() ? String("http://webkit.org/microdata/undefinedItemType") : typeNames; > >- pair<NodeListsNodeData::MicroDataItemListCache::iterator, bool> result = data->nodeLists()->m_microDataItemListCache.add(localTypeNames, 0); >+ pair<NodeListsNodeData::MicroDataItemListCache::iterator, bool> result = nodeLists->m_microDataItemListCache.add(localTypeNames, 0); > if (!result.second) > return PassRefPtr<NodeList>(result.first->second); > >Index: Source/WebCore/dom/Node.cpp >=================================================================== >--- Source/WebCore/dom/Node.cpp (revision 102183) >+++ Source/WebCore/dom/Node.cpp (working copy) >@@ -623,16 +623,10 @@ void Node::setNodeValue(const String& /* > > PassRefPtr<NodeList> Node::childNodes() > { >- NodeRareData* data = ensureRareData(); >- if (!data->nodeLists()) { >- data->setNodeLists(NodeListsNodeData::create()); >- if (treeScope()) >- treeScope()->addNodeListCache(); >- } >- >- if (!data->nodeLists()->m_childNodeListCaches) >- data->nodeLists()->m_childNodeListCaches = DynamicNodeList::Caches::create(); >- return ChildNodeList::create(this, data->nodeLists()->m_childNodeListCaches.get()); >+ NodeListsNodeData* nodeLists = ensureRareData()->ensureNodeLists(this); >+ if (!nodeLists->m_childNodeListCaches) >+ nodeLists->m_childNodeListCaches = DynamicNodeList::Caches::create(); >+ return ChildNodeList::create(this, nodeLists->m_childNodeListCaches.get()); > } > > Node *Node::lastDescendant() const >@@ -1005,16 +999,12 @@ unsigned Node::nodeIndex() const > void Node::registerDynamicNodeList(DynamicNodeList* list) > { > NodeRareData* data = ensureRareData(); >- if (!data->nodeLists()) { >- data->setNodeLists(NodeListsNodeData::create()); >- treeScope()->addNodeListCache(); >- } else if (!treeScope() || !treeScope()->hasNodeListCaches()) { >- // We haven't been receiving notifications while there were no registered lists, so the cache is invalid now. >+ // We haven't been receiving notifications while there were no registered lists, so the cache is invalid now. >+ if (data->nodeLists() && (!treeScope() || !treeScope()->hasNodeListCaches())) > data->nodeLists()->invalidateCaches(); >- } > > if (list->hasOwnCaches()) >- data->nodeLists()->m_listsWithCaches.add(list); >+ data->ensureNodeLists(this)->m_listsWithCaches.add(list); > } > > void Node::unregisterDynamicNodeList(DynamicNodeList* list) >@@ -1667,19 +1657,13 @@ PassRefPtr<NodeList> Node::getElementsBy > if (localName.isNull()) > return 0; > >- NodeRareData* data = ensureRareData(); >- if (!data->nodeLists()) { >- data->setNodeLists(NodeListsNodeData::create()); >- treeScope()->addNodeListCache(); >- } >- > String name = localName; > if (document()->isHTMLDocument()) > name = localName.lower(); > > AtomicString localNameAtom = name; > >- pair<NodeListsNodeData::TagNodeListCache::iterator, bool> result = data->nodeLists()->m_tagNodeListCache.add(localNameAtom, 0); >+ pair<NodeListsNodeData::TagNodeListCache::iterator, bool> result = ensureRareData()->ensureNodeLists(this)->m_tagNodeListCache.add(localNameAtom, 0); > if (!result.second) > return PassRefPtr<TagNodeList>(result.first->second); > >@@ -1696,19 +1680,14 @@ PassRefPtr<NodeList> Node::getElementsBy > if (namespaceURI == starAtom) > return getElementsByTagName(localName); > >- NodeRareData* data = ensureRareData(); >- if (!data->nodeLists()) { >- data->setNodeLists(NodeListsNodeData::create()); >- treeScope()->addNodeListCache(); >- } >- > String name = localName; > if (document()->isHTMLDocument()) > name = localName.lower(); > > AtomicString localNameAtom = name; > >- pair<NodeListsNodeData::TagNodeListCacheNS::iterator, bool> result = data->nodeLists()->m_tagNodeListCacheNS.add(QualifiedName(nullAtom, localNameAtom, namespaceURI).impl(), 0); >+ pair<NodeListsNodeData::TagNodeListCacheNS::iterator, bool> result >+ = ensureRareData()->ensureNodeLists(this)->m_tagNodeListCacheNS.add(QualifiedName(nullAtom, localNameAtom, namespaceURI).impl(), 0); > if (!result.second) > return PassRefPtr<TagNodeList>(result.first->second); > >@@ -1719,13 +1698,7 @@ PassRefPtr<NodeList> Node::getElementsBy > > PassRefPtr<NodeList> Node::getElementsByName(const String& elementName) > { >- NodeRareData* data = ensureRareData(); >- if (!data->nodeLists()) { >- data->setNodeLists(NodeListsNodeData::create()); >- treeScope()->addNodeListCache(); >- } >- >- pair<NodeListsNodeData::NameNodeListCache::iterator, bool> result = data->nodeLists()->m_nameNodeListCache.add(elementName, 0); >+ pair<NodeListsNodeData::NameNodeListCache::iterator, bool> result = ensureRareData()->ensureNodeLists(this)->m_nameNodeListCache.add(elementName, 0); > if (!result.second) > return PassRefPtr<NodeList>(result.first->second); > >@@ -1736,13 +1709,8 @@ PassRefPtr<NodeList> Node::getElementsBy > > PassRefPtr<NodeList> Node::getElementsByClassName(const String& classNames) > { >- NodeRareData* data = ensureRareData(); >- if (!data->nodeLists()) { >- data->setNodeLists(NodeListsNodeData::create()); >- treeScope()->addNodeListCache(); >- } >- >- pair<NodeListsNodeData::ClassNodeListCache::iterator, bool> result = data->nodeLists()->m_classNodeListCache.add(classNames, 0); >+ pair<NodeListsNodeData::ClassNodeListCache::iterator, bool> result >+ = ensureRareData()->ensureNodeLists(this)->m_classNodeListCache.add(classNames, 0); > if (!result.second) > return PassRefPtr<NodeList>(result.first->second); > >Index: Source/WebCore/dom/NodeRareData.h >=================================================================== >--- Source/WebCore/dom/NodeRareData.h (revision 102183) >+++ Source/WebCore/dom/NodeRareData.h (working copy) >@@ -126,6 +126,16 @@ public: > void clearNodeLists() { m_nodeLists.clear(); } > void setNodeLists(PassOwnPtr<NodeListsNodeData> lists) { m_nodeLists = lists; } > NodeListsNodeData* nodeLists() const { return m_nodeLists.get(); } >+ NodeListsNodeData* ensureNodeLists(Node* node) >+ { >+ ASSERT(node); >+ if (!m_nodeLists) { >+ setNodeLists(NodeListsNodeData::create()); >+ if (TreeScope* treeScope = node->treeScope()) >+ treeScope->addNodeListCache(); >+ } >+ return m_nodeLists.get(); >+ } > > short tabIndex() const { return m_tabIndex; } > void setTabIndexExplicitly(short index) { m_tabIndex = index; m_tabIndexWasSetExplicitly = true; } >Index: Source/WebCore/html/HTMLFormControlElement.cpp >=================================================================== >--- Source/WebCore/html/HTMLFormControlElement.cpp (revision 102183) >+++ Source/WebCore/html/HTMLFormControlElement.cpp (working copy) >@@ -492,17 +492,12 @@ PassRefPtr<NodeList> HTMLFormControlElem > if (!document()) > return 0; > >- NodeRareData* data = Node::ensureRareData(); >- if (!data->nodeLists()) { >- data->setNodeLists(NodeListsNodeData::create()); >- treeScope()->addNodeListCache(); >- } >- >- if (data->nodeLists()->m_labelsNodeListCache) >- return data->nodeLists()->m_labelsNodeListCache; >+ NodeListsNodeData* nodeLists = Node::ensureRareData()->ensureNodeLists(this); >+ if (nodeLists->m_labelsNodeListCache) >+ return nodeLists->m_labelsNodeListCache; > > RefPtr<LabelsNodeList> list = LabelsNodeList::create(this); >- data->nodeLists()->m_labelsNodeListCache = list.get(); >+ nodeLists->m_labelsNodeListCache = list.get(); > return list.release(); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
darin
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 73961
:
118139
| 118143