OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 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 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 LayoutObjectSizeCountMap::iterator it = m_clients.find(layoutObject); | 59 LayoutObjectSizeCountMap::iterator it = m_clients.find(layoutObject); |
60 if (it == m_clients.end()) { | 60 if (it == m_clients.end()) { |
61 m_clients.add(layoutObject, SizeAndCount(size, 1)); | 61 m_clients.add(layoutObject, SizeAndCount(size, 1)); |
62 } else { | 62 } else { |
63 SizeAndCount& sizeCount = it->value; | 63 SizeAndCount& sizeCount = it->value; |
64 ++sizeCount.count; | 64 ++sizeCount.count; |
65 } | 65 } |
66 } | 66 } |
67 | 67 |
68 RawPtr<CSSImageGeneratorValue> CSSImageGeneratorValue::valueWithURLsMadeAbsolute
() | 68 CSSImageGeneratorValue* CSSImageGeneratorValue::valueWithURLsMadeAbsolute() |
69 { | 69 { |
70 if (isCrossfadeValue()) | 70 if (isCrossfadeValue()) |
71 return toCSSCrossfadeValue(this)->valueWithURLsMadeAbsolute(); | 71 return toCSSCrossfadeValue(this)->valueWithURLsMadeAbsolute(); |
72 return this; | 72 return this; |
73 } | 73 } |
74 | 74 |
75 void CSSImageGeneratorValue::removeClient(const LayoutObject* layoutObject) | 75 void CSSImageGeneratorValue::removeClient(const LayoutObject* layoutObject) |
76 { | 76 { |
77 ASSERT(layoutObject); | 77 ASSERT(layoutObject); |
78 LayoutObjectSizeCountMap::iterator it = m_clients.find(layoutObject); | 78 LayoutObjectSizeCountMap::iterator it = m_clients.find(layoutObject); |
(...skipping 21 matching lines...) Expand all Loading... |
100 #endif | 100 #endif |
101 } | 101 } |
102 | 102 |
103 Image* CSSImageGeneratorValue::getImage(const LayoutObject* layoutObject, const
IntSize& size) | 103 Image* CSSImageGeneratorValue::getImage(const LayoutObject* layoutObject, const
IntSize& size) |
104 { | 104 { |
105 LayoutObjectSizeCountMap::iterator it = m_clients.find(layoutObject); | 105 LayoutObjectSizeCountMap::iterator it = m_clients.find(layoutObject); |
106 if (it != m_clients.end()) { | 106 if (it != m_clients.end()) { |
107 SizeAndCount& sizeCount = it->value; | 107 SizeAndCount& sizeCount = it->value; |
108 IntSize oldSize = sizeCount.size; | 108 IntSize oldSize = sizeCount.size; |
109 if (oldSize != size) { | 109 if (oldSize != size) { |
110 RawPtr<CSSImageGeneratorValue> protect(this); | |
111 removeClient(layoutObject); | 110 removeClient(layoutObject); |
112 addClient(layoutObject, size); | 111 addClient(layoutObject, size); |
113 } | 112 } |
114 } | 113 } |
115 | 114 |
116 // Don't generate an image for empty sizes. | 115 // Don't generate an image for empty sizes. |
117 if (size.isEmpty()) | 116 if (size.isEmpty()) |
118 return nullptr; | 117 return nullptr; |
119 | 118 |
120 // Look up the image in our cache. | 119 // Look up the image in our cache. |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 break; | 224 break; |
226 case RadialGradientClass: | 225 case RadialGradientClass: |
227 toCSSRadialGradientValue(this)->loadSubimages(document); | 226 toCSSRadialGradientValue(this)->loadSubimages(document); |
228 break; | 227 break; |
229 default: | 228 default: |
230 ASSERT_NOT_REACHED(); | 229 ASSERT_NOT_REACHED(); |
231 } | 230 } |
232 } | 231 } |
233 | 232 |
234 } // namespace blink | 233 } // namespace blink |
OLD | NEW |