| 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 "core/dom/Text.h" | 8 #include "core/dom/Text.h" |
| 9 #include "core/editing/EditingTestBase.h" | 9 #include "core/editing/EditingTestBase.h" |
| 10 | 10 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 setShadowContent(shadowContent); | 185 setShadowContent(shadowContent); |
| 186 one = document().getElementById("one"); | 186 one = document().getElementById("one"); |
| 187 text = toText(one->firstChild()); | 187 text = toText(one->firstChild()); |
| 188 PositionInComposedTree startICT(text, 0); | 188 PositionInComposedTree startICT(text, 0); |
| 189 PositionInComposedTree endICT(text, 2); | 189 PositionInComposedTree endICT(text, 2); |
| 190 const std::string& serializedICT = serializePart<EditingInComposedTreeStrate
gy>(startICT, endICT, AnnotateForInterchange); | 190 const std::string& serializedICT = serializePart<EditingInComposedTreeStrate
gy>(startICT, endICT, AnnotateForInterchange); |
| 191 | 191 |
| 192 EXPECT_EQ(serializedDOM, serializedICT); | 192 EXPECT_EQ(serializedDOM, serializedICT); |
| 193 } | 193 } |
| 194 | 194 |
| 195 TEST_F(StyledMarkupSerializerTest, AcrossShadow) |
| 196 { |
| 197 const char* bodyContent = "<p id='host1'>[<span id='one'>11</span>]</p><p id
='host2'>[<span id='two'>22</span>]</p>"; |
| 198 setBodyContent(bodyContent); |
| 199 RefPtrWillBeRawPtr<Element> one = document().getElementById("one"); |
| 200 RefPtrWillBeRawPtr<Element> two = document().getElementById("two"); |
| 201 Position startDOM(toText(one->firstChild()), 0); |
| 202 Position endDOM(toText(two->firstChild()), 2); |
| 203 const std::string& serializedDOM = serializePart<EditingStrategy>(startDOM,
endDOM, AnnotateForInterchange); |
| 204 |
| 205 bodyContent = "<p id='host1'><span id='one'>11</span></p><p id='host2'><span
id='two'>22</span></p>"; |
| 206 const char* shadowContent1 = "[<content select=#one></content>]"; |
| 207 const char* shadowContent2 = "[<content select=#two></content>]"; |
| 208 setBodyContent(bodyContent); |
| 209 setShadowContent(shadowContent1, "host1"); |
| 210 setShadowContent(shadowContent2, "host2"); |
| 211 one = document().getElementById("one"); |
| 212 two = document().getElementById("two"); |
| 213 PositionInComposedTree startICT(toText(one->firstChild()), 0); |
| 214 PositionInComposedTree endICT(toText(two->firstChild()), 2); |
| 215 const std::string& serializedICT = serializePart<EditingInComposedTreeStrate
gy>(startICT, endICT, AnnotateForInterchange); |
| 216 |
| 217 EXPECT_EQ(serializedDOM, serializedICT); |
| 218 } |
| 219 |
| 195 } // namespace blink | 220 } // namespace blink |
| OLD | NEW |