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

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

Issue 196983005: Replace big code block to build CSS pseudo name table with a loop. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Cleaned up after review. Created 6 years, 9 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 | « Source/core/css/CSSSelector.h ('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-2003 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * 1999 Waldo Bastian (bastian@kde.org) 3 * 1999 Waldo Bastian (bastian@kde.org)
4 * 2001 Andreas Schlapbach (schlpbch@iam.unibe.ch) 4 * 2001 Andreas Schlapbach (schlpbch@iam.unibe.ch)
5 * 2001-2003 Dirk Mueller (mueller@kde.org) 5 * 2001-2003 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2002, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2002, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2008 David Smith (catfish.man@gmail.com) 7 * Copyright (C) 2008 David Smith (catfish.man@gmail.com)
8 * Copyright (C) 2010 Google Inc. All rights reserved. 8 * Copyright (C) 2010 Google Inc. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 return NOPSEUDO; 260 return NOPSEUDO;
261 case PseudoNotParsed: 261 case PseudoNotParsed:
262 ASSERT_NOT_REACHED(); 262 ASSERT_NOT_REACHED();
263 return NOPSEUDO; 263 return NOPSEUDO;
264 } 264 }
265 265
266 ASSERT_NOT_REACHED(); 266 ASSERT_NOT_REACHED();
267 return NOPSEUDO; 267 return NOPSEUDO;
268 } 268 }
269 269
270 // Could be made smaller and faster by replacing pointer with an
271 // offset into a string buffer and making the bit fields smaller but
272 // that could not be maintained by hand.
273 struct NameToPseudoStruct {
274 const char* string;
275 unsigned type:8;
276 unsigned requirement:8;
277 };
278
279 const static NameToPseudoStruct pseudoTypeMap[] = {
280 {"active", CSSSelector::PseudoActive, 0},
281 {"after", CSSSelector::PseudoAfter, 0},
282 {"-webkit-any(", CSSSelector::PseudoAny, 0},
283 {"-webkit-any-link", CSSSelector::PseudoAnyLink, 0},
284 {"-webkit-autofill", CSSSelector::PseudoAutofill, 0},
285 {"backdrop", CSSSelector::PseudoBackdrop, 0},
286 {"before", CSSSelector::PseudoBefore, 0},
287 {"checked", CSSSelector::PseudoChecked, 0},
288 {"default", CSSSelector::PseudoDefault, 0},
289 {"disabled", CSSSelector::PseudoDisabled, 0},
290 {"read-only", CSSSelector::PseudoReadOnly, 0},
291 {"read-write", CSSSelector::PseudoReadWrite, 0},
292 {"valid", CSSSelector::PseudoValid, 0},
293 {"invalid", CSSSelector::PseudoInvalid, 0},
294 {"-webkit-drag", CSSSelector::PseudoDrag, 0},
295 {"empty", CSSSelector::PseudoEmpty, 0},
296 {"enabled", CSSSelector::PseudoEnabled, 0},
297 {"first-child", CSSSelector::PseudoFirstChild, 0},
298 {"first-letter", CSSSelector::PseudoFirstLetter, 0},
299 {"first-line", CSSSelector::PseudoFirstLine, 0},
300 {"first-of-type", CSSSelector::PseudoFirstOfType, 0},
301 {"-webkit-full-page-media", CSSSelector::PseudoFullPageMedia, 0},
302 {"nth-child(", CSSSelector::PseudoNthChild, 0},
303 {"nth-of-type(", CSSSelector::PseudoNthOfType, 0},
304 {"nth-last-child(", CSSSelector::PseudoNthLastChild, 0},
305 {"nth-last-of-type(", CSSSelector::PseudoNthLastOfType, 0},
306 {"focus", CSSSelector::PseudoFocus, 0},
307 {"hover", CSSSelector::PseudoHover, 0},
308 {"indeterminate", CSSSelector::PseudoIndeterminate, 0},
309 {"last-child", CSSSelector::PseudoLastChild, 0},
310 {"last-of-type", CSSSelector::PseudoLastOfType, 0},
311 {"link", CSSSelector::PseudoLink, 0},
312 {"lang(", CSSSelector::PseudoLang, 0},
313 {"not(", CSSSelector::PseudoNot, 0},
314 {"only-child", CSSSelector::PseudoOnlyChild, 0},
315 {"only-of-type", CSSSelector::PseudoOnlyOfType, 0},
316 {"optional", CSSSelector::PseudoOptional, 0},
317 {"required", CSSSelector::PseudoRequired, 0},
318 {"-webkit-resizer", CSSSelector::PseudoResizer, 0},
319 {"root", CSSSelector::PseudoRoot, 0},
320 {"-webkit-scrollbar", CSSSelector::PseudoScrollbar, 0},
321 {"-webkit-scrollbar-button", CSSSelector::PseudoScrollbarButton, 0},
322 {"-webkit-scrollbar-corner", CSSSelector::PseudoScrollbarCorner, 0},
323 {"-webkit-scrollbar-thumb", CSSSelector::PseudoScrollbarThumb, 0},
324 {"-webkit-scrollbar-track", CSSSelector::PseudoScrollbarTrack, 0},
325 {"-webkit-scrollbar-track-piece", CSSSelector::PseudoScrollbarTrackPiece, 0},
326 {"selection", CSSSelector::PseudoSelection, 0},
327 {"target", CSSSelector::PseudoTarget, 0},
328 {"visited", CSSSelector::PseudoVisited, 0},
329 {"window-inactive", CSSSelector::PseudoWindowInactive, 0},
330 {"decrement", CSSSelector::PseudoDecrement, 0},
331 {"increment", CSSSelector::PseudoIncrement, 0},
332 {"start", CSSSelector::PseudoStart, 0},
333 {"end", CSSSelector::PseudoEnd, 0},
334 {"horizontal", CSSSelector::PseudoHorizontal, 0},
335 {"vertical", CSSSelector::PseudoVertical, 0},
336 {"double-button", CSSSelector::PseudoDoubleButton, 0},
337 {"single-button", CSSSelector::PseudoSingleButton, 0},
338 {"no-button", CSSSelector::PseudoNoButton, 0},
339 {"corner-present", CSSSelector::PseudoCornerPresent, 0},
340 {"first", CSSSelector::PseudoFirstPage, 0},
341 {"left", CSSSelector::PseudoLeftPage, 0},
342 {"right", CSSSelector::PseudoRightPage, 0},
343 {"-webkit-full-screen", CSSSelector::PseudoFullScreen, 0},
344 {"-webkit-full-screen-document", CSSSelector::PseudoFullScreenDocument, 0},
345 {"-webkit-full-screen-ancestor", CSSSelector::PseudoFullScreenAncestor, 0},
346 {"cue(", CSSSelector::PseudoCue, 0},
347 {"cue", CSSSelector::PseudoWebKitCustomElement, 0},
348 {"future", CSSSelector::PseudoFutureCue, 0},
349 {"past", CSSSelector::PseudoPastCue, 0},
350 {"-webkit-distributed(", CSSSelector::PseudoDistributed, 0},
351 {"in-range", CSSSelector::PseudoInRange, 0},
352 {"out-of-range", CSSSelector::PseudoOutOfRange, 0},
353 {"scope", CSSSelector::PseudoScope, 0},
354 {"unresolved", CSSSelector::PseudoUnresolved, 0},
355 {"host", CSSSelector::PseudoHost, CSSSel ector::RequiresShadowDOM},
356 {"host(", CSSSelector::PseudoHost, CSSSel ector::RequiresShadowDOM},
357 {"ancestor", CSSSelector::PseudoAncestor, CSSSel ector::RequiresShadowDOM},
358 {"ancestor(", CSSSelector::PseudoAncestor, CSSSel ector::RequiresShadowDOM},
359 };
360
270 static HashMap<StringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap() 361 static HashMap<StringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap()
271 { 362 {
272 DEFINE_STATIC_LOCAL(AtomicString, active, ("active", AtomicString::Construct FromLiteral));
273 DEFINE_STATIC_LOCAL(AtomicString, after, ("after", AtomicString::ConstructFr omLiteral));
274 DEFINE_STATIC_LOCAL(AtomicString, any, ("-webkit-any(", AtomicString::Constr uctFromLiteral));
275 DEFINE_STATIC_LOCAL(AtomicString, anyLink, ("-webkit-any-link", AtomicString ::ConstructFromLiteral));
276 DEFINE_STATIC_LOCAL(AtomicString, autofill, ("-webkit-autofill", AtomicStrin g::ConstructFromLiteral));
277 DEFINE_STATIC_LOCAL(AtomicString, backdrop, ("backdrop", AtomicString::Const ructFromLiteral));
278 DEFINE_STATIC_LOCAL(AtomicString, before, ("before", AtomicString::Construct FromLiteral));
279 DEFINE_STATIC_LOCAL(AtomicString, checked, ("checked", AtomicString::Constru ctFromLiteral));
280 DEFINE_STATIC_LOCAL(AtomicString, defaultString, ("default", AtomicString::C onstructFromLiteral));
281 DEFINE_STATIC_LOCAL(AtomicString, disabled, ("disabled", AtomicString::Const ructFromLiteral));
282 DEFINE_STATIC_LOCAL(AtomicString, readOnly, ("read-only", AtomicString::Cons tructFromLiteral));
283 DEFINE_STATIC_LOCAL(AtomicString, readWrite, ("read-write", AtomicString::Co nstructFromLiteral));
284 DEFINE_STATIC_LOCAL(AtomicString, valid, ("valid", AtomicString::ConstructFr omLiteral));
285 DEFINE_STATIC_LOCAL(AtomicString, invalid, ("invalid", AtomicString::Constru ctFromLiteral));
286 DEFINE_STATIC_LOCAL(AtomicString, drag, ("-webkit-drag", AtomicString::Const ructFromLiteral));
287 DEFINE_STATIC_LOCAL(AtomicString, empty, ("empty", AtomicString::ConstructFr omLiteral));
288 DEFINE_STATIC_LOCAL(AtomicString, enabled, ("enabled", AtomicString::Constru ctFromLiteral));
289 DEFINE_STATIC_LOCAL(AtomicString, firstChild, ("first-child", AtomicString:: ConstructFromLiteral));
290 DEFINE_STATIC_LOCAL(AtomicString, firstLetter, ("first-letter", AtomicString ::ConstructFromLiteral));
291 DEFINE_STATIC_LOCAL(AtomicString, firstLine, ("first-line", AtomicString::Co nstructFromLiteral));
292 DEFINE_STATIC_LOCAL(AtomicString, firstOfType, ("first-of-type", AtomicStrin g::ConstructFromLiteral));
293 DEFINE_STATIC_LOCAL(AtomicString, fullPageMedia, ("-webkit-full-page-media", AtomicString::ConstructFromLiteral));
294 DEFINE_STATIC_LOCAL(AtomicString, nthChild, ("nth-child(", AtomicString::Con structFromLiteral));
295 DEFINE_STATIC_LOCAL(AtomicString, nthOfType, ("nth-of-type(", AtomicString:: ConstructFromLiteral));
296 DEFINE_STATIC_LOCAL(AtomicString, nthLastChild, ("nth-last-child(", AtomicSt ring::ConstructFromLiteral));
297 DEFINE_STATIC_LOCAL(AtomicString, nthLastOfType, ("nth-last-of-type(", Atomi cString::ConstructFromLiteral));
298 DEFINE_STATIC_LOCAL(AtomicString, focus, ("focus", AtomicString::ConstructFr omLiteral));
299 DEFINE_STATIC_LOCAL(AtomicString, hover, ("hover", AtomicString::ConstructFr omLiteral));
300 DEFINE_STATIC_LOCAL(AtomicString, indeterminate, ("indeterminate", AtomicStr ing::ConstructFromLiteral));
301 DEFINE_STATIC_LOCAL(AtomicString, lastChild, ("last-child", AtomicString::Co nstructFromLiteral));
302 DEFINE_STATIC_LOCAL(AtomicString, lastOfType, ("last-of-type", AtomicString: :ConstructFromLiteral));
303 DEFINE_STATIC_LOCAL(AtomicString, link, ("link", AtomicString::ConstructFrom Literal));
304 DEFINE_STATIC_LOCAL(AtomicString, lang, ("lang(", AtomicString::ConstructFro mLiteral));
305 DEFINE_STATIC_LOCAL(AtomicString, notStr, ("not(", AtomicString::ConstructFr omLiteral));
306 DEFINE_STATIC_LOCAL(AtomicString, onlyChild, ("only-child", AtomicString::Co nstructFromLiteral));
307 DEFINE_STATIC_LOCAL(AtomicString, onlyOfType, ("only-of-type", AtomicString: :ConstructFromLiteral));
308 DEFINE_STATIC_LOCAL(AtomicString, optional, ("optional", AtomicString::Const ructFromLiteral));
309 DEFINE_STATIC_LOCAL(AtomicString, required, ("required", AtomicString::Const ructFromLiteral));
310 DEFINE_STATIC_LOCAL(AtomicString, resizer, ("-webkit-resizer", AtomicString: :ConstructFromLiteral));
311 DEFINE_STATIC_LOCAL(AtomicString, root, ("root", AtomicString::ConstructFrom Literal));
312 DEFINE_STATIC_LOCAL(AtomicString, scrollbar, ("-webkit-scrollbar", AtomicStr ing::ConstructFromLiteral));
313 DEFINE_STATIC_LOCAL(AtomicString, scrollbarButton, ("-webkit-scrollbar-butto n", AtomicString::ConstructFromLiteral));
314 DEFINE_STATIC_LOCAL(AtomicString, scrollbarCorner, ("-webkit-scrollbar-corne r", AtomicString::ConstructFromLiteral));
315 DEFINE_STATIC_LOCAL(AtomicString, scrollbarThumb, ("-webkit-scrollbar-thumb" , AtomicString::ConstructFromLiteral));
316 DEFINE_STATIC_LOCAL(AtomicString, scrollbarTrack, ("-webkit-scrollbar-track" , AtomicString::ConstructFromLiteral));
317 DEFINE_STATIC_LOCAL(AtomicString, scrollbarTrackPiece, ("-webkit-scrollbar-t rack-piece", AtomicString::ConstructFromLiteral));
318 DEFINE_STATIC_LOCAL(AtomicString, selection, ("selection", AtomicString::Con structFromLiteral));
319 DEFINE_STATIC_LOCAL(AtomicString, target, ("target", AtomicString::Construct FromLiteral));
320 DEFINE_STATIC_LOCAL(AtomicString, visited, ("visited", AtomicString::Constru ctFromLiteral));
321 DEFINE_STATIC_LOCAL(AtomicString, windowInactive, ("window-inactive", Atomic String::ConstructFromLiteral));
322 DEFINE_STATIC_LOCAL(AtomicString, decrement, ("decrement", AtomicString::Con structFromLiteral));
323 DEFINE_STATIC_LOCAL(AtomicString, increment, ("increment", AtomicString::Con structFromLiteral));
324 DEFINE_STATIC_LOCAL(AtomicString, start, ("start", AtomicString::ConstructFr omLiteral));
325 DEFINE_STATIC_LOCAL(AtomicString, end, ("end", AtomicString::ConstructFromLi teral));
326 DEFINE_STATIC_LOCAL(AtomicString, horizontal, ("horizontal", AtomicString::C onstructFromLiteral));
327 DEFINE_STATIC_LOCAL(AtomicString, vertical, ("vertical", AtomicString::Const ructFromLiteral));
328 DEFINE_STATIC_LOCAL(AtomicString, doubleButton, ("double-button", AtomicStri ng::ConstructFromLiteral));
329 DEFINE_STATIC_LOCAL(AtomicString, singleButton, ("single-button", AtomicStri ng::ConstructFromLiteral));
330 DEFINE_STATIC_LOCAL(AtomicString, noButton, ("no-button", AtomicString::Cons tructFromLiteral));
331 DEFINE_STATIC_LOCAL(AtomicString, cornerPresent, ("corner-present", AtomicSt ring::ConstructFromLiteral));
332 // Paged Media pseudo-classes
333 DEFINE_STATIC_LOCAL(AtomicString, firstPage, ("first", AtomicString::Constru ctFromLiteral));
334 DEFINE_STATIC_LOCAL(AtomicString, leftPage, ("left", AtomicString::Construct FromLiteral));
335 DEFINE_STATIC_LOCAL(AtomicString, rightPage, ("right", AtomicString::Constru ctFromLiteral));
336 DEFINE_STATIC_LOCAL(AtomicString, fullScreen, ("-webkit-full-screen", Atomic String::ConstructFromLiteral));
337 DEFINE_STATIC_LOCAL(AtomicString, fullScreenDocument, ("-webkit-full-screen- document", AtomicString::ConstructFromLiteral));
338 DEFINE_STATIC_LOCAL(AtomicString, fullScreenAncestor, ("-webkit-full-screen- ancestor", AtomicString::ConstructFromLiteral));
339 DEFINE_STATIC_LOCAL(AtomicString, cue, ("cue(", AtomicString::ConstructFromL iteral));
340 DEFINE_STATIC_LOCAL(AtomicString, cueWithoutParen, ("cue", AtomicString::Con structFromLiteral));
341 DEFINE_STATIC_LOCAL(AtomicString, futureCue, ("future", AtomicString::Constr uctFromLiteral));
342 DEFINE_STATIC_LOCAL(AtomicString, pastCue, ("past", AtomicString::ConstructF romLiteral));
343 DEFINE_STATIC_LOCAL(AtomicString, distributed, ("-webkit-distributed(", Atom icString::ConstructFromLiteral));
344 DEFINE_STATIC_LOCAL(AtomicString, inRange, ("in-range", AtomicString::Constr uctFromLiteral));
345 DEFINE_STATIC_LOCAL(AtomicString, outOfRange, ("out-of-range", AtomicString: :ConstructFromLiteral));
346 DEFINE_STATIC_LOCAL(AtomicString, scope, ("scope", AtomicString::ConstructFr omLiteral));
347 DEFINE_STATIC_LOCAL(AtomicString, unresolved, ("unresolved", AtomicString::C onstructFromLiteral));
348 DEFINE_STATIC_LOCAL(AtomicString, host, ("host", AtomicString::ConstructFrom Literal));
349 DEFINE_STATIC_LOCAL(AtomicString, hostWithParams, ("host(", AtomicString::Co nstructFromLiteral));
350 DEFINE_STATIC_LOCAL(AtomicString, ancestor, ("ancestor", AtomicString::Const ructFromLiteral));
351 DEFINE_STATIC_LOCAL(AtomicString, ancestorWithParams, ("ancestor(", AtomicSt ring::ConstructFromLiteral));
352
353 static HashMap<StringImpl*, CSSSelector::PseudoType>* nameToPseudoType = 0; 363 static HashMap<StringImpl*, CSSSelector::PseudoType>* nameToPseudoType = 0;
354 if (!nameToPseudoType) { 364 if (!nameToPseudoType) {
355 nameToPseudoType = new HashMap<StringImpl*, CSSSelector::PseudoType>; 365 nameToPseudoType = new HashMap<StringImpl*, CSSSelector::PseudoType>;
356 nameToPseudoType->set(active.impl(), CSSSelector::PseudoActive); 366
357 nameToPseudoType->set(after.impl(), CSSSelector::PseudoAfter); 367 size_t pseudoCount = WTF_ARRAY_LENGTH(pseudoTypeMap);
358 nameToPseudoType->set(anyLink.impl(), CSSSelector::PseudoAnyLink); 368 for (size_t i = 0; i < pseudoCount; i++) {
359 nameToPseudoType->set(any.impl(), CSSSelector::PseudoAny); 369 if (pseudoTypeMap[i].requirement == CSSSelector::RequiresShadowDOM) {
360 nameToPseudoType->set(autofill.impl(), CSSSelector::PseudoAutofill); 370 if (!RuntimeEnabledFeatures::shadowDOMEnabled())
361 nameToPseudoType->set(backdrop.impl(), CSSSelector::PseudoBackdrop); 371 continue;
362 nameToPseudoType->set(before.impl(), CSSSelector::PseudoBefore); 372 }
363 nameToPseudoType->set(checked.impl(), CSSSelector::PseudoChecked); 373
364 nameToPseudoType->set(defaultString.impl(), CSSSelector::PseudoDefault); 374 const char* str = pseudoTypeMap[i].string;
365 nameToPseudoType->set(disabled.impl(), CSSSelector::PseudoDisabled); 375 CSSSelector::PseudoType type;
366 nameToPseudoType->set(readOnly.impl(), CSSSelector::PseudoReadOnly); 376 type = static_cast<CSSSelector::PseudoType>(pseudoTypeMap[i].type);
367 nameToPseudoType->set(readWrite.impl(), CSSSelector::PseudoReadWrite); 377 // This is a one-time leak.
368 nameToPseudoType->set(valid.impl(), CSSSelector::PseudoValid); 378 AtomicString* name = new AtomicString(str, strlen(str), AtomicString ::ConstructFromLiteral);
369 nameToPseudoType->set(invalid.impl(), CSSSelector::PseudoInvalid); 379 nameToPseudoType->set(name->impl(), type);
370 nameToPseudoType->set(drag.impl(), CSSSelector::PseudoDrag);
371 nameToPseudoType->set(enabled.impl(), CSSSelector::PseudoEnabled);
372 nameToPseudoType->set(empty.impl(), CSSSelector::PseudoEmpty);
373 nameToPseudoType->set(firstChild.impl(), CSSSelector::PseudoFirstChild);
374 nameToPseudoType->set(fullPageMedia.impl(), CSSSelector::PseudoFullPageM edia);
375 nameToPseudoType->set(lastChild.impl(), CSSSelector::PseudoLastChild);
376 nameToPseudoType->set(lastOfType.impl(), CSSSelector::PseudoLastOfType);
377 nameToPseudoType->set(onlyChild.impl(), CSSSelector::PseudoOnlyChild);
378 nameToPseudoType->set(onlyOfType.impl(), CSSSelector::PseudoOnlyOfType);
379 nameToPseudoType->set(firstLetter.impl(), CSSSelector::PseudoFirstLetter );
380 nameToPseudoType->set(firstLine.impl(), CSSSelector::PseudoFirstLine);
381 nameToPseudoType->set(firstOfType.impl(), CSSSelector::PseudoFirstOfType );
382 nameToPseudoType->set(focus.impl(), CSSSelector::PseudoFocus);
383 nameToPseudoType->set(hover.impl(), CSSSelector::PseudoHover);
384 nameToPseudoType->set(indeterminate.impl(), CSSSelector::PseudoIndetermi nate);
385 nameToPseudoType->set(link.impl(), CSSSelector::PseudoLink);
386 nameToPseudoType->set(lang.impl(), CSSSelector::PseudoLang);
387 nameToPseudoType->set(notStr.impl(), CSSSelector::PseudoNot);
388 nameToPseudoType->set(nthChild.impl(), CSSSelector::PseudoNthChild);
389 nameToPseudoType->set(nthOfType.impl(), CSSSelector::PseudoNthOfType);
390 nameToPseudoType->set(nthLastChild.impl(), CSSSelector::PseudoNthLastChi ld);
391 nameToPseudoType->set(nthLastOfType.impl(), CSSSelector::PseudoNthLastOf Type);
392 nameToPseudoType->set(root.impl(), CSSSelector::PseudoRoot);
393 nameToPseudoType->set(windowInactive.impl(), CSSSelector::PseudoWindowIn active);
394 nameToPseudoType->set(decrement.impl(), CSSSelector::PseudoDecrement);
395 nameToPseudoType->set(increment.impl(), CSSSelector::PseudoIncrement);
396 nameToPseudoType->set(start.impl(), CSSSelector::PseudoStart);
397 nameToPseudoType->set(end.impl(), CSSSelector::PseudoEnd);
398 nameToPseudoType->set(horizontal.impl(), CSSSelector::PseudoHorizontal);
399 nameToPseudoType->set(vertical.impl(), CSSSelector::PseudoVertical);
400 nameToPseudoType->set(doubleButton.impl(), CSSSelector::PseudoDoubleButt on);
401 nameToPseudoType->set(singleButton.impl(), CSSSelector::PseudoSingleButt on);
402 nameToPseudoType->set(noButton.impl(), CSSSelector::PseudoNoButton);
403 nameToPseudoType->set(optional.impl(), CSSSelector::PseudoOptional);
404 nameToPseudoType->set(required.impl(), CSSSelector::PseudoRequired);
405 nameToPseudoType->set(resizer.impl(), CSSSelector::PseudoResizer);
406 nameToPseudoType->set(scope.impl(), CSSSelector::PseudoScope);
407 nameToPseudoType->set(scrollbar.impl(), CSSSelector::PseudoScrollbar);
408 nameToPseudoType->set(scrollbarButton.impl(), CSSSelector::PseudoScrollb arButton);
409 nameToPseudoType->set(scrollbarCorner.impl(), CSSSelector::PseudoScrollb arCorner);
410 nameToPseudoType->set(scrollbarThumb.impl(), CSSSelector::PseudoScrollba rThumb);
411 nameToPseudoType->set(scrollbarTrack.impl(), CSSSelector::PseudoScrollba rTrack);
412 nameToPseudoType->set(scrollbarTrackPiece.impl(), CSSSelector::PseudoScr ollbarTrackPiece);
413 nameToPseudoType->set(cornerPresent.impl(), CSSSelector::PseudoCornerPre sent);
414 nameToPseudoType->set(selection.impl(), CSSSelector::PseudoSelection);
415 nameToPseudoType->set(target.impl(), CSSSelector::PseudoTarget);
416 nameToPseudoType->set(visited.impl(), CSSSelector::PseudoVisited);
417 nameToPseudoType->set(firstPage.impl(), CSSSelector::PseudoFirstPage);
418 nameToPseudoType->set(leftPage.impl(), CSSSelector::PseudoLeftPage);
419 nameToPseudoType->set(rightPage.impl(), CSSSelector::PseudoRightPage);
420 nameToPseudoType->set(fullScreen.impl(), CSSSelector::PseudoFullScreen);
421 nameToPseudoType->set(fullScreenDocument.impl(), CSSSelector::PseudoFull ScreenDocument);
422 nameToPseudoType->set(fullScreenAncestor.impl(), CSSSelector::PseudoFull ScreenAncestor);
423 nameToPseudoType->set(cue.impl(), CSSSelector::PseudoCue);
424 nameToPseudoType->set(cueWithoutParen.impl(), CSSSelector::PseudoWebKitC ustomElement);
425 nameToPseudoType->set(futureCue.impl(), CSSSelector::PseudoFutureCue);
426 nameToPseudoType->set(pastCue.impl(), CSSSelector::PseudoPastCue);
427 nameToPseudoType->set(distributed.impl(), CSSSelector::PseudoDistributed );
428 nameToPseudoType->set(inRange.impl(), CSSSelector::PseudoInRange);
429 nameToPseudoType->set(outOfRange.impl(), CSSSelector::PseudoOutOfRange);
430 nameToPseudoType->set(unresolved.impl(), CSSSelector::PseudoUnresolved);
431 if (RuntimeEnabledFeatures::shadowDOMEnabled()) {
432 nameToPseudoType->set(host.impl(), CSSSelector::PseudoHost);
433 nameToPseudoType->set(hostWithParams.impl(), CSSSelector::PseudoHost );
434 nameToPseudoType->set(ancestor.impl(), CSSSelector::PseudoAncestor);
435 nameToPseudoType->set(ancestorWithParams.impl(), CSSSelector::Pseudo Ancestor);
436 } 380 }
437 } 381 }
382
438 return nameToPseudoType; 383 return nameToPseudoType;
439 } 384 }
440 385
441 #ifndef NDEBUG 386 #ifndef NDEBUG
442 void CSSSelector::show(int indent) const 387 void CSSSelector::show(int indent) const
443 { 388 {
444 printf("%*sselectorText(): %s\n", indent, "", selectorText().ascii().data()) ; 389 printf("%*sselectorText(): %s\n", indent, "", selectorText().ascii().data()) ;
445 printf("%*sm_match: %d\n", indent, "", m_match); 390 printf("%*sm_match: %d\n", indent, "", m_match);
446 printf("%*sisCustomPseudoElement(): %d\n", indent, "", isCustomPseudoElement ()); 391 printf("%*sisCustomPseudoElement(): %d\n", indent, "", isCustomPseudoElement ());
447 if (m_match != Tag) 392 if (m_match != Tag)
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 return false; 883 return false;
939 return (count - m_b) % m_a == 0; 884 return (count - m_b) % m_a == 0;
940 } else { 885 } else {
941 if (count > m_b) 886 if (count > m_b)
942 return false; 887 return false;
943 return (m_b - count) % (-m_a) == 0; 888 return (m_b - count) % (-m_a) == 0;
944 } 889 }
945 } 890 }
946 891
947 } // namespace WebCore 892 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/CSSSelector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698