| 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..2d554516891080f07ceaf7acf577b167626964d6
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/core/css/CSSRayValue.cpp
|
| @@ -0,0 +1,62 @@
|
| +// 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 "core/css/CSSValueList.h"
|
| +#include "platform/wtf/text/StringBuilder.h"
|
| +
|
| +namespace blink {
|
| +
|
| +CSSRayValue* CSSRayValue::Create(CSSValueList* arguments) {
|
| + return new CSSRayValue(arguments);
|
| +}
|
| +
|
| +CSSRayValue::CSSRayValue(CSSValueList* arguments) : CSSValue(kRayClass) {
|
| + for (auto& member : *arguments) {
|
| + if (member->IsPrimitiveValue()) {
|
| + angle_ = ToCSSPrimitiveValue(member.Get());
|
| + continue;
|
| + }
|
| + const CSSIdentifierValue* identifier = ToCSSIdentifierValue(member.Get());
|
| + if (identifier->GetValueID() == CSSValueContain)
|
| + contain_ = identifier;
|
| + else
|
| + size_ = identifier;
|
| + }
|
| + DCHECK(angle_);
|
| + DCHECK(size_);
|
| + // contain_ is optional.
|
| +}
|
| +
|
| +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
|
|
|