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

Side by Side Diff: third_party/WebKit/Source/core/dom/ElementTest.cpp

Issue 2869803003: Change from ClientRect to DOMRect.
Patch Set: Change from ClientRect to DOMRect. Created 3 years, 6 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
OLDNEW
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/dom/Element.h" 5 #include "core/dom/Element.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include "core/dom/ClientRect.h"
9 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
10 #include "core/editing/EditingTestBase.h" 9 #include "core/editing/EditingTestBase.h"
11 #include "core/frame/LocalFrameView.h" 10 #include "core/frame/LocalFrameView.h"
11 #include "core/geometry/DOMRect.h"
12 #include "core/html/HTMLHtmlElement.h" 12 #include "core/html/HTMLHtmlElement.h"
13 #include "core/layout/LayoutBoxModelObject.h" 13 #include "core/layout/LayoutBoxModelObject.h"
14 #include "core/paint/PaintLayer.h" 14 #include "core/paint/PaintLayer.h"
15 #include "core/testing/DummyPageHolder.h" 15 #include "core/testing/DummyPageHolder.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 17
18 namespace blink { 18 namespace blink {
19 19
20 class ElementTest : public EditingTestBase {}; 20 class ElementTest : public EditingTestBase {};
21 21
(...skipping 22 matching lines...) Expand all
44 Element* sticky = document.getElementById("sticky"); 44 Element* sticky = document.getElementById("sticky");
45 45
46 ASSERT_TRUE(scroller); 46 ASSERT_TRUE(scroller);
47 ASSERT_TRUE(writer); 47 ASSERT_TRUE(writer);
48 ASSERT_TRUE(sticky); 48 ASSERT_TRUE(sticky);
49 49
50 scroller->scrollTo(50.0, 200.0); 50 scroller->scrollTo(50.0, 200.0);
51 51
52 // The sticky element should remain at (0, 25) relative to the viewport due to 52 // The sticky element should remain at (0, 25) relative to the viewport due to
53 // the constraints. 53 // the constraints.
54 ClientRect* bounding_client_rect = sticky->getBoundingClientRect(); 54 DOMRect* bounding_client_rect = sticky->getBoundingClientRect();
55 EXPECT_EQ(0, bounding_client_rect->top()); 55 EXPECT_EQ(0, bounding_client_rect->top());
56 EXPECT_EQ(25, bounding_client_rect->left()); 56 EXPECT_EQ(25, bounding_client_rect->left());
57 57
58 // Insert a new <div> above the sticky. This will dirty layout and invalidate 58 // Insert a new <div> above the sticky. This will dirty layout and invalidate
59 // the sticky constraints. 59 // the sticky constraints.
60 writer->setInnerHTML("<div style='height: 100px; width: 700px;'></div>"); 60 writer->setInnerHTML("<div style='height: 100px; width: 700px;'></div>");
61 EXPECT_EQ(DocumentLifecycle::kVisualUpdatePending, 61 EXPECT_EQ(DocumentLifecycle::kVisualUpdatePending,
62 document.Lifecycle().GetState()); 62 document.Lifecycle().GetState());
63 63
64 // Requesting the bounding client rect should cause both layout and 64 // Requesting the bounding client rect should cause both layout and
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 242
243 TEST_F(ElementTest, GetElementsByClassNameCrash) { 243 TEST_F(ElementTest, GetElementsByClassNameCrash) {
244 // Test for a crash in NodeListsNodeData::AddCache(). 244 // Test for a crash in NodeListsNodeData::AddCache().
245 ASSERT_TRUE(GetDocument().InQuirksMode()); 245 ASSERT_TRUE(GetDocument().InQuirksMode());
246 GetDocument().body()->getElementsByClassName("ABC DEF"); 246 GetDocument().body()->getElementsByClassName("ABC DEF");
247 GetDocument().body()->getElementsByClassName("ABC DEF"); 247 GetDocument().body()->getElementsByClassName("ABC DEF");
248 // The test passes if no crash happens. 248 // The test passes if no crash happens.
249 } 249 }
250 250
251 } // namespace blink 251 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.idl ('k') | third_party/WebKit/Source/core/dom/IntersectionObserverEntry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698