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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 return nullptr; | 298 return nullptr; |
299 | 299 |
300 if (!m_resolvedFilter) { | 300 if (!m_resolvedFilter) { |
301 RefPtr<ComputedStyle> filterStyle = ComputedStyle::create(); | 301 RefPtr<ComputedStyle> filterStyle = ComputedStyle::create(); |
302 // Must set font in case the filter uses any font-relative units (em, ex
) | 302 // Must set font in case the filter uses any font-relative units (em, ex
) |
303 filterStyle->setFont(m_fontForFilter); | 303 filterStyle->setFont(m_fontForFilter); |
304 | 304 |
305 StyleResolverState resolverState(styleResolutionHost->document(), styleR
esolutionHost, filterStyle.get()); | 305 StyleResolverState resolverState(styleResolutionHost->document(), styleR
esolutionHost, filterStyle.get()); |
306 resolverState.setStyle(filterStyle); | 306 resolverState.setStyle(filterStyle); |
307 | 307 |
308 StyleBuilder::applyProperty(CSSPropertyWebkitFilter, resolverState, m_fi
lterValue.get()); | 308 StyleBuilder::applyProperty(CSSPropertyFilter, resolverState, m_filterVa
lue.get()); |
309 resolverState.loadPendingResources(); | 309 resolverState.loadPendingResources(); |
310 FilterEffectBuilder* filterEffectBuilder = FilterEffectBuilder::create()
; | 310 FilterEffectBuilder* filterEffectBuilder = FilterEffectBuilder::create()
; |
311 | 311 |
312 // We can't reuse m_fillPaint and m_strokePaint for the filter, since th
ese incorporate | 312 // We can't reuse m_fillPaint and m_strokePaint for the filter, since th
ese incorporate |
313 // the global alpha, which isn't applicable here. | 313 // the global alpha, which isn't applicable here. |
314 SkPaint fillPaintForFilter; | 314 SkPaint fillPaintForFilter; |
315 SkPaint strokePaintForFilter; | 315 SkPaint strokePaintForFilter; |
316 m_fillStyle->applyToPaint(fillPaintForFilter); | 316 m_fillStyle->applyToPaint(fillPaintForFilter); |
317 m_strokeStyle->applyToPaint(strokePaintForFilter); | 317 m_strokeStyle->applyToPaint(strokePaintForFilter); |
318 fillPaintForFilter.setColor(m_fillStyle->paintColor()); | 318 fillPaintForFilter.setColor(m_fillStyle->paintColor()); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 paint->setLooper(0); | 561 paint->setLooper(0); |
562 paint->setImageFilter(shadowAndForegroundImageFilter()); | 562 paint->setImageFilter(shadowAndForegroundImageFilter()); |
563 return paint; | 563 return paint; |
564 } | 564 } |
565 paint->setLooper(sk_ref_sp(shadowAndForegroundDrawLooper())); | 565 paint->setLooper(sk_ref_sp(shadowAndForegroundDrawLooper())); |
566 paint->setImageFilter(0); | 566 paint->setImageFilter(0); |
567 return paint; | 567 return paint; |
568 } | 568 } |
569 | 569 |
570 } // namespace blink | 570 } // namespace blink |
OLD | NEW |