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

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

Issue 1614343002: Implement CSS4 pseudo-class :dir() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated layout tests Created 4 years, 10 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. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 value = toVTTElement(element).language(); 942 value = toVTTElement(element).language();
943 else 943 else
944 value = element.computeInheritedLanguage(); 944 value = element.computeInheritedLanguage();
945 const AtomicString& argument = selector.argument(); 945 const AtomicString& argument = selector.argument();
946 if (value.isEmpty() || !value.startsWith(argument, TextCaseASCIIInse nsitive)) 946 if (value.isEmpty() || !value.startsWith(argument, TextCaseASCIIInse nsitive))
947 break; 947 break;
948 if (value.length() != argument.length() && value[argument.length()] != '-') 948 if (value.length() != argument.length() && value[argument.length()] != '-')
949 break; 949 break;
950 return true; 950 return true;
951 } 951 }
952 case CSSSelector::PseudoDir:
953 {
954 // TODO(ramya.v): Need to check the exact direction element is rende red.
955 AtomicString value;
956 TextDirection dir = LTR;
957 if (m_mode == ResolvingStyle)
958 dir = context.elementStyle->direction();
esprehn 2016/02/12 05:13:41 how does this work? The elementStyle is the one be
959 else if (element.ensureComputedStyle())
960 dir = element.ensureComputedStyle()->direction();
esprehn 2016/02/12 05:13:41 ensureComputedStyle() is non-trivial, always do
961 switch (dir) {
962 case LTR:
963 value = "ltr";
esprehn 2016/02/12 05:13:41 we should just atomize these with a DEFINE_STATIC_
964 break;
965 case RTL:
966 value = "rtl";
967 break;
968 default:
969 break;
970 }
971 const AtomicString& argument = selector.argument();
972 if (value.isEmpty() || !equalIgnoringCase(value, argument))
esprehn 2016/02/12 05:13:41 should this use ascii case? this file is inconsist
973 break;
974 return true;
975 }
952 case CSSSelector::PseudoFullScreen: 976 case CSSSelector::PseudoFullScreen:
953 // While a Document is in the fullscreen state, and the document's curre nt fullscreen 977 // While a Document is in the fullscreen state, and the document's curre nt fullscreen
954 // element is an element in the document, the 'full-screen' pseudoclass applies to 978 // element is an element in the document, the 'full-screen' pseudoclass applies to
955 // that element. Also, an <iframe>, <object> or <embed> element whose ch ild browsing 979 // that element. Also, an <iframe>, <object> or <embed> element whose ch ild browsing
956 // context's Document is in the fullscreen state has the 'full-screen' p seudoclass applied. 980 // context's Document is in the fullscreen state has the 'full-screen' p seudoclass applied.
957 if (isHTMLFrameElementBase(element) && element.containsFullScreenElement ()) 981 if (isHTMLFrameElementBase(element) && element.containsFullScreenElement ())
958 return true; 982 return true;
959 return Fullscreen::isActiveFullScreenElement(element); 983 return Fullscreen::isActiveFullScreenElement(element);
960 case CSSSelector::PseudoFullScreenAncestor: 984 case CSSSelector::PseudoFullScreenAncestor:
961 return element.containsFullScreenElement(); 985 return element.containsFullScreenElement();
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 } 1221 }
1198 1222
1199 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) 1223 bool SelectorChecker::matchesFocusPseudoClass(const Element& element)
1200 { 1224 {
1201 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element ), CSSSelector::PseudoFocus)) 1225 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element ), CSSSelector::PseudoFocus))
1202 return true; 1226 return true;
1203 return element.focused() && isFrameFocused(element); 1227 return element.focused() && isFrameFocused(element);
1204 } 1228 }
1205 1229
1206 } 1230 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698