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

Side by Side Diff: Source/core/editing/StyledMarkupSerializerTest.cpp

Issue 1187273003: Introduce createMarkup function takes two positions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-06-18T09:58:34 Created 5 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
« no previous file with comments | « no previous file | Source/core/editing/markup.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | Source/core/editing/markup.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698