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

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

Issue 1675163002: Rename ComposedTree to FlatTree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wip 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 19 matching lines...) Expand all
30 #include "core/HTMLNames.h" 30 #include "core/HTMLNames.h"
31 #include "core/css/CSSSelectorList.h" 31 #include "core/css/CSSSelectorList.h"
32 #include "core/dom/Document.h" 32 #include "core/dom/Document.h"
33 #include "core/dom/Element.h" 33 #include "core/dom/Element.h"
34 #include "core/dom/ElementTraversal.h" 34 #include "core/dom/ElementTraversal.h"
35 #include "core/dom/Fullscreen.h" 35 #include "core/dom/Fullscreen.h"
36 #include "core/dom/NodeComputedStyle.h" 36 #include "core/dom/NodeComputedStyle.h"
37 #include "core/dom/NthIndexCache.h" 37 #include "core/dom/NthIndexCache.h"
38 #include "core/dom/StyleEngine.h" 38 #include "core/dom/StyleEngine.h"
39 #include "core/dom/Text.h" 39 #include "core/dom/Text.h"
40 #include "core/dom/shadow/ComposedTreeTraversal.h" 40 #include "core/dom/shadow/FlatTreeTraversal.h"
41 #include "core/dom/shadow/InsertionPoint.h" 41 #include "core/dom/shadow/InsertionPoint.h"
42 #include "core/dom/shadow/ShadowRoot.h" 42 #include "core/dom/shadow/ShadowRoot.h"
43 #include "core/editing/FrameSelection.h" 43 #include "core/editing/FrameSelection.h"
44 #include "core/frame/LocalFrame.h" 44 #include "core/frame/LocalFrame.h"
45 #include "core/html/HTMLDocument.h" 45 #include "core/html/HTMLDocument.h"
46 #include "core/html/HTMLFrameElementBase.h" 46 #include "core/html/HTMLFrameElementBase.h"
47 #include "core/html/HTMLInputElement.h" 47 #include "core/html/HTMLInputElement.h"
48 #include "core/html/HTMLOptionElement.h" 48 #include "core/html/HTMLOptionElement.h"
49 #include "core/html/HTMLSelectElement.h" 49 #include "core/html/HTMLSelectElement.h"
50 #include "core/html/HTMLSlotElement.h" 50 #include "core/html/HTMLSlotElement.h"
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 SelectorCheckingContext subContext(context); 1066 SelectorCheckingContext subContext(context);
1067 subContext.isSubSelector = true; 1067 subContext.isSubSelector = true;
1068 1068
1069 bool matched = false; 1069 bool matched = false;
1070 unsigned maxSpecificity = 0; 1070 unsigned maxSpecificity = 0;
1071 1071
1072 // If one of simple selectors matches an element, returns SelectorMatches. J ust "OR". 1072 // If one of simple selectors matches an element, returns SelectorMatches. J ust "OR".
1073 for (subContext.selector = selector.selectorList()->first(); subContext.sele ctor; subContext.selector = CSSSelectorList::next(*subContext.selector)) { 1073 for (subContext.selector = selector.selectorList()->first(); subContext.sele ctor; subContext.selector = CSSSelectorList::next(*subContext.selector)) {
1074 subContext.treatShadowHostAsNormalScope = true; 1074 subContext.treatShadowHostAsNormalScope = true;
1075 subContext.scope = context.scope; 1075 subContext.scope = context.scope;
1076 // Use ComposedTreeTraversal to traverse a composed ancestor list of a g iven element. 1076 // Use FlatTreeTraversal to traverse a composed ancestor list of a given element.
1077 Element* nextElement = &element; 1077 Element* nextElement = &element;
1078 SelectorCheckingContext hostContext(subContext); 1078 SelectorCheckingContext hostContext(subContext);
1079 do { 1079 do {
1080 MatchResult subResult; 1080 MatchResult subResult;
1081 hostContext.element = nextElement; 1081 hostContext.element = nextElement;
1082 if (match(hostContext, subResult)) { 1082 if (match(hostContext, subResult)) {
1083 matched = true; 1083 matched = true;
1084 // Consider div:host(div:host(div:host(div:host...))). 1084 // Consider div:host(div:host(div:host(div:host...))).
1085 maxSpecificity = std::max(maxSpecificity, hostContext.selector-> specificity() + subResult.specificity); 1085 maxSpecificity = std::max(maxSpecificity, hostContext.selector-> specificity() + subResult.specificity);
1086 break; 1086 break;
1087 } 1087 }
1088 hostContext.treatShadowHostAsNormalScope = false; 1088 hostContext.treatShadowHostAsNormalScope = false;
1089 hostContext.scope = nullptr; 1089 hostContext.scope = nullptr;
1090 1090
1091 if (selector.pseudoType() == CSSSelector::PseudoHost) 1091 if (selector.pseudoType() == CSSSelector::PseudoHost)
1092 break; 1092 break;
1093 1093
1094 hostContext.inRightmostCompound = false; 1094 hostContext.inRightmostCompound = false;
1095 nextElement = ComposedTreeTraversal::parentElement(*nextElement); 1095 nextElement = FlatTreeTraversal::parentElement(*nextElement);
1096 } while (nextElement); 1096 } while (nextElement);
1097 } 1097 }
1098 if (matched) { 1098 if (matched) {
1099 result.specificity += maxSpecificity; 1099 result.specificity += maxSpecificity;
1100 return true; 1100 return true;
1101 } 1101 }
1102 1102
1103 // FIXME: this was a fallthrough condition. 1103 // FIXME: this was a fallthrough condition.
1104 return false; 1104 return false;
1105 } 1105 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 } 1187 }
1188 1188
1189 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) 1189 bool SelectorChecker::matchesFocusPseudoClass(const Element& element)
1190 { 1190 {
1191 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element ), CSSSelector::PseudoFocus)) 1191 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element ), CSSSelector::PseudoFocus))
1192 return true; 1192 return true;
1193 return element.focused() && isFrameFocused(element); 1193 return element.focused() && isFrameFocused(element);
1194 } 1194 }
1195 1195
1196 } // namespace blink 1196 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698