Commit b1b9eb82 authored by yoichio@chromium.org's avatar yoichio@chromium.org

[Editing][CodeHealth] remove default argument 'host' in

EditingTestBase::setShadowContent

It is hard to understand setShadowContent puts content to a 'host' ID element.
Let's call explicitly.

BUG=
TEST=<no behavior changes>

Review URL: https://codereview.chromium.org/1304363008

git-svn-id: svn://svn.chromium.org/blink/trunk@201460 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent b2d88fc1
......@@ -18,7 +18,7 @@ TEST_F(EditingStrategyTest, caretMaxOffset)
const char* bodyContent = "<p id='host'>00<b id='one'>1</b><b id='two'>22</b>333</p>";
const char* shadowContent = "<content select=#two></content><content select=#one></content>";
setBodyContent(bodyContent);
setShadowContent(shadowContent);
setShadowContent(shadowContent, "host");
Node* host = document().getElementById("host");
Node* one = document().getElementById("one");
Node* two = document().getElementById("two");
......
......@@ -26,7 +26,7 @@ protected:
static PassRefPtrWillBeRawPtr<ShadowRoot> createShadowRootForElementWithIDAndSetInnerHTML(TreeScope&, const char* hostElementID, const char* shadowRootContent);
void setBodyContent(const char*);
PassRefPtrWillBeRawPtr<ShadowRoot> setShadowContent(const char* shadowContent, const char* host = "host");
PassRefPtrWillBeRawPtr<ShadowRoot> setShadowContent(const char* shadowContent, const char* shadowHostId);
void updateLayoutAndStyleForPainting();
private:
......
......@@ -17,7 +17,7 @@ TEST_F(EditingUtilitiesTest, directionOfEnclosingBlock)
const char* bodyContent = "<p id='host'><b id='one'></b><b id='two'>22</b></p>";
const char* shadowContent = "<content select=#two></content><p dir=rtl><content select=#one></content><p>";
setBodyContent(bodyContent);
setShadowContent(shadowContent);
setShadowContent(shadowContent, "host");
updateLayoutAndStyleForPainting();
Node* one = document().getElementById("one");
......@@ -30,7 +30,7 @@ TEST_F(EditingUtilitiesTest, firstEditablePositionAfterPositionInRoot)
const char* bodyContent = "<p id='host' contenteditable><b id='one'></b><b id='two'>22</b></p>";
const char* shadowContent = "<content select=#two></content><content select=#one></content><b id='three'>333</b>";
setBodyContent(bodyContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host");
updateLayoutAndStyleForPainting();
Node* host = document().getElementById("host");
Node* one = document().getElementById("one");
......@@ -49,7 +49,7 @@ TEST_F(EditingUtilitiesTest, enclosingBlock)
const char* bodyContent = "<p id='host'><b id='one'>11</b></p>";
const char* shadowContent = "<content select=#two></content><div id='three'><content select=#one></content></div>";
setBodyContent(bodyContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host");
updateLayoutAndStyleForPainting();
Node* host = document().getElementById("host");
Node* one = document().getElementById("one");
......@@ -64,7 +64,7 @@ TEST_F(EditingUtilitiesTest, enclosingNodeOfType)
const char* bodyContent = "<p id='host'><b id='one'>11</b></p>";
const char* shadowContent = "<content select=#two></content><div id='three'><content select=#one></div></content>";
setBodyContent(bodyContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host");
updateLayoutAndStyleForPainting();
Node* host = document().getElementById("host");
Node* one = document().getElementById("one");
......@@ -79,7 +79,7 @@ TEST_F(EditingUtilitiesTest, NextNodeIndex)
const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</b>33</p>";
const char* shadowContent = "<content select=#two></content><content select=#one></content>";
setBodyContent(bodyContent);
setShadowContent(shadowContent);
setShadowContent(shadowContent, "host");
Node* host = document().getElementById("host");
Node* two = document().getElementById("two");
......@@ -92,7 +92,7 @@ TEST_F(EditingUtilitiesTest, NextVisuallyDistinctCandidate)
const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</b><b id='three'>33</b></p>";
const char* shadowContent = "<content select=#two></content><content select=#one></content><content select=#three></content>";
setBodyContent(bodyContent);
setShadowContent(shadowContent);
setShadowContent(shadowContent, "host");
updateLayoutAndStyleForPainting();
Node* one = document().getElementById("one");
Node* two = document().getElementById("two");
......
......@@ -51,7 +51,7 @@ TEST_F(PositionTest, NodeAsRangeLastNodeShadow)
const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</b>33</p>";
const char* shadowContent = "<a id='a'><content select=#two></content><content select=#one></content></a>";
setBodyContent(bodyContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host");
Node* host = document().getElementById("host");
Node* n1 = document().getElementById("one");
......@@ -80,7 +80,7 @@ TEST_F(PositionTest, ToPositionInComposedTreeWithActiveInsertionPoint)
const char* bodyContent = "<p id='host'>00<b id='one'>11</b>22</p>";
const char* shadowContent = "<a id='a'><content select=#one id='content'></content><content></content></a>";
setBodyContent(bodyContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host");
RefPtrWillBeRawPtr<Element> anchor = shadowRoot->getElementById("a");
EXPECT_EQ(PositionInComposedTree(anchor.get(), 0), toPositionInComposedTree(Position(anchor.get(), 0)));
......@@ -103,7 +103,7 @@ TEST_F(PositionTest, ToPositionInComposedTreeWithShadowRoot)
const char* bodyContent = "<p id='host'>00<b id='one'>11</b>22</p>";
const char* shadowContent = "<a><content select=#one></content></a>";
setBodyContent(bodyContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host");
RefPtrWillBeRawPtr<Element> host = document().getElementById("host");
EXPECT_EQ(PositionInComposedTree(host.get(), 0), toPositionInComposedTree(Position(shadowRoot.get(), 0)));
......@@ -115,7 +115,7 @@ TEST_F(PositionTest, ToPositionInComposedTreeWithShadowRootContainingSingleConte
const char* bodyContent = "<p id='host'>00<b id='one'>11</b>22</p>";
const char* shadowContent = "<content select=#one></content>";
setBodyContent(bodyContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host");
RefPtrWillBeRawPtr<Element> host = document().getElementById("host");
EXPECT_EQ(PositionInComposedTree(host.get(), 0), toPositionInComposedTree(Position(shadowRoot.get(), 0)));
......@@ -127,7 +127,7 @@ TEST_F(PositionTest, ToPositionInComposedTreeWithEmptyShadowRoot)
const char* bodyContent = "<p id='host'>00<b id='one'>11</b>22</p>";
const char* shadowContent = "";
setBodyContent(bodyContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host");
RefPtrWillBeRawPtr<Element> host = document().getElementById("host");
EXPECT_EQ(PositionInComposedTree(host, PositionAnchorType::AfterChildren), toPositionInComposedTree(Position(shadowRoot.get(), 0)));
......
......@@ -17,7 +17,7 @@ TEST_F(VisiblePositionTest, ShadowDistributedNodes)
const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</b>33</p>";
const char* shadowContent = "<a><span id='s4'>44</span><content select=#two></content><span id='s5'>55</span><content select=#one></content><span id='s6'>66</span></a>";
setBodyContent(bodyContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host");
RefPtrWillBeRawPtr<Element> body = document().body();
RefPtrWillBeRawPtr<Element> one = body->querySelector("#one", ASSERT_NO_EXCEPTION);
......
......@@ -73,7 +73,7 @@ TEST_F(VisibleSelectionTest, ShadowCrossing)
const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</b>33</p>";
const char* shadowContent = "<a><span id='s4'>44</span><content select=#two></content><span id='s5'>55</span><content select=#one></content><span id='s6'>66</span></a>";
setBodyContent(bodyContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host");
RefPtrWillBeRawPtr<Element> body = document().body();
RefPtrWillBeRawPtr<Element> host = body->querySelector("#host", ASSERT_NO_EXCEPTION);
......@@ -93,7 +93,7 @@ TEST_F(VisibleSelectionTest, ShadowDistributedNodes)
const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</b>33</p>";
const char* shadowContent = "<a><span id='s4'>44</span><content select=#two></content><span id='s5'>55</span><content select=#one></content><span id='s6'>66</span></a>";
setBodyContent(bodyContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host");
RefPtrWillBeRawPtr<Element> body = document().body();
RefPtrWillBeRawPtr<Element> one = body->querySelector("#one", ASSERT_NO_EXCEPTION);
......@@ -114,7 +114,7 @@ TEST_F(VisibleSelectionTest, ShadowNested)
const char* shadowContent = "<a><span id='s4'>44</span><content select=#two></content><span id='s5'>55</span><content select=#one></content><span id='s6'>66</span></a>";
const char* shadowContent2 = "<span id='s7'>77</span><content></content><span id='s8'>88</span>";
setBodyContent(bodyContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host");
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot2 = createShadowRootForElementWithIDAndSetInnerHTML(*shadowRoot, "s5", shadowContent2);
RefPtrWillBeRawPtr<Element> body = document().body();
......
......@@ -32,7 +32,7 @@ TEST_F(VisibleUnitsTest, inSameLine)
const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</b>33</p>";
const char* shadowContent = "<div><span id='s4'>44</span><content select=#two></content><br><span id='s5'>55</span><br><content select=#one></content><span id='s6'>66</span></div>";
setBodyContent(bodyContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host");
updateLayoutAndStyleForPainting();
RefPtrWillBeRawPtr<Element> body = document().body();
......@@ -57,7 +57,7 @@ TEST_F(VisibleUnitsTest, localCaretRectOfPosition)
const char* bodyContent = "<p id='host'><b id='one'>1</b></p><b id='two'>22</b>";
const char* shadowContent = "<b id='two'>22</b><content select=#one></content><b id='three'>333</b>";
setBodyContent(bodyContent);
setShadowContent(shadowContent);
setShadowContent(shadowContent, "host");
updateLayoutAndStyleForPainting();
RefPtrWillBeRawPtr<Element> one = document().getElementById("one");
......@@ -79,7 +79,7 @@ TEST_F(VisibleUnitsTest, mostBackwardCaretPositionAfterAnchor)
const char* bodyContent = "<p id='host'><b id='one'>1</b></p><b id='two'>22</b>";
const char* shadowContent = "<b id='two'>22</b><content select=#one></content><b id='three'>333</b>";
setBodyContent(bodyContent);
setShadowContent(shadowContent);
setShadowContent(shadowContent, "host");
updateLayoutAndStyleForPainting();
RefPtrWillBeRawPtr<Element> host = document().getElementById("host");
......@@ -93,7 +93,7 @@ TEST_F(VisibleUnitsTest, mostForwardCaretPositionAfterAnchor)
const char* bodyContent = "<p id='host'><b id='one'>1</b></p>";
const char* shadowContent = "<b id='two'>22</b><content select=#one></content><b id='three'>333</b>";
setBodyContent(bodyContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent, "host");
updateLayoutAndStyleForPainting();
RefPtrWillBeRawPtr<Element> host = document().getElementById("host");
......
......@@ -117,7 +117,7 @@ TEST_F(StyledMarkupSerializerTest, ShadowTreeDistributeOrder)
const char* bodyContent = "<p id=\"host\">00<b id=\"one\">11</b><b id=\"two\">22</b>33</p>";
const char* shadowContent = "<a><content select=#two></content><content select=#one></content></a>";
setBodyContent(bodyContent);
setShadowContent(shadowContent);
setShadowContent(shadowContent, "host");
EXPECT_EQ("<p id=\"host\"><b id=\"one\">11</b><b id=\"two\">22</b></p>", serialize<EditingStrategy>())
<< "00 and 33 aren't appeared since they aren't distributed.";
EXPECT_EQ("<p id=\"host\"><a><b id=\"two\">22</b><b id=\"one\">11</b></a></p>", serialize<EditingInComposedTreeStrategy>())
......@@ -129,7 +129,7 @@ TEST_F(StyledMarkupSerializerTest, ShadowTreeInput)
const char* bodyContent = "<p id=\"host\">00<b id=\"one\">11</b><b id=\"two\"><input value=\"22\"></b>33</p>";
const char* shadowContent = "<a><content select=#two></content><content select=#one></content></a>";
setBodyContent(bodyContent);
setShadowContent(shadowContent);
setShadowContent(shadowContent, "host");
EXPECT_EQ("<p id=\"host\"><b id=\"one\">11</b><b id=\"two\"><input value=\"22\"></b></p>", serialize<EditingStrategy>())
<< "00 and 33 aren't appeared since they aren't distributed.";
EXPECT_EQ("<p id=\"host\"><a><b id=\"two\"><input value=\"22\"></b><b id=\"one\">11</b></a></p>", serialize<EditingInComposedTreeStrategy>())
......@@ -142,7 +142,7 @@ TEST_F(StyledMarkupSerializerTest, ShadowTreeNested)
const char* shadowContent1 = "<a><content select=#two></content><b id=host2></b><content select=#one></content></a>";
const char* shadowContent2 = "NESTED";
setBodyContent(bodyContent);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot1 = setShadowContent(shadowContent1);
RefPtrWillBeRawPtr<ShadowRoot> shadowRoot1 = setShadowContent(shadowContent1, "host");
createShadowRootForElementWithIDAndSetInnerHTML(*shadowRoot1, "host2", shadowContent2);
EXPECT_EQ("<p id=\"host\"><b id=\"one\">11</b><b id=\"two\">22</b></p>", serialize<EditingStrategy>())
......@@ -181,7 +181,7 @@ TEST_F(StyledMarkupSerializerTest, ShadowTreeStyle)
bodyContent = "<p id='host' style='color: red'>00<span id='one'>11</span>22</p>\n";
const char* shadowContent = "<span style='font-weight: bold'><content select=#one></content></span>";
setBodyContent(bodyContent);
setShadowContent(shadowContent);
setShadowContent(shadowContent, "host");
one = document().getElementById("one");
text = toText(one->firstChild());
PositionInComposedTree startICT(text, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment