| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/editing/EditingTestBase.h" | 5 #include "core/editing/EditingTestBase.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/dom/Range.h" | 8 #include "core/dom/Range.h" |
| 9 #include "core/dom/Text.h" | 9 #include "core/dom/Text.h" |
| 10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 Document& EditingTestBase::document() const | 24 Document& EditingTestBase::document() const |
| 25 { | 25 { |
| 26 return m_dummyPageHolder->document(); | 26 return m_dummyPageHolder->document(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void EditingTestBase::SetUp() | 29 void EditingTestBase::SetUp() |
| 30 { | 30 { |
| 31 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); | 31 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); |
| 32 } | 32 } |
| 33 | 33 |
| 34 PassRefPtrWillBeRawPtr<ShadowRoot> EditingTestBase::createShadowRootForElementWi
thIDAndSetInnerHTML(TreeScope& scope, const char* hostElementID, const char* sha
dowRootContent) | 34 RawPtr<ShadowRoot> EditingTestBase::createShadowRootForElementWithIDAndSetInnerH
TML(TreeScope& scope, const char* hostElementID, const char* shadowRootContent) |
| 35 { | 35 { |
| 36 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = scope.getElementById(AtomicStrin
g::fromUTF8(hostElementID))->createShadowRootInternal(ShadowRootType::V0, ASSERT
_NO_EXCEPTION); | 36 RawPtr<ShadowRoot> shadowRoot = scope.getElementById(AtomicString::fromUTF8(
hostElementID))->createShadowRootInternal(ShadowRootType::V0, ASSERT_NO_EXCEPTIO
N); |
| 37 shadowRoot->setInnerHTML(String::fromUTF8(shadowRootContent), ASSERT_NO_EXCE
PTION); | 37 shadowRoot->setInnerHTML(String::fromUTF8(shadowRootContent), ASSERT_NO_EXCE
PTION); |
| 38 return shadowRoot.release(); | 38 return shadowRoot.release(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void EditingTestBase::setBodyContent(const std::string& bodyContent) | 41 void EditingTestBase::setBodyContent(const std::string& bodyContent) |
| 42 { | 42 { |
| 43 document().body()->setInnerHTML(String::fromUTF8(bodyContent.c_str()), ASSER
T_NO_EXCEPTION); | 43 document().body()->setInnerHTML(String::fromUTF8(bodyContent.c_str()), ASSER
T_NO_EXCEPTION); |
| 44 } | 44 } |
| 45 | 45 |
| 46 PassRefPtrWillBeRawPtr<ShadowRoot> EditingTestBase::setShadowContent(const char*
shadowContent, const char* host) | 46 RawPtr<ShadowRoot> EditingTestBase::setShadowContent(const char* shadowContent,
const char* host) |
| 47 { | 47 { |
| 48 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = createShadowRootForElementWithID
AndSetInnerHTML(document(), host, shadowContent); | 48 RawPtr<ShadowRoot> shadowRoot = createShadowRootForElementWithIDAndSetInnerH
TML(document(), host, shadowContent); |
| 49 document().updateDistribution(); | 49 document().updateDistribution(); |
| 50 return shadowRoot.release(); | 50 return shadowRoot.release(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void EditingTestBase::updateLayoutAndStyleForPainting() | 53 void EditingTestBase::updateLayoutAndStyleForPainting() |
| 54 { | 54 { |
| 55 document().view()->updateAllLifecyclePhases(); | 55 document().view()->updateAllLifecyclePhases(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace blink | 58 } // namespace blink |
| OLD | NEW |