| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/csspaint/CSSPaintDefinition.h" | 5 #include "modules/csspaint/CSSPaintDefinition.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptState.h" | 7 #include "bindings/core/v8/ScriptState.h" |
| 8 #include "bindings/core/v8/V8Binding.h" | 8 #include "bindings/core/v8/V8Binding.h" |
| 9 #include "bindings/core/v8/V8BindingMacros.h" | 9 #include "bindings/core/v8/V8BindingMacros.h" |
| 10 #include "bindings/core/v8/V8ObjectConstructor.h" | 10 #include "bindings/core/v8/V8ObjectConstructor.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 } | 32 } |
| 33 | 33 |
| 34 } // namespace | 34 } // namespace |
| 35 | 35 |
| 36 CSSPaintDefinition* CSSPaintDefinition::create( | 36 CSSPaintDefinition* CSSPaintDefinition::create( |
| 37 ScriptState* scriptState, | 37 ScriptState* scriptState, |
| 38 v8::Local<v8::Function> constructor, | 38 v8::Local<v8::Function> constructor, |
| 39 v8::Local<v8::Function> paint, | 39 v8::Local<v8::Function> paint, |
| 40 Vector<CSSPropertyID>& nativeInvalidationProperties, | 40 Vector<CSSPropertyID>& nativeInvalidationProperties, |
| 41 Vector<AtomicString>& customInvalidationProperties, | 41 Vector<AtomicString>& customInvalidationProperties, |
| 42 Vector<CSSSyntaxDescriptor>& inputArgumentTypes, |
| 42 bool hasAlpha) { | 43 bool hasAlpha) { |
| 43 return new CSSPaintDefinition(scriptState, constructor, paint, | 44 return new CSSPaintDefinition( |
| 44 nativeInvalidationProperties, | 45 scriptState, constructor, paint, nativeInvalidationProperties, |
| 45 customInvalidationProperties, hasAlpha); | 46 customInvalidationProperties, inputArgumentTypes, hasAlpha); |
| 46 } | 47 } |
| 47 | 48 |
| 48 CSSPaintDefinition::CSSPaintDefinition( | 49 CSSPaintDefinition::CSSPaintDefinition( |
| 49 ScriptState* scriptState, | 50 ScriptState* scriptState, |
| 50 v8::Local<v8::Function> constructor, | 51 v8::Local<v8::Function> constructor, |
| 51 v8::Local<v8::Function> paint, | 52 v8::Local<v8::Function> paint, |
| 52 Vector<CSSPropertyID>& nativeInvalidationProperties, | 53 Vector<CSSPropertyID>& nativeInvalidationProperties, |
| 53 Vector<AtomicString>& customInvalidationProperties, | 54 Vector<AtomicString>& customInvalidationProperties, |
| 55 Vector<CSSSyntaxDescriptor>& inputArgumentTypes, |
| 54 bool hasAlpha) | 56 bool hasAlpha) |
| 55 : m_scriptState(scriptState), | 57 : m_scriptState(scriptState), |
| 56 m_constructor(scriptState->isolate(), constructor), | 58 m_constructor(scriptState->isolate(), constructor), |
| 57 m_paint(scriptState->isolate(), paint), | 59 m_paint(scriptState->isolate(), paint), |
| 58 m_didCallConstructor(false), | 60 m_didCallConstructor(false), |
| 59 m_hasAlpha(hasAlpha) { | 61 m_hasAlpha(hasAlpha) { |
| 60 m_nativeInvalidationProperties.swap(nativeInvalidationProperties); | 62 m_nativeInvalidationProperties.swap(nativeInvalidationProperties); |
| 61 m_customInvalidationProperties.swap(customInvalidationProperties); | 63 m_customInvalidationProperties.swap(customInvalidationProperties); |
| 64 m_inputArgumentTypes.swap(inputArgumentTypes); |
| 62 } | 65 } |
| 63 | 66 |
| 64 CSSPaintDefinition::~CSSPaintDefinition() {} | 67 CSSPaintDefinition::~CSSPaintDefinition() {} |
| 65 | 68 |
| 66 PassRefPtr<Image> CSSPaintDefinition::paint(const LayoutObject& layoutObject, | 69 PassRefPtr<Image> CSSPaintDefinition::paint(const LayoutObject& layoutObject, |
| 67 const IntSize& size, | 70 const IntSize& size, |
| 68 float zoom) { | 71 float zoom) { |
| 69 const IntSize specifiedSize = getSpecifiedSize(size, zoom); | 72 const IntSize specifiedSize = getSpecifiedSize(size, zoom); |
| 70 | 73 |
| 71 ScriptState::Scope scope(m_scriptState.get()); | 74 ScriptState::Scope scope(m_scriptState.get()); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 v8::Local<v8::Object> paintInstance; | 131 v8::Local<v8::Object> paintInstance; |
| 129 if (V8ObjectConstructor::newInstance(isolate, constructor) | 132 if (V8ObjectConstructor::newInstance(isolate, constructor) |
| 130 .ToLocal(&paintInstance)) { | 133 .ToLocal(&paintInstance)) { |
| 131 m_instance.set(isolate, paintInstance); | 134 m_instance.set(isolate, paintInstance); |
| 132 } | 135 } |
| 133 | 136 |
| 134 m_didCallConstructor = true; | 137 m_didCallConstructor = true; |
| 135 } | 138 } |
| 136 | 139 |
| 137 } // namespace blink | 140 } // namespace blink |
| OLD | NEW |