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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutTestHelper.cpp

Issue 1516893002: Second reland: Fix incorrect sign in scroll and content box offset in absoluteToLocalPoint. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 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/layout/LayoutTestHelper.h" 6 #include "core/layout/LayoutTestHelper.h"
7 7
8 #include "core/frame/FrameHost.h" 8 #include "core/frame/FrameHost.h"
9 #include "core/html/HTMLIFrameElement.h"
9 #include "platform/graphics/test/FakeGraphicsLayerFactory.h" 10 #include "platform/graphics/test/FakeGraphicsLayerFactory.h"
10 11
11 namespace blink { 12 namespace blink {
12 13
13 namespace { 14 namespace {
14 15
15 class FakeChromeClient : public EmptyChromeClient { 16 class FakeChromeClient : public EmptyChromeClient {
16 public: 17 public:
17 static PassOwnPtrWillBeRawPtr<FakeChromeClient> create() { return adoptPtrWi llBeNoop(new FakeChromeClient); } 18 static PassOwnPtrWillBeRawPtr<FakeChromeClient> create() { return adoptPtrWi llBeNoop(new FakeChromeClient); }
18 19
(...skipping 16 matching lines...) Expand all
35 36
36 void RenderingTest::SetUp() 37 void RenderingTest::SetUp()
37 { 38 {
38 // This ensures that the minimal DOM tree gets attached 39 // This ensures that the minimal DOM tree gets attached
39 // correctly for tests that don't call setBodyInnerHTML. 40 // correctly for tests that don't call setBodyInnerHTML.
40 document().view()->updateAllLifecyclePhases(); 41 document().view()->updateAllLifecyclePhases();
41 } 42 }
42 43
43 void RenderingTest::TearDown() 44 void RenderingTest::TearDown()
44 { 45 {
46 if (m_subframe) {
47 m_subframe->detach(FrameDetachType::Remove);
48 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client()) ->setChild(nullptr);
49 document().frame()->host()->decrementSubframeCount();
50 }
51
45 // We need to destroy most of the Blink structure here because derived tests may restore 52 // We need to destroy most of the Blink structure here because derived tests may restore
46 // RuntimeEnabledFeatures setting during teardown, which happens before our destructor 53 // RuntimeEnabledFeatures setting during teardown, which happens before our destructor
47 // getting invoked, breaking the assumption that REF can't change during Bli nk lifetime. 54 // getting invoked, breaking the assumption that REF can't change during Bli nk lifetime.
48 m_pageHolder = nullptr; 55 m_pageHolder = nullptr;
49 } 56 }
50 57
58 Document& RenderingTest::setupChildIframe(const AtomicString& iframeElementId, c onst String& htmlContentOfIframe)
59 {
60
61 HTMLIFrameElement& iframe = *toHTMLIFrameElement(document().getElementById(i frameElementId));
62 m_frameLoaderClient = FrameLoaderClientWithParent::create(document().frame() );
63 m_subframe = LocalFrame::create(m_frameLoaderClient.get(), document().frame( )->host(), &iframe);
64 m_subframe->setView(FrameView::create(m_subframe.get(), IntSize(500, 500)));
65 m_subframe->init();
66 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->se tChild(m_subframe.get());
67 document().frame()->host()->incrementSubframeCount();
68 Document& frameDocument = *iframe.contentDocument();
69
70 frameDocument.setBaseURLOverride(KURL(ParsedURLString, "http://test.com"));
71 frameDocument.body()->setInnerHTML(htmlContentOfIframe, ASSERT_NO_EXCEPTION) ;
72 return frameDocument;
73 }
74
51 } // namespace blink 75 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTestHelper.h ('k') | third_party/WebKit/Source/core/layout/LayoutView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698