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

Side by Side Diff: Source/core/rendering/RenderObject.cpp

Issue 712553003: [New Multicolumn] Actual support for layout of column-span:all. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Let containingBlock() on a spanner return the multicol container. Created 6 years, 1 month 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
OLDNEW
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
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
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
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 curr = curr->container();
Julien - ping for review 2014/11/19 17:54:34 Is this really correct? The main difference betwee
mstensho (USE GERRIT) 2014/11/21 15:39:24 Now that containingBlock() may end up calling this
638 } 645 }
639 return 0; 646 return 0;
640 } 647 }
641 648
642 bool RenderObject::skipInvalidationWhenLaidOutChildren() const 649 bool RenderObject::skipInvalidationWhenLaidOutChildren() const
643 { 650 {
644 if (!neededLayoutBecauseOfChildren()) 651 if (!neededLayoutBecauseOfChildren())
645 return false; 652 return false;
646 653
647 // SVG renderers need to be invalidated when their children are laid out. 654 // SVG renderers need to be invalidated when their children are laid out.
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 } 834 }
828 835
829 o = o->parent(); 836 o = o->parent();
830 } 837 }
831 838
832 if (o && !o->isRenderBlock()) 839 if (o && !o->isRenderBlock())
833 o = o->containingBlock(); 840 o = o->containingBlock();
834 841
835 while (o && o->isAnonymousBlock()) 842 while (o && o->isAnonymousBlock())
836 o = o->containingBlock(); 843 o = o->containingBlock();
844 } else if (isColumnSpanAll()) {
845 o = toRenderMultiColumnFlowThread(flowThreadContainingBlock())->multiCol umnBlockFlow();
Julien - ping for review 2014/11/19 17:54:34 If you update containingBlock(), you should also u
mstensho (USE GERRIT) 2014/11/21 15:39:24 If I do that, I also have to deal with changed beh
mstensho (USE GERRIT) 2014/12/10 13:48:19 To follow up here: I tried this (make container()
837 } else { 846 } else {
838 while (o && ((o->isInline() && !o->isReplaced()) || !o->isRenderBlock()) ) 847 while (o && ((o->isInline() && !o->isReplaced()) || !o->isRenderBlock()) )
839 o = o->parent(); 848 o = o->parent();
840 } 849 }
841 850
842 if (!o || !o->isRenderBlock()) 851 if (!o || !o->isRenderBlock())
843 return 0; // This can still happen in case of an orphaned tree 852 return 0; // This can still happen in case of an orphaned tree
844 853
845 return toRenderBlock(o); 854 return toRenderBlock(o);
846 } 855 }
(...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after
2411 // Pass in the flow thread so that we don't have to look it up for all the c hildren. 2420 // Pass in the flow thread so that we don't have to look it up for all the c hildren.
2412 removeFromRenderFlowThreadRecursive(flowThreadContainingBlock()); 2421 removeFromRenderFlowThreadRecursive(flowThreadContainingBlock());
2413 } 2422 }
2414 2423
2415 void RenderObject::removeFromRenderFlowThreadRecursive(RenderFlowThread* renderF lowThread) 2424 void RenderObject::removeFromRenderFlowThreadRecursive(RenderFlowThread* renderF lowThread)
2416 { 2425 {
2417 if (const RenderObjectChildList* children = virtualChildren()) { 2426 if (const RenderObjectChildList* children = virtualChildren()) {
2418 for (RenderObject* child = children->firstChild(); child; child = child- >nextSibling()) 2427 for (RenderObject* child = children->firstChild(); child; child = child- >nextSibling())
2419 child->removeFromRenderFlowThreadRecursive(renderFlowThread); 2428 child->removeFromRenderFlowThreadRecursive(renderFlowThread);
2420 } 2429 }
2430
2431 if (renderFlowThread && renderFlowThread != this)
2432 renderFlowThread->flowThreadDescendantWillBeRemoved(this);
2421 setFlowThreadState(NotInsideFlowThread); 2433 setFlowThreadState(NotInsideFlowThread);
2422 } 2434 }
2423 2435
2424 void RenderObject::destroyAndCleanupAnonymousWrappers() 2436 void RenderObject::destroyAndCleanupAnonymousWrappers()
2425 { 2437 {
2426 // If the tree is destroyed, there is no need for a clean-up phase. 2438 // If the tree is destroyed, there is no need for a clean-up phase.
2427 if (documentBeingDestroyed()) { 2439 if (documentBeingDestroyed()) {
2428 destroy(); 2440 destroy();
2429 return; 2441 return;
2430 } 2442 }
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
3148 { 3160 {
3149 if (object1) { 3161 if (object1) {
3150 const blink::RenderObject* root = object1; 3162 const blink::RenderObject* root = object1;
3151 while (root->parent()) 3163 while (root->parent())
3152 root = root->parent(); 3164 root = root->parent();
3153 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3165 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3154 } 3166 }
3155 } 3167 }
3156 3168
3157 #endif 3169 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698