| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/fetch/CSSStyleSheetResource.h" | 5 #include "core/fetch/CSSStyleSheetResource.h" |
| 6 | 6 |
| 7 #include "core/css/CSSCrossfadeValue.h" | 7 #include "core/css/CSSCrossfadeValue.h" |
| 8 #include "core/css/CSSImageValue.h" | 8 #include "core/css/CSSImageValue.h" |
| 9 #include "core/css/CSSPrimitiveValue.h" | 9 #include "core/css/CSSPrimitiveValue.h" |
| 10 #include "core/css/CSSProperty.h" | 10 #include "core/css/CSSProperty.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 CSSImageValue::create(String("image"), imageURL), | 86 CSSImageValue::create(String("image"), imageURL), |
| 87 CSSPrimitiveValue::create(1.0, CSSPrimitiveValue::UnitType::Number))
; | 87 CSSPrimitiveValue::create(1.0, CSSPrimitiveValue::UnitType::Number))
; |
| 88 Vector<std::unique_ptr<CSSParserSelector>> selectors; | 88 Vector<std::unique_ptr<CSSParserSelector>> selectors; |
| 89 selectors.append(wrapUnique(new CSSParserSelector())); | 89 selectors.append(wrapUnique(new CSSParserSelector())); |
| 90 selectors[0]->setMatch(CSSSelector::Id); | 90 selectors[0]->setMatch(CSSSelector::Id); |
| 91 selectors[0]->setValue("foo"); | 91 selectors[0]->setValue("foo"); |
| 92 CSSProperty property(CSSPropertyBackground, *crossfade); | 92 CSSProperty property(CSSPropertyBackground, *crossfade); |
| 93 contents->parserAppendRule( | 93 contents->parserAppendRule( |
| 94 StyleRule::create(CSSSelectorList::adoptSelectorVector(selectors), I
mmutableStylePropertySet::create(&property, 1, HTMLStandardMode))); | 94 StyleRule::create(CSSSelectorList::adoptSelectorVector(selectors), I
mmutableStylePropertySet::create(&property, 1, HTMLStandardMode))); |
| 95 | 95 |
| 96 // TODO(rune@opera.com): loadSubimages should take Document&. | 96 crossfade->loadSubimages(document()); |
| 97 crossfade->loadSubimages(&document()); | |
| 98 Resource* imageResource = memoryCache()->resourceForURL(imageURL, Memory
Cache::defaultCacheIdentifier()); | 97 Resource* imageResource = memoryCache()->resourceForURL(imageURL, Memory
Cache::defaultCacheIdentifier()); |
| 99 ASSERT_TRUE(imageResource); | 98 ASSERT_TRUE(imageResource); |
| 100 ResourceResponse imageResponse; | 99 ResourceResponse imageResponse; |
| 101 imageResponse.setURL(imageURL); | 100 imageResponse.setURL(imageURL); |
| 102 imageResponse.setHTTPHeaderField("cache-control", "no-store"); | 101 imageResponse.setHTTPHeaderField("cache-control", "no-store"); |
| 103 imageResource->responseReceived(imageResponse, nullptr); | 102 imageResource->responseReceived(imageResponse, nullptr); |
| 104 | 103 |
| 105 contents->checkLoaded(); | 104 contents->checkLoaded(); |
| 106 cssResource->saveParsedStyleSheet(contents); | 105 cssResource->saveParsedStyleSheet(contents); |
| 107 | 106 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // The underlying |contents| for the stylesheet resource must have a | 149 // The underlying |contents| for the stylesheet resource must have a |
| 151 // matching reference status. | 150 // matching reference status. |
| 152 EXPECT_TRUE(memoryCache()->contains(imageResource)); | 151 EXPECT_TRUE(memoryCache()->contains(imageResource)); |
| 153 EXPECT_FALSE(memoryCache()->contains(cssResource)); | 152 EXPECT_FALSE(memoryCache()->contains(cssResource)); |
| 154 EXPECT_FALSE(contents->isReferencedFromResource()); | 153 EXPECT_FALSE(contents->isReferencedFromResource()); |
| 155 EXPECT_FALSE(cssResource->restoreParsedStyleSheet(parserContext)); | 154 EXPECT_FALSE(cssResource->restoreParsedStyleSheet(parserContext)); |
| 156 } | 155 } |
| 157 | 156 |
| 158 } // namespace | 157 } // namespace |
| 159 } // namespace blink | 158 } // namespace blink |
| OLD | NEW |