| 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 20 matching lines...) Expand all Loading... |
| 31 #include "platform/weborigin/Referrer.h" | 31 #include "platform/weborigin/Referrer.h" |
| 32 #include "wtf/Allocator.h" | 32 #include "wtf/Allocator.h" |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 class Document; | 36 class Document; |
| 37 class StyleFetchedImageSet; | 37 class StyleFetchedImageSet; |
| 38 | 38 |
| 39 class CSSImageSetValue : public CSSValueList { | 39 class CSSImageSetValue : public CSSValueList { |
| 40 public: | 40 public: |
| 41 | |
| 42 static PassRefPtrWillBeRawPtr<CSSImageSetValue> create() | 41 static PassRefPtrWillBeRawPtr<CSSImageSetValue> create() |
| 43 { | 42 { |
| 44 return adoptRefWillBeNoop(new CSSImageSetValue()); | 43 return adoptRefWillBeNoop(new CSSImageSetValue()); |
| 45 } | 44 } |
| 45 static PassRefPtrWillBeRawPtr<CSSImageSetValue> deserializeAfterDispatch(uns
igned bitfields, CSSDeserializeStream* stream) |
| 46 { |
| 47 return adoptRefWillBeNoop(new CSSImageSetValue(bitfields, stream)); |
| 48 } |
| 46 ~CSSImageSetValue(); | 49 ~CSSImageSetValue(); |
| 47 | 50 |
| 48 bool isCachePending(float deviceScaleFactor) const; | 51 bool isCachePending(float deviceScaleFactor) const; |
| 49 StyleFetchedImageSet* cachedImageSet(float deviceScaleFactor) const; | 52 StyleFetchedImageSet* cachedImageSet(float deviceScaleFactor) const; |
| 50 StyleFetchedImageSet* cacheImageSet(Document*, float deviceScaleFactor, Cros
sOriginAttributeValue = CrossOriginAttributeNotSet); | 53 StyleFetchedImageSet* cacheImageSet(Document*, float deviceScaleFactor, Cros
sOriginAttributeValue = CrossOriginAttributeNotSet); |
| 51 | 54 |
| 52 String customCSSText() const; | 55 String customCSSText() const; |
| 53 | 56 |
| 54 struct ImageWithScale { | 57 struct ImageWithScale { |
| 55 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 58 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 56 String imageURL; | 59 String imageURL; |
| 57 Referrer referrer; | 60 Referrer referrer; |
| 58 float scaleFactor; | 61 float scaleFactor; |
| 59 }; | 62 }; |
| 60 | 63 |
| 61 PassRefPtrWillBeRawPtr<CSSImageSetValue> valueWithURLsMadeAbsolute(); | 64 PassRefPtrWillBeRawPtr<CSSImageSetValue> valueWithURLsMadeAbsolute(); |
| 62 | 65 |
| 63 bool hasFailedOrCanceledSubresources() const; | 66 bool hasFailedOrCanceledSubresources() const; |
| 64 | 67 |
| 68 void serializeAfterDispatch(CSSSerializeStream*) const; |
| 69 |
| 65 DECLARE_TRACE_AFTER_DISPATCH(); | 70 DECLARE_TRACE_AFTER_DISPATCH(); |
| 66 | 71 |
| 67 protected: | 72 protected: |
| 68 ImageWithScale bestImageForScaleFactor(float scaleFactor); | 73 ImageWithScale bestImageForScaleFactor(float scaleFactor); |
| 69 | 74 |
| 70 private: | 75 private: |
| 71 CSSImageSetValue(); | 76 CSSImageSetValue(); |
| 77 CSSImageSetValue(unsigned bitfields, CSSDeserializeStream*); |
| 72 | 78 |
| 73 void fillImageSet(); | 79 void fillImageSet(); |
| 74 static inline bool compareByScaleFactor(ImageWithScale first, ImageWithScale
second) { return first.scaleFactor < second.scaleFactor; } | 80 static inline bool compareByScaleFactor(ImageWithScale first, ImageWithScale
second) { return first.scaleFactor < second.scaleFactor; } |
| 75 | 81 |
| 76 bool m_isCachePending; | 82 bool m_isCachePending; |
| 77 float m_cachedScaleFactor; | 83 float m_cachedScaleFactor; |
| 78 RefPtrWillBeMember<StyleFetchedImageSet> m_cachedImageSet; | 84 RefPtrWillBeMember<StyleFetchedImageSet> m_cachedImageSet; |
| 79 | 85 |
| 80 Vector<ImageWithScale> m_imagesInSet; | 86 Vector<ImageWithScale> m_imagesInSet; |
| 81 }; | 87 }; |
| 82 | 88 |
| 83 DEFINE_CSS_VALUE_TYPE_CASTS(CSSImageSetValue, isImageSetValue()); | 89 DEFINE_CSS_VALUE_TYPE_CASTS(CSSImageSetValue, isImageSetValue()); |
| 84 | 90 |
| 85 } // namespace blink | 91 } // namespace blink |
| 86 | 92 |
| 87 #endif // CSSImageSetValue_h | 93 #endif // CSSImageSetValue_h |
| OLD | NEW |