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

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

Issue 1421423003: Require spanners to have the multicol container as their nearest block formatting context. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test for bug 529737 Created 5 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 583
584 // The spec says that column-span only applies to in-flow block-level elemen ts. 584 // The spec says that column-span only applies to in-flow block-level elemen ts.
585 if (descendant->style()->columnSpan() != ColumnSpanAll || !descendant->isBox () || descendant->isInline() || descendant->isFloatingOrOutOfFlowPositioned()) 585 if (descendant->style()->columnSpan() != ColumnSpanAll || !descendant->isBox () || descendant->isInline() || descendant->isFloatingOrOutOfFlowPositioned())
586 return false; 586 return false;
587 587
588 if (!descendant->containingBlock()->isLayoutBlockFlow()) { 588 if (!descendant->containingBlock()->isLayoutBlockFlow()) {
589 // Needs to be in a block-flow container, and not e.g. a table. 589 // Needs to be in a block-flow container, and not e.g. a table.
590 return false; 590 return false;
591 } 591 }
592 592
593 // This looks like a spanner, but if we're inside something unbreakable, it' s not to be treated as one. 593 // This looks like a spanner, but if we're inside something unbreakable or s omething that
594 // establishes a new formatting context, it's not to be treated as one.
594 for (LayoutBox* ancestor = toLayoutBox(descendant)->parentBox(); ancestor; a ncestor = ancestor->containingBlock()) { 595 for (LayoutBox* ancestor = toLayoutBox(descendant)->parentBox(); ancestor; a ncestor = ancestor->containingBlock()) {
595 if (ancestor->isLayoutFlowThread()) { 596 if (ancestor->isLayoutFlowThread()) {
596 ASSERT(ancestor == this); 597 ASSERT(ancestor == this);
597 return true; 598 return true;
598 } 599 }
599 if (ancestor->spannerPlaceholder()) { 600 if (!ancestor->isLayoutBlockFlow())
600 // FIXME: do we want to support nested spanners in a different way? The outer spanner
601 // has already broken out from the columns to become sized by the mu lticol container,
602 // which may be good enough for the inner spanner. But margins, bord ers, padding and
603 // explicit widths on the outer spanner, or on any children between the outer and inner
604 // spanner, will affect the width of the inner spanner this way, whi ch might be
605 // undesirable. The spec has nothing to say on the matter.
606 return false; // Ignore nested spanners.
607 }
608 if (ancestor->isFloatingOrOutOfFlowPositioned()) {
609 // TODO(mstensho): It could actually be nice to support this (althou gh the usefulness is
610 // probably very limited), but currently our column balancing algori thm gets confused
611 // when a spanner is inside a float, because a float's position isn' t always known until
612 // after layout. Similarly for absolutely positioned boxes.
613 return false; 601 return false;
614 } 602 const LayoutBlockFlow& ancestorBlockFlow = *toLayoutBlockFlow(ancestor);
615 if (ancestor->isUnsplittableForPagination()) 603 if (ancestorBlockFlow.createsNewFormattingContext() || ancestorBlockFlow .isUnsplittableForPagination())
616 return false; 604 return false;
617 } 605 }
618 ASSERT_NOT_REACHED(); 606 ASSERT_NOT_REACHED();
619 return false; 607 return false;
620 } 608 }
621 609
622 void LayoutMultiColumnFlowThread::addColumnSetToThread(LayoutMultiColumnSet* col umnSet) 610 void LayoutMultiColumnFlowThread::addColumnSetToThread(LayoutMultiColumnSet* col umnSet)
623 { 611 {
624 if (LayoutMultiColumnSet* nextSet = columnSet->nextSiblingMultiColumnSet()) { 612 if (LayoutMultiColumnSet* nextSet = columnSet->nextSiblingMultiColumnSet()) {
625 LayoutMultiColumnSetList::iterator it = m_multiColumnSetList.find(nextSe t); 613 LayoutMultiColumnSetList::iterator it = m_multiColumnSetList.find(nextSe t);
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 appendNewFragmentainerGroupIfNeeded(logicalTopInFlowThreadAfterPagination); 935 appendNewFragmentainerGroupIfNeeded(logicalTopInFlowThreadAfterPagination);
948 } 936 }
949 937
950 void LayoutMultiColumnFlowThread::updateMinimumPageHeight(LayoutUnit offset, Lay outUnit minHeight) 938 void LayoutMultiColumnFlowThread::updateMinimumPageHeight(LayoutUnit offset, Lay outUnit minHeight)
951 { 939 {
952 if (LayoutMultiColumnSet* multicolSet = columnSetAtBlockOffset(offset)) 940 if (LayoutMultiColumnSet* multicolSet = columnSetAtBlockOffset(offset))
953 multicolSet->updateMinimumColumnHeight(offset, minHeight); 941 multicolSet->updateMinimumColumnHeight(offset, minHeight);
954 } 942 }
955 943
956 } 944 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698