OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "core/style/FilterOperation.h" | 26 #include "core/style/FilterOperation.h" |
27 | 27 |
28 #include "core/svg/SVGElementProxy.h" | |
28 #include "platform/LengthFunctions.h" | 29 #include "platform/LengthFunctions.h" |
29 #include "platform/animation/AnimationUtilities.h" | 30 #include "platform/animation/AnimationUtilities.h" |
30 #include "platform/graphics/filters/FEDropShadow.h" | 31 #include "platform/graphics/filters/FEDropShadow.h" |
31 #include "platform/graphics/filters/FEGaussianBlur.h" | 32 #include "platform/graphics/filters/FEGaussianBlur.h" |
32 #include "platform/graphics/filters/Filter.h" | 33 #include "platform/graphics/filters/Filter.h" |
33 #include "platform/graphics/filters/FilterEffect.h" | 34 #include "platform/graphics/filters/FilterEffect.h" |
34 | 35 |
35 namespace blink { | 36 namespace blink { |
36 | 37 |
37 FilterOperation* FilterOperation::blend(const FilterOperation* from, | 38 FilterOperation* FilterOperation::blend(const FilterOperation* from, |
38 const FilterOperation* to, | 39 const FilterOperation* to, |
39 double progress) { | 40 double progress) { |
40 DCHECK(from || to); | 41 DCHECK(from || to); |
41 if (to) | 42 if (to) |
42 return to->blend(from, progress); | 43 return to->blend(from, progress); |
43 return from->blend(0, 1 - progress); | 44 return from->blend(0, 1 - progress); |
44 } | 45 } |
45 | 46 |
46 DEFINE_TRACE(ReferenceFilterOperation) { | 47 DEFINE_TRACE(ReferenceFilterOperation) { |
48 visitor->trace(m_elementProxy); | |
47 visitor->trace(m_filter); | 49 visitor->trace(m_filter); |
48 FilterOperation::trace(visitor); | 50 FilterOperation::trace(visitor); |
49 } | 51 } |
50 | 52 |
51 FloatRect ReferenceFilterOperation::mapRect(const FloatRect& rect) const { | 53 FloatRect ReferenceFilterOperation::mapRect(const FloatRect& rect) const { |
52 const auto* lastEffect = m_filter ? m_filter->lastEffect() : nullptr; | 54 const auto* lastEffect = m_filter ? m_filter->lastEffect() : nullptr; |
53 if (!lastEffect) | 55 if (!lastEffect) |
54 return rect; | 56 return rect; |
55 return lastEffect->mapRect(rect); | 57 return lastEffect->mapRect(rect); |
56 } | 58 } |
57 | 59 |
60 ReferenceFilterOperation::ReferenceFilterOperation( | |
61 const String& url, | |
62 SVGElementProxy& elementProxy) | |
63 : FilterOperation(REFERENCE), | |
64 m_url(url), | |
65 m_elementProxy(&elementProxy), | |
66 m_elementProxyGeneration(elementProxy.generation()) {} | |
67 | |
68 void ReferenceFilterOperation::addClient(SVGResourceClient* client) { | |
69 m_elementProxy->addClient(client); | |
70 } | |
71 | |
72 void ReferenceFilterOperation::removeClient(SVGResourceClient* client) { | |
73 m_elementProxy->removeClient(client); | |
74 } | |
75 | |
76 bool ReferenceFilterOperation::operator==(const FilterOperation& o) const { | |
77 if (!isSameType(o)) | |
78 return false; | |
79 const ReferenceFilterOperation& other = toReferenceFilterOperation(o); | |
80 return m_url == other.m_url && m_elementProxy == other.m_elementProxy && | |
81 m_elementProxyGeneration == other.m_elementProxyGeneration; | |
esprehn
2016/10/25 01:18:42
What changes the generation?
fs
2016/10/25 15:00:53
All invalidations of the proxy (SVGElementProxy::p
| |
82 } | |
83 | |
58 FilterOperation* BasicColorMatrixFilterOperation::blend( | 84 FilterOperation* BasicColorMatrixFilterOperation::blend( |
59 const FilterOperation* from, | 85 const FilterOperation* from, |
60 double progress) const { | 86 double progress) const { |
61 double fromAmount; | 87 double fromAmount; |
62 if (from) { | 88 if (from) { |
63 SECURITY_DCHECK(from->isSameType(*this)); | 89 SECURITY_DCHECK(from->isSameType(*this)); |
64 fromAmount = toBasicColorMatrixFilterOperation(from)->amount(); | 90 fromAmount = toBasicColorMatrixFilterOperation(from)->amount(); |
65 } else { | 91 } else { |
66 switch (m_type) { | 92 switch (m_type) { |
67 case GRAYSCALE: | 93 case GRAYSCALE: |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 } | 210 } |
185 | 211 |
186 bool BoxReflectFilterOperation::operator==(const FilterOperation& o) const { | 212 bool BoxReflectFilterOperation::operator==(const FilterOperation& o) const { |
187 if (!isSameType(o)) | 213 if (!isSameType(o)) |
188 return false; | 214 return false; |
189 const auto& other = static_cast<const BoxReflectFilterOperation&>(o); | 215 const auto& other = static_cast<const BoxReflectFilterOperation&>(o); |
190 return m_reflection == other.m_reflection; | 216 return m_reflection == other.m_reflection; |
191 } | 217 } |
192 | 218 |
193 } // namespace blink | 219 } // namespace blink |
OLD | NEW |