Summary: | Refactoring: HTMLContentSelector should be InsertionPoint-aware | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Shinya Kawanaka <shinyak> | ||||||||
Component: | DOM | Assignee: | Shinya Kawanaka <shinyak> | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | Normal | CC: | dglazkov, dominicc, hayato, morrita, rolandsteiner, shinyak | ||||||||
Priority: | P2 | ||||||||||
Version: | 528+ (Nightly build) | ||||||||||
Hardware: | Unspecified | ||||||||||
OS: | Unspecified | ||||||||||
Bug Depends on: | |||||||||||
Bug Blocks: | 78596 | ||||||||||
Attachments: |
|
Description
Shinya Kawanaka
2012-02-29 03:11:28 PST
I want to use HTMLContentSelector in <shadow> element for selecting the rest of light elements. To support this, If HTMLContentSelector::select takes non HTMLContentElement InsertionPoint, we want to choose all of the rest light children. Created attachment 129433 [details]
Patch
Comment on attachment 129433 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=129433&action=review > Source/WebCore/html/shadow/HTMLContentSelector.cpp:117 > + query = adoptPtr(new ContentSelectorQuery(toHTMLContentElement(insertionPoint))); I don't want to allocate this on heap since this will be hit for each attach() even though we do it while following code. Also, I hope these decisions being done by ContentSelectorQuery to make HTMLContentSelector element-type agnostic. I feel that we should also get rid of such heap allocation. But it's another homework. Created attachment 129608 [details]
Patch
(In reply to comment #3) > (From update of attachment 129433 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=129433&action=review > > > Source/WebCore/html/shadow/HTMLContentSelector.cpp:117 > > + query = adoptPtr(new ContentSelectorQuery(toHTMLContentElement(insertionPoint))); > > I don't want to allocate this on heap since this will be hit for each attach() > even though we do it while following code. > Also, I hope these decisions being done by ContentSelectorQuery to make HTMLContentSelector element-type agnostic. Fixed this issue. > > I feel that we should also get rid of such heap allocation. But it's another homework. Comment on attachment 129608 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=129608&action=review > Source/WebCore/html/shadow/ContentSelectorQuery.cpp:43 > + if (!insertionPoint->isContentElement()) { Having these explicit type check is unfortunate. Can you pull thee stuff up to InsertionPoint to make this code path more straight? My feeling is that we can just pull select() up and return empty or null in HTMLShadowElement. Or we mihght able to add some polymorphic method to InsertionPoint. > Source/WebCore/html/shadow/ContentSelectorQuery.cpp:76 > + if (!m_insertionPoint->isContentElement()) Ditto about type check. (In reply to comment #6) > (From update of attachment 129608 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=129608&action=review > > > Source/WebCore/html/shadow/ContentSelectorQuery.cpp:43 > > + if (!insertionPoint->isContentElement()) { > > Having these explicit type check is unfortunate. > Can you pull thee stuff up to InsertionPoint to make this code path more straight? > My feeling is that we can just pull select() up and return empty or null in HTMLShadowElement. Or we mihght able to add some polymorphic method to InsertionPoint. > > > Source/WebCore/html/shadow/ContentSelectorQuery.cpp:76 > > + if (!m_insertionPoint->isContentElement()) > > Ditto about type check. I agree. I'll update the patch soon. Created attachment 129633 [details]
Patch
Comment on attachment 129633 [details]
Patch
Looks good.
Committed r109313: <http://trac.webkit.org/changeset/109313> |