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

Side by Side Diff: third_party/WebKit/Source/core/css/CSSRayValue.cpp

Issue 2881673003: CSS Motion Path: Support parsing of ray(<angle>) paths (Closed)
Patch Set: size contain? 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 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 #include "core/css/CSSRayValue.h"
6
7 #include "core/css/CSSIdentifierValue.h"
8 #include "core/css/CSSPrimitiveValue.h"
9 #include "core/css/CSSValueList.h"
10 #include "platform/wtf/text/StringBuilder.h"
11
12 namespace blink {
13
14 CSSRayValue* CSSRayValue::Create(CSSValueList* arguments) {
15 return new CSSRayValue(arguments);
16 }
17
18 CSSRayValue::CSSRayValue(CSSValueList* arguments) : CSSValue(kRayClass) {
19 for (auto& member : *arguments) {
20 if (member->IsPrimitiveValue()) {
21 angle_ = ToCSSPrimitiveValue(member.Get());
22 continue;
23 }
24 const CSSIdentifierValue* identifier = ToCSSIdentifierValue(member.Get());
25 if (identifier->GetValueID() == CSSValueContain)
26 contain_ = identifier;
27 else
28 size_ = identifier;
29 }
30 DCHECK(angle_);
31 DCHECK(size_);
32 // contain_ is optional.
33 }
34
35 String CSSRayValue::CustomCSSText() const {
36 StringBuilder result;
37 result.Append("ray(");
38 result.Append(angle_->CssText());
39 result.Append(' ');
40 result.Append(size_->CssText());
41 if (contain_) {
42 result.Append(' ');
43 result.Append(contain_->CssText());
44 }
45 result.Append(')');
46 return result.ToString();
47 }
48
49 bool CSSRayValue::Equals(const CSSRayValue& other) const {
50 return DataEquivalent(angle_, other.angle_) &&
51 DataEquivalent(size_, other.size_) &&
52 DataEquivalent(contain_, other.contain_);
53 }
54
55 DEFINE_TRACE_AFTER_DISPATCH(CSSRayValue) {
56 visitor->Trace(angle_);
57 visitor->Trace(size_);
58 visitor->Trace(contain_);
59 CSSValue::TraceAfterDispatch(visitor);
60 }
61
62 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698