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

Unified Diff: third_party/WebKit/Source/core/css/CSSRayValue.cpp

Issue 2881673003: CSS Motion Path: Support parsing of ray(<angle>) paths (Closed)
Patch Set: DCHECK_EQ Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/CSSRayValue.cpp
diff --git a/third_party/WebKit/Source/core/css/CSSRayValue.cpp b/third_party/WebKit/Source/core/css/CSSRayValue.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..d617c2c3d8d82f6d3b311d68d36885a096d313b7
--- /dev/null
+++ b/third_party/WebKit/Source/core/css/CSSRayValue.cpp
@@ -0,0 +1,51 @@
+// Copyright 2017 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/CSSRayValue.h"
+
+#include "core/css/CSSIdentifierValue.h"
+#include "core/css/CSSPrimitiveValue.h"
+#include "platform/wtf/text/StringBuilder.h"
+
+namespace blink {
+
+CSSRayValue* CSSRayValue::Create(const CSSPrimitiveValue& angle,
+ const CSSIdentifierValue& size,
+ const CSSIdentifierValue* contain) {
+ return new CSSRayValue(angle, size, contain);
+}
+
+CSSRayValue::CSSRayValue(const CSSPrimitiveValue& angle,
+ const CSSIdentifierValue& size,
+ const CSSIdentifierValue* contain)
+ : CSSValue(kRayClass), angle_(&angle), size_(&size), contain_(contain) {}
+
+String CSSRayValue::CustomCSSText() const {
+ StringBuilder result;
+ result.Append("ray(");
+ result.Append(angle_->CssText());
+ result.Append(' ');
+ result.Append(size_->CssText());
+ if (contain_) {
+ result.Append(' ');
+ result.Append(contain_->CssText());
+ }
+ result.Append(')');
+ return result.ToString();
+}
+
+bool CSSRayValue::Equals(const CSSRayValue& other) const {
+ return DataEquivalent(angle_, other.angle_) &&
+ DataEquivalent(size_, other.size_) &&
+ DataEquivalent(contain_, other.contain_);
+}
+
+DEFINE_TRACE_AFTER_DISPATCH(CSSRayValue) {
+ visitor->Trace(angle_);
+ visitor->Trace(size_);
+ visitor->Trace(contain_);
+ CSSValue::TraceAfterDispatch(visitor);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698