Commit fb63d769 authored by hyatt@apple.com's avatar hyatt@apple.com

2008-03-20 David Hyatt <hyatt@apple.com>

        Fix for http://bugs.webkit.org/show_bug.cgi?id=9279

        Make :hover work with the adjacent sibling selector.  This fix makes all forms of dynamic changes
        (class name changes, :hover, :focus, etc.) work properly when used with the + selector.

        Reviewed by weinig

        Added fast/css/dynamic-sibling-selector.html

        * dom/Element.cpp:
        (WebCore::Element::recalcStyle):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@31181 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a147b791
2008-03-20 David Hyatt <hyatt@apple.com>
Fix for http://bugs.webkit.org/show_bug.cgi?id=9279
Make :hover work with the adjacent sibling selector. This fix makes all forms of dynamic changes
(class name changes, :hover, :focus, etc.) work properly when used with the + selector.
Reviewed by weinig
Added fast/css/dynamic-sibling-selector.html
* dom/Element.cpp:
(WebCore::Element::recalcStyle):
2008-03-20 Aaron Golden <aegolden@gmail.com>
Reviewed by Darin and David Kilzer.
......@@ -707,6 +707,7 @@ void Element::recalcStyle(StyleChange change)
RenderStyle* currentStyle = renderStyle();
bool hasParentStyle = parentNode() ? parentNode()->renderStyle() : false;
bool hasPositionalRules = changed() && currentStyle && currentStyle->childrenAffectedByPositionalRules();
bool hasDirectAdjacentRules = currentStyle && currentStyle->childrenAffectedByDirectAdjacentRules();
#if ENABLE(SVG)
if (!hasParentStyle && isShadowNode() && isSVGElement())
......@@ -776,9 +777,18 @@ void Element::recalcStyle(StyleChange change)
}
}
// FIXME: This check is good enough for :hover + foo, but it is not good enough for :hover + foo + bar.
// For now we will just worry about the common case, since it's a lot trickier to get the second case right
// without doing way too much re-resolution.
bool forceCheckOfNextElementSibling = false;
for (Node *n = firstChild(); n; n = n->nextSibling()) {
bool childRulesChanged = n->changed() && n->styleChangeType() == FullStyleChange;
if (forceCheckOfNextElementSibling && n->isElementNode())
n->setChanged();
if (change >= Inherit || n->isTextNode() || n->hasChangedChild() || n->changed())
n->recalcStyle(change);
if (n->isElementNode())
forceCheckOfNextElementSibling = childRulesChanged && hasDirectAdjacentRules;
}
setChanged(NoStyleChange);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment