OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2015 Google Inc. All rights reserved. | 3 * Copyright (C) 2015 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include <utility> | 44 #include <utility> |
45 | 45 |
46 namespace blink { | 46 namespace blink { |
47 | 47 |
48 DEFINE_TRACE(CSSGradientColorStop) | 48 DEFINE_TRACE(CSSGradientColorStop) |
49 { | 49 { |
50 visitor->trace(m_position); | 50 visitor->trace(m_position); |
51 visitor->trace(m_color); | 51 visitor->trace(m_color); |
52 } | 52 } |
53 | 53 |
54 PassRefPtr<Image> CSSGradientValue::image(LayoutObject* renderer, const IntSize&
size) | 54 PassRefPtr<Image> CSSGradientValue::image(LayoutObject* layoutObject, const IntS
ize& size) |
55 { | 55 { |
56 if (size.isEmpty()) | 56 if (size.isEmpty()) |
57 return nullptr; | 57 return nullptr; |
58 | 58 |
59 bool cacheable = isCacheable(); | 59 bool cacheable = isCacheable(); |
60 if (cacheable) { | 60 if (cacheable) { |
61 if (!clients().contains(renderer)) | 61 if (!clients().contains(layoutObject)) |
62 return nullptr; | 62 return nullptr; |
63 | 63 |
64 // Need to look up our size. Create a string of width*height to use as
a hash key. | 64 // Need to look up our size. Create a string of width*height to use as
a hash key. |
65 Image* result = getImage(renderer, size); | 65 Image* result = getImage(layoutObject, size); |
66 if (result) | 66 if (result) |
67 return result; | 67 return result; |
68 } | 68 } |
69 | 69 |
70 // We need to create an image. | 70 // We need to create an image. |
71 RefPtr<Gradient> gradient; | 71 RefPtr<Gradient> gradient; |
72 | 72 |
73 const ComputedStyle* rootStyle = renderer->document().documentElement()->com
putedStyle(); | 73 const ComputedStyle* rootStyle = layoutObject->document().documentElement()-
>computedStyle(); |
74 CSSToLengthConversionData conversionData(renderer->style(), rootStyle, rende
rer->view(), renderer->style()->effectiveZoom()); | 74 CSSToLengthConversionData conversionData(layoutObject->style(), rootStyle, l
ayoutObject->view(), layoutObject->style()->effectiveZoom()); |
75 if (isLinearGradientValue()) | 75 if (isLinearGradientValue()) |
76 gradient = toCSSLinearGradientValue(this)->createGradient(conversionData
, size, *renderer); | 76 gradient = toCSSLinearGradientValue(this)->createGradient(conversionData
, size, *layoutObject); |
77 else | 77 else |
78 gradient = toCSSRadialGradientValue(this)->createGradient(conversionData
, size, *renderer); | 78 gradient = toCSSRadialGradientValue(this)->createGradient(conversionData
, size, *layoutObject); |
79 | 79 |
80 RefPtr<Image> newImage = GradientGeneratedImage::create(gradient, size); | 80 RefPtr<Image> newImage = GradientGeneratedImage::create(gradient, size); |
81 if (cacheable) | 81 if (cacheable) |
82 putImage(size, newImage); | 82 putImage(size, newImage); |
83 | 83 |
84 return newImage.release(); | 84 return newImage.release(); |
85 } | 85 } |
86 | 86 |
87 // Should only ever be called for deprecated gradients. | 87 // Should only ever be called for deprecated gradients. |
88 static inline bool compareStops(const CSSGradientColorStop& a, const CSSGradient
ColorStop& b) | 88 static inline bool compareStops(const CSSGradientColorStop& a, const CSSGradient
ColorStop& b) |
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1202 visitor->trace(m_firstRadius); | 1202 visitor->trace(m_firstRadius); |
1203 visitor->trace(m_secondRadius); | 1203 visitor->trace(m_secondRadius); |
1204 visitor->trace(m_shape); | 1204 visitor->trace(m_shape); |
1205 visitor->trace(m_sizingBehavior); | 1205 visitor->trace(m_sizingBehavior); |
1206 visitor->trace(m_endHorizontalSize); | 1206 visitor->trace(m_endHorizontalSize); |
1207 visitor->trace(m_endVerticalSize); | 1207 visitor->trace(m_endVerticalSize); |
1208 CSSGradientValue::traceAfterDispatch(visitor); | 1208 CSSGradientValue::traceAfterDispatch(visitor); |
1209 } | 1209 } |
1210 | 1210 |
1211 } // namespace blink | 1211 } // namespace blink |
OLD | NEW |