| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "public/web/WebDocument.h" | 5 #include "public/web/WebDocument.h" |
| 6 | 6 |
| 7 #include "core/CSSPropertyNames.h" | 7 #include "core/CSSPropertyNames.h" |
| 8 #include "core/HTMLNames.h" | 8 #include "core/HTMLNames.h" |
| 9 #include "core/dom/NodeComputedStyle.h" | 9 #include "core/dom/NodeComputedStyle.h" |
| 10 #include "core/dom/StyleEngine.h" | 10 #include "core/dom/StyleEngine.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 unsigned startCount = coreDoc->styleEngine().styleForElementCount(); | 70 unsigned startCount = coreDoc->styleEngine().styleForElementCount(); |
| 71 | 71 |
| 72 webDoc.insertStyleSheet("body { color: green }"); | 72 webDoc.insertStyleSheet("body { color: green }"); |
| 73 | 73 |
| 74 // Check insertStyleSheet did not cause a synchronous style recalc. | 74 // Check insertStyleSheet did not cause a synchronous style recalc. |
| 75 unsigned elementCount = coreDoc->styleEngine().styleForElementCount() - star
tCount; | 75 unsigned elementCount = coreDoc->styleEngine().styleForElementCount() - star
tCount; |
| 76 ASSERT_EQ(0U, elementCount); | 76 ASSERT_EQ(0U, elementCount); |
| 77 | 77 |
| 78 HTMLElement* bodyElement = coreDoc->body(); | 78 HTMLElement* bodyElement = coreDoc->body(); |
| 79 ASSERT(bodyElement); | 79 DCHECK(bodyElement); |
| 80 | 80 |
| 81 const ComputedStyle& styleBeforeInsertion = bodyElement->computedStyleRef(); | 81 const ComputedStyle& styleBeforeInsertion = bodyElement->computedStyleRef(); |
| 82 | 82 |
| 83 // Inserted stylesheet not yet applied. | 83 // Inserted stylesheet not yet applied. |
| 84 ASSERT_EQ(Color(0, 0, 0), styleBeforeInsertion.visitedDependentColor(CSSProp
ertyColor)); | 84 ASSERT_EQ(Color(0, 0, 0), styleBeforeInsertion.visitedDependentColor(CSSProp
ertyColor)); |
| 85 | 85 |
| 86 // Apply inserted stylesheet. | 86 // Apply inserted stylesheet. |
| 87 coreDoc->updateLayoutTree(); | 87 coreDoc->updateLayoutTree(); |
| 88 | 88 |
| 89 const ComputedStyle& styleAfterInsertion = bodyElement->computedStyleRef(); | 89 const ComputedStyle& styleAfterInsertion = bodyElement->computedStyleRef(); |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 load(nestedOriginAInOriginB); | 320 load(nestedOriginAInOriginB); |
| 321 | 321 |
| 322 SchemeRegistry::registerURLSchemeAsFirstPartyWhenTopLevel("http"); | 322 SchemeRegistry::registerURLSchemeAsFirstPartyWhenTopLevel("http"); |
| 323 | 323 |
| 324 ASSERT_EQ(toOriginA(nestedOriginAInOriginB), topDocument()->firstPartyForCoo
kies()); | 324 ASSERT_EQ(toOriginA(nestedOriginAInOriginB), topDocument()->firstPartyForCoo
kies()); |
| 325 ASSERT_EQ(toOriginA(nestedOriginAInOriginB), nestedDocument()->firstPartyFor
Cookies()); | 325 ASSERT_EQ(toOriginA(nestedOriginAInOriginB), nestedDocument()->firstPartyFor
Cookies()); |
| 326 ASSERT_EQ(toOriginA(nestedOriginAInOriginB), nestedNestedDocument()->firstPa
rtyForCookies()); | 326 ASSERT_EQ(toOriginA(nestedOriginAInOriginB), nestedNestedDocument()->firstPa
rtyForCookies()); |
| 327 } | 327 } |
| 328 | 328 |
| 329 } // namespace blink | 329 } // namespace blink |
| OLD | NEW |