Chromium Code Reviews| Index: third_party/WebKit/Source/core/css/CSSPaintValue.cpp |
| diff --git a/third_party/WebKit/Source/core/css/CSSPaintValue.cpp b/third_party/WebKit/Source/core/css/CSSPaintValue.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..aec7fd07e09349d1d420ad5dbf41cffea33b979e |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/css/CSSPaintValue.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/CSSPaintValue.h" |
| + |
| +#include "core/css/CSSCustomIdentValue.h" |
| +#include "platform/graphics/Image.h" |
| +#include "wtf/text/StringBuilder.h" |
| + |
| +namespace blink { |
| + |
| +CSSPaintValue::CSSPaintValue(PassRefPtrWillBeRawPtr<CSSCustomIdentValue> name) |
| + : CSSImageGeneratorValue(PaintClass) |
| + , m_name(name) |
| +{ |
| +} |
| + |
| +CSSPaintValue::~CSSPaintValue() |
| +{ |
| +} |
| + |
| +String CSSPaintValue::customCSSText() const |
| +{ |
| + StringBuilder result; |
| + result.appendLiteral("paint("); |
| + result.append(name()); |
|
Timothy Loh
2016/03/14 00:45:52
Actually this probably needs to be m_name->customC
ikilpatrick
2016/03/14 17:41:46
Done.
|
| + result.append(')'); |
| + return result.toString(); |
| +} |
| + |
| +String CSSPaintValue::name() const |
| +{ |
| + return m_name->value(); |
| +} |
| + |
| +PassRefPtr<Image> CSSPaintValue::image(const LayoutObject*, const IntSize&) |
| +{ |
| + // TODO(ikilpatrick): implement. |
| + return nullptr; |
| +} |
| + |
| +bool CSSPaintValue::equals(const CSSPaintValue& other) const |
| +{ |
| + return name() == other.name(); |
| +} |
| + |
| +DEFINE_TRACE_AFTER_DISPATCH(CSSPaintValue) |
| +{ |
| + visitor->trace(m_name); |
| + CSSImageGeneratorValue::traceAfterDispatch(visitor); |
| +} |
| + |
| +} // namespace blink |