Bug 87694
Summary: | [CSS] Move StyleResolver::canShareStyleWithElement to StyledElement as virtual method | ||
---|---|---|---|
Product: | WebKit | Reporter: | yosin |
Component: | CSS | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED CONFIGURATION CHANGED | ||
Severity: | Normal | CC: | bfulgham, eric |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Bug Depends on: | |||
Bug Blocks: | 80381 |
yosin
I would like to move StyleResolver::canShareStyleWithElement to StyleElement class as virtual method.
The reasons are:
1. Move hasTagName checking to class which implements element. This also removes some #if, e.g. ENABLE(PROGRESS_TAG)
2. Control sharing in fine grain, e.g. if (element->hasTagName(optionTag)) return false is too conservative.
Call site changes are:
inline StyledElement* StyleResolver::findSiblingForStyleSharing(Node* node, unsigned& count) const
{
for (; node; node = node->previousSibling()) {
if (!node->isStyledElement())
continue;
NOW: if (canShareStyleWithElement(static_cast<StyledElement*>(node)))
NEW: if (m_element->canShareStyleWithElement(static_cast<StyledElement*>(node)))
break;
....
}
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Eric Seidel (no email)
canShareStyleWith is an insanity-hot function. I do not recommend this approach, unless you're finding ways to avoid calling it.
Brent Fulgham
This code has been significantly refactored since this patch was proposed. There doesn't seem to be any action we can take here.