OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/canvas2d/CanvasRenderingContext2DState.h" | 5 #include "modules/canvas2d/CanvasRenderingContext2DState.h" |
6 | 6 |
7 #include "core/css/CSSFontSelector.h" | 7 #include "core/css/CSSFontSelector.h" |
8 #include "core/css/resolver/FilterOperationResolver.h" | 8 #include "core/css/resolver/FilterOperationResolver.h" |
9 #include "core/css/resolver/StyleBuilder.h" | 9 #include "core/css/resolver/StyleBuilder.h" |
10 #include "core/css/resolver/StyleResolverState.h" | 10 #include "core/css/resolver/StyleResolverState.h" |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 return nullptr; | 299 return nullptr; |
300 | 300 |
301 if (!m_resolvedFilter) { | 301 if (!m_resolvedFilter) { |
302 RefPtr<ComputedStyle> filterStyle = ComputedStyle::create(); | 302 RefPtr<ComputedStyle> filterStyle = ComputedStyle::create(); |
303 // Must set font in case the filter uses any font-relative units (em, ex
) | 303 // Must set font in case the filter uses any font-relative units (em, ex
) |
304 filterStyle->setFont(m_fontForFilter); | 304 filterStyle->setFont(m_fontForFilter); |
305 | 305 |
306 StyleResolverState resolverState(styleResolutionHost->document(), styleR
esolutionHost, filterStyle.get()); | 306 StyleResolverState resolverState(styleResolutionHost->document(), styleR
esolutionHost, filterStyle.get()); |
307 resolverState.setStyle(filterStyle); | 307 resolverState.setStyle(filterStyle); |
308 | 308 |
309 StyleBuilder::applyProperty(CSSPropertyWebkitFilter, resolverState, *m_f
ilterValue); | 309 StyleBuilder::applyProperty(CSSPropertyFilter, resolverState, *m_filterV
alue); |
310 resolverState.loadPendingResources(); | 310 resolverState.loadPendingResources(); |
311 FilterEffectBuilder* filterEffectBuilder = FilterEffectBuilder::create()
; | 311 FilterEffectBuilder* filterEffectBuilder = FilterEffectBuilder::create()
; |
312 | 312 |
313 // We can't reuse m_fillPaint and m_strokePaint for the filter, since th
ese incorporate | 313 // We can't reuse m_fillPaint and m_strokePaint for the filter, since th
ese incorporate |
314 // the global alpha, which isn't applicable here. | 314 // the global alpha, which isn't applicable here. |
315 SkPaint fillPaintForFilter; | 315 SkPaint fillPaintForFilter; |
316 SkPaint strokePaintForFilter; | 316 SkPaint strokePaintForFilter; |
317 m_fillStyle->applyToPaint(fillPaintForFilter); | 317 m_fillStyle->applyToPaint(fillPaintForFilter); |
318 m_strokeStyle->applyToPaint(strokePaintForFilter); | 318 m_strokeStyle->applyToPaint(strokePaintForFilter); |
319 fillPaintForFilter.setColor(m_fillStyle->paintColor()); | 319 fillPaintForFilter.setColor(m_fillStyle->paintColor()); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 paint->setLooper(0); | 562 paint->setLooper(0); |
563 paint->setImageFilter(shadowAndForegroundImageFilter()); | 563 paint->setImageFilter(shadowAndForegroundImageFilter()); |
564 return paint; | 564 return paint; |
565 } | 565 } |
566 paint->setLooper(sk_ref_sp(shadowAndForegroundDrawLooper())); | 566 paint->setLooper(sk_ref_sp(shadowAndForegroundDrawLooper())); |
567 paint->setImageFilter(0); | 567 paint->setImageFilter(0); |
568 return paint; | 568 return paint; |
569 } | 569 } |
570 | 570 |
571 } // namespace blink | 571 } // namespace blink |
OLD | NEW |