Bug 116167

Summary: DocumentOrderedMap doesn't need to have two HashMaps
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: DOMAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Normal CC: allan.jensen, andersca, benjamin, cmarcelo, commit-queue, darin, esprehn+autocc, ggaren, kling, koivisto, sam
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 119780    
Attachments:
Description Flags
Cleanup + accidental bug fix ggaren: review+

Ryosuke Niwa
Reported 2013-05-15 10:51:30 PDT
DocumentOrderedMap has m_map and m_duplicateCounts but it doesn’t have to.
Attachments
Cleanup + accidental bug fix (27.30 KB, patch)
2013-05-15 19:50 PDT, Ryosuke Niwa
ggaren: review+
Ryosuke Niwa
Comment 1 2013-05-15 19:50:33 PDT
Created attachment 201913 [details] Cleanup + accidental bug fix
Ryosuke Niwa
Comment 2 2013-05-15 19:51:18 PDT
Darin Adler
Comment 3 2013-05-15 21:47:32 PDT
I might get a chance to review this later. Ryosuke, bug 80224 is also about a problem in this class.
Geoffrey Garen
Comment 4 2013-05-15 22:07:26 PDT
Comment on attachment 201913 [details] Cleanup + accidental bug fix View in context: https://bugs.webkit.org/attachment.cgi?id=201913&action=review I started reviewing this and then I learned that the season finale of New Girl was available on iTunes. > Source/WebCore/dom/DocumentOrderedMap.cpp:119 > + entry.orderedList.clear(); // FIXME: Remove the element instead but it can't be too slow. I'm not sure I agree with this FIXME. Removal in the duplicate id case, followed by a getElementById for that id, is not obviously worth optimizing.
Ryosuke Niwa
Comment 5 2013-05-15 22:15:13 PDT
(In reply to comment #4) > I'm not sure I agree with this FIXME. Removal in the duplicate id case, followed by a getElementById for that id, is not obviously worth optimizing. I think it's possible for authors to insert an element with some id, and then remove the other element of the same id next. I agree it's probably not worth optimizing the case where there will be more than two elements with the same id, and one of them is removed.
Geoffrey Garen
Comment 6 2013-05-15 23:43:55 PDT
> I think it's possible for authors to insert an element with some id, and then remove the other element of the same id next. I agree it's probably not worth optimizing the case where there will be more than two elements with the same id, and one of them is removed. Sounds reasonable. Maybe the FIXME should say "FIXME: For short lists, remove the element from the list instead of clearing the list."
Geoffrey Garen
Comment 7 2013-05-15 23:50:04 PDT
Comment on attachment 201913 [details] Cleanup + accidental bug fix View in context: https://bugs.webkit.org/attachment.cgi?id=201913&action=review r=me > Source/WebCore/dom/SelectorQuery.cpp:101 > +const CSSSelector* SelectorDataList::canUseIdLookup(Node* rootNode) const Since the return value changed, should we rename this? Something like "selectorForIdLookup"? > Source/WebCore/dom/SelectorQuery.cpp:131 > + const AtomicString idToMatch = idSelector->value(); Should be const AtomicString&.
Ryosuke Niwa
Comment 8 2013-05-16 00:07:49 PDT
Comment on attachment 201913 [details] Cleanup + accidental bug fix View in context: https://bugs.webkit.org/attachment.cgi?id=201913&action=review Thanks for the review! >> Source/WebCore/dom/DocumentOrderedMap.cpp:119 >> + entry.orderedList.clear(); // FIXME: Remove the element instead but it can't be too slow. > > I'm not sure I agree with this FIXME. Removal in the duplicate id case, followed by a getElementById for that id, is not obviously worth optimizing. Will rephrase the FIXME. >> Source/WebCore/dom/SelectorQuery.cpp:101 >> +const CSSSelector* SelectorDataList::canUseIdLookup(Node* rootNode) const > > Since the return value changed, should we rename this? Something like "selectorForIdLookup"? Oh, I must have made the exact rename on another checkout :/ Will do that again before I land. >> Source/WebCore/dom/SelectorQuery.cpp:131 >> + const AtomicString idToMatch = idSelector->value(); > > Should be const AtomicString&. Oops, will fix.
Ryosuke Niwa
Comment 9 2013-05-16 11:05:30 PDT
Note You need to log in before you can comment on or make changes to this bug.