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 "config.h" | 5 #include "config.h" |
6 #include "core/dom/Element.h" | 6 #include "core/dom/Element.h" |
7 #include "core/dom/StyleEngine.h" | 7 #include "core/dom/StyleEngine.h" |
8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
9 #include "core/html/HTMLDocument.h" | 9 #include "core/html/HTMLDocument.h" |
10 #include "core/html/HTMLElement.h" | 10 #include "core/html/HTMLElement.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 "<div>" | 27 "<div>" |
28 "<span></span>" | 28 "<span></span>" |
29 "<span></span>" | 29 "<span></span>" |
30 "<span></span>" | 30 "<span></span>" |
31 "<span></span>" | 31 "<span></span>" |
32 "</div>", ASSERT_NO_EXCEPTION); | 32 "</div>", ASSERT_NO_EXCEPTION); |
33 | 33 |
34 document.view()->updateLayoutAndStyleIfNeededRecursive(); | 34 document.view()->updateLayoutAndStyleIfNeededRecursive(); |
35 unsigned startCount = document.styleEngine().resolverAccessCount(); | 35 unsigned startCount = document.styleEngine().resolverAccessCount(); |
36 | 36 |
37 document.documentElement()->renderer()->updateDragState(true); | 37 document.documentElement()->layoutObject()->updateDragState(true); |
38 document.view()->updateLayoutAndStyleIfNeededRecursive(); | 38 document.view()->updateLayoutAndStyleIfNeededRecursive(); |
39 | 39 |
40 unsigned accessCount = document.styleEngine().resolverAccessCount() - startC
ount; | 40 unsigned accessCount = document.styleEngine().resolverAccessCount() - startC
ount; |
41 | 41 |
42 ASSERT_EQ(1U, accessCount); | 42 ASSERT_EQ(1U, accessCount); |
43 } | 43 } |
44 | 44 |
45 TEST(DragUpdateTest, ChildrenOrSiblingsAffectedByDragUpdate) | 45 TEST(DragUpdateTest, ChildrenOrSiblingsAffectedByDragUpdate) |
46 { | 46 { |
47 // Check that when dragging the div in the document below, you get a | 47 // Check that when dragging the div in the document below, you get a |
48 // full subtree style recalc. | 48 // full subtree style recalc. |
49 | 49 |
50 OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(80
0, 600)); | 50 OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(80
0, 600)); |
51 HTMLDocument& document = toHTMLDocument(dummyPageHolder->document()); | 51 HTMLDocument& document = toHTMLDocument(dummyPageHolder->document()); |
52 document.documentElement()->setInnerHTML("<style>div {width:100px;height:100
px} div:-webkit-drag span { background-color: green }</style>" | 52 document.documentElement()->setInnerHTML("<style>div {width:100px;height:100
px} div:-webkit-drag span { background-color: green }</style>" |
53 "<div>" | 53 "<div>" |
54 "<span></span>" | 54 "<span></span>" |
55 "<span></span>" | 55 "<span></span>" |
56 "<span></span>" | 56 "<span></span>" |
57 "<span></span>" | 57 "<span></span>" |
58 "</div>", ASSERT_NO_EXCEPTION); | 58 "</div>", ASSERT_NO_EXCEPTION); |
59 | 59 |
60 document.updateLayout(); | 60 document.updateLayout(); |
61 unsigned startCount = document.styleEngine().resolverAccessCount(); | 61 unsigned startCount = document.styleEngine().resolverAccessCount(); |
62 | 62 |
63 document.documentElement()->renderer()->updateDragState(true); | 63 document.documentElement()->layoutObject()->updateDragState(true); |
64 document.updateLayout(); | 64 document.updateLayout(); |
65 | 65 |
66 unsigned accessCount = document.styleEngine().resolverAccessCount() - startC
ount; | 66 unsigned accessCount = document.styleEngine().resolverAccessCount() - startC
ount; |
67 | 67 |
68 ASSERT_EQ(5U, accessCount); | 68 ASSERT_EQ(5U, accessCount); |
69 } | 69 } |
70 | 70 |
71 } // namespace | 71 } // namespace |
OLD | NEW |