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

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

Issue 2661323002: Implement CSSPaintValue and add a layout test. (Closed)
Patch Set: fix indent Created 3 years, 10 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
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 "core/css/CSSPaintValue.h" 5 #include "core/css/CSSPaintValue.h"
6 6
7 #include "core/css/CSSCustomIdentValue.h" 7 #include "core/css/CSSCustomIdentValue.h"
8 #include "core/layout/LayoutObject.h" 8 #include "core/layout/LayoutObject.h"
9 #include "platform/graphics/Image.h" 9 #include "platform/graphics/Image.h"
10 #include "wtf/text/StringBuilder.h" 10 #include "wtf/text/StringBuilder.h"
(...skipping 29 matching lines...) Expand all
40 return m_name->value(); 40 return m_name->value();
41 } 41 }
42 42
43 PassRefPtr<Image> CSSPaintValue::image(const LayoutObject& layoutObject, 43 PassRefPtr<Image> CSSPaintValue::image(const LayoutObject& layoutObject,
44 const IntSize& size, 44 const IntSize& size,
45 float zoom) { 45 float zoom) {
46 if (!m_generator) 46 if (!m_generator)
47 m_generator = CSSPaintImageGenerator::create( 47 m_generator = CSSPaintImageGenerator::create(
48 name(), layoutObject.document(), m_paintImageGeneratorObserver); 48 name(), layoutObject.document(), m_paintImageGeneratorObserver);
49 49
50 return m_generator->paint(layoutObject, size, zoom); 50 return m_generator->paint(layoutObject, size, zoom, m_argumentVariableData);
ikilpatrick 2017/02/16 03:19:36 should be able to parse the variable data inside t
renjieliu1 2017/02/16 04:11:14 do you think we can pass in the input argument typ
51 } 51 }
52 52
53 void CSSPaintValue::Observer::paintImageGeneratorReady() { 53 void CSSPaintValue::Observer::paintImageGeneratorReady() {
54 m_ownerValue->paintImageGeneratorReady(); 54 m_ownerValue->paintImageGeneratorReady();
55 } 55 }
56 56
57 void CSSPaintValue::paintImageGeneratorReady() { 57 void CSSPaintValue::paintImageGeneratorReady() {
58 for (const LayoutObject* client : clients().keys()) { 58 for (const LayoutObject* client : clients().keys()) {
59 const_cast<LayoutObject*>(client)->imageChanged( 59 const_cast<LayoutObject*>(client)->imageChanged(
60 static_cast<WrappedImagePtr>(this)); 60 static_cast<WrappedImagePtr>(this));
61 } 61 }
62 } 62 }
63 63
64 bool CSSPaintValue::knownToBeOpaque(const LayoutObject& layoutObject) const { 64 bool CSSPaintValue::knownToBeOpaque(const LayoutObject& layoutObject) const {
65 return m_generator && !m_generator->hasAlpha(); 65 return m_generator && !m_generator->hasAlpha();
66 } 66 }
67 67
68 bool CSSPaintValue::equals(const CSSPaintValue& other) const { 68 bool CSSPaintValue::equals(const CSSPaintValue& other) const {
69 return name() == other.name() && customCSSText() == other.customCSSText(); 69 return name() == other.name() && customCSSText() == other.customCSSText();
70 } 70 }
71 71
72 DEFINE_TRACE_AFTER_DISPATCH(CSSPaintValue) { 72 DEFINE_TRACE_AFTER_DISPATCH(CSSPaintValue) {
73 visitor->trace(m_name); 73 visitor->trace(m_name);
74 visitor->trace(m_generator); 74 visitor->trace(m_generator);
75 visitor->trace(m_paintImageGeneratorObserver); 75 visitor->trace(m_paintImageGeneratorObserver);
76 CSSImageGeneratorValue::traceAfterDispatch(visitor); 76 CSSImageGeneratorValue::traceAfterDispatch(visitor);
77 } 77 }
78 78
79 } // namespace blink 79 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698