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

Unified Diff: Source/core/css/parser/SizesAttributeParser.h

Issue 224733011: A sizes attribute parser (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/css/parser/SizesAttributeParser.h
diff --git a/Source/core/css/parser/SizesAttributeParser.h b/Source/core/css/parser/SizesAttributeParser.h
new file mode 100644
index 0000000000000000000000000000000000000000..44ba86bc29217eaa5987173a88df80eea715e7b5
--- /dev/null
+++ b/Source/core/css/parser/SizesAttributeParser.h
@@ -0,0 +1,40 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SizesAttributeParser_h
+#define SizesAttributeParser_h
+
+#include "core/css/MediaValues.h"
+#include "core/css/parser/MediaQueryParser.h"
+#include "wtf/text/WTFString.h"
+
+namespace WebCore {
+
+class SizesAttributeParser {
+public:
+ static int findEffectiveSize(const String& attribute, PassRefPtr<MediaValues>);
+
+private:
+ SizesAttributeParser(PassRefPtr<MediaValues> mediaValues)
eseidel 2014/04/08 06:02:14 Feels a bit odd for this to be private, but OK. I
+ : m_mediaValues(mediaValues)
+ , m_length(0)
+ {
+ }
+
+ bool parseImpl(Vector<MediaQueryToken>& tokens);
+ bool parseMediaConditionAndLength(TokenIterator startToken, TokenIterator endToken);
eseidel 2014/04/08 06:02:14 Should these be const&?
+ int effectiveSize();
+ int calculateLengthInPixels(TokenIterator startToken, TokenIterator endToken);
+ bool mediaConditionMatches(PassRefPtr<MediaQuerySet> mediaCondition);
+
+ RefPtr<MediaQuerySet> m_mediaCondition;
+ RefPtr<MediaValues> m_mediaValues;
+ int m_length;
eseidel 2014/04/08 06:02:14 Do you want these to be ints or unsigned?
+ int m_defaultLength;
+};
+
+} // namespace
+
+#endif
+

Powered by Google App Engine
This is Rietveld 408576698