| 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 24 matching lines...) Expand all Loading... |
| 35 #include "sky/engine/core/rendering/style/StyleGeneratedImage.h" | 35 #include "sky/engine/core/rendering/style/StyleGeneratedImage.h" |
| 36 #include "sky/engine/core/rendering/style/StylePendingImage.h" | 36 #include "sky/engine/core/rendering/style/StylePendingImage.h" |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 StyleResourceLoader::StyleResourceLoader(ResourceFetcher* fetcher) | 40 StyleResourceLoader::StyleResourceLoader(ResourceFetcher* fetcher) |
| 41 : m_fetcher(fetcher) | 41 : m_fetcher(fetcher) |
| 42 { | 42 { |
| 43 } | 43 } |
| 44 | 44 |
| 45 static PassRefPtr<StyleImage> doLoadPendingImage(ResourceFetcher* fetcher, Style
PendingImage* pendingImage, float deviceScaleFactor, const ResourceLoaderOptions
& options) | 45 PassRefPtr<StyleImage> StyleResourceLoader::loadPendingImage(StylePendingImage*
pendingImage, float deviceScaleFactor) |
| 46 { | 46 { |
| 47 if (CSSImageValue* imageValue = pendingImage->cssImageValue()) | 47 if (CSSImageValue* imageValue = pendingImage->cssImageValue()) |
| 48 return imageValue->cachedImage(fetcher, options); | 48 return imageValue->cachedImage(m_fetcher, ResourceFetcher::defaultResour
ceOptions()); |
| 49 | 49 |
| 50 if (CSSImageGeneratorValue* imageGeneratorValue | 50 if (CSSImageGeneratorValue* imageGeneratorValue |
| 51 = pendingImage->cssImageGeneratorValue()) { | 51 = pendingImage->cssImageGeneratorValue()) { |
| 52 imageGeneratorValue->loadSubimages(fetcher); | 52 imageGeneratorValue->loadSubimages(m_fetcher); |
| 53 return StyleGeneratedImage::create(imageGeneratorValue); | 53 return StyleGeneratedImage::create(imageGeneratorValue); |
| 54 } | 54 } |
| 55 | 55 |
| 56 if (CSSCursorImageValue* cursorImageValue | 56 if (CSSCursorImageValue* cursorImageValue |
| 57 = pendingImage->cssCursorImageValue()) | 57 = pendingImage->cssCursorImageValue()) |
| 58 return cursorImageValue->cachedImage(fetcher, deviceScaleFactor); | 58 return cursorImageValue->cachedImage(m_fetcher, deviceScaleFactor); |
| 59 | 59 |
| 60 if (CSSImageSetValue* imageSetValue = pendingImage->cssImageSetValue()) | 60 if (CSSImageSetValue* imageSetValue = pendingImage->cssImageSetValue()) |
| 61 return imageSetValue->cachedImageSet(fetcher, deviceScaleFactor, options
); | 61 return imageSetValue->cachedImageSet(m_fetcher, deviceScaleFactor, Resou
rceFetcher::defaultResourceOptions()); |
| 62 | 62 |
| 63 return nullptr; | 63 return nullptr; |
| 64 } | 64 } |
| 65 | 65 |
| 66 PassRefPtr<StyleImage> StyleResourceLoader::loadPendingImage(StylePendingImage*
pendingImage, float deviceScaleFactor) | |
| 67 { | |
| 68 return doLoadPendingImage(m_fetcher, pendingImage, deviceScaleFactor, Resour
ceFetcher::defaultResourceOptions()); | |
| 69 } | |
| 70 | |
| 71 void StyleResourceLoader::loadPendingImages(RenderStyle* style, ElementStyleReso
urces& elementStyleResources) | 66 void StyleResourceLoader::loadPendingImages(RenderStyle* style, ElementStyleReso
urces& elementStyleResources) |
| 72 { | 67 { |
| 73 if (elementStyleResources.pendingImageProperties().isEmpty()) | 68 if (elementStyleResources.pendingImageProperties().isEmpty()) |
| 74 return; | 69 return; |
| 75 | 70 |
| 76 PendingImagePropertyMap::const_iterator::Keys end = elementStyleResources.pe
ndingImageProperties().end().keys(); | 71 PendingImagePropertyMap::const_iterator::Keys end = elementStyleResources.pe
ndingImageProperties().end().keys(); |
| 77 for (PendingImagePropertyMap::const_iterator::Keys it = elementStyleResource
s.pendingImageProperties().begin().keys(); it != end; ++it) { | 72 for (PendingImagePropertyMap::const_iterator::Keys it = elementStyleResource
s.pendingImageProperties().begin().keys(); it != end; ++it) { |
| 78 CSSPropertyID currentProperty = *it; | 73 CSSPropertyID currentProperty = *it; |
| 79 | 74 |
| 80 switch (currentProperty) { | 75 switch (currentProperty) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 elementStyleResources.clearPendingImageProperties(); | 122 elementStyleResources.clearPendingImageProperties(); |
| 128 } | 123 } |
| 129 | 124 |
| 130 void StyleResourceLoader::loadPendingResources(RenderStyle* renderStyle, Element
StyleResources& elementStyleResources) | 125 void StyleResourceLoader::loadPendingResources(RenderStyle* renderStyle, Element
StyleResources& elementStyleResources) |
| 131 { | 126 { |
| 132 // Start loading images referenced by this style. | 127 // Start loading images referenced by this style. |
| 133 loadPendingImages(renderStyle, elementStyleResources); | 128 loadPendingImages(renderStyle, elementStyleResources); |
| 134 } | 129 } |
| 135 | 130 |
| 136 } | 131 } |
| OLD | NEW |