Index: third_party/WebKit/Source/core/css/SelectorChecker.cpp |
diff --git a/third_party/WebKit/Source/core/css/SelectorChecker.cpp b/third_party/WebKit/Source/core/css/SelectorChecker.cpp |
index 86a68368667e7ce6e0f9daff6d0c8b93e0a910f4..049b269a99f5e363fadc20a39271793451ab11b5 100644 |
--- a/third_party/WebKit/Source/core/css/SelectorChecker.cpp |
+++ b/third_party/WebKit/Source/core/css/SelectorChecker.cpp |
@@ -260,6 +260,17 @@ SelectorChecker::MatchStatus SelectorChecker::MatchForSubSelector( |
dynamic_pseudo != kPseudoIdNone && |
(scrollbar_ || dynamic_pseudo == kPseudoIdScrollbarCorner || |
dynamic_pseudo == kPseudoIdResizer); |
+ |
+ // Only match pseudo classes following scrollbar pseudo elements while |
+ // actually computing style for scrollbar pseudo elements. This is to |
+ // avoid incorrectly setting affected-by flags on actual elements for |
+ // cases like: div::-webkit-scrollbar-thumb:hover { } |
+ if (context.in_rightmost_compound && dynamic_pseudo != kPseudoIdNone && |
+ dynamic_pseudo != kPseudoIdSelection && |
+ !next_context.has_scrollbar_pseudo) { |
+ return kSelectorFailsCompletely; |
+ } |
+ |
next_context.has_selection_pseudo = dynamic_pseudo == kPseudoIdSelection; |
next_context.is_sub_selector = true; |
return MatchSelector(next_context, result); |