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 12 matching lines...) Expand all Loading... |
23 #include "config.h" | 23 #include "config.h" |
24 #include "core/css/resolver/StyleResourceLoader.h" | 24 #include "core/css/resolver/StyleResourceLoader.h" |
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/svg/ReferenceFilterBuilder.h" | |
34 #include "core/style/ComputedStyle.h" | |
35 #include "core/style/ContentData.h" | 33 #include "core/style/ContentData.h" |
36 #include "core/style/FillLayer.h" | 34 #include "core/style/FillLayer.h" |
| 35 #include "core/style/ComputedStyle.h" |
37 #include "core/style/StyleFetchedImage.h" | 36 #include "core/style/StyleFetchedImage.h" |
38 #include "core/style/StyleFetchedImageSet.h" | 37 #include "core/style/StyleFetchedImageSet.h" |
39 #include "core/style/StyleGeneratedImage.h" | 38 #include "core/style/StyleGeneratedImage.h" |
40 #include "core/style/StylePendingImage.h" | 39 #include "core/style/StylePendingImage.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 { |
(...skipping 22 matching lines...) Expand all Loading... |
73 ReferenceFilterBuilder::setDocumentResourceReference(referenceFilter
, adoptPtr(new DocumentResourceReference(resource))); | 73 ReferenceFilterBuilder::setDocumentResourceReference(referenceFilter
, adoptPtr(new DocumentResourceReference(resource))); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 elementStyleResources.clearPendingSVGDocuments(); | 77 elementStyleResources.clearPendingSVGDocuments(); |
78 } | 78 } |
79 | 79 |
80 static PassRefPtrWillBeRawPtr<StyleImage> doLoadPendingImage(Document* document,
StylePendingImage* pendingImage, float deviceScaleFactor, const ResourceLoaderO
ptions& options) | 80 static PassRefPtrWillBeRawPtr<StyleImage> doLoadPendingImage(Document* document,
StylePendingImage* pendingImage, float deviceScaleFactor, const ResourceLoaderO
ptions& options) |
81 { | 81 { |
82 if (CSSImageValue* imageValue = pendingImage->cssImageValue()) | 82 if (CSSImageValue* imageValue = pendingImage->cssImageValue()) |
83 return imageValue->cacheImage(document, options); | 83 return imageValue->cachedImage(document, options); |
84 | 84 |
85 if (CSSImageGeneratorValue* imageGeneratorValue = pendingImage->cssImageGene
ratorValue()) { | 85 if (CSSImageGeneratorValue* imageGeneratorValue |
| 86 = pendingImage->cssImageGeneratorValue()) { |
86 imageGeneratorValue->loadSubimages(document); | 87 imageGeneratorValue->loadSubimages(document); |
87 return StyleGeneratedImage::create(imageGeneratorValue); | 88 return StyleGeneratedImage::create(imageGeneratorValue); |
88 } | 89 } |
89 | 90 |
90 if (CSSCursorImageValue* cursorImageValue = pendingImage->cssCursorImageValu
e()) | 91 if (CSSCursorImageValue* cursorImageValue |
91 return cursorImageValue->cacheImage(document, deviceScaleFactor); | 92 = pendingImage->cssCursorImageValue()) |
| 93 return cursorImageValue->cachedImage(document, deviceScaleFactor); |
92 | 94 |
93 if (CSSImageSetValue* imageSetValue = pendingImage->cssImageSetValue()) | 95 if (CSSImageSetValue* imageSetValue = pendingImage->cssImageSetValue()) |
94 return imageSetValue->cacheImageSet(document, deviceScaleFactor, options
); | 96 return imageSetValue->cachedImageSet(document, deviceScaleFactor, option
s); |
95 | 97 |
96 return nullptr; | 98 return nullptr; |
97 } | 99 } |
98 | 100 |
99 PassRefPtrWillBeRawPtr<StyleImage> StyleResourceLoader::loadPendingImage(StylePe
ndingImage* pendingImage, float deviceScaleFactor) | 101 PassRefPtrWillBeRawPtr<StyleImage> StyleResourceLoader::loadPendingImage(StylePe
ndingImage* pendingImage, float deviceScaleFactor) |
100 { | 102 { |
101 return doLoadPendingImage(m_document, pendingImage, deviceScaleFactor, Resou
rceFetcher::defaultResourceOptions()); | 103 return doLoadPendingImage(m_document, pendingImage, deviceScaleFactor, Resou
rceFetcher::defaultResourceOptions()); |
102 } | 104 } |
103 | 105 |
104 void StyleResourceLoader::loadPendingShapeImage(ComputedStyle* computedStyle, Sh
apeValue* shapeValue, float deviceScaleFactor) | 106 void StyleResourceLoader::loadPendingShapeImage(ComputedStyle* computedStyle, Sh
apeValue* shapeValue, float deviceScaleFactor) |
(...skipping 11 matching lines...) Expand all Loading... |
116 options.corsEnabled = IsCORSEnabled; | 118 options.corsEnabled = IsCORSEnabled; |
117 | 119 |
118 shapeValue->setImage(doLoadPendingImage(m_document, toStylePendingImage(imag
e), deviceScaleFactor, options)); | 120 shapeValue->setImage(doLoadPendingImage(m_document, toStylePendingImage(imag
e), deviceScaleFactor, options)); |
119 } | 121 } |
120 | 122 |
121 void StyleResourceLoader::loadPendingImages(ComputedStyle* style, ElementStyleRe
sources& elementStyleResources) | 123 void StyleResourceLoader::loadPendingImages(ComputedStyle* style, ElementStyleRe
sources& elementStyleResources) |
122 { | 124 { |
123 if (elementStyleResources.pendingImageProperties().isEmpty()) | 125 if (elementStyleResources.pendingImageProperties().isEmpty()) |
124 return; | 126 return; |
125 | 127 |
126 for (CSSPropertyID property : elementStyleResources.pendingImageProperties()
) { | 128 PendingImagePropertyMap::const_iterator::Keys end = elementStyleResources.pe
ndingImageProperties().end().keys(); |
127 switch (property) { | 129 for (PendingImagePropertyMap::const_iterator::Keys it = elementStyleResource
s.pendingImageProperties().begin().keys(); it != end; ++it) { |
| 130 CSSPropertyID currentProperty = *it; |
| 131 |
| 132 switch (currentProperty) { |
128 case CSSPropertyBackgroundImage: { | 133 case CSSPropertyBackgroundImage: { |
129 for (FillLayer* backgroundLayer = &style->accessBackgroundLayers();
backgroundLayer; backgroundLayer = backgroundLayer->next()) { | 134 for (FillLayer* backgroundLayer = &style->accessBackgroundLayers();
backgroundLayer; backgroundLayer = backgroundLayer->next()) { |
130 if (backgroundLayer->image() && backgroundLayer->image()->isPend
ingImage()) | 135 if (backgroundLayer->image() && backgroundLayer->image()->isPend
ingImage()) |
131 backgroundLayer->setImage(loadPendingImage(toStylePendingIma
ge(backgroundLayer->image()), elementStyleResources.deviceScaleFactor())); | 136 backgroundLayer->setImage(loadPendingImage(toStylePendingIma
ge(backgroundLayer->image()), elementStyleResources.deviceScaleFactor())); |
132 } | 137 } |
133 break; | 138 break; |
134 } | 139 } |
135 case CSSPropertyContent: { | 140 case CSSPropertyContent: { |
136 for (ContentData* contentData = const_cast<ContentData*>(style->cont
entData()); contentData; contentData = contentData->next()) { | 141 for (ContentData* contentData = const_cast<ContentData*>(style->cont
entData()); contentData; contentData = contentData->next()) { |
137 if (contentData->isImage()) { | 142 if (contentData->isImage()) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 void StyleResourceLoader::loadPendingResources(ComputedStyle* computedStyle, Ele
mentStyleResources& elementStyleResources) | 208 void StyleResourceLoader::loadPendingResources(ComputedStyle* computedStyle, Ele
mentStyleResources& elementStyleResources) |
204 { | 209 { |
205 // Start loading images referenced by this style. | 210 // Start loading images referenced by this style. |
206 loadPendingImages(computedStyle, elementStyleResources); | 211 loadPendingImages(computedStyle, elementStyleResources); |
207 | 212 |
208 // Start loading the SVG Documents referenced by this style. | 213 // Start loading the SVG Documents referenced by this style. |
209 loadPendingSVGDocuments(computedStyle, elementStyleResources); | 214 loadPendingSVGDocuments(computedStyle, elementStyleResources); |
210 } | 215 } |
211 | 216 |
212 } | 217 } |
OLD | NEW |