Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Side by Side Diff: third_party/WebKit/Source/core/css/SelectorChecker.cpp

Issue 2850743003: Stop matching scrollbar pseudo element without a scrollbar. (Closed)
Patch Set: Added unit test. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/css/AffectedByPseudoTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/) 10 * (http://www.torchmobile.com/)
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 SelectorChecker::MatchStatus SelectorChecker::MatchForSubSelector( 253 SelectorChecker::MatchStatus SelectorChecker::MatchForSubSelector(
254 const SelectorCheckingContext& context, 254 const SelectorCheckingContext& context,
255 MatchResult& result) const { 255 MatchResult& result) const {
256 SelectorCheckingContext next_context = PrepareNextContextForRelation(context); 256 SelectorCheckingContext next_context = PrepareNextContextForRelation(context);
257 257
258 PseudoId dynamic_pseudo = result.dynamic_pseudo; 258 PseudoId dynamic_pseudo = result.dynamic_pseudo;
259 next_context.has_scrollbar_pseudo = 259 next_context.has_scrollbar_pseudo =
260 dynamic_pseudo != kPseudoIdNone && 260 dynamic_pseudo != kPseudoIdNone &&
261 (scrollbar_ || dynamic_pseudo == kPseudoIdScrollbarCorner || 261 (scrollbar_ || dynamic_pseudo == kPseudoIdScrollbarCorner ||
262 dynamic_pseudo == kPseudoIdResizer); 262 dynamic_pseudo == kPseudoIdResizer);
263
264 // Only match pseudo classes following scrollbar pseudo elements while
265 // actually computing style for scrollbar pseudo elements. This is to
266 // avoid incorrectly setting affected-by flags on actual elements for
267 // cases like: div::-webkit-scrollbar-thumb:hover { }
268 if (context.in_rightmost_compound && dynamic_pseudo != kPseudoIdNone &&
269 dynamic_pseudo != kPseudoIdSelection &&
270 !next_context.has_scrollbar_pseudo) {
271 return kSelectorFailsCompletely;
272 }
273
263 next_context.has_selection_pseudo = dynamic_pseudo == kPseudoIdSelection; 274 next_context.has_selection_pseudo = dynamic_pseudo == kPseudoIdSelection;
264 next_context.is_sub_selector = true; 275 next_context.is_sub_selector = true;
265 return MatchSelector(next_context, result); 276 return MatchSelector(next_context, result);
266 } 277 }
267 278
268 static inline bool IsV0ShadowRoot(const Node* node) { 279 static inline bool IsV0ShadowRoot(const Node* node) {
269 return node && node->IsShadowRoot() && 280 return node && node->IsShadowRoot() &&
270 ToShadowRoot(node)->GetType() == ShadowRootType::V0; 281 ToShadowRoot(node)->GetType() == ShadowRootType::V0;
271 } 282 }
272 283
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 bool SelectorChecker::MatchesFocusPseudoClass(const Element& element) { 1372 bool SelectorChecker::MatchesFocusPseudoClass(const Element& element) {
1362 bool force_pseudo_state = false; 1373 bool force_pseudo_state = false;
1363 probe::forcePseudoState(const_cast<Element*>(&element), 1374 probe::forcePseudoState(const_cast<Element*>(&element),
1364 CSSSelector::kPseudoFocus, &force_pseudo_state); 1375 CSSSelector::kPseudoFocus, &force_pseudo_state);
1365 if (force_pseudo_state) 1376 if (force_pseudo_state)
1366 return true; 1377 return true;
1367 return element.IsFocused() && IsFrameFocused(element); 1378 return element.IsFocused() && IsFrameFocused(element);
1368 } 1379 }
1369 1380
1370 } // namespace blink 1381 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/AffectedByPseudoTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698