| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/editing/StyledMarkupSerializer.h" | 6 #include "core/editing/StyledMarkupSerializer.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 8 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
| 10 #include "core/dom/Element.h" | 10 #include "core/dom/Element.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 m_document = toHTMLDocument(&m_dummyPageHolder->document()); | 53 m_document = toHTMLDocument(&m_dummyPageHolder->document()); |
| 54 ASSERT(m_document); | 54 ASSERT(m_document); |
| 55 } | 55 } |
| 56 | 56 |
| 57 template <typename Tree> | 57 template <typename Tree> |
| 58 std::string StyledMarkupSerializerTest::serialize() | 58 std::string StyledMarkupSerializerTest::serialize() |
| 59 { | 59 { |
| 60 using PositionType = typename Tree::PositionType; | 60 using PositionType = typename Tree::PositionType; |
| 61 PositionType start = PositionType(m_document->body(), PositionType::Position
IsBeforeChildren); | 61 PositionType start = PositionType(m_document->body(), PositionType::Position
IsBeforeChildren); |
| 62 PositionType end = PositionType(m_document->body(), PositionType::PositionIs
AfterChildren); | 62 PositionType end = PositionType(m_document->body(), PositionType::PositionIs
AfterChildren); |
| 63 return CreateMarkupAlgorithm<Tree>::createMarkup(start, end).utf8().data(); | 63 return createMarkup(start, end).utf8().data(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 static PassRefPtrWillBeRawPtr<ShadowRoot> createShadowRootForElementWithIDAndSet
InnerHTML(TreeScope& scope, const char* hostElementID, const char* shadowRootCon
tent) | 66 static PassRefPtrWillBeRawPtr<ShadowRoot> createShadowRootForElementWithIDAndSet
InnerHTML(TreeScope& scope, const char* hostElementID, const char* shadowRootCon
tent) |
| 67 { | 67 { |
| 68 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = scope.getElementById(AtomicStrin
g::fromUTF8(hostElementID))->createShadowRoot(ASSERT_NO_EXCEPTION); | 68 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = scope.getElementById(AtomicStrin
g::fromUTF8(hostElementID))->createShadowRoot(ASSERT_NO_EXCEPTION); |
| 69 shadowRoot->setInnerHTML(String::fromUTF8(shadowRootContent), ASSERT_NO_EXCE
PTION); | 69 shadowRoot->setInnerHTML(String::fromUTF8(shadowRootContent), ASSERT_NO_EXCE
PTION); |
| 70 return shadowRoot.release(); | 70 return shadowRoot.release(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void StyledMarkupSerializerTest::setBodyContent(const char* bodyContent) | 73 void StyledMarkupSerializerTest::setBodyContent(const char* bodyContent) |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 TEST_F(StyledMarkupSerializerTest, StyleDisplayNone) | 174 TEST_F(StyledMarkupSerializerTest, StyleDisplayNone) |
| 175 { | 175 { |
| 176 const char* bodyContent = "<b>00<i style='display:none'>11</i>22</b>"; | 176 const char* bodyContent = "<b>00<i style='display:none'>11</i>22</b>"; |
| 177 setBodyContent(bodyContent); | 177 setBodyContent(bodyContent); |
| 178 const char* expectedResult = "<b>0022</b>"; | 178 const char* expectedResult = "<b>0022</b>"; |
| 179 EXPECT_EQ(expectedResult, serialize<EditingStrategy>()); | 179 EXPECT_EQ(expectedResult, serialize<EditingStrategy>()); |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace blink | 182 } // namespace blink |
| OLD | NEW |