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

Side by Side Diff: Source/core/css/CSSSelectorList.cpp

Issue 1305973007: Clean up empty namespace handling and fix empty namespaces in compound selectors (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@defaultns
Patch Set: Created 5 years, 3 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) 2008, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Google Inc. All rights reserved. 3 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 return true; 146 return true;
147 } 147 }
148 148
149 return false; 149 return false;
150 } 150 }
151 151
152 class SelectorNeedsNamespaceResolutionFunctor { 152 class SelectorNeedsNamespaceResolutionFunctor {
153 public: 153 public:
154 bool operator()(const CSSSelector& selector) 154 bool operator()(const CSSSelector& selector)
155 { 155 {
156 if (selector.match() == CSSSelector::Tag && selector.tagQName().prefix() != nullAtom && selector.tagQName().prefix() != starAtom) 156 if (selector.match() != CSSSelector::Tag && !selector.isAttributeSelecto r())
157 return true; 157 return false;
158 if (selector.isAttributeSelector() && selector.attribute().prefix() != n ullAtom && selector.attribute().prefix() != starAtom) 158 const AtomicString& prefix = selector.isAttributeSelector() ? selector.a ttribute().prefix() : selector.tagQName().prefix();
159 return true; 159 return prefix != nullAtom && prefix != emptyAtom && prefix != starAtom;
160 return false;
161 } 160 }
162 }; 161 };
163 162
164 bool CSSSelectorList::selectorsNeedNamespaceResolution() 163 bool CSSSelectorList::selectorsNeedNamespaceResolution()
165 { 164 {
166 SelectorNeedsNamespaceResolutionFunctor functor; 165 SelectorNeedsNamespaceResolutionFunctor functor;
167 return forEachSelector(functor, this); 166 return forEachSelector(functor, this);
168 } 167 }
169 168
170 class SelectorHasShadowDistributed { 169 class SelectorHasShadowDistributed {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 202 }
204 }; 203 };
205 204
206 bool CSSSelectorList::selectorNeedsUpdatedDistribution(size_t index) const 205 bool CSSSelectorList::selectorNeedsUpdatedDistribution(size_t index) const
207 { 206 {
208 SelectorNeedsUpdatedDistribution functor; 207 SelectorNeedsUpdatedDistribution functor;
209 return forEachTagSelector(functor, selectorAt(index)); 208 return forEachTagSelector(functor, selectorAt(index));
210 } 209 }
211 210
212 } // namespace blink 211 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/css/namespaces/empty-namespace-compound-selector-2.xhtml ('k') | Source/core/css/StyleSheetContents.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698