| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 namespace blink { | 31 namespace blink { |
| 32 | 32 |
| 33 ElementStyleResources::ElementStyleResources() | 33 ElementStyleResources::ElementStyleResources() |
| 34 : m_deviceScaleFactor(1) | 34 : m_deviceScaleFactor(1) |
| 35 { | 35 { |
| 36 } | 36 } |
| 37 | 37 |
| 38 PassRefPtr<StyleImage> ElementStyleResources::styleImage(Document& document, con
st TextLinkColors& textLinkColors, Color currentColor, CSSPropertyID property, C
SSValue* value) | 38 PassRefPtr<StyleImage> ElementStyleResources::styleImage(Document& document, con
st TextLinkColors& textLinkColors, Color currentColor, CSSPropertyID property, C
SSValue* value) |
| 39 { | 39 { |
| 40 if (value->isImageValue()) | |
| 41 return cachedOrPendingFromValue(document, property, toCSSImageValue(valu
e)); | |
| 42 | |
| 43 if (value->isImageGeneratorValue()) { | 40 if (value->isImageGeneratorValue()) { |
| 44 if (value->isGradientValue()) | 41 if (value->isGradientValue()) |
| 45 return generatedOrPendingFromValue(property, toCSSGradientValue(valu
e)->gradientWithStylesResolved(textLinkColors, currentColor).get()); | 42 return generatedOrPendingFromValue(property, toCSSGradientValue(valu
e)->gradientWithStylesResolved(textLinkColors, currentColor).get()); |
| 46 return generatedOrPendingFromValue(property, toCSSImageGeneratorValue(va
lue)); | 43 return generatedOrPendingFromValue(property, toCSSImageGeneratorValue(va
lue)); |
| 47 } | 44 } |
| 48 | 45 |
| 49 if (value->isImageSetValue()) | |
| 50 return setOrPendingFromValue(property, toCSSImageSetValue(value)); | |
| 51 | |
| 52 return nullptr; | 46 return nullptr; |
| 53 } | 47 } |
| 54 | 48 |
| 55 PassRefPtr<StyleImage> ElementStyleResources::generatedOrPendingFromValue(CSSPro
pertyID property, CSSImageGeneratorValue* value) | 49 PassRefPtr<StyleImage> ElementStyleResources::generatedOrPendingFromValue(CSSPro
pertyID property, CSSImageGeneratorValue* value) |
| 56 { | 50 { |
| 57 if (value->isPending()) { | 51 if (value->isPending()) { |
| 58 m_pendingImageProperties.set(property, value); | 52 m_pendingImageProperties.set(property, value); |
| 59 return StylePendingImage::create(value); | 53 return StylePendingImage::create(value); |
| 60 } | 54 } |
| 61 return StyleGeneratedImage::create(value); | 55 return StyleGeneratedImage::create(value); |
| 62 } | 56 } |
| 63 | 57 |
| 64 PassRefPtr<StyleImage> ElementStyleResources::setOrPendingFromValue(CSSPropertyI
D property, CSSImageSetValue* value) | |
| 65 { | |
| 66 RefPtr<StyleImage> image = value->cachedOrPendingImageSet(m_deviceScaleFacto
r); | |
| 67 if (image && image->isPendingImage()) | |
| 68 m_pendingImageProperties.set(property, value); | |
| 69 return image.release(); | |
| 70 } | |
| 71 | |
| 72 PassRefPtr<StyleImage> ElementStyleResources::cachedOrPendingFromValue(Document&
document, CSSPropertyID property, CSSImageValue* value) | |
| 73 { | |
| 74 RefPtr<StyleImage> image = value->cachedOrPendingImage(); | |
| 75 if (image) { | |
| 76 if (image->isPendingImage()) | |
| 77 m_pendingImageProperties.set(property, value); | |
| 78 else | |
| 79 value->restoreCachedResourceIfNeeded(document); | |
| 80 } | |
| 81 return image.release(); | |
| 82 } | |
| 83 | |
| 84 void ElementStyleResources::clearPendingImageProperties() | 58 void ElementStyleResources::clearPendingImageProperties() |
| 85 { | 59 { |
| 86 m_pendingImageProperties.clear(); | 60 m_pendingImageProperties.clear(); |
| 87 } | 61 } |
| 88 | 62 |
| 89 } | 63 } |
| OLD | NEW |