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

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

Issue 1217943010: Add a FrameView lifecycle method that just updates layout, style and compositing. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 6
7 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 7 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
8 #include "core/HTMLNames.h" 8 #include "core/HTMLNames.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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 PassRefPtrWillBeRawPtr<Text> GranularityStrategyTest::appendTextNode(const Strin g& data) 100 PassRefPtrWillBeRawPtr<Text> GranularityStrategyTest::appendTextNode(const Strin g& data)
101 { 101 {
102 RefPtrWillBeRawPtr<Text> text = document().createTextNode(data); 102 RefPtrWillBeRawPtr<Text> text = document().createTextNode(data);
103 document().body()->appendChild(text); 103 document().body()->appendChild(text);
104 return text.release(); 104 return text.release();
105 } 105 }
106 106
107 void GranularityStrategyTest::setInnerHTML(const char* htmlContent) 107 void GranularityStrategyTest::setInnerHTML(const char* htmlContent)
108 { 108 {
109 document().documentElement()->setInnerHTML(String::fromUTF8(htmlContent), AS SERT_NO_EXCEPTION); 109 document().documentElement()->setInnerHTML(String::fromUTF8(htmlContent), AS SERT_NO_EXCEPTION);
110 document().view()->updateLayoutAndStyleForPainting(); 110 document().view()->updateAllLifecyclePhases();
111 } 111 }
112 112
113 void GranularityStrategyTest::parseText(Text* text) 113 void GranularityStrategyTest::parseText(Text* text)
114 { 114 {
115 std::vector<Text*> vec; 115 std::vector<Text*> vec;
116 vec.push_back(text); 116 vec.push_back(text);
117 parseText(vec); 117 parseText(vec);
118 } 118 }
119 119
120 void GranularityStrategyTest::parseText(std::vector<Text*> textNodes) 120 void GranularityStrategyTest::parseText(std::vector<Text*> textNodes)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 "</head>" 158 "</head>"
159 "<body>" 159 "<body>"
160 "<div id='mytext'></div>" 160 "<div id='mytext'></div>"
161 "</body>" 161 "</body>"
162 "</html>"); 162 "</html>");
163 163
164 RefPtrWillBeRawPtr<Text> text = document().createTextNode(str); 164 RefPtrWillBeRawPtr<Text> text = document().createTextNode(str);
165 Element* div = document().getElementById("mytext"); 165 Element* div = document().getElementById("mytext");
166 div->appendChild(text); 166 div->appendChild(text);
167 167
168 document().view()->updateLayoutAndStyleForPainting(); 168 document().view()->updateAllLifecyclePhases();
169 169
170 parseText(text.get()); 170 parseText(text.get());
171 return text.release(); 171 return text.release();
172 } 172 }
173 173
174 PassRefPtrWillBeRawPtr<Text> GranularityStrategyTest::setupTransform(WTF::String str) 174 PassRefPtrWillBeRawPtr<Text> GranularityStrategyTest::setupTransform(WTF::String str)
175 { 175 {
176 setInnerHTML( 176 setInnerHTML(
177 "<html>" 177 "<html>"
178 "<head>" 178 "<head>"
179 "<style>" 179 "<style>"
180 "div {" 180 "div {"
181 "transform: scale(1,-1) translate(0,-100px);" 181 "transform: scale(1,-1) translate(0,-100px);"
182 "}" 182 "}"
183 "</style>" 183 "</style>"
184 "</head>" 184 "</head>"
185 "<body>" 185 "<body>"
186 "<div id='mytext'></div>" 186 "<div id='mytext'></div>"
187 "</body>" 187 "</body>"
188 "</html>"); 188 "</html>");
189 189
190 RefPtrWillBeRawPtr<Text> text = document().createTextNode(str); 190 RefPtrWillBeRawPtr<Text> text = document().createTextNode(str);
191 Element* div = document().getElementById("mytext"); 191 Element* div = document().getElementById("mytext");
192 div->appendChild(text); 192 div->appendChild(text);
193 193
194 document().view()->updateLayoutAndStyleForPainting(); 194 document().view()->updateAllLifecyclePhases();
195 195
196 parseText(text.get()); 196 parseText(text.get());
197 return text.release(); 197 return text.release();
198 } 198 }
199 199
200 PassRefPtrWillBeRawPtr<Text> GranularityStrategyTest::setupRotate(WTF::String st r) 200 PassRefPtrWillBeRawPtr<Text> GranularityStrategyTest::setupRotate(WTF::String st r)
201 { 201 {
202 setInnerHTML( 202 setInnerHTML(
203 "<html>" 203 "<html>"
204 "<head>" 204 "<head>"
205 "<style>" 205 "<style>"
206 "div {" 206 "div {"
207 "transform: translate(0px,600px) rotate(90deg);" 207 "transform: translate(0px,600px) rotate(90deg);"
208 "}" 208 "}"
209 "</style>" 209 "</style>"
210 "</head>" 210 "</head>"
211 "<body>" 211 "<body>"
212 "<div id='mytext'></div>" 212 "<div id='mytext'></div>"
213 "</body>" 213 "</body>"
214 "</html>"); 214 "</html>");
215 215
216 RefPtrWillBeRawPtr<Text> text = document().createTextNode(str); 216 RefPtrWillBeRawPtr<Text> text = document().createTextNode(str);
217 Element* div = document().getElementById("mytext"); 217 Element* div = document().getElementById("mytext");
218 div->appendChild(text); 218 div->appendChild(text);
219 219
220 document().view()->updateLayoutAndStyleForPainting(); 220 document().view()->updateAllLifecyclePhases();
221 221
222 parseText(text.get()); 222 parseText(text.get());
223 return text.release(); 223 return text.release();
224 } 224 }
225 225
226 void GranularityStrategyTest::setupTextSpan(WTF::String str1, WTF::String str2, WTF::String str3, size_t selBegin, size_t selEnd) 226 void GranularityStrategyTest::setupTextSpan(WTF::String str1, WTF::String str2, WTF::String str3, size_t selBegin, size_t selEnd)
227 { 227 {
228 RefPtrWillBeRawPtr<Text> text1 = document().createTextNode(str1); 228 RefPtrWillBeRawPtr<Text> text1 = document().createTextNode(str1);
229 RefPtrWillBeRawPtr<Text> text2 = document().createTextNode(str2); 229 RefPtrWillBeRawPtr<Text> text2 = document().createTextNode(str2);
230 RefPtrWillBeRawPtr<Text> text3 = document().createTextNode(str3); 230 RefPtrWillBeRawPtr<Text> text3 = document().createTextNode(str3);
231 RefPtrWillBeRawPtr<Element> span = document().createElement(HTMLNames::spanT ag, true); 231 RefPtrWillBeRawPtr<Element> span = document().createElement(HTMLNames::spanT ag, true);
232 Element* div = document().getElementById("mytext"); 232 Element* div = document().getElementById("mytext");
233 div->appendChild(text1); 233 div->appendChild(text1);
234 div->appendChild(span); 234 div->appendChild(span);
235 span->appendChild(text2); 235 span->appendChild(text2);
236 div->appendChild(text3); 236 div->appendChild(text3);
237 237
238 document().view()->updateLayoutAndStyleForPainting(); 238 document().view()->updateAllLifecyclePhases();
239 239
240 std::vector<IntPoint> letterPos; 240 std::vector<IntPoint> letterPos;
241 std::vector<IntPoint> wordMiddlePos; 241 std::vector<IntPoint> wordMiddlePos;
242 242
243 std::vector<Text*> textNodes; 243 std::vector<Text*> textNodes;
244 textNodes.push_back(text1.get()); 244 textNodes.push_back(text1.get());
245 textNodes.push_back(text2.get()); 245 textNodes.push_back(text2.get());
246 textNodes.push_back(text3.get()); 246 textNodes.push_back(text3.get());
247 parseText(textNodes); 247 parseText(textNodes);
248 248
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 653
654 // "ab cd efghijkl ^mnopqr |>stuvwi inm," (^ means base and | means extent, 654 // "ab cd efghijkl ^mnopqr |>stuvwi inm," (^ means base and | means extent,
655 // > means end). 655 // > means end).
656 selection().setSelection(VisibleSelection(Position(text, 15), Position(text, 22))); 656 selection().setSelection(VisibleSelection(Position(text, 15), Position(text, 22)));
657 EXPECT_EQ_SELECTED_TEXT("mnopqr "); 657 EXPECT_EQ_SELECTED_TEXT("mnopqr ");
658 selection().moveRangeSelectionExtent(m_wordMiddles[4]); 658 selection().moveRangeSelectionExtent(m_wordMiddles[4]);
659 EXPECT_EQ_SELECTED_TEXT("mnopqr iiin"); 659 EXPECT_EQ_SELECTED_TEXT("mnopqr iiin");
660 } 660 }
661 661
662 } // namespace blink 662 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/FrameSelectionTest.cpp ('k') | Source/core/editing/iterators/TextIteratorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698