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

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: Revert last patch, will include it in a separate commit 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 lengthValue)
27 : value(lengthValue)
28 , isLength(true)
29 , operation(0)
30 {
31 }
32 };
33
34 class SizesCalcParser {
35
36 public:
37 static bool parse(MediaQueryTokenIterator start,
eseidel 2014/04/29 17:30:37 We don't wrap to 80c in blink, I wouldn't bother d
38 MediaQueryTokenIterator end,
39 PassRefPtr<MediaValues>,
40 unsigned& result);
41
42 private:
43 SizesCalcParser(PassRefPtr<MediaValues> mediaValues)
44 : m_mediaValues(mediaValues)
45 {
46 }
47
48 bool calcToReversePolishNotation(MediaQueryTokenIterator start, MediaQueryTo kenIterator end);
49 bool calculate(unsigned& result);
50 void appendNumber(const MediaQueryToken&);
51 bool appendLength(const MediaQueryToken&);
52 bool handleOperator(Vector<MediaQueryToken>& stack, const MediaQueryToken&);
53 void appendOperator(const MediaQueryToken&);
54
55 Vector<SizesCalcValue> m_valueList;
56 RefPtr<MediaValues> m_mediaValues;
57 };
58
59 } // namespace WebCore
60
61 #endif // SizesCalcParser_h
62
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698