OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 } | 158 } |
159 | 159 |
160 // If the child is a ruby run, just add it normally. | 160 // If the child is a ruby run, just add it normally. |
161 if (child->isRubyRun()) { | 161 if (child->isRubyRun()) { |
162 RenderInline::addChild(child, beforeChild); | 162 RenderInline::addChild(child, beforeChild); |
163 return; | 163 return; |
164 } | 164 } |
165 | 165 |
166 if (beforeChild && !isAfterContent(beforeChild)) { | 166 if (beforeChild && !isAfterContent(beforeChild)) { |
167 // insert child into run | 167 // insert child into run |
168 ASSERT(!beforeChild->isRubyRun()); | |
169 RenderObject* run = beforeChild; | 168 RenderObject* run = beforeChild; |
170 while (run && !run->isRubyRun()) | 169 while (run && !run->isRubyRun()) |
171 run = run->parent(); | 170 run = run->parent(); |
172 if (run) { | 171 if (run) { |
| 172 if (beforeChild == run) |
| 173 beforeChild = toRenderRubyRun(beforeChild)->firstChild(); |
| 174 ASSERT(!beforeChild || beforeChild->isDescendantOf(run)); |
173 run->addChild(child, beforeChild); | 175 run->addChild(child, beforeChild); |
174 return; | 176 return; |
175 } | 177 } |
176 ASSERT_NOT_REACHED(); // beforeChild should always have a run as parent! | 178 ASSERT_NOT_REACHED(); // beforeChild should always have a run as parent! |
177 // Emergency fallback: fall through and just append. | 179 // Emergency fallback: fall through and just append. |
178 } | 180 } |
179 | 181 |
180 // If the new child would be appended, try to add the child to the previous
run | 182 // If the new child would be appended, try to add the child to the previous
run |
181 // if possible, or create a new run otherwise. | 183 // if possible, or create a new run otherwise. |
182 // (The RenderRubyRun object will handle the details) | 184 // (The RenderRubyRun object will handle the details) |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 } | 266 } |
265 | 267 |
266 // If the child is a ruby run, just add it normally. | 268 // If the child is a ruby run, just add it normally. |
267 if (child->isRubyRun()) { | 269 if (child->isRubyRun()) { |
268 RenderBlockFlow::addChild(child, beforeChild); | 270 RenderBlockFlow::addChild(child, beforeChild); |
269 return; | 271 return; |
270 } | 272 } |
271 | 273 |
272 if (beforeChild && !isAfterContent(beforeChild)) { | 274 if (beforeChild && !isAfterContent(beforeChild)) { |
273 // insert child into run | 275 // insert child into run |
274 ASSERT(!beforeChild->isRubyRun()); | |
275 RenderObject* run = beforeChild; | 276 RenderObject* run = beforeChild; |
276 while (run && !run->isRubyRun()) | 277 while (run && !run->isRubyRun()) |
277 run = run->parent(); | 278 run = run->parent(); |
278 if (run) { | 279 if (run) { |
| 280 if (beforeChild == run) |
| 281 beforeChild = toRenderRubyRun(beforeChild)->firstChild(); |
| 282 ASSERT(!beforeChild || beforeChild->isDescendantOf(run)); |
279 run->addChild(child, beforeChild); | 283 run->addChild(child, beforeChild); |
280 return; | 284 return; |
281 } | 285 } |
282 ASSERT_NOT_REACHED(); // beforeChild should always have a run as parent! | 286 ASSERT_NOT_REACHED(); // beforeChild should always have a run as parent! |
283 // Emergency fallback: fall through and just append. | 287 // Emergency fallback: fall through and just append. |
284 } | 288 } |
285 | 289 |
286 // If the new child would be appended, try to add the child to the previous
run | 290 // If the new child would be appended, try to add the child to the previous
run |
287 // if possible, or create a new run otherwise. | 291 // if possible, or create a new run otherwise. |
288 // (The RenderRubyRun object will handle the details) | 292 // (The RenderRubyRun object will handle the details) |
(...skipping 23 matching lines...) Expand all Loading... |
312 return; | 316 return; |
313 } | 317 } |
314 | 318 |
315 // Otherwise find the containing run and remove it from there. | 319 // Otherwise find the containing run and remove it from there. |
316 RenderRubyRun* run = findRubyRunParent(child); | 320 RenderRubyRun* run = findRubyRunParent(child); |
317 ASSERT(run); | 321 ASSERT(run); |
318 run->removeChild(child); | 322 run->removeChild(child); |
319 } | 323 } |
320 | 324 |
321 } // namespace blink | 325 } // namespace blink |
OLD | NEW |