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

Side by Side Diff: Source/core/css/HoverUpdateTest.cpp

Issue 220943002: Use invalidation sets for :hover, :active, and :focus. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove unnecessary seenCombinator handling. Created 6 years, 8 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
« no previous file with comments | « Source/core/css/AffectedByFocusTest.cpp ('k') | Source/core/css/RuleFeature.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "HTMLNames.h"
7 #include "core/dom/Element.h"
8 #include "core/dom/ElementTraversal.h"
9 #include "core/frame/FrameView.h"
10 #include "core/frame/LocalFrame.h"
11 #include "core/html/HTMLDocument.h"
12 #include "core/html/HTMLElement.h"
13 #include "core/page/EventHandler.h"
14 #include "core/testing/DummyPageHolder.h"
15 #include "platform/PlatformMouseEvent.h"
16 #include <gtest/gtest.h>
17
18 using namespace WebCore;
19
20 namespace {
21
22 TEST(HoverUpdateTest, AffectedByHoverUpdate)
23 {
24 // Check that when hovering the div in the document below, you only get a
25 // single element style recalc.
26
27 OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(80 0, 600));
28 HTMLDocument* document = toHTMLDocument(&dummyPageHolder->document());
29 document->documentElement()->setInnerHTML("<style>div {width:100px;height:10 0px} div:hover { background-color: green }</style>"
30 "<div>"
31 "<span></span>"
32 "<span></span>"
33 "<span></span>"
34 "<span></span>"
35 "</div>", ASSERT_NO_EXCEPTION);
36
37 document->view()->updateLayoutAndStyleIfNeededRecursive();
38 unsigned startCount = document->styleEngine()->resolverAccessCount();
39
40 PlatformMouseEvent moveEvent(IntPoint(20, 20), IntPoint(20, 20), NoButton, P latformEvent::MouseMoved, 0, false, false, false, false, currentTime());
41 document->frame()->eventHandler().handleMouseMoveEvent(moveEvent);
42 document->view()->updateLayoutAndStyleIfNeededRecursive();
43
44 unsigned accessCount = document->styleEngine()->resolverAccessCount() - star tCount;
45
46 ASSERT_EQ(1U, accessCount);
47 }
48
49 } // namespace
OLDNEW
« no previous file with comments | « Source/core/css/AffectedByFocusTest.cpp ('k') | Source/core/css/RuleFeature.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698