| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 StyleSheetContents* contents = | 80 StyleSheetContents* contents = |
| 81 StyleSheetContents::create(CSSParserContext(HTMLStandardMode, nullptr)); | 81 StyleSheetContents::create(CSSParserContext(HTMLStandardMode, nullptr)); |
| 82 CSSStyleSheet* sheet = CSSStyleSheet::create(contents, document()); | 82 CSSStyleSheet* sheet = CSSStyleSheet::create(contents, document()); |
| 83 EXPECT_TRUE(sheet); | 83 EXPECT_TRUE(sheet); |
| 84 CSSCrossfadeValue* crossfade = CSSCrossfadeValue::create( | 84 CSSCrossfadeValue* crossfade = CSSCrossfadeValue::create( |
| 85 CSSImageValue::create(String("image"), imageURL), | 85 CSSImageValue::create(String("image"), imageURL), |
| 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(makeUnique<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(StyleRule::create( | 93 contents->parserAppendRule(StyleRule::create( |
| 94 CSSSelectorList::adoptSelectorVector(selectors), | 94 CSSSelectorList::adoptSelectorVector(selectors), |
| 95 ImmutableStylePropertySet::create(&property, 1, HTMLStandardMode))); | 95 ImmutableStylePropertySet::create(&property, 1, HTMLStandardMode))); |
| 96 | 96 |
| 97 crossfade->loadSubimages(document()); | 97 crossfade->loadSubimages(document()); |
| 98 Resource* imageResource = memoryCache()->resourceForURL( | 98 Resource* imageResource = memoryCache()->resourceForURL( |
| 99 imageURL, MemoryCache::defaultCacheIdentifier()); | 99 imageURL, MemoryCache::defaultCacheIdentifier()); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 // The underlying |contents| for the stylesheet resource must have a | 157 // The underlying |contents| for the stylesheet resource must have a |
| 158 // matching reference status. | 158 // matching reference status. |
| 159 EXPECT_TRUE(memoryCache()->contains(imageResource)); | 159 EXPECT_TRUE(memoryCache()->contains(imageResource)); |
| 160 EXPECT_FALSE(memoryCache()->contains(cssResource)); | 160 EXPECT_FALSE(memoryCache()->contains(cssResource)); |
| 161 EXPECT_FALSE(contents->isReferencedFromResource()); | 161 EXPECT_FALSE(contents->isReferencedFromResource()); |
| 162 EXPECT_FALSE(cssResource->restoreParsedStyleSheet(parserContext)); | 162 EXPECT_FALSE(cssResource->restoreParsedStyleSheet(parserContext)); |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace | 165 } // namespace |
| 166 } // namespace blink | 166 } // namespace blink |
| OLD | NEW |