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

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

Issue 2795143004: [selectors4] Implement :focus-within pseudo-class (Closed)
Patch Set: Rebased patch Created 3 years, 8 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
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 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 return true; 907 return true;
908 if (mode_ == kResolvingStyle) { 908 if (mode_ == kResolvingStyle) {
909 if (context.in_rightmost_compound) { 909 if (context.in_rightmost_compound) {
910 element_style_->SetAffectedByFocus(); 910 element_style_->SetAffectedByFocus();
911 } else { 911 } else {
912 element_style_->SetUnique(); 912 element_style_->SetUnique();
913 element.SetChildrenOrSiblingsAffectedByFocus(); 913 element.SetChildrenOrSiblingsAffectedByFocus();
914 } 914 }
915 } 915 }
916 return MatchesFocusPseudoClass(element); 916 return MatchesFocusPseudoClass(element);
917 case CSSSelector::kPseudoFocusWithin:
918 if (mode_ == kSharingRules)
919 return true;
920 if (mode_ == kResolvingStyle) {
921 if (context.in_rightmost_compound) {
922 element_style_->SetAffectedByFocusWithin();
923 } else {
924 element_style_->SetUnique();
925 element.SetChildrenOrSiblingsAffectedByFocusWithin();
926 }
927 }
928 probe::forcePseudoState(&element, CSSSelector::kPseudoFocusWithin,
929 &force_pseudo_state);
930 if (force_pseudo_state)
931 return true;
932 return element.HasFocusWithin();
917 case CSSSelector::kPseudoHover: 933 case CSSSelector::kPseudoHover:
918 if (mode_ == kSharingRules) 934 if (mode_ == kSharingRules)
919 return true; 935 return true;
920 if (mode_ == kResolvingStyle) { 936 if (mode_ == kResolvingStyle) {
921 if (context.in_rightmost_compound) { 937 if (context.in_rightmost_compound) {
922 element_style_->SetAffectedByHover(); 938 element_style_->SetAffectedByHover();
923 } else { 939 } else {
924 element_style_->SetUnique(); 940 element_style_->SetUnique();
925 element.SetChildrenOrSiblingsAffectedByHover(); 941 element.SetChildrenOrSiblingsAffectedByHover();
926 } 942 }
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 bool SelectorChecker::MatchesFocusPseudoClass(const Element& element) { 1351 bool SelectorChecker::MatchesFocusPseudoClass(const Element& element) {
1336 bool force_pseudo_state = false; 1352 bool force_pseudo_state = false;
1337 probe::forcePseudoState(const_cast<Element*>(&element), 1353 probe::forcePseudoState(const_cast<Element*>(&element),
1338 CSSSelector::kPseudoFocus, &force_pseudo_state); 1354 CSSSelector::kPseudoFocus, &force_pseudo_state);
1339 if (force_pseudo_state) 1355 if (force_pseudo_state)
1340 return true; 1356 return true;
1341 return element.IsFocused() && IsFrameFocused(element); 1357 return element.IsFocused() && IsFrameFocused(element);
1342 } 1358 }
1343 1359
1344 } // namespace blink 1360 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/RuleFeature.cpp ('k') | third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698