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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 if (AXObjectCache::accessibilityEnabled()) | 276 if (AXObjectCache::accessibilityEnabled()) |
277 owner->document()->axObjectCache()->childrenChanged(owner); | 277 owner->document()->axObjectCache()->childrenChanged(owner); |
278 } | 278 } |
279 | 279 |
280 static RenderObject* findBeforeAfterParent(RenderObject* object) | 280 static RenderObject* findBeforeAfterParent(RenderObject* object) |
281 { | 281 { |
282 // Only table parts need to search for the :before or :after parent | 282 // Only table parts need to search for the :before or :after parent |
283 if (!(object->isTable() || object->isTableSection() || object->isTableRow())
) | 283 if (!(object->isTable() || object->isTableSection() || object->isTableRow())
) |
284 return object; | 284 return object; |
285 | 285 |
| 286 // If there is a :first-letter style applied on the :before or :after conten
t, |
| 287 // then we want the parent of the first-letter block |
286 RenderObject* beforeAfterParent = object; | 288 RenderObject* beforeAfterParent = object; |
287 while (beforeAfterParent && !(beforeAfterParent->isText() || beforeAfterPare
nt->isImage())) | 289 while (beforeAfterParent && !(beforeAfterParent->isText() || beforeAfterPare
nt->isImage()) |
| 290 && (beforeAfterParent->style()->styleType() != FIRST_LETTER)) |
288 beforeAfterParent = beforeAfterParent->firstChild(); | 291 beforeAfterParent = beforeAfterParent->firstChild(); |
| 292 |
289 return beforeAfterParent ? beforeAfterParent->parent() : 0; | 293 return beforeAfterParent ? beforeAfterParent->parent() : 0; |
290 } | 294 } |
291 | 295 |
292 RenderObject* RenderObjectChildList::beforePseudoElementRenderer(const RenderObj
ect* owner) const | 296 RenderObject* RenderObjectChildList::beforePseudoElementRenderer(const RenderObj
ect* owner) const |
293 { | 297 { |
294 // An anonymous (generated) inline run-in that has PseudoId BEFORE must come
from a grandparent. | 298 // 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. | 299 // 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 | 300 // 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. | 301 // generated inline run-in in the next level of children. |
298 RenderObject* first = const_cast<RenderObject*>(owner); | 302 RenderObject* first = const_cast<RenderObject*>(owner); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 // Images get an empty style that inherits from the pseudo. | 443 // Images get an empty style that inherits from the pseudo. |
440 RefPtr<RenderStyle> style = RenderStyle::create(); | 444 RefPtr<RenderStyle> style = RenderStyle::create(); |
441 style->inheritFrom(pseudoElementStyle); | 445 style->inheritFrom(pseudoElementStyle); |
442 genChild->setStyle(style.release()); | 446 genChild->setStyle(style.release()); |
443 } else { | 447 } else { |
444 // RenderListItem may insert a list marker here. We do not n
eed to care about this case. | 448 // RenderListItem may insert a list marker here. We do not n
eed to care about this case. |
445 // Otherwise, genChild must be a first-letter container. upd
ateFirstLetter() will take care of it. | 449 // Otherwise, genChild must be a first-letter container. upd
ateFirstLetter() will take care of it. |
446 ASSERT(genChild->isListMarker() || genChild->style()->styleT
ype() == FIRST_LETTER); | 450 ASSERT(genChild->isListMarker() || genChild->style()->styleT
ype() == FIRST_LETTER); |
447 } | 451 } |
448 } | 452 } |
449 | |
450 // Update style on the remaining text fragment after the first-lette
r. | |
451 if (beforeAfterParent->style()->styleType() == FIRST_LETTER) { | |
452 if (RenderObject* nextSibling = beforeAfterParent->nextSibling()
) { | |
453 if (nextSibling->isText() && nextSibling->style()->styleType
() == child->style()->styleType()) | |
454 nextSibling->setStyle(pseudoElementStyle); | |
455 } | |
456 } | |
457 } | 453 } |
458 return; // We've updated the generated content. That's all we needed to
do. | 454 return; // We've updated the generated content. That's all we needed to
do. |
459 } | 455 } |
460 | 456 |
461 RenderObject* insertBefore = (type == BEFORE) ? owner->virtualChildren()->fi
rstChild() : 0; | 457 RenderObject* insertBefore = (type == BEFORE) ? owner->virtualChildren()->fi
rstChild() : 0; |
462 if (insertBefore && insertBefore->isAnonymousBlock() && insertBefore->childr
enInline() && !insertBefore->isEmpty()) { | 458 if (insertBefore && insertBefore->isAnonymousBlock() && insertBefore->childr
enInline() && !insertBefore->isEmpty()) { |
463 // We are going to add the "before" element. We have to check whether th
e "insertBefore" element | 459 // We are going to add the "before" element. We have to check whether th
e "insertBefore" element |
464 // is an anonymous block with inline children. If it is, then we should
insert the "before" element | 460 // is an anonymous block with inline children. If it is, then we should
insert the "before" element |
465 // before the first inline child of the anonymous block, otherwise we wi
ll end up with the "before" | 461 // before the first inline child of the anonymous block, otherwise we wi
ll end up with the "before" |
466 // element in a different block. We do this only when the anonymous bloc
k has children, otherwise | 462 // element in a different block. We do this only when the anonymous bloc
k has children, otherwise |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 } | 518 } |
523 if (generatedContentContainer->isChildAllowed(renderer, pseudoElemen
tStyle)) | 519 if (generatedContentContainer->isChildAllowed(renderer, pseudoElemen
tStyle)) |
524 generatedContentContainer->addChild(renderer); | 520 generatedContentContainer->addChild(renderer); |
525 else | 521 else |
526 renderer->destroy(); | 522 renderer->destroy(); |
527 } | 523 } |
528 } | 524 } |
529 } | 525 } |
530 | 526 |
531 } // namespace WebCore | 527 } // namespace WebCore |
OLD | NEW |