| 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 10 matching lines...) Expand all Loading... |
| 21 */ | 21 */ |
| 22 | 22 |
| 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/resolver/ElementStyleResources.h" | 29 #include "core/css/resolver/ElementStyleResources.h" |
| 30 #include "core/fetch/ResourceFetcher.h" | 30 #include "core/fetch/ResourceFetcher.h" |
| 31 #include "core/rendering/style/ContentData.h" | |
| 32 #include "core/rendering/style/FillLayer.h" | 31 #include "core/rendering/style/FillLayer.h" |
| 33 #include "core/rendering/style/RenderStyle.h" | 32 #include "core/rendering/style/RenderStyle.h" |
| 34 #include "core/rendering/style/StyleFetchedImage.h" | 33 #include "core/rendering/style/StyleFetchedImage.h" |
| 35 #include "core/rendering/style/StyleFetchedImageSet.h" | 34 #include "core/rendering/style/StyleFetchedImageSet.h" |
| 36 #include "core/rendering/style/StyleGeneratedImage.h" | 35 #include "core/rendering/style/StyleGeneratedImage.h" |
| 37 #include "core/rendering/style/StylePendingImage.h" | 36 #include "core/rendering/style/StylePendingImage.h" |
| 38 | 37 |
| 39 namespace blink { | 38 namespace blink { |
| 40 | 39 |
| 41 StyleResourceLoader::StyleResourceLoader(ResourceFetcher* fetcher) | 40 StyleResourceLoader::StyleResourceLoader(ResourceFetcher* fetcher) |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 CSSPropertyID currentProperty = *it; | 78 CSSPropertyID currentProperty = *it; |
| 80 | 79 |
| 81 switch (currentProperty) { | 80 switch (currentProperty) { |
| 82 case CSSPropertyBackgroundImage: { | 81 case CSSPropertyBackgroundImage: { |
| 83 for (FillLayer* backgroundLayer = &style->accessBackgroundLayers();
backgroundLayer; backgroundLayer = backgroundLayer->next()) { | 82 for (FillLayer* backgroundLayer = &style->accessBackgroundLayers();
backgroundLayer; backgroundLayer = backgroundLayer->next()) { |
| 84 if (backgroundLayer->image() && backgroundLayer->image()->isPend
ingImage()) | 83 if (backgroundLayer->image() && backgroundLayer->image()->isPend
ingImage()) |
| 85 backgroundLayer->setImage(loadPendingImage(toStylePendingIma
ge(backgroundLayer->image()), elementStyleResources.deviceScaleFactor())); | 84 backgroundLayer->setImage(loadPendingImage(toStylePendingIma
ge(backgroundLayer->image()), elementStyleResources.deviceScaleFactor())); |
| 86 } | 85 } |
| 87 break; | 86 break; |
| 88 } | 87 } |
| 89 case CSSPropertyContent: { | |
| 90 for (ContentData* contentData = const_cast<ContentData*>(style->cont
entData()); contentData; contentData = contentData->next()) { | |
| 91 if (contentData->isImage()) { | |
| 92 StyleImage* image = toImageContentData(contentData)->image()
; | |
| 93 if (image->isPendingImage()) { | |
| 94 RefPtr<StyleImage> loadedImage = loadPendingImage(toStyl
ePendingImage(image), elementStyleResources.deviceScaleFactor()); | |
| 95 if (loadedImage) | |
| 96 toImageContentData(contentData)->setImage(loadedImag
e.release()); | |
| 97 } | |
| 98 } | |
| 99 } | |
| 100 break; | |
| 101 } | |
| 102 case CSSPropertyCursor: { | 88 case CSSPropertyCursor: { |
| 103 if (CursorList* cursorList = style->cursors()) { | 89 if (CursorList* cursorList = style->cursors()) { |
| 104 for (size_t i = 0; i < cursorList->size(); ++i) { | 90 for (size_t i = 0; i < cursorList->size(); ++i) { |
| 105 CursorData& currentCursor = cursorList->at(i); | 91 CursorData& currentCursor = cursorList->at(i); |
| 106 if (StyleImage* image = currentCursor.image()) { | 92 if (StyleImage* image = currentCursor.image()) { |
| 107 if (image->isPendingImage()) | 93 if (image->isPendingImage()) |
| 108 currentCursor.setImage(loadPendingImage(toStylePendi
ngImage(image), elementStyleResources.deviceScaleFactor())); | 94 currentCursor.setImage(loadPendingImage(toStylePendi
ngImage(image), elementStyleResources.deviceScaleFactor())); |
| 109 } | 95 } |
| 110 } | 96 } |
| 111 } | 97 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 141 elementStyleResources.clearPendingImageProperties(); | 127 elementStyleResources.clearPendingImageProperties(); |
| 142 } | 128 } |
| 143 | 129 |
| 144 void StyleResourceLoader::loadPendingResources(RenderStyle* renderStyle, Element
StyleResources& elementStyleResources) | 130 void StyleResourceLoader::loadPendingResources(RenderStyle* renderStyle, Element
StyleResources& elementStyleResources) |
| 145 { | 131 { |
| 146 // Start loading images referenced by this style. | 132 // Start loading images referenced by this style. |
| 147 loadPendingImages(renderStyle, elementStyleResources); | 133 loadPendingImages(renderStyle, elementStyleResources); |
| 148 } | 134 } |
| 149 | 135 |
| 150 } | 136 } |
| OLD | NEW |