OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
4 * Copyright (C) 2013 Google Inc. All rights reserved. | 4 * Copyright (C) 2013 Google Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
20 * | 20 * |
21 */ | 21 */ |
22 | 22 |
23 #include "core/css/resolver/ElementStyleResources.h" | 23 #include "core/css/resolver/ElementStyleResources.h" |
24 | 24 |
25 #include "core/CSSPropertyNames.h" | 25 #include "core/CSSPropertyNames.h" |
26 #include "core/css/CSSCursorImageValue.h" | 26 #include "core/css/CSSCursorImageValue.h" |
27 #include "core/css/CSSGradientValue.h" | 27 #include "core/css/CSSGradientValue.h" |
28 #include "core/css/CSSImageValue.h" | 28 #include "core/css/CSSImageValue.h" |
29 #include "core/css/CSSSVGDocumentValue.h" | 29 #include "core/css/CSSURIValue.h" |
30 #include "core/dom/Document.h" | 30 #include "core/dom/Document.h" |
31 #include "core/fetch/ResourceFetcher.h" | 31 #include "core/fetch/ResourceFetcher.h" |
32 #include "core/layout/svg/ReferenceFilterBuilder.h" | 32 #include "core/layout/svg/ReferenceFilterBuilder.h" |
33 #include "core/style/ComputedStyle.h" | 33 #include "core/style/ComputedStyle.h" |
34 #include "core/style/ContentData.h" | 34 #include "core/style/ContentData.h" |
35 #include "core/style/CursorData.h" | 35 #include "core/style/CursorData.h" |
36 #include "core/style/FillLayer.h" | 36 #include "core/style/FillLayer.h" |
37 #include "core/style/StyleFetchedImage.h" | 37 #include "core/style/StyleFetchedImage.h" |
38 #include "core/style/StyleFetchedImageSet.h" | 38 #include "core/style/StyleFetchedImageSet.h" |
39 #include "core/style/StyleGeneratedImage.h" | 39 #include "core/style/StyleGeneratedImage.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 StyleImage* ElementStyleResources::cursorOrPendingFromValue(CSSPropertyID proper
ty, const CSSCursorImageValue& value) | 98 StyleImage* ElementStyleResources::cursorOrPendingFromValue(CSSPropertyID proper
ty, const CSSCursorImageValue& value) |
99 { | 99 { |
100 if (value.isCachePending(m_deviceScaleFactor)) { | 100 if (value.isCachePending(m_deviceScaleFactor)) { |
101 m_pendingImageProperties.add(property); | 101 m_pendingImageProperties.add(property); |
102 return StylePendingImage::create(value); | 102 return StylePendingImage::create(value); |
103 } | 103 } |
104 return value.cachedImage(m_deviceScaleFactor); | 104 return value.cachedImage(m_deviceScaleFactor); |
105 } | 105 } |
106 | 106 |
107 void ElementStyleResources::addPendingSVGDocument(FilterOperation* filterOperati
on, const CSSSVGDocumentValue* cssSVGDocumentValue) | 107 void ElementStyleResources::addPendingSVGDocument(FilterOperation* filterOperati
on, const CSSURIValue* cssUriValue) |
108 { | 108 { |
109 m_pendingSVGDocuments.set(filterOperation, cssSVGDocumentValue); | 109 m_pendingSVGDocuments.set(filterOperation, cssUriValue); |
110 } | 110 } |
111 | 111 |
112 void ElementStyleResources::loadPendingSVGDocuments(ComputedStyle* computedStyle
) | 112 void ElementStyleResources::loadPendingSVGDocuments(ComputedStyle* computedStyle
) |
113 { | 113 { |
114 if (!computedStyle->hasFilter() || m_pendingSVGDocuments.isEmpty()) | 114 if (!computedStyle->hasFilter() || m_pendingSVGDocuments.isEmpty()) |
115 return; | 115 return; |
116 | 116 |
117 FilterOperations::FilterOperationVector& filterOperations = computedStyle->m
utableFilter().operations(); | 117 FilterOperations::FilterOperationVector& filterOperations = computedStyle->m
utableFilter().operations(); |
118 for (unsigned i = 0; i < filterOperations.size(); ++i) { | 118 for (unsigned i = 0; i < filterOperations.size(); ++i) { |
119 FilterOperation* filterOperation = filterOperations.at(i); | 119 FilterOperation* filterOperation = filterOperations.at(i); |
120 if (filterOperation->type() == FilterOperation::REFERENCE) { | 120 if (filterOperation->type() == FilterOperation::REFERENCE) { |
121 ReferenceFilterOperation* referenceFilter = toReferenceFilterOperati
on(filterOperation); | 121 ReferenceFilterOperation* referenceFilter = toReferenceFilterOperati
on(filterOperation); |
122 | 122 |
123 const CSSSVGDocumentValue* value = m_pendingSVGDocuments.get(referen
ceFilter); | 123 const CSSURIValue* value = m_pendingSVGDocuments.get(referenceFilter
); |
124 if (!value) | 124 if (!value) |
125 continue; | 125 continue; |
126 DocumentResource* resource = value->load(m_document); | 126 DocumentResource* resource = value->load(*m_document); |
127 if (!resource) | 127 if (!resource) |
128 continue; | 128 continue; |
129 | 129 |
130 // Stash the DocumentResource on the reference filter. | 130 // Stash the DocumentResource on the reference filter. |
131 ReferenceFilterBuilder::setDocumentResourceReference(referenceFilter
, new DocumentResourceReference(resource)); | 131 ReferenceFilterBuilder::setDocumentResourceReference(referenceFilter
, new DocumentResourceReference(resource)); |
132 } | 132 } |
133 } | 133 } |
134 } | 134 } |
135 | 135 |
136 StyleImage* ElementStyleResources::loadPendingImage(ComputedStyle* style, StyleP
endingImage* pendingImage, CrossOriginAttributeValue crossOrigin) | 136 StyleImage* ElementStyleResources::loadPendingImage(ComputedStyle* style, StyleP
endingImage* pendingImage, CrossOriginAttributeValue crossOrigin) |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 } | 252 } |
253 } | 253 } |
254 | 254 |
255 void ElementStyleResources::loadPendingResources(ComputedStyle* computedStyle) | 255 void ElementStyleResources::loadPendingResources(ComputedStyle* computedStyle) |
256 { | 256 { |
257 loadPendingImages(computedStyle); | 257 loadPendingImages(computedStyle); |
258 loadPendingSVGDocuments(computedStyle); | 258 loadPendingSVGDocuments(computedStyle); |
259 } | 259 } |
260 | 260 |
261 } // namespace blink | 261 } // namespace blink |
OLD | NEW |