| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 IntSize canvasSize, | 277 IntSize canvasSize, |
| 278 CanvasRenderingContext2D* context) const { | 278 CanvasRenderingContext2D* context) const { |
| 279 if (!m_filterValue) | 279 if (!m_filterValue) |
| 280 return nullptr; | 280 return nullptr; |
| 281 | 281 |
| 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 // Update the filter value to the proper base URL if needed. |
| 288 if (m_filterValue->mayContainUrl()) |
| 289 m_filterValue->reResolveUrl(styleResolutionHost->document()); |
| 290 |
| 287 RefPtr<ComputedStyle> filterStyle = ComputedStyle::create(); | 291 RefPtr<ComputedStyle> filterStyle = ComputedStyle::create(); |
| 288 // Must set font in case the filter uses any font-relative units (em, ex) | 292 // Must set font in case the filter uses any font-relative units (em, ex) |
| 289 filterStyle->setFont(m_fontForFilter); | 293 filterStyle->setFont(m_fontForFilter); |
| 290 | 294 |
| 291 StyleResolverState resolverState(styleResolutionHost->document(), | 295 StyleResolverState resolverState(styleResolutionHost->document(), |
| 292 styleResolutionHost, filterStyle.get()); | 296 styleResolutionHost, filterStyle.get()); |
| 293 resolverState.setStyle(filterStyle); | 297 resolverState.setStyle(filterStyle); |
| 294 | 298 |
| 295 StyleBuilder::applyProperty(CSSPropertyFilter, resolverState, | 299 StyleBuilder::applyProperty(CSSPropertyFilter, resolverState, |
| 296 *m_filterValue); | 300 *m_filterValue); |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 paint->setLooper(0); | 549 paint->setLooper(0); |
| 546 paint->setImageFilter(shadowAndForegroundImageFilter()); | 550 paint->setImageFilter(shadowAndForegroundImageFilter()); |
| 547 return paint; | 551 return paint; |
| 548 } | 552 } |
| 549 paint->setLooper(sk_ref_sp(shadowAndForegroundDrawLooper())); | 553 paint->setLooper(sk_ref_sp(shadowAndForegroundDrawLooper())); |
| 550 paint->setImageFilter(0); | 554 paint->setImageFilter(0); |
| 551 return paint; | 555 return paint; |
| 552 } | 556 } |
| 553 | 557 |
| 554 } // namespace blink | 558 } // namespace blink |
| OLD | NEW |