WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
ASSIGNED
88466
Web Inspector: Forced ':hover' pseudo-state does not bubble to ancestor elements
https://bugs.webkit.org/show_bug.cgi?id=88466
Summary
Web Inspector: Forced ':hover' pseudo-state does not bubble to ancestor elements
BrianMB
Reported
2012-06-06 15:54:30 PDT
This is problematic if an element with :hover styling is hidden until a :hover state is activated on its ancestor. When :hover is checked, the current element and all its parents should receive the :hover state as well. EXAMPLE === Say we have a common nav setup: ul > li > ul { display: none; } ul > li:hover > ul { display: block; } ul > li > ul a:hover { color: green; } In this example, I want to tweak the link's :hover color. However, I can't easily interact with Web Inspector and hover over the <li> at the same time. Thus, the link is hidden entirely from view.
Attachments
Screenshot of the "Toggle Element State" menu.
(16.82 KB, image/png)
2012-06-06 15:58 PDT
,
BrianMB
no flags
Details
Patch
(23.66 KB, patch)
2012-08-08 11:48 PDT
,
Alexander Pavlov (apavlov)
no flags
Details
Formatted Diff
Diff
Patch
(26.74 KB, patch)
2012-08-10 01:31 PDT
,
Alexander Pavlov (apavlov)
no flags
Details
Formatted Diff
Diff
Patch
(28.28 KB, patch)
2012-08-13 02:34 PDT
,
Alexander Pavlov (apavlov)
pfeldman
: review-
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
BrianMB
Comment 1
2012-06-06 15:58:03 PDT
Created
attachment 146136
[details]
Screenshot of the "Toggle Element State" menu. This ticket is in regards to the "Toggle Element State" menu, pictured in the attachment.
Alexander Pavlov (apavlov)
Comment 2
2012-08-08 11:48:31 PDT
Created
attachment 157263
[details]
Patch
Pavel Feldman
Comment 3
2012-08-09 05:26:16 PDT
Comment on
attachment 157263
[details]
Patch r- as per out discussion offline: storing counters along with the node state would simplify things.
Alexander Pavlov (apavlov)
Comment 4
2012-08-10 01:31:00 PDT
Created
attachment 157672
[details]
Patch
Pavel Feldman
Comment 5
2012-08-10 06:21:54 PDT
Comment on
attachment 157672
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=157672&action=review
> Source/WebCore/inspector/InspectorCSSAgent.cpp:724 > + m_forcedPseudoStateManager->forgetForcedPseudoState(nodeId);
I think that the fundamental problem is that we only force state from within getMatchedStyles call. We should instead provide a full control over the emulation via the protocol.
Alexander Pavlov (apavlov)
Comment 6
2012-08-13 02:34:42 PDT
Created
attachment 157947
[details]
Patch
Pavel Feldman
Comment 7
2012-08-13 07:07:57 PDT
Comment on
attachment 157947
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=157947&action=review
> Source/WebCore/inspector/InspectorCSSAgent.cpp:935 > + unsigned currentForcedPseudoState = m_forcedPseudoStateManager->fullForcedPseudoState(nodeId);
Ok, this is not good - we now have both: InspectorInstrumentation and front-end calling different overloads of forcePseudoState. It might be a good idea to rename it back to setForcedPseudoState. Also, I think I have a pseudo code that does what you want to achieve with this test and only takes a dozen of lines. It introduces a convenience struct ForcedPseudoState { unsigned stateMask; unsigned hoverCount; } to achieve that. if (forcedPseudoState.hover && !currentForcedPseudoState.hover) { for (Element* currentElement = element; currentElement; currentElement = currentElement->parentElement()) m_nodeIdToForcedPseudoState[m_domAgent->boundNodeId(parentElement)].hoverCount++; } else if (!forcedPseudoState.hover && currentForcedPseudoState.hover) { for (Element* currentElement = element; currentElement; currentElement = currentElement->parentElement()) int id = m_domAgent->boundNodeId(parentElement); PseudoState& state = m_nodeIdToForcedPseudoState[id]; state.hoverCount--; if (!parentState.stateMask && !parentState.hoverCount) m_nodeIdToForcedPseudoState.remove(id); } But I guess we don't even need a counter - there can only be one hovered element at a time, so we only need to mark that element + its path to the document. Another point that is missing is DOM mutations - what if the node that has been hovered has been removed from the DOM - we need to clean its path as well.
Radar WebKit Bug Importer
Comment 8
2014-12-01 14:39:32 PST
<
rdar://problem/19107056
>
Radar WebKit Bug Importer
Comment 9
2014-12-01 14:39:41 PST
<
rdar://problem/19107058
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug