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

Side by Side Diff: Source/core/layout/LayoutMultiColumnFlowThread.cpp

Issue 1181483005: Avoid stretching the parent of a column spanner. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update unit tests that used to test the container stretching mechanism Created 5 years, 6 months 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2012 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 { 574 {
575 // Detach all column sets from the flow thread. Cannot destroy them at this point, since they 575 // Detach all column sets from the flow thread. Cannot destroy them at this point, since they
576 // are siblings of this object, and there may be pointers to this object's s ibling somewhere 576 // are siblings of this object, and there may be pointers to this object's s ibling somewhere
577 // further up on the call stack. 577 // further up on the call stack.
578 for (LayoutMultiColumnSet* columnSet = firstMultiColumnSet(); columnSet; col umnSet = columnSet->nextSiblingMultiColumnSet()) 578 for (LayoutMultiColumnSet* columnSet = firstMultiColumnSet(); columnSet; col umnSet = columnSet->nextSiblingMultiColumnSet())
579 columnSet->detachFromFlowThread(); 579 columnSet->detachFromFlowThread();
580 multiColumnBlockFlow()->resetMultiColumnFlowThread(); 580 multiColumnBlockFlow()->resetMultiColumnFlowThread();
581 LayoutFlowThread::willBeRemovedFromTree(); 581 LayoutFlowThread::willBeRemovedFromTree();
582 } 582 }
583 583
584 LayoutUnit LayoutMultiColumnFlowThread::skipColumnSpanner(LayoutBox* layoutObjec t, LayoutUnit logicalTopInFlowThread) 584 void LayoutMultiColumnFlowThread::skipColumnSpanner(LayoutBox* layoutObject, Lay outUnit logicalTopInFlowThread)
585 { 585 {
586 ASSERT(layoutObject->isColumnSpanAll()); 586 ASSERT(layoutObject->isColumnSpanAll());
587 LayoutMultiColumnSpannerPlaceholder* placeholder = layoutObject->spannerPlac eholder(); 587 LayoutMultiColumnSpannerPlaceholder* placeholder = layoutObject->spannerPlac eholder();
588 LayoutUnit adjustment;
589 LayoutBox* previousColumnBox = placeholder->previousSiblingMultiColumnBox(); 588 LayoutBox* previousColumnBox = placeholder->previousSiblingMultiColumnBox();
590 if (previousColumnBox && previousColumnBox->isLayoutMultiColumnSet()) { 589 if (previousColumnBox && previousColumnBox->isLayoutMultiColumnSet())
591 // Pad flow thread offset to a column boundary, so that any column conte nt that's supposed 590 toLayoutMultiColumnSet(previousColumnBox)->endFlow(logicalTopInFlowThrea d);
592 // to come after the spanner doesn't bleed into the column row preceding the spanner.
593 LayoutMultiColumnSet* previousSet = toLayoutMultiColumnSet(previousColum nBox);
594 if (previousSet->pageLogicalHeight()) {
595 LayoutUnit columnLogicalTopInFlowThread = previousSet->pageLogicalTo pForOffset(logicalTopInFlowThread);
596 if (columnLogicalTopInFlowThread != logicalTopInFlowThread) {
597 adjustment = columnLogicalTopInFlowThread + previousSet->pageLog icalHeight() - logicalTopInFlowThread;
598 logicalTopInFlowThread += adjustment;
599 }
600 }
601 previousSet->endFlow(logicalTopInFlowThread);
602 }
603 LayoutBox* nextColumnBox = placeholder->nextSiblingMultiColumnBox(); 591 LayoutBox* nextColumnBox = placeholder->nextSiblingMultiColumnBox();
604 if (nextColumnBox && nextColumnBox->isLayoutMultiColumnSet()) { 592 if (nextColumnBox && nextColumnBox->isLayoutMultiColumnSet()) {
605 LayoutMultiColumnSet* nextSet = toLayoutMultiColumnSet(nextColumnBox); 593 LayoutMultiColumnSet* nextSet = toLayoutMultiColumnSet(nextColumnBox);
606 m_lastSetWorkedOn = nextSet; 594 m_lastSetWorkedOn = nextSet;
607 nextSet->beginFlow(logicalTopInFlowThread); 595 nextSet->beginFlow(logicalTopInFlowThread);
608 } 596 }
609 597
610 // We'll lay out of spanners after flow thread layout has finished (during l ayout of the spanner 598 // We'll lay out of spanners after flow thread layout has finished (during l ayout of the spanner
611 // placeholders). There may be containing blocks for out-of-flow positioned descendants of the 599 // placeholders). There may be containing blocks for out-of-flow positioned descendants of the
612 // spanner in the flow thread, so that out-of-flow objects inside the spanne r will be laid out 600 // spanner in the flow thread, so that out-of-flow objects inside the spanne r will be laid out
613 // as part of flow thread layout (even if the spanner itself won't). We need to add such 601 // as part of flow thread layout (even if the spanner itself won't). We need to add such
614 // out-of-flow positioned objects to their containing blocks now, or they'll never get laid 602 // out-of-flow positioned objects to their containing blocks now, or they'll never get laid
615 // out. Since it's non-trivial to determine if we need this, and where such out-of-flow objects 603 // out. Since it's non-trivial to determine if we need this, and where such out-of-flow objects
616 // might be, just go through the whole subtree. 604 // might be, just go through the whole subtree.
617 for (LayoutObject* descendant = layoutObject->slowFirstChild(); descendant; descendant = descendant->nextInPreOrder()) { 605 for (LayoutObject* descendant = layoutObject->slowFirstChild(); descendant; descendant = descendant->nextInPreOrder()) {
618 if (descendant->isBox() && descendant->isOutOfFlowPositioned()) 606 if (descendant->isBox() && descendant->isOutOfFlowPositioned())
619 descendant->containingBlock()->insertPositionedObject(toLayoutBox(de scendant)); 607 descendant->containingBlock()->insertPositionedObject(toLayoutBox(de scendant));
620 } 608 }
621
622 return adjustment;
623 } 609 }
624 610
625 // When processing layout objects to remove or when processing layout objects th at have just been 611 // When processing layout objects to remove or when processing layout objects th at have just been
626 // inserted, certain types of objects should be skipped. 612 // inserted, certain types of objects should be skipped.
627 static bool shouldSkipInsertedOrRemovedChild(LayoutMultiColumnFlowThread* flowTh read, const LayoutObject& child) 613 static bool shouldSkipInsertedOrRemovedChild(LayoutMultiColumnFlowThread* flowTh read, const LayoutObject& child)
628 { 614 {
629 if (child.isSVG() && !child.isSVGRoot()) { 615 if (child.isSVG() && !child.isSVGRoot()) {
630 // Don't descend into SVG objects. What's in there is of no interest, an d there might even 616 // Don't descend into SVG objects. What's in there is of no interest, an d there might even
631 // be a foreignObject there with column-span:all, which doesn't apply to us. 617 // be a foreignObject there with column-span:all, which doesn't apply to us.
632 return true; 618 return true;
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 } 882 }
897 883
898 bool LayoutMultiColumnFlowThread::isPageLogicalHeightKnown() const 884 bool LayoutMultiColumnFlowThread::isPageLogicalHeightKnown() const
899 { 885 {
900 if (LayoutMultiColumnSet* columnSet = lastMultiColumnSet()) 886 if (LayoutMultiColumnSet* columnSet = lastMultiColumnSet())
901 return columnSet->pageLogicalHeight(); 887 return columnSet->pageLogicalHeight();
902 return false; 888 return false;
903 } 889 }
904 890
905 } 891 }
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutMultiColumnFlowThread.h ('k') | Source/core/layout/LayoutMultiColumnFlowThreadTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698