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

Side by Side Diff: Source/core/css/CSSParser.h

Issue 22917005: New parser mode for CSSOM @viewport descriptors. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: More comments added. Created 7 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) 2003 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 3 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
4 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 - 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserve d. 5 * Copyright (C) 2009 - 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserve d.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 16 matching lines...) Expand all
27 #include "CSSValueKeywords.h" 27 #include "CSSValueKeywords.h"
28 #include "core/css/CSSCalculationValue.h" 28 #include "core/css/CSSCalculationValue.h"
29 #include "core/css/CSSFilterValue.h" 29 #include "core/css/CSSFilterValue.h"
30 #include "core/css/CSSGradientValue.h" 30 #include "core/css/CSSGradientValue.h"
31 #include "core/css/CSSParserMode.h" 31 #include "core/css/CSSParserMode.h"
32 #include "core/css/CSSParserValues.h" 32 #include "core/css/CSSParserValues.h"
33 #include "core/css/CSSProperty.h" 33 #include "core/css/CSSProperty.h"
34 #include "core/css/CSSPropertySourceData.h" 34 #include "core/css/CSSPropertySourceData.h"
35 #include "core/css/CSSSelector.h" 35 #include "core/css/CSSSelector.h"
36 #include "core/css/MediaQuery.h" 36 #include "core/css/MediaQuery.h"
37 #include "core/css/StylePropertySet.h"
37 #include "core/page/UseCounter.h" 38 #include "core/page/UseCounter.h"
38 #include "core/platform/graphics/Color.h" 39 #include "core/platform/graphics/Color.h"
39 #include "wtf/HashSet.h" 40 #include "wtf/HashSet.h"
40 #include "wtf/OwnArrayPtr.h" 41 #include "wtf/OwnArrayPtr.h"
41 #include "wtf/Vector.h" 42 #include "wtf/Vector.h"
42 #include "wtf/text/AtomicString.h" 43 #include "wtf/text/AtomicString.h"
43 #include "wtf/text/TextPosition.h" 44 #include "wtf/text/TextPosition.h"
44 45
45 namespace WebCore { 46 namespace WebCore {
46 47
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 453
453 ~ImplicitScope() 454 ~ImplicitScope()
454 { 455 {
455 m_parser->m_implicitShorthand = false; 456 m_parser->m_implicitShorthand = false;
456 } 457 }
457 458
458 private: 459 private:
459 WebCore::CSSParser* m_parser; 460 WebCore::CSSParser* m_parser;
460 }; 461 };
461 462
463 class StyleDeclarationScope {
464 WTF_MAKE_NONCOPYABLE(StyleDeclarationScope);
465 public:
466 StyleDeclarationScope(CSSParser* parser, const StylePropertySet* declara tion)
467 : m_parser(parser)
468 , m_mode(declaration->cssParserMode())
469 {
470 if (m_mode == ViewportMode) {
471 ASSERT(!m_parser->inViewport());
472 m_parser->markViewportRuleBodyStart();
473 }
474 }
475
476 ~StyleDeclarationScope()
477 {
478 if (m_mode == ViewportMode)
479 m_parser->markViewportRuleBodyEnd();
480 }
481
482 private:
483 CSSParser* m_parser;
484 CSSParserMode m_mode;
485 };
486
462 bool is8BitSource() const { return m_is8BitSource; } 487 bool is8BitSource() const { return m_is8BitSource; }
463 488
464 template <typename SourceCharacterType> 489 template <typename SourceCharacterType>
465 int realLex(void* yylval); 490 int realLex(void* yylval);
466 491
467 UChar*& currentCharacter16(); 492 UChar*& currentCharacter16();
468 493
469 template <typename CharacterType> 494 template <typename CharacterType>
470 inline CharacterType*& currentCharacter(); 495 inline CharacterType*& currentCharacter();
471 496
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 inline void detectDashToken(int); 554 inline void detectDashToken(int);
530 template <typename CharacterType> 555 template <typename CharacterType>
531 inline void detectAtToken(int, bool); 556 inline void detectAtToken(int, bool);
532 template <typename CharacterType> 557 template <typename CharacterType>
533 inline void detectSupportsToken(int); 558 inline void detectSupportsToken(int);
534 template <typename CharacterType> 559 template <typename CharacterType>
535 inline void detectCSSVariableDefinitionToken(int); 560 inline void detectCSSVariableDefinitionToken(int);
536 561
537 void setStyleSheet(StyleSheetContents* styleSheet) { m_styleSheet = styleShe et; } 562 void setStyleSheet(StyleSheetContents* styleSheet) { m_styleSheet = styleShe et; }
538 563
539 inline bool inStrictMode() const { return m_context.mode == CSSStrictMode || m_context.mode == SVGAttributeMode; } 564 inline bool inStrictMode() const { return isStrictParserMode(m_context.mode) ; }
540 inline bool inQuirksMode() const { return m_context.mode == CSSQuirksMode; } 565 inline bool inQuirksMode() const { return m_context.mode == CSSQuirksMode; }
541 566
542 KURL completeURL(const String& url) const; 567 KURL completeURL(const String& url) const;
543 568
544 void recheckAtKeyword(const UChar* str, int len); 569 void recheckAtKeyword(const UChar* str, int len);
545 570
546 template<unsigned prefixLength, unsigned suffixLength> 571 template<unsigned prefixLength, unsigned suffixLength>
547 inline void setupParser(const char (&prefix)[prefixLength], const String& st ring, const char (&suffix)[suffixLength]) 572 inline void setupParser(const char (&prefix)[prefixLength], const String& st ring, const char (&suffix)[suffixLength])
548 { 573 {
549 setupParser(prefix, prefixLength - 1, string, suffix, suffixLength - 1); 574 setupParser(prefix, prefixLength - 1, string, suffix, suffixLength - 1);
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 } 787 }
763 788
764 inline int cssyylex(void* yylval, CSSParser* parser) 789 inline int cssyylex(void* yylval, CSSParser* parser)
765 { 790 {
766 return parser->lex(yylval); 791 return parser->lex(yylval);
767 } 792 }
768 793
769 } // namespace WebCore 794 } // namespace WebCore
770 795
771 #endif // CSSParser_h 796 #endif // CSSParser_h
OLDNEW
« no previous file with comments | « LayoutTests/css3/device-adapt/viewport-cssom-01-expected.txt ('k') | Source/core/css/CSSParser-in.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698