| 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 // StyleResolverState cannot be used in frame-less documents. | 282 // StyleResolverState cannot be used in frame-less documents. |
| 283 if (!styleResolutionHost->document().frame()) | 283 if (!styleResolutionHost->document().frame()) |
| 284 return nullptr; | 284 return nullptr; |
| 285 | 285 |
| 286 if (!m_resolvedFilter) { | 286 if (!m_resolvedFilter) { |
| 287 RefPtr<ComputedStyle> filterStyle = ComputedStyle::create(); | 287 RefPtr<ComputedStyle> filterStyle = ComputedStyle::create(); |
| 288 // Must set font in case the filter uses any font-relative units (em, ex) | 288 // Must set font in case the filter uses any font-relative units (em, ex) |
| 289 filterStyle->setFont(m_fontForFilter); | 289 filterStyle->setFont(m_fontForFilter); |
| 290 | 290 |
| 291 StyleResolverState resolverState(styleResolutionHost->document(), | 291 StyleResolverState resolverState(styleResolutionHost->document(), |
| 292 styleResolutionHost, filterStyle.get()); | 292 styleResolutionHost, filterStyle.get(), |
| 293 filterStyle.get()); |
| 293 resolverState.setStyle(filterStyle); | 294 resolverState.setStyle(filterStyle); |
| 294 | 295 |
| 295 StyleBuilder::applyProperty(CSSPropertyFilter, resolverState, | 296 StyleBuilder::applyProperty(CSSPropertyFilter, resolverState, |
| 296 *m_filterValue); | 297 *m_filterValue); |
| 297 resolverState.loadPendingResources(); | 298 resolverState.loadPendingResources(); |
| 298 | 299 |
| 299 // We can't reuse m_fillPaint and m_strokePaint for the filter, since these | 300 // We can't reuse m_fillPaint and m_strokePaint for the filter, since these |
| 300 // incorporate the global alpha, which isn't applicable here. | 301 // incorporate the global alpha, which isn't applicable here. |
| 301 SkPaint fillPaintForFilter; | 302 SkPaint fillPaintForFilter; |
| 302 m_fillStyle->applyToPaint(fillPaintForFilter); | 303 m_fillStyle->applyToPaint(fillPaintForFilter); |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 paint->setLooper(0); | 546 paint->setLooper(0); |
| 546 paint->setImageFilter(shadowAndForegroundImageFilter()); | 547 paint->setImageFilter(shadowAndForegroundImageFilter()); |
| 547 return paint; | 548 return paint; |
| 548 } | 549 } |
| 549 paint->setLooper(sk_ref_sp(shadowAndForegroundDrawLooper())); | 550 paint->setLooper(sk_ref_sp(shadowAndForegroundDrawLooper())); |
| 550 paint->setImageFilter(0); | 551 paint->setImageFilter(0); |
| 551 return paint; | 552 return paint; |
| 552 } | 553 } |
| 553 | 554 |
| 554 } // namespace blink | 555 } // namespace blink |
| OLD | NEW |