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

Unified Diff: third_party/WebKit/Source/core/css/cssom/CSSOMTypes.cpp

Issue 1590193002: Partial implementation of inline StylePropertyMap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@maps
Patch Set: Fix windows maybe Created 4 years, 10 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: third_party/WebKit/Source/core/css/cssom/CSSOMTypes.cpp
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSOMTypes.cpp b/third_party/WebKit/Source/core/css/cssom/CSSOMTypes.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..043ff617033e623326ca8877108fda0a8f9b32d2
--- /dev/null
+++ b/third_party/WebKit/Source/core/css/cssom/CSSOMTypes.cpp
@@ -0,0 +1,54 @@
+// Copyright 2016 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.
+
+#include "core/css/cssom/CSSOMTypes.h"
+
+#include "core/css/cssom/KeywordValue.h"
+#include "core/css/cssom/LengthValue.h"
+
+namespace blink {
+
+bool CSSOMTypes::propertyCanTake(CSSPropertyID id, const StyleValue& styleValue)
+{
+ StyleValue::StyleValueType type = styleValue.type();
+
+ if (type == StyleValue::KeywordValueType)
+ return validKeywordForProperty(id, toKeywordValue(styleValue));
+
+ switch (id) {
+ case CSSPropertyHeight:
+ case CSSPropertyWidth:
+ case CSSPropertyMinHeight:
+ case CSSPropertyMinWidth:
+ case CSSPropertyMaxHeight:
+ case CSSPropertyMaxWidth:
+ case CSSPropertyBackgroundPosition:
+ case CSSPropertyBackgroundPositionY:
+ if (type != StyleValue::SimpleLengthType && type != StyleValue::CalcLengthType)
+ return false;
+ return (!toLengthValue(styleValue).containsPercent() || propertySupportsPercentage(id));
+ default:
+ return false;
+ }
+}
+
+bool CSSOMTypes::propertySupportsPercentage(CSSPropertyID id)
+{
+ // TODO(meade): Implement.
+ return false;
+}
+
+bool CSSOMTypes::validKeywordForProperty(CSSPropertyID id, const KeywordValue& keyword)
+{
+ // TODO(meade): Implement.
+ return false;
+}
+
+bool CSSOMTypes::propertySupportsMultiple(CSSPropertyID id)
+{
+ // TODO(meade): Implement.
+ return false;
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698