Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Side by Side Diff: third_party/WebKit/Source/core/css/CSSImageSetValue.cpp

Issue 1481383002: [Experimental] CSSSerializer Proof-of-concept Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: snapshot: top_25 sites ser/dser now works Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE. 23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "core/css/CSSImageSetValue.h" 26 #include "core/css/CSSImageSetValue.h"
27 27
28 #include "core/css/CSSImageValue.h" 28 #include "core/css/CSSImageValue.h"
29 #include "core/css/CSSPrimitiveValue.h" 29 #include "core/css/CSSPrimitiveValue.h"
30 #include "core/css/serializer/CSSDeserializeStream.h"
31 #include "core/css/serializer/CSSSerializeStream.h"
30 #include "core/dom/Document.h" 32 #include "core/dom/Document.h"
31 #include "core/fetch/FetchInitiatorTypeNames.h" 33 #include "core/fetch/FetchInitiatorTypeNames.h"
32 #include "core/fetch/FetchRequest.h" 34 #include "core/fetch/FetchRequest.h"
33 #include "core/fetch/ImageResource.h" 35 #include "core/fetch/ImageResource.h"
34 #include "core/fetch/ResourceFetcher.h" 36 #include "core/fetch/ResourceFetcher.h"
35 #include "core/fetch/ResourceLoaderOptions.h" 37 #include "core/fetch/ResourceLoaderOptions.h"
36 #include "core/style/StyleFetchedImageSet.h" 38 #include "core/style/StyleFetchedImageSet.h"
37 #include "platform/weborigin/KURL.h" 39 #include "platform/weborigin/KURL.h"
38 #include "platform/weborigin/SecurityPolicy.h" 40 #include "platform/weborigin/SecurityPolicy.h"
39 #include "wtf/text/StringBuilder.h" 41 #include "wtf/text/StringBuilder.h"
40 #include <algorithm> 42 #include <algorithm>
41 43
42 namespace blink { 44 namespace blink {
43 45
44 CSSImageSetValue::CSSImageSetValue() 46 CSSImageSetValue::CSSImageSetValue()
45 : CSSValueList(ImageSetClass, CommaSeparator) 47 : CSSValueList(ImageSetClass, CommaSeparator)
46 , m_isCachePending(true) 48 , m_isCachePending(true)
47 , m_cachedScaleFactor(1) 49 , m_cachedScaleFactor(1)
48 { 50 {
49 } 51 }
50 52
53 CSSImageSetValue::CSSImageSetValue(unsigned bitfields, CSSDeserializeStream* str eam)
54 : CSSValueList(ImageSetClass, bitfields, stream)
55 , m_isCachePending(true)
56 , m_cachedScaleFactor(1)
57 {
58 }
59
51 CSSImageSetValue::~CSSImageSetValue() 60 CSSImageSetValue::~CSSImageSetValue()
52 { 61 {
53 #if !ENABLE(OILPAN) 62 #if !ENABLE(OILPAN)
54 if (m_cachedImageSet) 63 if (m_cachedImageSet)
55 m_cachedImageSet->clearImageSetValue(); 64 m_cachedImageSet->clearImageSetValue();
56 #endif 65 #endif
57 } 66 }
58 67
59 void CSSImageSetValue::fillImageSet() 68 void CSSImageSetValue::fillImageSet()
60 { 69 {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 173
165 bool CSSImageSetValue::hasFailedOrCanceledSubresources() const 174 bool CSSImageSetValue::hasFailedOrCanceledSubresources() const
166 { 175 {
167 if (!m_cachedImageSet) 176 if (!m_cachedImageSet)
168 return false; 177 return false;
169 if (Resource* cachedResource = m_cachedImageSet->cachedImage()) 178 if (Resource* cachedResource = m_cachedImageSet->cachedImage())
170 return cachedResource->loadFailedOrCanceled(); 179 return cachedResource->loadFailedOrCanceled();
171 return true; 180 return true;
172 } 181 }
173 182
183 void CSSImageSetValue::serializeAfterDispatch(CSSSerializeStream* stream) const
184 {
185 CSSValueList::serializeAfterDispatch(stream);
186 }
187
174 DEFINE_TRACE_AFTER_DISPATCH(CSSImageSetValue) 188 DEFINE_TRACE_AFTER_DISPATCH(CSSImageSetValue)
175 { 189 {
176 visitor->trace(m_cachedImageSet); 190 visitor->trace(m_cachedImageSet);
177 CSSValueList::traceAfterDispatch(visitor); 191 CSSValueList::traceAfterDispatch(visitor);
178 } 192 }
179 193
180 PassRefPtrWillBeRawPtr<CSSImageSetValue> CSSImageSetValue::valueWithURLsMadeAbso lute() 194 PassRefPtrWillBeRawPtr<CSSImageSetValue> CSSImageSetValue::valueWithURLsMadeAbso lute()
181 { 195 {
182 RefPtrWillBeRawPtr<CSSImageSetValue> value = CSSImageSetValue::create(); 196 RefPtrWillBeRawPtr<CSSImageSetValue> value = CSSImageSetValue::create();
183 for (auto& item : *this) 197 for (auto& item : *this)
184 item->isImageValue() ? value->append(toCSSImageValue(*item).valueWithURL MadeAbsolute()) : value->append(item); 198 item->isImageValue() ? value->append(toCSSImageValue(*item).valueWithURL MadeAbsolute()) : value->append(item);
185 return value.release(); 199 return value.release();
186 } 200 }
187 201
188 202
189 } // namespace blink 203 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSImageSetValue.h ('k') | third_party/WebKit/Source/core/css/CSSImageValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698