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 * |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 #include "core/CSSPropertyNames.h" | 26 #include "core/CSSPropertyNames.h" |
27 #include "core/css/CSSCursorImageValue.h" | 27 #include "core/css/CSSCursorImageValue.h" |
28 #include "core/css/CSSImageValue.h" | 28 #include "core/css/CSSImageValue.h" |
29 #include "core/css/CSSSVGDocumentValue.h" | 29 #include "core/css/CSSSVGDocumentValue.h" |
30 #include "core/css/resolver/ElementStyleResources.h" | 30 #include "core/css/resolver/ElementStyleResources.h" |
31 #include "core/dom/Document.h" | 31 #include "core/dom/Document.h" |
32 #include "core/fetch/ResourceFetcher.h" | 32 #include "core/fetch/ResourceFetcher.h" |
33 #include "core/layout/style/ContentData.h" | 33 #include "core/layout/style/ContentData.h" |
34 #include "core/layout/style/FillLayer.h" | 34 #include "core/layout/style/FillLayer.h" |
35 #include "core/layout/style/LayoutStyle.h" | 35 #include "core/layout/style/ComputedStyle.h" |
36 #include "core/layout/style/StyleFetchedImage.h" | 36 #include "core/layout/style/StyleFetchedImage.h" |
37 #include "core/layout/style/StyleFetchedImageSet.h" | 37 #include "core/layout/style/StyleFetchedImageSet.h" |
38 #include "core/layout/style/StyleGeneratedImage.h" | 38 #include "core/layout/style/StyleGeneratedImage.h" |
39 #include "core/layout/style/StylePendingImage.h" | 39 #include "core/layout/style/StylePendingImage.h" |
40 #include "core/layout/svg/ReferenceFilterBuilder.h" | 40 #include "core/layout/svg/ReferenceFilterBuilder.h" |
41 | 41 |
42 namespace blink { | 42 namespace blink { |
43 | 43 |
44 StyleResourceLoader::StyleResourceLoader(Document* document) | 44 StyleResourceLoader::StyleResourceLoader(Document* document) |
45 : m_document(document) | 45 : m_document(document) |
46 { | 46 { |
47 } | 47 } |
48 | 48 |
49 DEFINE_TRACE(StyleResourceLoader) | 49 DEFINE_TRACE(StyleResourceLoader) |
50 { | 50 { |
51 visitor->trace(m_document); | 51 visitor->trace(m_document); |
52 } | 52 } |
53 | 53 |
54 void StyleResourceLoader::loadPendingSVGDocuments(LayoutStyle* layoutStyle, Elem
entStyleResources& elementStyleResources) | 54 void StyleResourceLoader::loadPendingSVGDocuments(ComputedStyle* computedStyle,
ElementStyleResources& elementStyleResources) |
55 { | 55 { |
56 if (!layoutStyle->hasFilter() || elementStyleResources.pendingSVGDocuments()
.isEmpty()) | 56 if (!computedStyle->hasFilter() || elementStyleResources.pendingSVGDocuments
().isEmpty()) |
57 return; | 57 return; |
58 | 58 |
59 FilterOperations::FilterOperationVector& filterOperations = layoutStyle->mut
ableFilter().operations(); | 59 FilterOperations::FilterOperationVector& filterOperations = computedStyle->m
utableFilter().operations(); |
60 for (unsigned i = 0; i < filterOperations.size(); ++i) { | 60 for (unsigned i = 0; i < filterOperations.size(); ++i) { |
61 RefPtrWillBeRawPtr<FilterOperation> filterOperation = filterOperations.a
t(i); | 61 RefPtrWillBeRawPtr<FilterOperation> filterOperation = filterOperations.a
t(i); |
62 if (filterOperation->type() == FilterOperation::REFERENCE) { | 62 if (filterOperation->type() == FilterOperation::REFERENCE) { |
63 ReferenceFilterOperation* referenceFilter = toReferenceFilterOperati
on(filterOperation.get()); | 63 ReferenceFilterOperation* referenceFilter = toReferenceFilterOperati
on(filterOperation.get()); |
64 | 64 |
65 CSSSVGDocumentValue* value = elementStyleResources.pendingSVGDocumen
ts().get(referenceFilter); | 65 CSSSVGDocumentValue* value = elementStyleResources.pendingSVGDocumen
ts().get(referenceFilter); |
66 if (!value) | 66 if (!value) |
67 continue; | 67 continue; |
68 DocumentResource* resource = value->load(m_document); | 68 DocumentResource* resource = value->load(m_document); |
69 if (!resource) | 69 if (!resource) |
(...skipping 26 matching lines...) Expand all Loading... |
96 return imageSetValue->cachedImageSet(document, deviceScaleFactor, option
s); | 96 return imageSetValue->cachedImageSet(document, deviceScaleFactor, option
s); |
97 | 97 |
98 return nullptr; | 98 return nullptr; |
99 } | 99 } |
100 | 100 |
101 PassRefPtr<StyleImage> StyleResourceLoader::loadPendingImage(StylePendingImage*
pendingImage, float deviceScaleFactor) | 101 PassRefPtr<StyleImage> StyleResourceLoader::loadPendingImage(StylePendingImage*
pendingImage, float deviceScaleFactor) |
102 { | 102 { |
103 return doLoadPendingImage(m_document, pendingImage, deviceScaleFactor, Resou
rceFetcher::defaultResourceOptions()); | 103 return doLoadPendingImage(m_document, pendingImage, deviceScaleFactor, Resou
rceFetcher::defaultResourceOptions()); |
104 } | 104 } |
105 | 105 |
106 void StyleResourceLoader::loadPendingShapeImage(LayoutStyle* layoutStyle, ShapeV
alue* shapeValue, float deviceScaleFactor) | 106 void StyleResourceLoader::loadPendingShapeImage(ComputedStyle* computedStyle, Sh
apeValue* shapeValue, float deviceScaleFactor) |
107 { | 107 { |
108 if (!shapeValue) | 108 if (!shapeValue) |
109 return; | 109 return; |
110 | 110 |
111 StyleImage* image = shapeValue->image(); | 111 StyleImage* image = shapeValue->image(); |
112 if (!image || !image->isPendingImage()) | 112 if (!image || !image->isPendingImage()) |
113 return; | 113 return; |
114 | 114 |
115 ResourceLoaderOptions options = ResourceFetcher::defaultResourceOptions(); | 115 ResourceLoaderOptions options = ResourceFetcher::defaultResourceOptions(); |
116 options.allowCredentials = DoNotAllowStoredCredentials; | 116 options.allowCredentials = DoNotAllowStoredCredentials; |
117 options.credentialsRequested = ClientDidNotRequestCredentials; | 117 options.credentialsRequested = ClientDidNotRequestCredentials; |
118 options.corsEnabled = IsCORSEnabled; | 118 options.corsEnabled = IsCORSEnabled; |
119 | 119 |
120 shapeValue->setImage(doLoadPendingImage(m_document, toStylePendingImage(imag
e), deviceScaleFactor, options)); | 120 shapeValue->setImage(doLoadPendingImage(m_document, toStylePendingImage(imag
e), deviceScaleFactor, options)); |
121 } | 121 } |
122 | 122 |
123 void StyleResourceLoader::loadPendingImages(LayoutStyle* style, ElementStyleReso
urces& elementStyleResources) | 123 void StyleResourceLoader::loadPendingImages(ComputedStyle* style, ElementStyleRe
sources& elementStyleResources) |
124 { | 124 { |
125 if (elementStyleResources.pendingImageProperties().isEmpty()) | 125 if (elementStyleResources.pendingImageProperties().isEmpty()) |
126 return; | 126 return; |
127 | 127 |
128 PendingImagePropertyMap::const_iterator::Keys end = elementStyleResources.pe
ndingImageProperties().end().keys(); | 128 PendingImagePropertyMap::const_iterator::Keys end = elementStyleResources.pe
ndingImageProperties().end().keys(); |
129 for (PendingImagePropertyMap::const_iterator::Keys it = elementStyleResource
s.pendingImageProperties().begin().keys(); it != end; ++it) { | 129 for (PendingImagePropertyMap::const_iterator::Keys it = elementStyleResource
s.pendingImageProperties().begin().keys(); it != end; ++it) { |
130 CSSPropertyID currentProperty = *it; | 130 CSSPropertyID currentProperty = *it; |
131 | 131 |
132 switch (currentProperty) { | 132 switch (currentProperty) { |
133 case CSSPropertyBackgroundImage: { | 133 case CSSPropertyBackgroundImage: { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 loadPendingShapeImage(style, style->shapeOutside(), elementStyleReso
urces.deviceScaleFactor()); | 198 loadPendingShapeImage(style, style->shapeOutside(), elementStyleReso
urces.deviceScaleFactor()); |
199 break; | 199 break; |
200 default: | 200 default: |
201 ASSERT_NOT_REACHED(); | 201 ASSERT_NOT_REACHED(); |
202 } | 202 } |
203 } | 203 } |
204 | 204 |
205 elementStyleResources.clearPendingImageProperties(); | 205 elementStyleResources.clearPendingImageProperties(); |
206 } | 206 } |
207 | 207 |
208 void StyleResourceLoader::loadPendingResources(LayoutStyle* layoutStyle, Element
StyleResources& elementStyleResources) | 208 void StyleResourceLoader::loadPendingResources(ComputedStyle* computedStyle, Ele
mentStyleResources& elementStyleResources) |
209 { | 209 { |
210 // Start loading images referenced by this style. | 210 // Start loading images referenced by this style. |
211 loadPendingImages(layoutStyle, elementStyleResources); | 211 loadPendingImages(computedStyle, elementStyleResources); |
212 | 212 |
213 // Start loading the SVG Documents referenced by this style. | 213 // Start loading the SVG Documents referenced by this style. |
214 loadPendingSVGDocuments(layoutStyle, elementStyleResources); | 214 loadPendingSVGDocuments(computedStyle, elementStyleResources); |
215 } | 215 } |
216 | 216 |
217 } | 217 } |
OLD | NEW |