| 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 20 matching lines...) Expand all Loading... |
| 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" | 33 #include "core/layout/svg/ReferenceFilterBuilder.h" |
| 34 #include "core/style/ComputedStyle.h" | 34 #include "core/style/ComputedStyle.h" |
| 35 #include "core/style/ContentData.h" | 35 #include "core/style/ContentData.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" |
| 40 #include "core/style/StylePendingImage.h" | 40 #include "core/style/StylePendingImage.h" |
| 41 #include "platform/CrossOriginAttributeValue.h" |
| 41 | 42 |
| 42 namespace blink { | 43 namespace blink { |
| 43 | 44 |
| 44 StyleResourceLoader::StyleResourceLoader(Document* document) | 45 StyleResourceLoader::StyleResourceLoader(Document* document) |
| 45 : m_document(document) | 46 : m_document(document) |
| 46 { | 47 { |
| 47 } | 48 } |
| 48 | 49 |
| 49 DEFINE_TRACE(StyleResourceLoader) | 50 DEFINE_TRACE(StyleResourceLoader) |
| 50 { | 51 { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 70 continue; | 71 continue; |
| 71 | 72 |
| 72 // Stash the DocumentResource on the reference filter. | 73 // Stash the DocumentResource on the reference filter. |
| 73 ReferenceFilterBuilder::setDocumentResourceReference(referenceFilter
, adoptPtr(new DocumentResourceReference(resource))); | 74 ReferenceFilterBuilder::setDocumentResourceReference(referenceFilter
, adoptPtr(new DocumentResourceReference(resource))); |
| 74 } | 75 } |
| 75 } | 76 } |
| 76 | 77 |
| 77 elementStyleResources.clearPendingSVGDocuments(); | 78 elementStyleResources.clearPendingSVGDocuments(); |
| 78 } | 79 } |
| 79 | 80 |
| 80 static PassRefPtrWillBeRawPtr<StyleImage> doLoadPendingImage(Document* document,
StylePendingImage* pendingImage, float deviceScaleFactor, const ResourceLoaderO
ptions& options) | 81 static PassRefPtrWillBeRawPtr<StyleImage> doLoadPendingImage(Document* document,
StylePendingImage* pendingImage, float deviceScaleFactor, CrossOriginAttributeV
alue crossOrigin) |
| 81 { | 82 { |
| 82 if (CSSImageValue* imageValue = pendingImage->cssImageValue()) | 83 if (CSSImageValue* imageValue = pendingImage->cssImageValue()) |
| 83 return imageValue->cacheImage(document, options); | 84 return imageValue->cacheImage(document, crossOrigin); |
| 84 | 85 |
| 85 if (CSSImageGeneratorValue* imageGeneratorValue = pendingImage->cssImageGene
ratorValue()) { | 86 if (CSSImageGeneratorValue* imageGeneratorValue = pendingImage->cssImageGene
ratorValue()) { |
| 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 = pendingImage->cssCursorImageValu
e()) |
| 91 return cursorImageValue->cacheImage(document, deviceScaleFactor); | 92 return cursorImageValue->cacheImage(document, deviceScaleFactor); |
| 92 | 93 |
| 93 if (CSSImageSetValue* imageSetValue = pendingImage->cssImageSetValue()) | 94 if (CSSImageSetValue* imageSetValue = pendingImage->cssImageSetValue()) |
| 94 return imageSetValue->cacheImageSet(document, deviceScaleFactor, options
); | 95 return imageSetValue->cacheImageSet(document, deviceScaleFactor, crossOr
igin); |
| 95 | 96 |
| 96 return nullptr; | 97 return nullptr; |
| 97 } | 98 } |
| 98 | 99 |
| 99 PassRefPtrWillBeRawPtr<StyleImage> StyleResourceLoader::loadPendingImage(StylePe
ndingImage* pendingImage, float deviceScaleFactor) | 100 PassRefPtrWillBeRawPtr<StyleImage> StyleResourceLoader::loadPendingImage(StylePe
ndingImage* pendingImage, float deviceScaleFactor) |
| 100 { | 101 { |
| 101 return doLoadPendingImage(m_document, pendingImage, deviceScaleFactor, Resou
rceFetcher::defaultResourceOptions()); | 102 return doLoadPendingImage(m_document, pendingImage, deviceScaleFactor, Cross
OriginAttributeNotSet); |
| 102 } | 103 } |
| 103 | 104 |
| 104 void StyleResourceLoader::loadPendingShapeImage(ComputedStyle* computedStyle, Sh
apeValue* shapeValue, float deviceScaleFactor) | 105 void StyleResourceLoader::loadPendingShapeImage(ComputedStyle* computedStyle, Sh
apeValue* shapeValue, float deviceScaleFactor) |
| 105 { | 106 { |
| 106 if (!shapeValue) | 107 if (!shapeValue) |
| 107 return; | 108 return; |
| 108 | 109 |
| 109 StyleImage* image = shapeValue->image(); | 110 StyleImage* image = shapeValue->image(); |
| 110 if (!image || !image->isPendingImage()) | 111 if (!image || !image->isPendingImage()) |
| 111 return; | 112 return; |
| 112 | 113 |
| 113 ResourceLoaderOptions options = ResourceFetcher::defaultResourceOptions(); | 114 shapeValue->setImage(doLoadPendingImage(m_document, toStylePendingImage(imag
e), deviceScaleFactor, CrossOriginAttributeAnonymous)); |
| 114 options.allowCredentials = DoNotAllowStoredCredentials; | |
| 115 options.credentialsRequested = ClientDidNotRequestCredentials; | |
| 116 options.corsEnabled = IsCORSEnabled; | |
| 117 | |
| 118 shapeValue->setImage(doLoadPendingImage(m_document, toStylePendingImage(imag
e), deviceScaleFactor, options)); | |
| 119 } | 115 } |
| 120 | 116 |
| 121 void StyleResourceLoader::loadPendingImages(ComputedStyle* style, ElementStyleRe
sources& elementStyleResources) | 117 void StyleResourceLoader::loadPendingImages(ComputedStyle* style, ElementStyleRe
sources& elementStyleResources) |
| 122 { | 118 { |
| 123 if (elementStyleResources.pendingImageProperties().isEmpty()) | 119 if (elementStyleResources.pendingImageProperties().isEmpty()) |
| 124 return; | 120 return; |
| 125 | 121 |
| 126 for (CSSPropertyID property : elementStyleResources.pendingImageProperties()
) { | 122 for (CSSPropertyID property : elementStyleResources.pendingImageProperties()
) { |
| 127 switch (property) { | 123 switch (property) { |
| 128 case CSSPropertyBackgroundImage: { | 124 case CSSPropertyBackgroundImage: { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 void StyleResourceLoader::loadPendingResources(ComputedStyle* computedStyle, Ele
mentStyleResources& elementStyleResources) | 199 void StyleResourceLoader::loadPendingResources(ComputedStyle* computedStyle, Ele
mentStyleResources& elementStyleResources) |
| 204 { | 200 { |
| 205 // Start loading images referenced by this style. | 201 // Start loading images referenced by this style. |
| 206 loadPendingImages(computedStyle, elementStyleResources); | 202 loadPendingImages(computedStyle, elementStyleResources); |
| 207 | 203 |
| 208 // Start loading the SVG Documents referenced by this style. | 204 // Start loading the SVG Documents referenced by this style. |
| 209 loadPendingSVGDocuments(computedStyle, elementStyleResources); | 205 loadPendingSVGDocuments(computedStyle, elementStyleResources); |
| 210 } | 206 } |
| 211 | 207 |
| 212 } | 208 } |
| OLD | NEW |