Bug 732667. Only do checks for :hover selectors when hover state changes on nodes which have relevant hover rules. r=dbaron
This commit is contained in:
@@ -175,11 +175,14 @@ enum {
|
|||||||
// Set if the node is handling a click.
|
// Set if the node is handling a click.
|
||||||
NODE_HANDLING_CLICK = 0x00040000U,
|
NODE_HANDLING_CLICK = 0x00040000U,
|
||||||
|
|
||||||
|
// Set if the node has had :hover selectors matched against it
|
||||||
|
NODE_HAS_RELEVANT_HOVER_RULES = 0x00080000U,
|
||||||
|
|
||||||
// Two bits for the script-type ID. Not enough to represent all
|
// Two bits for the script-type ID. Not enough to represent all
|
||||||
// nsIProgrammingLanguage values, but we don't care. In practice,
|
// nsIProgrammingLanguage values, but we don't care. In practice,
|
||||||
// we can represent the ones we want, and we can fail the others at
|
// we can represent the ones we want, and we can fail the others at
|
||||||
// runtime.
|
// runtime.
|
||||||
NODE_SCRIPT_TYPE_OFFSET = 19,
|
NODE_SCRIPT_TYPE_OFFSET = 20,
|
||||||
|
|
||||||
NODE_SCRIPT_TYPE_SIZE = 2,
|
NODE_SCRIPT_TYPE_SIZE = 2,
|
||||||
|
|
||||||
|
|||||||
@@ -8085,7 +8085,13 @@ nsCSSFrameConstructor::ContentStateChanged(nsIContent* aContent,
|
|||||||
primaryFrame->ContentStatesChanged(aStateMask);
|
primaryFrame->ContentStatesChanged(aStateMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRestyleHint rshint =
|
if (aStateMask.HasState(NS_EVENT_STATE_HOVER) &&
|
||||||
|
!aElement->HasFlag(NODE_HAS_RELEVANT_HOVER_RULES)) {
|
||||||
|
aStateMask &= ~NS_EVENT_STATE_HOVER;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsRestyleHint rshint = aStateMask.IsEmpty() ?
|
||||||
|
nsRestyleHint(0) :
|
||||||
styleSet->HasStateDependentStyle(presContext, aElement, aStateMask);
|
styleSet->HasStateDependentStyle(presContext, aElement, aStateMask);
|
||||||
|
|
||||||
if (aStateMask.HasState(NS_EVENT_STATE_HOVER) && rshint != 0) {
|
if (aStateMask.HasState(NS_EVENT_STATE_HOVER) && rshint != 0) {
|
||||||
|
|||||||
@@ -2114,6 +2114,11 @@ static bool SelectorMatches(Element* aElement,
|
|||||||
// selectors ":hover" and ":active".
|
// selectors ":hover" and ":active".
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
if (aTreeMatchContext.mForStyling &&
|
||||||
|
statesToCheck.HasAtLeastOneOfStates(NS_EVENT_STATE_HOVER)) {
|
||||||
|
// Mark the element as having :hover-dependent style
|
||||||
|
aElement->SetFlags(NODE_HAS_RELEVANT_HOVER_RULES);
|
||||||
|
}
|
||||||
if (aNodeMatchContext.mStateMask.HasAtLeastOneOfStates(statesToCheck)) {
|
if (aNodeMatchContext.mStateMask.HasAtLeastOneOfStates(statesToCheck)) {
|
||||||
if (aDependence)
|
if (aDependence)
|
||||||
*aDependence = true;
|
*aDependence = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user