| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 class CSSImageSetValue : public CSSValueList { | 40 class CSSImageSetValue : public CSSValueList { |
| 41 public: | 41 public: |
| 42 | 42 |
| 43 static PassRefPtrWillBeRawPtr<CSSImageSetValue> create() | 43 static PassRefPtrWillBeRawPtr<CSSImageSetValue> create() |
| 44 { | 44 { |
| 45 return adoptRefWillBeNoop(new CSSImageSetValue()); | 45 return adoptRefWillBeNoop(new CSSImageSetValue()); |
| 46 } | 46 } |
| 47 ~CSSImageSetValue(); | 47 ~CSSImageSetValue(); |
| 48 | 48 |
| 49 StyleFetchedImageSet* cachedImageSet(Document*, float deviceScaleFactor, con
st ResourceLoaderOptions&); | 49 bool isCachePending(float deviceScaleFactor) const; |
| 50 StyleFetchedImageSet* cachedImageSet(Document*, float deviceScaleFactor); | 50 StyleImage* cachedImageSet(float deviceScaleFactor); |
| 51 | 51 StyleFetchedImageSet* cacheImageSet(Document*, float deviceScaleFactor, cons
t ResourceLoaderOptions&); |
| 52 // Returns a StyleFetchedImageSet if the best fit image has been cached alre
ady, otherwise a StylePendingImage. | 52 StyleFetchedImageSet* cacheImageSet(Document*, float deviceScaleFactor); |
| 53 StyleImage* cachedOrPendingImageSet(float); | |
| 54 | 53 |
| 55 String customCSSText() const; | 54 String customCSSText() const; |
| 56 | 55 |
| 57 bool isPending() const { return !m_accessedBestFitImage; } | |
| 58 | |
| 59 struct ImageWithScale { | 56 struct ImageWithScale { |
| 60 ALLOW_ONLY_INLINE_ALLOCATION(); | 57 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 61 String imageURL; | 58 String imageURL; |
| 62 Referrer referrer; | 59 Referrer referrer; |
| 63 float scaleFactor; | 60 float scaleFactor; |
| 64 }; | 61 }; |
| 65 | 62 |
| 66 PassRefPtrWillBeRawPtr<CSSImageSetValue> valueWithURLsMadeAbsolute(); | 63 PassRefPtrWillBeRawPtr<CSSImageSetValue> valueWithURLsMadeAbsolute(); |
| 67 | 64 |
| 68 bool hasFailedOrCanceledSubresources() const; | 65 bool hasFailedOrCanceledSubresources() const; |
| 69 | 66 |
| 70 DECLARE_TRACE_AFTER_DISPATCH(); | 67 DECLARE_TRACE_AFTER_DISPATCH(); |
| 71 | 68 |
| 72 protected: | 69 protected: |
| 73 ImageWithScale bestImageForScaleFactor(); | 70 ImageWithScale bestImageForScaleFactor(float scaleFactor); |
| 74 | 71 |
| 75 private: | 72 private: |
| 76 CSSImageSetValue(); | 73 CSSImageSetValue(); |
| 77 | 74 |
| 78 void fillImageSet(); | 75 void fillImageSet(); |
| 79 static inline bool compareByScaleFactor(ImageWithScale first, ImageWithScale
second) { return first.scaleFactor < second.scaleFactor; } | 76 static inline bool compareByScaleFactor(ImageWithScale first, ImageWithScale
second) { return first.scaleFactor < second.scaleFactor; } |
| 80 | 77 |
| 81 RefPtrWillBeMember<StyleImage> m_imageSet; | 78 bool m_isCachePending; |
| 82 bool m_accessedBestFitImage; | 79 float m_cachedScaleFactor; |
| 83 | 80 RefPtrWillBeMember<StyleImage> m_cachedImageSet; |
| 84 // This represents the scale factor that we used to find the best fit image.
It does not necessarily | |
| 85 // correspond to the scale factor of the best fit image. | |
| 86 float m_scaleFactor; | |
| 87 | 81 |
| 88 Vector<ImageWithScale> m_imagesInSet; | 82 Vector<ImageWithScale> m_imagesInSet; |
| 89 }; | 83 }; |
| 90 | 84 |
| 91 DEFINE_CSS_VALUE_TYPE_CASTS(CSSImageSetValue, isImageSetValue()); | 85 DEFINE_CSS_VALUE_TYPE_CASTS(CSSImageSetValue, isImageSetValue()); |
| 92 | 86 |
| 93 } // namespace blink | 87 } // namespace blink |
| 94 | 88 |
| 95 #endif // CSSImageSetValue_h | 89 #endif // CSSImageSetValue_h |
| OLD | NEW |