|
|
Created:
6 years, 10 months ago by Inactive Modified:
6 years, 10 months ago CC:
blink-reviews, dglazkov+blink, adamk+blink_chromium.org Base URL:
svn://svn.chromium.org/blink/trunk Visibility:
Public. |
DescriptionBring back fast paths for HTMLTagCollection / ClassCollection's access
Bring back fast paths for HTMLTagCollection / ClassCollection's access.
Those were removed in r166263, when switching them from LiveNodeList to
HTMLCollection type. r166263 caused Dromaeo's dom-query test to regress by
~12% according to our build bots and this CL is an attempt to address the
issue. Locally, I see a 3-4% improvement on dom-query but I am hoping the
bots get better results.
R=arv, haraken, adamk
BUG=340325
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=166427
Patch Set 1 #Patch Set 2 : Rebase #
Total comments: 2
Patch Set 3 : Rebase #Messages
Total messages: 40 (0 generated)
I'll let abarth or haraken be the reviewer of this since my C++ skill is not nearly as good as theirs. https://codereview.chromium.org/138653004/diff/40001/Source/core/html/HTMLCol... File Source/core/html/HTMLCollection.cpp (right): https://codereview.chromium.org/138653004/diff/40001/Source/core/html/HTMLCol... Source/core/html/HTMLCollection.cpp:455: switch (type()) { Would it make sense to use virtual dispatch instead of switch?
In terms of correctness, LGTM. I'm not familiar with C++ either to consider more optimized code :)
I basically reintroduced the fast paths that were there before my CL. See bottom changes in: https://codereview.chromium.org/143453010/diff/230001/Source/core/html/HTMLCo... There is really nothing new.
https://codereview.chromium.org/138653004/diff/40001/Source/core/html/HTMLCol... File Source/core/html/HTMLCollection.cpp (right): https://codereview.chromium.org/138653004/diff/40001/Source/core/html/HTMLCol... Source/core/html/HTMLCollection.cpp:455: switch (type()) { On 2014/02/04 15:12:36, arv wrote: > Would it make sense to use virtual dispatch instead of switch? As this is hot code, I think we should avoid virtual calls. A switch is what was used before my CL that caused the regression so I am merely bringing it back.
LGTM This is a clear improvements in performance. If Adam comes and suggests something better later we can always make another CL.
The CQ bit was checked by ch.dumez@samsung.com
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/138653004/40001
The CQ bit was unchecked by commit-bot@chromium.org
Retried try job too often on linux_blink_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_blin...
CQ bit was unchecked on CL. Ignoring.
The CQ bit was checked by ch.dumez@samsung.com
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/138653004/40001
The CQ bit was unchecked by commit-bot@chromium.org
Failed to apply patch for Source/core/html/HTMLCollection.cpp: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file Source/core/html/HTMLCollection.cpp Hunk #2 succeeded at 458 (offset 6 lines). Hunk #3 FAILED at 478. 1 out of 3 hunks FAILED -- saving rejects to file Source/core/html/HTMLCollection.cpp.rej Patch: Source/core/html/HTMLCollection.cpp Index: Source/core/html/HTMLCollection.cpp diff --git a/Source/core/html/HTMLCollection.cpp b/Source/core/html/HTMLCollection.cpp index 14023c7a3d6aeb227faccedbeddf67341e1de004..f600f26df3cd81e9cef7a790188af1e5dee25bcd 100644 --- a/Source/core/html/HTMLCollection.cpp +++ b/Source/core/html/HTMLCollection.cpp @@ -269,6 +269,16 @@ template <> inline bool isMatchingElement(const HTMLCollection& htmlCollection, return false; } +template <> inline bool isMatchingElement(const ClassCollection& collection, const Element& element) +{ + return collection.elementMatches(element); +} + +template <> inline bool isMatchingElement(const HTMLTagCollection& collection, const Element& element) +{ + return collection.elementMatches(element); +} + template <> inline bool isMatchingElement(const LiveNodeList& nodeList, const Element& element) { return nodeList.nodeMatches(element); @@ -442,11 +452,18 @@ inline Element* nextMatchingChildElement(const HTMLCollection& nodeList, Element Element* HTMLCollection::traverseToFirstElement(const ContainerNode& root) const { - if (overridesItemAfter()) - return virtualItemAfter(0); - if (shouldOnlyIncludeDirectChildren()) - return firstMatchingChildElement(*this, root); - return firstMatchingElement(*this, root); + switch (type()) { + case HTMLTagCollectionType: + return firstMatchingElement(static_cast<const HTMLTagCollection&>(*this), root); + case ClassCollectionType: + return firstMatchingElement(static_cast<const ClassCollection&>(*this), root); + default: + if (overridesItemAfter()) + return virtualItemAfter(0); + if (shouldOnlyIncludeDirectChildren()) + return firstMatchingChildElement(*this, root); + return firstMatchingElement(*this, root); + } } inline Element* HTMLCollection::traverseNextElement(Element& previous, const ContainerNode& root) const @@ -461,23 +478,30 @@ inline Element* HTMLCollection::traverseNextElement(Element& previous, const Con Element* HTMLCollection::traverseForwardToOffset(unsigned offset, Node& currentElement, unsigned& currentOffset, const ContainerNode& root) const { ASSERT(currentOffset < offset); - if (overridesItemAfter()) { - Element* next = &toElement(currentElement); - while ((next = virtualItemAfter(next))) { - if (++currentOffset == offset) - return next; + switch (type()) { + case HTMLTagCollectionType: + return traverseMatchingElementsForwardToOffset(static_cast<const HTMLTagCollection&>(*this), offset, toElement(currentElement), currentOffset, root); + case ClassCollectionType: + return traverseMatchingElementsForwardToOffset(static_cast<const ClassCollection&>(*this), offset, toElement(currentElement), currentOffset, root); + default: + if (overridesItemAfter()) { + Element* next = &toElement(currentElement); + while ((next = virtualItemAfter(next))) { + if (++currentOffset == offset) + return next; + } + return 0; } - return 0; - } - if (shouldOnlyIncludeDirectChildren()) { - Element* next = &toElement(currentElement); - while ((next = nextMatchingChildElement(*this, *next, root))) { - if (++currentOffset == offset) - return next; + if (shouldOnlyIncludeDirectChildren()) { + Element* next = &toElement(currentElement); + while ((next = nextMatchingChildElement(*this, *next, root))) { + if (++currentOffset == offset) + return next; + } + return 0; } - return 0; + return traverseMatchingElementsForwardToOffset(*this, offset, toElement(currentElement), currentOffset, root); } - return traverseMatchingElementsForwardToOffset(*this, offset, toElement(currentElement), currentOffset, root); } Element* HTMLCollection::namedItem(const AtomicString& name) const
The CQ bit was checked by ch.dumez@samsung.com
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/138653004/300001
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/138653004/300001
Failed to apply patch for Source/core/html/HTMLCollection.cpp: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file Source/core/html/HTMLCollection.cpp Hunk #1 succeeded at 279 with fuzz 1 (offset 10 lines). Hunk #2 FAILED at 458. Hunk #3 FAILED at 477. 2 out of 3 hunks FAILED -- saving rejects to file Source/core/html/HTMLCollection.cpp.rej Patch: Source/core/html/HTMLCollection.cpp Index: Source/core/html/HTMLCollection.cpp diff --git a/Source/core/html/HTMLCollection.cpp b/Source/core/html/HTMLCollection.cpp index 4d2fbc0fea46e920e95ed2ce9a19118196f81a9a..12574b936ccf69480f342f8f8b7f4bbde8d46cb8 100644 --- a/Source/core/html/HTMLCollection.cpp +++ b/Source/core/html/HTMLCollection.cpp @@ -269,6 +269,16 @@ template <> inline bool isMatchingElement(const HTMLCollection& htmlCollection, return false; } +template <> inline bool isMatchingElement(const ClassCollection& collection, const Element& element) +{ + return collection.elementMatches(element); +} + +template <> inline bool isMatchingElement(const HTMLTagCollection& collection, const Element& element) +{ + return collection.elementMatches(element); +} + template <> inline bool isMatchingElement(const LiveNodeList& nodeList, const Element& element) { return nodeList.nodeMatches(element); @@ -448,11 +458,18 @@ inline Element* nextMatchingChildElement(const HTMLCollection& nodeList, Element Element* HTMLCollection::traverseToFirstElement(const ContainerNode& root) const { - if (overridesItemAfter()) - return virtualItemAfter(0); - if (shouldOnlyIncludeDirectChildren()) - return firstMatchingChildElement(*this, root); - return firstMatchingElement(*this, root); + switch (type()) { + case HTMLTagCollectionType: + return firstMatchingElement(static_cast<const HTMLTagCollection&>(*this), root); + case ClassCollectionType: + return firstMatchingElement(static_cast<const ClassCollection&>(*this), root); + default: + if (overridesItemAfter()) + return virtualItemAfter(0); + if (shouldOnlyIncludeDirectChildren()) + return firstMatchingChildElement(*this, root); + return firstMatchingElement(*this, root); + } } inline Element* HTMLCollection::traverseNextElement(Element& previous, const ContainerNode& root) const @@ -467,23 +484,30 @@ inline Element* HTMLCollection::traverseNextElement(Element& previous, const Con Element* HTMLCollection::traverseForwardToOffset(unsigned offset, Element& currentElement, unsigned& currentOffset, const ContainerNode& root) const { ASSERT(currentOffset < offset); - if (overridesItemAfter()) { - Element* next = ¤tElement; - while ((next = virtualItemAfter(next))) { - if (++currentOffset == offset) - return next; + switch (type()) { + case HTMLTagCollectionType: + return traverseMatchingElementsForwardToOffset(static_cast<const HTMLTagCollection&>(*this), offset, currentElement, currentOffset, root); + case ClassCollectionType: + return traverseMatchingElementsForwardToOffset(static_cast<const ClassCollection&>(*this), offset, currentElement, currentOffset, root); + default: + if (overridesItemAfter()) { + Element* next = ¤tElement; + while ((next = virtualItemAfter(next))) { + if (++currentOffset == offset) + return next; + } + return 0; } - return 0; - } - if (shouldOnlyIncludeDirectChildren()) { - Element* next = ¤tElement; - while ((next = nextMatchingChildElement(*this, *next, root))) { - if (++currentOffset == offset) - return next; + if (shouldOnlyIncludeDirectChildren()) { + Element* next = ¤tElement; + while ((next = nextMatchingChildElement(*this, *next, root))) { + if (++currentOffset == offset) + return next; + } + return 0; } - return 0; + return traverseMatchingElementsForwardToOffset(*this, offset, currentElement, currentOffset, root); } - return traverseMatchingElementsForwardToOffset(*this, offset, currentElement, currentOffset, root); } Element* HTMLCollection::namedItem(const AtomicString& name) const
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/138653004/300001
Failed to apply patch for Source/core/html/HTMLCollection.cpp: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file Source/core/html/HTMLCollection.cpp Hunk #1 succeeded at 279 with fuzz 1 (offset 10 lines). Hunk #2 FAILED at 458. Hunk #3 FAILED at 477. 2 out of 3 hunks FAILED -- saving rejects to file Source/core/html/HTMLCollection.cpp.rej Patch: Source/core/html/HTMLCollection.cpp Index: Source/core/html/HTMLCollection.cpp diff --git a/Source/core/html/HTMLCollection.cpp b/Source/core/html/HTMLCollection.cpp index 4d2fbc0fea46e920e95ed2ce9a19118196f81a9a..12574b936ccf69480f342f8f8b7f4bbde8d46cb8 100644 --- a/Source/core/html/HTMLCollection.cpp +++ b/Source/core/html/HTMLCollection.cpp @@ -269,6 +269,16 @@ template <> inline bool isMatchingElement(const HTMLCollection& htmlCollection, return false; } +template <> inline bool isMatchingElement(const ClassCollection& collection, const Element& element) +{ + return collection.elementMatches(element); +} + +template <> inline bool isMatchingElement(const HTMLTagCollection& collection, const Element& element) +{ + return collection.elementMatches(element); +} + template <> inline bool isMatchingElement(const LiveNodeList& nodeList, const Element& element) { return nodeList.nodeMatches(element); @@ -448,11 +458,18 @@ inline Element* nextMatchingChildElement(const HTMLCollection& nodeList, Element Element* HTMLCollection::traverseToFirstElement(const ContainerNode& root) const { - if (overridesItemAfter()) - return virtualItemAfter(0); - if (shouldOnlyIncludeDirectChildren()) - return firstMatchingChildElement(*this, root); - return firstMatchingElement(*this, root); + switch (type()) { + case HTMLTagCollectionType: + return firstMatchingElement(static_cast<const HTMLTagCollection&>(*this), root); + case ClassCollectionType: + return firstMatchingElement(static_cast<const ClassCollection&>(*this), root); + default: + if (overridesItemAfter()) + return virtualItemAfter(0); + if (shouldOnlyIncludeDirectChildren()) + return firstMatchingChildElement(*this, root); + return firstMatchingElement(*this, root); + } } inline Element* HTMLCollection::traverseNextElement(Element& previous, const ContainerNode& root) const @@ -467,23 +484,30 @@ inline Element* HTMLCollection::traverseNextElement(Element& previous, const Con Element* HTMLCollection::traverseForwardToOffset(unsigned offset, Element& currentElement, unsigned& currentOffset, const ContainerNode& root) const { ASSERT(currentOffset < offset); - if (overridesItemAfter()) { - Element* next = ¤tElement; - while ((next = virtualItemAfter(next))) { - if (++currentOffset == offset) - return next; + switch (type()) { + case HTMLTagCollectionType: + return traverseMatchingElementsForwardToOffset(static_cast<const HTMLTagCollection&>(*this), offset, currentElement, currentOffset, root); + case ClassCollectionType: + return traverseMatchingElementsForwardToOffset(static_cast<const ClassCollection&>(*this), offset, currentElement, currentOffset, root); + default: + if (overridesItemAfter()) { + Element* next = ¤tElement; + while ((next = virtualItemAfter(next))) { + if (++currentOffset == offset) + return next; + } + return 0; } - return 0; - } - if (shouldOnlyIncludeDirectChildren()) { - Element* next = ¤tElement; - while ((next = nextMatchingChildElement(*this, *next, root))) { - if (++currentOffset == offset) - return next; + if (shouldOnlyIncludeDirectChildren()) { + Element* next = ¤tElement; + while ((next = nextMatchingChildElement(*this, *next, root))) { + if (++currentOffset == offset) + return next; + } + return 0; } - return 0; + return traverseMatchingElementsForwardToOffset(*this, offset, currentElement, currentOffset, root); } - return traverseMatchingElementsForwardToOffset(*this, offset, currentElement, currentOffset, root); } Element* HTMLCollection::namedItem(const AtomicString& name) const
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/138653004/300001
Failed to apply patch for Source/core/html/HTMLCollection.cpp: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file Source/core/html/HTMLCollection.cpp Hunk #1 succeeded at 279 with fuzz 1 (offset 10 lines). Hunk #2 FAILED at 458. Hunk #3 FAILED at 477. 2 out of 3 hunks FAILED -- saving rejects to file Source/core/html/HTMLCollection.cpp.rej Patch: Source/core/html/HTMLCollection.cpp Index: Source/core/html/HTMLCollection.cpp diff --git a/Source/core/html/HTMLCollection.cpp b/Source/core/html/HTMLCollection.cpp index 4d2fbc0fea46e920e95ed2ce9a19118196f81a9a..12574b936ccf69480f342f8f8b7f4bbde8d46cb8 100644 --- a/Source/core/html/HTMLCollection.cpp +++ b/Source/core/html/HTMLCollection.cpp @@ -269,6 +269,16 @@ template <> inline bool isMatchingElement(const HTMLCollection& htmlCollection, return false; } +template <> inline bool isMatchingElement(const ClassCollection& collection, const Element& element) +{ + return collection.elementMatches(element); +} + +template <> inline bool isMatchingElement(const HTMLTagCollection& collection, const Element& element) +{ + return collection.elementMatches(element); +} + template <> inline bool isMatchingElement(const LiveNodeList& nodeList, const Element& element) { return nodeList.nodeMatches(element); @@ -448,11 +458,18 @@ inline Element* nextMatchingChildElement(const HTMLCollection& nodeList, Element Element* HTMLCollection::traverseToFirstElement(const ContainerNode& root) const { - if (overridesItemAfter()) - return virtualItemAfter(0); - if (shouldOnlyIncludeDirectChildren()) - return firstMatchingChildElement(*this, root); - return firstMatchingElement(*this, root); + switch (type()) { + case HTMLTagCollectionType: + return firstMatchingElement(static_cast<const HTMLTagCollection&>(*this), root); + case ClassCollectionType: + return firstMatchingElement(static_cast<const ClassCollection&>(*this), root); + default: + if (overridesItemAfter()) + return virtualItemAfter(0); + if (shouldOnlyIncludeDirectChildren()) + return firstMatchingChildElement(*this, root); + return firstMatchingElement(*this, root); + } } inline Element* HTMLCollection::traverseNextElement(Element& previous, const ContainerNode& root) const @@ -467,23 +484,30 @@ inline Element* HTMLCollection::traverseNextElement(Element& previous, const Con Element* HTMLCollection::traverseForwardToOffset(unsigned offset, Element& currentElement, unsigned& currentOffset, const ContainerNode& root) const { ASSERT(currentOffset < offset); - if (overridesItemAfter()) { - Element* next = ¤tElement; - while ((next = virtualItemAfter(next))) { - if (++currentOffset == offset) - return next; + switch (type()) { + case HTMLTagCollectionType: + return traverseMatchingElementsForwardToOffset(static_cast<const HTMLTagCollection&>(*this), offset, currentElement, currentOffset, root); + case ClassCollectionType: + return traverseMatchingElementsForwardToOffset(static_cast<const ClassCollection&>(*this), offset, currentElement, currentOffset, root); + default: + if (overridesItemAfter()) { + Element* next = ¤tElement; + while ((next = virtualItemAfter(next))) { + if (++currentOffset == offset) + return next; + } + return 0; } - return 0; - } - if (shouldOnlyIncludeDirectChildren()) { - Element* next = ¤tElement; - while ((next = nextMatchingChildElement(*this, *next, root))) { - if (++currentOffset == offset) - return next; + if (shouldOnlyIncludeDirectChildren()) { + Element* next = ¤tElement; + while ((next = nextMatchingChildElement(*this, *next, root))) { + if (++currentOffset == offset) + return next; + } + return 0; } - return 0; + return traverseMatchingElementsForwardToOffset(*this, offset, currentElement, currentOffset, root); } - return traverseMatchingElementsForwardToOffset(*this, offset, currentElement, currentOffset, root); } Element* HTMLCollection::namedItem(const AtomicString& name) const
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/138653004/300001
Failed to apply patch for Source/core/html/HTMLCollection.cpp: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file Source/core/html/HTMLCollection.cpp Hunk #1 succeeded at 279 with fuzz 1 (offset 10 lines). Hunk #2 FAILED at 458. Hunk #3 FAILED at 477. 2 out of 3 hunks FAILED -- saving rejects to file Source/core/html/HTMLCollection.cpp.rej Patch: Source/core/html/HTMLCollection.cpp Index: Source/core/html/HTMLCollection.cpp diff --git a/Source/core/html/HTMLCollection.cpp b/Source/core/html/HTMLCollection.cpp index 4d2fbc0fea46e920e95ed2ce9a19118196f81a9a..12574b936ccf69480f342f8f8b7f4bbde8d46cb8 100644 --- a/Source/core/html/HTMLCollection.cpp +++ b/Source/core/html/HTMLCollection.cpp @@ -269,6 +269,16 @@ template <> inline bool isMatchingElement(const HTMLCollection& htmlCollection, return false; } +template <> inline bool isMatchingElement(const ClassCollection& collection, const Element& element) +{ + return collection.elementMatches(element); +} + +template <> inline bool isMatchingElement(const HTMLTagCollection& collection, const Element& element) +{ + return collection.elementMatches(element); +} + template <> inline bool isMatchingElement(const LiveNodeList& nodeList, const Element& element) { return nodeList.nodeMatches(element); @@ -448,11 +458,18 @@ inline Element* nextMatchingChildElement(const HTMLCollection& nodeList, Element Element* HTMLCollection::traverseToFirstElement(const ContainerNode& root) const { - if (overridesItemAfter()) - return virtualItemAfter(0); - if (shouldOnlyIncludeDirectChildren()) - return firstMatchingChildElement(*this, root); - return firstMatchingElement(*this, root); + switch (type()) { + case HTMLTagCollectionType: + return firstMatchingElement(static_cast<const HTMLTagCollection&>(*this), root); + case ClassCollectionType: + return firstMatchingElement(static_cast<const ClassCollection&>(*this), root); + default: + if (overridesItemAfter()) + return virtualItemAfter(0); + if (shouldOnlyIncludeDirectChildren()) + return firstMatchingChildElement(*this, root); + return firstMatchingElement(*this, root); + } } inline Element* HTMLCollection::traverseNextElement(Element& previous, const ContainerNode& root) const @@ -467,23 +484,30 @@ inline Element* HTMLCollection::traverseNextElement(Element& previous, const Con Element* HTMLCollection::traverseForwardToOffset(unsigned offset, Element& currentElement, unsigned& currentOffset, const ContainerNode& root) const { ASSERT(currentOffset < offset); - if (overridesItemAfter()) { - Element* next = ¤tElement; - while ((next = virtualItemAfter(next))) { - if (++currentOffset == offset) - return next; + switch (type()) { + case HTMLTagCollectionType: + return traverseMatchingElementsForwardToOffset(static_cast<const HTMLTagCollection&>(*this), offset, currentElement, currentOffset, root); + case ClassCollectionType: + return traverseMatchingElementsForwardToOffset(static_cast<const ClassCollection&>(*this), offset, currentElement, currentOffset, root); + default: + if (overridesItemAfter()) { + Element* next = ¤tElement; + while ((next = virtualItemAfter(next))) { + if (++currentOffset == offset) + return next; + } + return 0; } - return 0; - } - if (shouldOnlyIncludeDirectChildren()) { - Element* next = ¤tElement; - while ((next = nextMatchingChildElement(*this, *next, root))) { - if (++currentOffset == offset) - return next; + if (shouldOnlyIncludeDirectChildren()) { + Element* next = ¤tElement; + while ((next = nextMatchingChildElement(*this, *next, root))) { + if (++currentOffset == offset) + return next; + } + return 0; } - return 0; + return traverseMatchingElementsForwardToOffset(*this, offset, currentElement, currentOffset, root); } - return traverseMatchingElementsForwardToOffset(*this, offset, currentElement, currentOffset, root); } Element* HTMLCollection::namedItem(const AtomicString& name) const
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/138653004/300001
Failed to apply patch for Source/core/html/HTMLCollection.cpp: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file Source/core/html/HTMLCollection.cpp Hunk #1 succeeded at 279 with fuzz 1 (offset 10 lines). Hunk #2 FAILED at 458. Hunk #3 FAILED at 477. 2 out of 3 hunks FAILED -- saving rejects to file Source/core/html/HTMLCollection.cpp.rej Patch: Source/core/html/HTMLCollection.cpp Index: Source/core/html/HTMLCollection.cpp diff --git a/Source/core/html/HTMLCollection.cpp b/Source/core/html/HTMLCollection.cpp index 4d2fbc0fea46e920e95ed2ce9a19118196f81a9a..12574b936ccf69480f342f8f8b7f4bbde8d46cb8 100644 --- a/Source/core/html/HTMLCollection.cpp +++ b/Source/core/html/HTMLCollection.cpp @@ -269,6 +269,16 @@ template <> inline bool isMatchingElement(const HTMLCollection& htmlCollection, return false; } +template <> inline bool isMatchingElement(const ClassCollection& collection, const Element& element) +{ + return collection.elementMatches(element); +} + +template <> inline bool isMatchingElement(const HTMLTagCollection& collection, const Element& element) +{ + return collection.elementMatches(element); +} + template <> inline bool isMatchingElement(const LiveNodeList& nodeList, const Element& element) { return nodeList.nodeMatches(element); @@ -448,11 +458,18 @@ inline Element* nextMatchingChildElement(const HTMLCollection& nodeList, Element Element* HTMLCollection::traverseToFirstElement(const ContainerNode& root) const { - if (overridesItemAfter()) - return virtualItemAfter(0); - if (shouldOnlyIncludeDirectChildren()) - return firstMatchingChildElement(*this, root); - return firstMatchingElement(*this, root); + switch (type()) { + case HTMLTagCollectionType: + return firstMatchingElement(static_cast<const HTMLTagCollection&>(*this), root); + case ClassCollectionType: + return firstMatchingElement(static_cast<const ClassCollection&>(*this), root); + default: + if (overridesItemAfter()) + return virtualItemAfter(0); + if (shouldOnlyIncludeDirectChildren()) + return firstMatchingChildElement(*this, root); + return firstMatchingElement(*this, root); + } } inline Element* HTMLCollection::traverseNextElement(Element& previous, const ContainerNode& root) const @@ -467,23 +484,30 @@ inline Element* HTMLCollection::traverseNextElement(Element& previous, const Con Element* HTMLCollection::traverseForwardToOffset(unsigned offset, Element& currentElement, unsigned& currentOffset, const ContainerNode& root) const { ASSERT(currentOffset < offset); - if (overridesItemAfter()) { - Element* next = ¤tElement; - while ((next = virtualItemAfter(next))) { - if (++currentOffset == offset) - return next; + switch (type()) { + case HTMLTagCollectionType: + return traverseMatchingElementsForwardToOffset(static_cast<const HTMLTagCollection&>(*this), offset, currentElement, currentOffset, root); + case ClassCollectionType: + return traverseMatchingElementsForwardToOffset(static_cast<const ClassCollection&>(*this), offset, currentElement, currentOffset, root); + default: + if (overridesItemAfter()) { + Element* next = ¤tElement; + while ((next = virtualItemAfter(next))) { + if (++currentOffset == offset) + return next; + } + return 0; } - return 0; - } - if (shouldOnlyIncludeDirectChildren()) { - Element* next = ¤tElement; - while ((next = nextMatchingChildElement(*this, *next, root))) { - if (++currentOffset == offset) - return next; + if (shouldOnlyIncludeDirectChildren()) { + Element* next = ¤tElement; + while ((next = nextMatchingChildElement(*this, *next, root))) { + if (++currentOffset == offset) + return next; + } + return 0; } - return 0; + return traverseMatchingElementsForwardToOffset(*this, offset, currentElement, currentOffset, root); } - return traverseMatchingElementsForwardToOffset(*this, offset, currentElement, currentOffset, root); } Element* HTMLCollection::namedItem(const AtomicString& name) const
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/138653004/300001
Failed to apply patch for Source/core/html/HTMLCollection.cpp: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file Source/core/html/HTMLCollection.cpp Hunk #1 succeeded at 279 with fuzz 1 (offset 10 lines). Hunk #2 FAILED at 458. Hunk #3 FAILED at 477. 2 out of 3 hunks FAILED -- saving rejects to file Source/core/html/HTMLCollection.cpp.rej Patch: Source/core/html/HTMLCollection.cpp Index: Source/core/html/HTMLCollection.cpp diff --git a/Source/core/html/HTMLCollection.cpp b/Source/core/html/HTMLCollection.cpp index 4d2fbc0fea46e920e95ed2ce9a19118196f81a9a..12574b936ccf69480f342f8f8b7f4bbde8d46cb8 100644 --- a/Source/core/html/HTMLCollection.cpp +++ b/Source/core/html/HTMLCollection.cpp @@ -269,6 +269,16 @@ template <> inline bool isMatchingElement(const HTMLCollection& htmlCollection, return false; } +template <> inline bool isMatchingElement(const ClassCollection& collection, const Element& element) +{ + return collection.elementMatches(element); +} + +template <> inline bool isMatchingElement(const HTMLTagCollection& collection, const Element& element) +{ + return collection.elementMatches(element); +} + template <> inline bool isMatchingElement(const LiveNodeList& nodeList, const Element& element) { return nodeList.nodeMatches(element); @@ -448,11 +458,18 @@ inline Element* nextMatchingChildElement(const HTMLCollection& nodeList, Element Element* HTMLCollection::traverseToFirstElement(const ContainerNode& root) const { - if (overridesItemAfter()) - return virtualItemAfter(0); - if (shouldOnlyIncludeDirectChildren()) - return firstMatchingChildElement(*this, root); - return firstMatchingElement(*this, root); + switch (type()) { + case HTMLTagCollectionType: + return firstMatchingElement(static_cast<const HTMLTagCollection&>(*this), root); + case ClassCollectionType: + return firstMatchingElement(static_cast<const ClassCollection&>(*this), root); + default: + if (overridesItemAfter()) + return virtualItemAfter(0); + if (shouldOnlyIncludeDirectChildren()) + return firstMatchingChildElement(*this, root); + return firstMatchingElement(*this, root); + } } inline Element* HTMLCollection::traverseNextElement(Element& previous, const ContainerNode& root) const @@ -467,23 +484,30 @@ inline Element* HTMLCollection::traverseNextElement(Element& previous, const Con Element* HTMLCollection::traverseForwardToOffset(unsigned offset, Element& currentElement, unsigned& currentOffset, const ContainerNode& root) const { ASSERT(currentOffset < offset); - if (overridesItemAfter()) { - Element* next = ¤tElement; - while ((next = virtualItemAfter(next))) { - if (++currentOffset == offset) - return next; + switch (type()) { + case HTMLTagCollectionType: + return traverseMatchingElementsForwardToOffset(static_cast<const HTMLTagCollection&>(*this), offset, currentElement, currentOffset, root); + case ClassCollectionType: + return traverseMatchingElementsForwardToOffset(static_cast<const ClassCollection&>(*this), offset, currentElement, currentOffset, root); + default: + if (overridesItemAfter()) { + Element* next = ¤tElement; + while ((next = virtualItemAfter(next))) { + if (++currentOffset == offset) + return next; + } + return 0; } - return 0; - } - if (shouldOnlyIncludeDirectChildren()) { - Element* next = ¤tElement; - while ((next = nextMatchingChildElement(*this, *next, root))) { - if (++currentOffset == offset) - return next; + if (shouldOnlyIncludeDirectChildren()) { + Element* next = ¤tElement; + while ((next = nextMatchingChildElement(*this, *next, root))) { + if (++currentOffset == offset) + return next; + } + return 0; } - return 0; + return traverseMatchingElementsForwardToOffset(*this, offset, currentElement, currentOffset, root); } - return traverseMatchingElementsForwardToOffset(*this, offset, currentElement, currentOffset, root); } Element* HTMLCollection::namedItem(const AtomicString& name) const
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/138653004/300001
Failed to apply patch for Source/core/html/HTMLCollection.cpp: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file Source/core/html/HTMLCollection.cpp Hunk #1 succeeded at 279 with fuzz 1 (offset 10 lines). Hunk #2 FAILED at 458. Hunk #3 FAILED at 477. 2 out of 3 hunks FAILED -- saving rejects to file Source/core/html/HTMLCollection.cpp.rej Patch: Source/core/html/HTMLCollection.cpp Index: Source/core/html/HTMLCollection.cpp diff --git a/Source/core/html/HTMLCollection.cpp b/Source/core/html/HTMLCollection.cpp index 4d2fbc0fea46e920e95ed2ce9a19118196f81a9a..12574b936ccf69480f342f8f8b7f4bbde8d46cb8 100644 --- a/Source/core/html/HTMLCollection.cpp +++ b/Source/core/html/HTMLCollection.cpp @@ -269,6 +269,16 @@ template <> inline bool isMatchingElement(const HTMLCollection& htmlCollection, return false; } +template <> inline bool isMatchingElement(const ClassCollection& collection, const Element& element) +{ + return collection.elementMatches(element); +} + +template <> inline bool isMatchingElement(const HTMLTagCollection& collection, const Element& element) +{ + return collection.elementMatches(element); +} + template <> inline bool isMatchingElement(const LiveNodeList& nodeList, const Element& element) { return nodeList.nodeMatches(element); @@ -448,11 +458,18 @@ inline Element* nextMatchingChildElement(const HTMLCollection& nodeList, Element Element* HTMLCollection::traverseToFirstElement(const ContainerNode& root) const { - if (overridesItemAfter()) - return virtualItemAfter(0); - if (shouldOnlyIncludeDirectChildren()) - return firstMatchingChildElement(*this, root); - return firstMatchingElement(*this, root); + switch (type()) { + case HTMLTagCollectionType: + return firstMatchingElement(static_cast<const HTMLTagCollection&>(*this), root); + case ClassCollectionType: + return firstMatchingElement(static_cast<const ClassCollection&>(*this), root); + default: + if (overridesItemAfter()) + return virtualItemAfter(0); + if (shouldOnlyIncludeDirectChildren()) + return firstMatchingChildElement(*this, root); + return firstMatchingElement(*this, root); + } } inline Element* HTMLCollection::traverseNextElement(Element& previous, const ContainerNode& root) const @@ -467,23 +484,30 @@ inline Element* HTMLCollection::traverseNextElement(Element& previous, const Con Element* HTMLCollection::traverseForwardToOffset(unsigned offset, Element& currentElement, unsigned& currentOffset, const ContainerNode& root) const { ASSERT(currentOffset < offset); - if (overridesItemAfter()) { - Element* next = ¤tElement; - while ((next = virtualItemAfter(next))) { - if (++currentOffset == offset) - return next; + switch (type()) { + case HTMLTagCollectionType: + return traverseMatchingElementsForwardToOffset(static_cast<const HTMLTagCollection&>(*this), offset, currentElement, currentOffset, root); + case ClassCollectionType: + return traverseMatchingElementsForwardToOffset(static_cast<const ClassCollection&>(*this), offset, currentElement, currentOffset, root); + default: + if (overridesItemAfter()) { + Element* next = ¤tElement; + while ((next = virtualItemAfter(next))) { + if (++currentOffset == offset) + return next; + } + return 0; } - return 0; - } - if (shouldOnlyIncludeDirectChildren()) { - Element* next = ¤tElement; - while ((next = nextMatchingChildElement(*this, *next, root))) { - if (++currentOffset == offset) - return next; + if (shouldOnlyIncludeDirectChildren()) { + Element* next = ¤tElement; + while ((next = nextMatchingChildElement(*this, *next, root))) { + if (++currentOffset == offset) + return next; + } + return 0; } - return 0; + return traverseMatchingElementsForwardToOffset(*this, offset, currentElement, currentOffset, root); } - return traverseMatchingElementsForwardToOffset(*this, offset, currentElement, currentOffset, root); } Element* HTMLCollection::namedItem(const AtomicString& name) const
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/138653004/300001
Failed to apply patch for Source/core/html/HTMLCollection.cpp: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file Source/core/html/HTMLCollection.cpp Hunk #1 succeeded at 279 with fuzz 1 (offset 10 lines). Hunk #2 FAILED at 458. Hunk #3 FAILED at 477. 2 out of 3 hunks FAILED -- saving rejects to file Source/core/html/HTMLCollection.cpp.rej Patch: Source/core/html/HTMLCollection.cpp Index: Source/core/html/HTMLCollection.cpp diff --git a/Source/core/html/HTMLCollection.cpp b/Source/core/html/HTMLCollection.cpp index 4d2fbc0fea46e920e95ed2ce9a19118196f81a9a..12574b936ccf69480f342f8f8b7f4bbde8d46cb8 100644 --- a/Source/core/html/HTMLCollection.cpp +++ b/Source/core/html/HTMLCollection.cpp @@ -269,6 +269,16 @@ template <> inline bool isMatchingElement(const HTMLCollection& htmlCollection, return false; } +template <> inline bool isMatchingElement(const ClassCollection& collection, const Element& element) +{ + return collection.elementMatches(element); +} + +template <> inline bool isMatchingElement(const HTMLTagCollection& collection, const Element& element) +{ + return collection.elementMatches(element); +} + template <> inline bool isMatchingElement(const LiveNodeList& nodeList, const Element& element) { return nodeList.nodeMatches(element); @@ -448,11 +458,18 @@ inline Element* nextMatchingChildElement(const HTMLCollection& nodeList, Element Element* HTMLCollection::traverseToFirstElement(const ContainerNode& root) const { - if (overridesItemAfter()) - return virtualItemAfter(0); - if (shouldOnlyIncludeDirectChildren()) - return firstMatchingChildElement(*this, root); - return firstMatchingElement(*this, root); + switch (type()) { + case HTMLTagCollectionType: + return firstMatchingElement(static_cast<const HTMLTagCollection&>(*this), root); + case ClassCollectionType: + return firstMatchingElement(static_cast<const ClassCollection&>(*this), root); + default: + if (overridesItemAfter()) + return virtualItemAfter(0); + if (shouldOnlyIncludeDirectChildren()) + return firstMatchingChildElement(*this, root); + return firstMatchingElement(*this, root); + } } inline Element* HTMLCollection::traverseNextElement(Element& previous, const ContainerNode& root) const @@ -467,23 +484,30 @@ inline Element* HTMLCollection::traverseNextElement(Element& previous, const Con Element* HTMLCollection::traverseForwardToOffset(unsigned offset, Element& currentElement, unsigned& currentOffset, const ContainerNode& root) const { ASSERT(currentOffset < offset); - if (overridesItemAfter()) { - Element* next = ¤tElement; - while ((next = virtualItemAfter(next))) { - if (++currentOffset == offset) - return next; + switch (type()) { + case HTMLTagCollectionType: + return traverseMatchingElementsForwardToOffset(static_cast<const HTMLTagCollection&>(*this), offset, currentElement, currentOffset, root); + case ClassCollectionType: + return traverseMatchingElementsForwardToOffset(static_cast<const ClassCollection&>(*this), offset, currentElement, currentOffset, root); + default: + if (overridesItemAfter()) { + Element* next = ¤tElement; + while ((next = virtualItemAfter(next))) { + if (++currentOffset == offset) + return next; + } + return 0; } - return 0; - } - if (shouldOnlyIncludeDirectChildren()) { - Element* next = ¤tElement; - while ((next = nextMatchingChildElement(*this, *next, root))) { - if (++currentOffset == offset) - return next; + if (shouldOnlyIncludeDirectChildren()) { + Element* next = ¤tElement; + while ((next = nextMatchingChildElement(*this, *next, root))) { + if (++currentOffset == offset) + return next; + } + return 0; } - return 0; + return traverseMatchingElementsForwardToOffset(*this, offset, currentElement, currentOffset, root); } - return traverseMatchingElementsForwardToOffset(*this, offset, currentElement, currentOffset, root); } Element* HTMLCollection::namedItem(const AtomicString& name) const
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/138653004/300001
Failed to apply patch for Source/core/html/HTMLCollection.cpp: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file Source/core/html/HTMLCollection.cpp Hunk #1 succeeded at 279 with fuzz 1 (offset 10 lines). Hunk #2 FAILED at 458. Hunk #3 FAILED at 477. 2 out of 3 hunks FAILED -- saving rejects to file Source/core/html/HTMLCollection.cpp.rej Patch: Source/core/html/HTMLCollection.cpp Index: Source/core/html/HTMLCollection.cpp diff --git a/Source/core/html/HTMLCollection.cpp b/Source/core/html/HTMLCollection.cpp index 4d2fbc0fea46e920e95ed2ce9a19118196f81a9a..12574b936ccf69480f342f8f8b7f4bbde8d46cb8 100644 --- a/Source/core/html/HTMLCollection.cpp +++ b/Source/core/html/HTMLCollection.cpp @@ -269,6 +269,16 @@ template <> inline bool isMatchingElement(const HTMLCollection& htmlCollection, return false; } +template <> inline bool isMatchingElement(const ClassCollection& collection, const Element& element) +{ + return collection.elementMatches(element); +} + +template <> inline bool isMatchingElement(const HTMLTagCollection& collection, const Element& element) +{ + return collection.elementMatches(element); +} + template <> inline bool isMatchingElement(const LiveNodeList& nodeList, const Element& element) { return nodeList.nodeMatches(element); @@ -448,11 +458,18 @@ inline Element* nextMatchingChildElement(const HTMLCollection& nodeList, Element Element* HTMLCollection::traverseToFirstElement(const ContainerNode& root) const { - if (overridesItemAfter()) - return virtualItemAfter(0); - if (shouldOnlyIncludeDirectChildren()) - return firstMatchingChildElement(*this, root); - return firstMatchingElement(*this, root); + switch (type()) { + case HTMLTagCollectionType: + return firstMatchingElement(static_cast<const HTMLTagCollection&>(*this), root); + case ClassCollectionType: + return firstMatchingElement(static_cast<const ClassCollection&>(*this), root); + default: + if (overridesItemAfter()) + return virtualItemAfter(0); + if (shouldOnlyIncludeDirectChildren()) + return firstMatchingChildElement(*this, root); + return firstMatchingElement(*this, root); + } } inline Element* HTMLCollection::traverseNextElement(Element& previous, const ContainerNode& root) const @@ -467,23 +484,30 @@ inline Element* HTMLCollection::traverseNextElement(Element& previous, const Con Element* HTMLCollection::traverseForwardToOffset(unsigned offset, Element& currentElement, unsigned& currentOffset, const ContainerNode& root) const { ASSERT(currentOffset < offset); - if (overridesItemAfter()) { - Element* next = ¤tElement; - while ((next = virtualItemAfter(next))) { - if (++currentOffset == offset) - return next; + switch (type()) { + case HTMLTagCollectionType: + return traverseMatchingElementsForwardToOffset(static_cast<const HTMLTagCollection&>(*this), offset, currentElement, currentOffset, root); + case ClassCollectionType: + return traverseMatchingElementsForwardToOffset(static_cast<const ClassCollection&>(*this), offset, currentElement, currentOffset, root); + default: + if (overridesItemAfter()) { + Element* next = ¤tElement; + while ((next = virtualItemAfter(next))) { + if (++currentOffset == offset) + return next; + } + return 0; } - return 0; - } - if (shouldOnlyIncludeDirectChildren()) { - Element* next = ¤tElement; - while ((next = nextMatchingChildElement(*this, *next, root))) { - if (++currentOffset == offset) - return next; + if (shouldOnlyIncludeDirectChildren()) { + Element* next = ¤tElement; + while ((next = nextMatchingChildElement(*this, *next, root))) { + if (++currentOffset == offset) + return next; + } + return 0; } - return 0; + return traverseMatchingElementsForwardToOffset(*this, offset, currentElement, currentOffset, root); } - return traverseMatchingElementsForwardToOffset(*this, offset, currentElement, currentOffset, root); } Element* HTMLCollection::namedItem(const AtomicString& name) const
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ch.dumez@samsung.com/138653004/300001
Failed to apply patch for Source/core/html/HTMLCollection.cpp: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file Source/core/html/HTMLCollection.cpp Hunk #1 succeeded at 279 with fuzz 1 (offset 10 lines). Hunk #2 FAILED at 458. Hunk #3 FAILED at 477. 2 out of 3 hunks FAILED -- saving rejects to file Source/core/html/HTMLCollection.cpp.rej Patch: Source/core/html/HTMLCollection.cpp Index: Source/core/html/HTMLCollection.cpp diff --git a/Source/core/html/HTMLCollection.cpp b/Source/core/html/HTMLCollection.cpp index 4d2fbc0fea46e920e95ed2ce9a19118196f81a9a..12574b936ccf69480f342f8f8b7f4bbde8d46cb8 100644 --- a/Source/core/html/HTMLCollection.cpp +++ b/Source/core/html/HTMLCollection.cpp @@ -269,6 +269,16 @@ template <> inline bool isMatchingElement(const HTMLCollection& htmlCollection, return false; } +template <> inline bool isMatchingElement(const ClassCollection& collection, const Element& element) +{ + return collection.elementMatches(element); +} + +template <> inline bool isMatchingElement(const HTMLTagCollection& collection, const Element& element) +{ + return collection.elementMatches(element); +} + template <> inline bool isMatchingElement(const LiveNodeList& nodeList, const Element& element) { return nodeList.nodeMatches(element); @@ -448,11 +458,18 @@ inline Element* nextMatchingChildElement(const HTMLCollection& nodeList, Element Element* HTMLCollection::traverseToFirstElement(const ContainerNode& root) const { - if (overridesItemAfter()) - return virtualItemAfter(0); - if (shouldOnlyIncludeDirectChildren()) - return firstMatchingChildElement(*this, root); - return firstMatchingElement(*this, root); + switch (type()) { + case HTMLTagCollectionType: + return firstMatchingElement(static_cast<const HTMLTagCollection&>(*this), root); + case ClassCollectionType: + return firstMatchingElement(static_cast<const ClassCollection&>(*this), root); + default: + if (overridesItemAfter()) + return virtualItemAfter(0); + if (shouldOnlyIncludeDirectChildren()) + return firstMatchingChildElement(*this, root); + return firstMatchingElement(*this, root); + } } inline Element* HTMLCollection::traverseNextElement(Element& previous, const ContainerNode& root) const @@ -467,23 +484,30 @@ inline Element* HTMLCollection::traverseNextElement(Element& previous, const Con Element* HTMLCollection::traverseForwardToOffset(unsigned offset, Element& currentElement, unsigned& currentOffset, const ContainerNode& root) const { ASSERT(currentOffset < offset); - if (overridesItemAfter()) { - Element* next = ¤tElement; - while ((next = virtualItemAfter(next))) { - if (++currentOffset == offset) - return next; + switch (type()) { + case HTMLTagCollectionType: + return traverseMatchingElementsForwardToOffset(static_cast<const HTMLTagCollection&>(*this), offset, currentElement, currentOffset, root); + case ClassCollectionType: + return traverseMatchingElementsForwardToOffset(static_cast<const ClassCollection&>(*this), offset, currentElement, currentOffset, root); + default: + if (overridesItemAfter()) { + Element* next = ¤tElement; + while ((next = virtualItemAfter(next))) { + if (++currentOffset == offset) + return next; + } + return 0; } - return 0; - } - if (shouldOnlyIncludeDirectChildren()) { - Element* next = ¤tElement; - while ((next = nextMatchingChildElement(*this, *next, root))) { - if (++currentOffset == offset) - return next; + if (shouldOnlyIncludeDirectChildren()) { + Element* next = ¤tElement; + while ((next = nextMatchingChildElement(*this, *next, root))) { + if (++currentOffset == offset) + return next; + } + return 0; } - return 0; + return traverseMatchingElementsForwardToOffset(*this, offset, currentElement, currentOffset, root); } - return traverseMatchingElementsForwardToOffset(*this, offset, currentElement, currentOffset, root); } Element* HTMLCollection::namedItem(const AtomicString& name) const
The CQ bit was unchecked by ch.dumez@samsung.com
On 2014/02/04 19:45:39, Chris Dumez wrote: > The CQ bit was unchecked by mailto:ch.dumez@samsung.com The bot was going crazy and kept trying to commit despite the patch not applying anymore it seems :/ I unchecked the bot manually until I can rebase, hopefully the bot stops messing around...
On 2014/02/04 19:46:56, Chris Dumez wrote: > On 2014/02/04 19:45:39, Chris Dumez wrote: > > The CQ bit was unchecked by mailto:ch.dumez@samsung.com > > The bot was going crazy and kept trying to commit despite the patch not applying > anymore it seems :/ > I unchecked the bot manually until I can rebase, hopefully the bot stops messing > around... Looks like the bot actually succeeded in committing the patch in r166427. For some reason though, it kept trying to do things afterwards... I am going to close this issue manually then. |