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

Side by Side Diff: Source/core/css/parser/SizesCalcParser.h

Issue 252743004: A thread safe CSS calc parser for sizes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed CSSCalc tests that assert Created 6 years, 7 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SizesCalcParser_h
6 #define SizesCalcParser_h
7
8 #include "core/css/MediaValues.h"
9 #include "core/css/parser/MediaQueryToken.h"
10 #include "wtf/text/WTFString.h"
11
12 namespace WebCore {
13
14 struct SizesCalcValue {
15 double value;
16 bool isLength;
17 UChar operation;
18
19 SizesCalcValue()
20 : value(0)
21 , isLength(false)
22 , operation(0)
23 {
24 }
25
26 SizesCalcValue(double numericValue, bool length)
27 : value(numericValue)
28 , isLength(length)
29 , operation(0)
30 {
31 }
32 };
33
34 class SizesCalcParser {
35
36 public:
37 static bool parse(MediaQueryTokenIterator start, MediaQueryTokenIterator end , PassRefPtr<MediaValues>, unsigned& result);
38
39 private:
40 SizesCalcParser(PassRefPtr<MediaValues> mediaValues)
41 : m_mediaValues(mediaValues)
42 {
43 }
44
45 bool calcToReversePolishNotation(MediaQueryTokenIterator start, MediaQueryTo kenIterator end);
46 bool calculate(unsigned& result);
47 void appendNumber(const MediaQueryToken&);
48 bool appendLength(const MediaQueryToken&);
49 bool handleOperator(Vector<MediaQueryToken>& stack, const MediaQueryToken&);
50 void appendOperator(const MediaQueryToken&);
51
52 Vector<SizesCalcValue> m_valueList;
53 RefPtr<MediaValues> m_mediaValues;
54 };
55
56 } // namespace WebCore
57
58 #endif // SizesCalcParser_h
59
OLDNEW
« no previous file with comments | « Source/core/css/parser/SizesAttributeParser.cpp ('k') | Source/core/css/parser/SizesCalcParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698