OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. |
7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 #include "core/html/HTMLTableElement.h" | 50 #include "core/html/HTMLTableElement.h" |
51 #include "core/page/AutoscrollController.h" | 51 #include "core/page/AutoscrollController.h" |
52 #include "core/page/EventHandler.h" | 52 #include "core/page/EventHandler.h" |
53 #include "core/page/Page.h" | 53 #include "core/page/Page.h" |
54 #include "core/paint/ObjectPainter.h" | 54 #include "core/paint/ObjectPainter.h" |
55 #include "core/rendering/FlowThreadController.h" | 55 #include "core/rendering/FlowThreadController.h" |
56 #include "core/rendering/HitTestResult.h" | 56 #include "core/rendering/HitTestResult.h" |
57 #include "core/rendering/RenderCounter.h" | 57 #include "core/rendering/RenderCounter.h" |
58 #include "core/rendering/RenderDeprecatedFlexibleBox.h" | 58 #include "core/rendering/RenderDeprecatedFlexibleBox.h" |
59 #include "core/rendering/RenderFlexibleBox.h" | 59 #include "core/rendering/RenderFlexibleBox.h" |
60 #include "core/rendering/RenderFlowThread.h" | |
61 #include "core/rendering/RenderGeometryMap.h" | 60 #include "core/rendering/RenderGeometryMap.h" |
62 #include "core/rendering/RenderGrid.h" | 61 #include "core/rendering/RenderGrid.h" |
63 #include "core/rendering/RenderImage.h" | 62 #include "core/rendering/RenderImage.h" |
64 #include "core/rendering/RenderImageResourceStyleImage.h" | 63 #include "core/rendering/RenderImageResourceStyleImage.h" |
65 #include "core/rendering/RenderInline.h" | 64 #include "core/rendering/RenderInline.h" |
66 #include "core/rendering/RenderLayer.h" | 65 #include "core/rendering/RenderLayer.h" |
67 #include "core/rendering/RenderListItem.h" | 66 #include "core/rendering/RenderListItem.h" |
67 #include "core/rendering/RenderMultiColumnFlowThread.h" | |
68 #include "core/rendering/RenderObjectInlines.h" | 68 #include "core/rendering/RenderObjectInlines.h" |
69 #include "core/rendering/RenderPart.h" | 69 #include "core/rendering/RenderPart.h" |
70 #include "core/rendering/RenderScrollbarPart.h" | 70 #include "core/rendering/RenderScrollbarPart.h" |
71 #include "core/rendering/RenderTableCaption.h" | 71 #include "core/rendering/RenderTableCaption.h" |
72 #include "core/rendering/RenderTableCell.h" | 72 #include "core/rendering/RenderTableCell.h" |
73 #include "core/rendering/RenderTableCol.h" | 73 #include "core/rendering/RenderTableCol.h" |
74 #include "core/rendering/RenderTableRow.h" | 74 #include "core/rendering/RenderTableRow.h" |
75 #include "core/rendering/RenderTheme.h" | 75 #include "core/rendering/RenderTheme.h" |
76 #include "core/rendering/RenderView.h" | 76 #include "core/rendering/RenderView.h" |
77 #include "core/rendering/compositing/CompositedLayerMapping.h" | 77 #include "core/rendering/compositing/CompositedLayerMapping.h" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
318 return !isTable(); | 318 return !isTable(); |
319 else if (newChild->isTableSection()) | 319 else if (newChild->isTableSection()) |
320 return !isTable(); | 320 return !isTable(); |
321 else if (newChild->isTableRow()) | 321 else if (newChild->isTableRow()) |
322 return !isTableSection(); | 322 return !isTableSection(); |
323 else if (newChild->isTableCell()) | 323 else if (newChild->isTableCell()) |
324 return !isTableRow(); | 324 return !isTableRow(); |
325 return false; | 325 return false; |
326 } | 326 } |
327 | 327 |
328 bool RenderObject::isValidColumnSpanAll() const | |
329 { | |
330 ASSERT(style()->columnSpan() == ColumnSpanAll); | |
331 RenderFlowThread* flowThread = flowThreadContainingBlock(); | |
332 return flowThread && flowThread->isColumnSpanner(this); | |
333 } | |
334 | |
328 void RenderObject::addChild(RenderObject* newChild, RenderObject* beforeChild) | 335 void RenderObject::addChild(RenderObject* newChild, RenderObject* beforeChild) |
329 { | 336 { |
330 ASSERT(isAllowedToModifyRenderTreeStructure(document())); | 337 ASSERT(isAllowedToModifyRenderTreeStructure(document())); |
331 | 338 |
332 RenderObjectChildList* children = virtualChildren(); | 339 RenderObjectChildList* children = virtualChildren(); |
333 ASSERT(children); | 340 ASSERT(children); |
334 if (!children) | 341 if (!children) |
335 return; | 342 return; |
336 | 343 |
337 if (requiresAnonymousTableWrappers(newChild)) { | 344 if (requiresAnonymousTableWrappers(newChild)) { |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
627 // See if we have the thread cached because we're in the middle of layout. | 634 // See if we have the thread cached because we're in the middle of layout. |
628 RenderFlowThread* flowThread = view()->flowThreadController()->currentRender FlowThread(); | 635 RenderFlowThread* flowThread = view()->flowThreadController()->currentRender FlowThread(); |
629 if (flowThread) | 636 if (flowThread) |
630 return flowThread; | 637 return flowThread; |
631 | 638 |
632 // Not in the middle of layout so have to find the thread the slow way. | 639 // Not in the middle of layout so have to find the thread the slow way. |
633 RenderObject* curr = const_cast<RenderObject*>(this); | 640 RenderObject* curr = const_cast<RenderObject*>(this); |
634 while (curr) { | 641 while (curr) { |
635 if (curr->isRenderFlowThread()) | 642 if (curr->isRenderFlowThread()) |
636 return toRenderFlowThread(curr); | 643 return toRenderFlowThread(curr); |
637 curr = curr->containingBlock(); | 644 switch (curr->style()->position()) { |
645 case FixedPosition: | |
646 curr = curr->containerForFixedPosition(); | |
647 break; | |
648 case AbsolutePosition: | |
649 curr = curr->containerForAbsolutePosition(); | |
650 break; | |
651 default: | |
652 curr = curr->parentBlock(); | |
653 break; | |
654 } | |
638 } | 655 } |
639 return 0; | 656 return 0; |
640 } | 657 } |
641 | 658 |
642 bool RenderObject::skipInvalidationWhenLaidOutChildren() const | 659 bool RenderObject::skipInvalidationWhenLaidOutChildren() const |
643 { | 660 { |
644 if (!neededLayoutBecauseOfChildren()) | 661 if (!neededLayoutBecauseOfChildren()) |
645 return false; | 662 return false; |
646 | 663 |
647 // SVG renderers need to be invalidated when their children are laid out. | 664 // SVG renderers need to be invalidated when their children are laid out. |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
794 RenderObject* ancestor = parent(); | 811 RenderObject* ancestor = parent(); |
795 for (; ancestor && !ancestor->canContainFixedPositionObjects(); ancestor = a ncestor->parent()) { | 812 for (; ancestor && !ancestor->canContainFixedPositionObjects(); ancestor = a ncestor->parent()) { |
796 if (paintInvalidationContainerSkipped && ancestor == paintInvalidationCo ntainer) | 813 if (paintInvalidationContainerSkipped && ancestor == paintInvalidationCo ntainer) |
797 *paintInvalidationContainerSkipped = true; | 814 *paintInvalidationContainerSkipped = true; |
798 } | 815 } |
799 | 816 |
800 ASSERT(!ancestor || !ancestor->isAnonymousBlock()); | 817 ASSERT(!ancestor || !ancestor->isAnonymousBlock()); |
801 return toRenderBlock(ancestor); | 818 return toRenderBlock(ancestor); |
802 } | 819 } |
803 | 820 |
804 RenderBlock* RenderObject::containingBlock() const | 821 RenderBlock* RenderObject::containerForAbsolutePosition() const |
805 { | 822 { |
806 RenderObject* o = parent(); | 823 RenderObject* o = parent(); |
807 if (!o && isRenderScrollbarPart()) | 824 while (o) { |
808 o = toRenderScrollbarPart(this)->rendererOwningScrollbar(); | 825 // For relpositioned inlines, we return the nearest non-anonymous enclos ing block. We don't try |
809 if (!isText() && m_style->position() == FixedPosition) { | 826 // to return the inline itself. This allows us to avoid having a positi oned objects |
810 return containerForFixedPosition(); | 827 // list in all RenderInlines and lets us return a strongly-typed RenderB lock* result |
811 } else if (!isText() && m_style->position() == AbsolutePosition) { | 828 // from this method. The container() method can actually be used to obt ain the |
812 while (o) { | 829 // inline directly. |
813 // For relpositioned inlines, we return the nearest non-anonymous en closing block. We don't try | 830 if (o->style()->position() != StaticPosition && (!o->isInline() || o->is Replaced())) |
814 // to return the inline itself. This allows us to avoid having a po sitioned objects | 831 break; |
815 // list in all RenderInlines and lets us return a strongly-typed Ren derBlock* result | |
816 // from this method. The container() method can actually be used to obtain the | |
817 // inline directly. | |
818 if (o->style()->position() != StaticPosition && (!o->isInline() || o ->isReplaced())) | |
819 break; | |
820 | 832 |
821 if (o->canContainFixedPositionObjects()) | 833 if (o->canContainFixedPositionObjects()) |
822 break; | 834 break; |
823 | 835 |
824 if (o->style()->hasInFlowPosition() && o->isInline() && !o->isReplac ed()) { | 836 if (o->style()->hasInFlowPosition() && o->isInline() && !o->isReplaced() ) { |
825 o = o->containingBlock(); | 837 o = o->parentBlock(); |
826 break; | 838 break; |
827 } | |
828 | |
829 o = o->parent(); | |
830 } | 839 } |
831 | 840 |
832 if (o && !o->isRenderBlock()) | 841 o = o->parent(); |
833 o = o->containingBlock(); | 842 } |
834 | 843 |
835 while (o && o->isAnonymousBlock()) | 844 if (o && !o->isRenderBlock()) |
836 o = o->containingBlock(); | 845 o = o->parentBlock(); |
837 } else { | 846 |
838 while (o && ((o->isInline() && !o->isReplaced()) || !o->isRenderBlock()) ) | 847 while (o && o->isAnonymousBlock()) |
839 o = o->parent(); | 848 o = o->parentBlock(); |
840 } | 849 |
850 return toRenderBlock(o); | |
851 } | |
852 | |
853 RenderBlock* RenderObject::parentBlock() const | |
854 { | |
855 RenderObject* o = parent(); | |
856 while (o && ((o->isInline() && !o->isReplaced()) || !o->isRenderBlock())) | |
857 o = o->parent(); | |
841 | 858 |
842 if (!o || !o->isRenderBlock()) | 859 if (!o || !o->isRenderBlock()) |
843 return 0; // This can still happen in case of an orphaned tree | 860 return 0; // This can still happen in case of an orphaned tree |
844 | 861 |
845 return toRenderBlock(o); | 862 return toRenderBlock(o); |
846 } | 863 } |
847 | 864 |
865 RenderBlock* RenderObject::containingBlock() const | |
866 { | |
867 if (!parent() && isRenderScrollbarPart()) { | |
868 RenderObject* o = toRenderScrollbarPart(this)->rendererOwningScrollbar() ; | |
869 if (o && !o->isRenderBlock()) | |
870 o = o->parentBlock(); | |
871 return toRenderBlock(o); | |
872 } | |
873 if (!isText()) { | |
874 if (m_style->position() == FixedPosition) | |
875 return containerForFixedPosition(); | |
876 if (m_style->position() == AbsolutePosition) | |
877 return containerForAbsolutePosition(); | |
878 } | |
879 if (isColumnSpanAll()) | |
880 return toRenderMultiColumnFlowThread(flowThreadContainingBlock())->multi ColumnBlockFlow(); | |
881 return parentBlock(); | |
882 } | |
Julien - ping for review
2014/11/26 21:09:01
A lot of this containing-block related change is o
mstensho (USE GERRIT)
2014/11/27 21:20:29
Yeah, as long as you think this is a good change o
Julien - ping for review
2014/12/03 23:02:22
Anything that shrinks this patch should be split o
mstensho (USE GERRIT)
2014/12/10 13:48:19
I found a way around making this big change. The c
| |
883 | |
848 bool RenderObject::canRenderBorderImage() const | 884 bool RenderObject::canRenderBorderImage() const |
849 { | 885 { |
850 if (!style()->hasBorder()) | 886 if (!style()->hasBorder()) |
851 return false; | 887 return false; |
852 | 888 |
853 StyleImage* borderImage = style()->borderImage().image(); | 889 StyleImage* borderImage = style()->borderImage().image(); |
854 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded(); | 890 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded(); |
855 } | 891 } |
856 | 892 |
857 bool RenderObject::mustInvalidateFillLayersPaintOnWidthChange(const FillLayer& l ayer) const | 893 bool RenderObject::mustInvalidateFillLayersPaintOnWidthChange(const FillLayer& l ayer) const |
(...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2411 // Pass in the flow thread so that we don't have to look it up for all the c hildren. | 2447 // Pass in the flow thread so that we don't have to look it up for all the c hildren. |
2412 removeFromRenderFlowThreadRecursive(flowThreadContainingBlock()); | 2448 removeFromRenderFlowThreadRecursive(flowThreadContainingBlock()); |
2413 } | 2449 } |
2414 | 2450 |
2415 void RenderObject::removeFromRenderFlowThreadRecursive(RenderFlowThread* renderF lowThread) | 2451 void RenderObject::removeFromRenderFlowThreadRecursive(RenderFlowThread* renderF lowThread) |
2416 { | 2452 { |
2417 if (const RenderObjectChildList* children = virtualChildren()) { | 2453 if (const RenderObjectChildList* children = virtualChildren()) { |
2418 for (RenderObject* child = children->firstChild(); child; child = child- >nextSibling()) | 2454 for (RenderObject* child = children->firstChild(); child; child = child- >nextSibling()) |
2419 child->removeFromRenderFlowThreadRecursive(renderFlowThread); | 2455 child->removeFromRenderFlowThreadRecursive(renderFlowThread); |
2420 } | 2456 } |
2457 | |
2458 if (renderFlowThread && renderFlowThread != this) | |
2459 renderFlowThread->flowThreadDescendantWillBeRemoved(this); | |
2421 setFlowThreadState(NotInsideFlowThread); | 2460 setFlowThreadState(NotInsideFlowThread); |
2422 } | 2461 } |
2423 | 2462 |
2424 void RenderObject::destroyAndCleanupAnonymousWrappers() | 2463 void RenderObject::destroyAndCleanupAnonymousWrappers() |
2425 { | 2464 { |
2426 // If the tree is destroyed, there is no need for a clean-up phase. | 2465 // If the tree is destroyed, there is no need for a clean-up phase. |
2427 if (documentBeingDestroyed()) { | 2466 if (documentBeingDestroyed()) { |
2428 destroy(); | 2467 destroy(); |
2429 return; | 2468 return; |
2430 } | 2469 } |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3148 { | 3187 { |
3149 if (object1) { | 3188 if (object1) { |
3150 const blink::RenderObject* root = object1; | 3189 const blink::RenderObject* root = object1; |
3151 while (root->parent()) | 3190 while (root->parent()) |
3152 root = root->parent(); | 3191 root = root->parent(); |
3153 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3192 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3154 } | 3193 } |
3155 } | 3194 } |
3156 | 3195 |
3157 #endif | 3196 #endif |
OLD | NEW |