OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 } | 290 } |
291 | 291 |
292 RenderObject* RenderObjectChildList::beforePseudoElementRenderer(const RenderObj
ect* owner) const | 292 RenderObject* RenderObjectChildList::beforePseudoElementRenderer(const RenderObj
ect* owner) const |
293 { | 293 { |
294 // An anonymous (generated) inline run-in that has PseudoId BEFORE must come
from a grandparent. | 294 // An anonymous (generated) inline run-in that has PseudoId BEFORE must come
from a grandparent. |
295 // Therefore we should skip these generated run-ins when checking our immedi
ate children. | 295 // Therefore we should skip these generated run-ins when checking our immedi
ate children. |
296 // If we don't find our :before child immediately, then we should check if w
e own a | 296 // If we don't find our :before child immediately, then we should check if w
e own a |
297 // generated inline run-in in the next level of children. | 297 // generated inline run-in in the next level of children. |
298 RenderObject* first = const_cast<RenderObject*>(owner); | 298 RenderObject* first = const_cast<RenderObject*>(owner); |
299 do { | 299 do { |
300 // Skip list markers and generated run-ins | |
301 first = first->firstChild(); | 300 first = first->firstChild(); |
302 while (first && first->isListMarker()) { | 301 // Skip list markers and generated run-ins. |
303 if (first->parent() != owner && first->parent()->isAnonymousBlock()) | 302 while (first && (first->isListMarker() || (first->isRenderInline() && fi
rst->isRunIn()))) |
304 first = first->parent(); | 303 first = first->nextInPreOrderAfterChildren(owner); |
305 first = first->nextSibling(); | |
306 } | |
307 while (first && first->isRenderInline() && first->isRunIn()) | |
308 first = first->nextSibling(); | |
309 } while (first && first->isAnonymous() && first->style()->styleType() == NOP
SEUDO); | 304 } while (first && first->isAnonymous() && first->style()->styleType() == NOP
SEUDO); |
310 | 305 |
311 if (!first) | 306 if (!first) |
312 return 0; | 307 return 0; |
313 | 308 |
314 if (first->style()->styleType() == BEFORE) | 309 if (first->style()->styleType() == BEFORE) |
315 return first; | 310 return first; |
316 | 311 |
317 // Check for a possible generated run-in, using run-in positioning rules. | 312 // Check for a possible generated run-in, using run-in positioning rules. |
318 // Skip inlines and floating / positioned blocks, and place as the first chi
ld. | |
319 first = owner->firstChild(); | 313 first = owner->firstChild(); |
320 if (!first->isRenderBlock()) | 314 if (!first->isRenderBlock()) |
321 return 0; | 315 return 0; |
322 while (first && first->isFloatingOrPositioned()) | 316 |
| 317 first = first->firstChild(); |
| 318 // We still need to skip any list markers that could exist before the run-in
. |
| 319 while (first && first->isListMarker()) |
323 first = first->nextSibling(); | 320 first = first->nextSibling(); |
324 if (first) { | 321 if (first && first->style()->styleType() == BEFORE && first->isRenderInline(
) && first->isRunIn()) |
325 first = first->firstChild(); | 322 return first; |
326 // We still need to skip any list markers that could exist before the ru
n-in. | 323 |
327 while (first && first->isListMarker()) | |
328 first = first->nextSibling(); | |
329 if (first && first->style()->styleType() == BEFORE && first->isRenderInl
ine() && first->isRunIn()) | |
330 return first; | |
331 } | |
332 return 0; | 324 return 0; |
333 } | 325 } |
334 | 326 |
335 RenderObject* RenderObjectChildList::afterPseudoElementRenderer(const RenderObje
ct* owner) const | 327 RenderObject* RenderObjectChildList::afterPseudoElementRenderer(const RenderObje
ct* owner) const |
336 { | 328 { |
337 RenderObject* last = const_cast<RenderObject*>(owner); | 329 RenderObject* last = const_cast<RenderObject*>(owner); |
338 do { | 330 do { |
339 last = last->lastChild(); | 331 last = last->lastChild(); |
340 } while (last && last->isAnonymous() && last->style()->styleType() == NOPSEU
DO && !last->isListMarker()); | 332 } while (last && last->isAnonymous() && last->style()->styleType() == NOPSEU
DO && !last->isListMarker()); |
341 if (last && last->style()->styleType() != AFTER) | 333 if (last && last->style()->styleType() != AFTER) |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 } | 514 } |
523 if (generatedContentContainer->isChildAllowed(renderer, pseudoElemen
tStyle)) | 515 if (generatedContentContainer->isChildAllowed(renderer, pseudoElemen
tStyle)) |
524 generatedContentContainer->addChild(renderer); | 516 generatedContentContainer->addChild(renderer); |
525 else | 517 else |
526 renderer->destroy(); | 518 renderer->destroy(); |
527 } | 519 } |
528 } | 520 } |
529 } | 521 } |
530 | 522 |
531 } // namespace WebCore | 523 } // namespace WebCore |
OLD | NEW |