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

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

Issue 1028383002: Enable new multicol for testing and experimental web platform features. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Need to mark virtual/slimmingpaint/svg/text/columns-do-not-apply.html as failing too. Created 5 years, 9 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
« no previous file with comments | « Source/core/frame/Settings.in ('k') | Source/core/layout/LayoutBlockFlow.cpp » ('j') | 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) 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) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 #include "core/layout/line/InlineIterator.h" 59 #include "core/layout/line/InlineIterator.h"
60 #include "core/layout/line/InlineTextBox.h" 60 #include "core/layout/line/InlineTextBox.h"
61 #include "core/layout/shapes/ShapeOutsideInfo.h" 61 #include "core/layout/shapes/ShapeOutsideInfo.h"
62 #include "core/layout/style/ContentData.h" 62 #include "core/layout/style/ContentData.h"
63 #include "core/layout/style/LayoutStyle.h" 63 #include "core/layout/style/LayoutStyle.h"
64 #include "core/page/Page.h" 64 #include "core/page/Page.h"
65 #include "core/paint/BlockPainter.h" 65 #include "core/paint/BlockPainter.h"
66 #include "core/paint/BoxPainter.h" 66 #include "core/paint/BoxPainter.h"
67 #include "core/paint/DeprecatedPaintLayer.h" 67 #include "core/paint/DeprecatedPaintLayer.h"
68 #include "core/paint/LayoutObjectDrawingRecorder.h" 68 #include "core/paint/LayoutObjectDrawingRecorder.h"
69 #include "platform/RuntimeEnabledFeatures.h"
69 #include "platform/geometry/FloatQuad.h" 70 #include "platform/geometry/FloatQuad.h"
70 #include "platform/geometry/TransformState.h" 71 #include "platform/geometry/TransformState.h"
71 #include "wtf/StdLibExtras.h" 72 #include "wtf/StdLibExtras.h"
72 #include "wtf/TemporaryChange.h" 73 #include "wtf/TemporaryChange.h"
73 74
74 using namespace WTF; 75 using namespace WTF;
75 using namespace Unicode; 76 using namespace Unicode;
76 77
77 namespace blink { 78 namespace blink {
78 79
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 ASSERT(beforeChild->parent() == this); 843 ASSERT(beforeChild->parent() == this);
843 if (beforeChild->parent() != this) { 844 if (beforeChild->parent() != this) {
844 // We should never reach here. If we do, we need to use the 845 // We should never reach here. If we do, we need to use the
845 // safe fallback to use the topmost beforeChild container. 846 // safe fallback to use the topmost beforeChild container.
846 beforeChild = beforeChildContainer; 847 beforeChild = beforeChildContainer;
847 } 848 }
848 } 849 }
849 } 850 }
850 851
851 // Check for a spanning element in columns. 852 // Check for a spanning element in columns.
852 if (gColumnFlowSplitEnabled && !document().regionBasedColumnsEnabled()) { 853 if (gColumnFlowSplitEnabled && !RuntimeEnabledFeatures::regionBasedColumnsEn abled()) {
853 LayoutBlockFlow* columnsBlockAncestor = columnsBlockForSpanningElement(n ewChild); 854 LayoutBlockFlow* columnsBlockAncestor = columnsBlockForSpanningElement(n ewChild);
854 if (columnsBlockAncestor) { 855 if (columnsBlockAncestor) {
855 TemporaryChange<bool> columnFlowSplitEnabled(gColumnFlowSplitEnabled , false); 856 TemporaryChange<bool> columnFlowSplitEnabled(gColumnFlowSplitEnabled , false);
856 // We are placing a column-span element inside a block. 857 // We are placing a column-span element inside a block.
857 LayoutBlockFlow* newBox = createAnonymousColumnSpanBlock(); 858 LayoutBlockFlow* newBox = createAnonymousColumnSpanBlock();
858 859
859 if (columnsBlockAncestor != this && !isLayoutFlowThread()) { 860 if (columnsBlockAncestor != this && !isLayoutFlowThread()) {
860 // We are nested inside a multi-column element and are being spl it by the span. We have to break up 861 // We are nested inside a multi-column element and are being spl it by the span. We have to break up
861 // our block into continuations. 862 // our block into continuations.
862 LayoutBoxModelObject* oldContinuation = continuation(); 863 LayoutBoxModelObject* oldContinuation = continuation();
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
1525 1526
1526 IntRect inflatedRect = pixelSnappedBorderBoxRect(); 1527 IntRect inflatedRect = pixelSnappedBorderBoxRect();
1527 LayoutTheme::theme().adjustPaintInvalidationRect(this, inflatedRect); 1528 LayoutTheme::theme().adjustPaintInvalidationRect(this, inflatedRect);
1528 addVisualOverflow(LayoutRect(inflatedRect)); 1529 addVisualOverflow(LayoutRect(inflatedRect));
1529 } 1530 }
1530 1531
1531 bool LayoutBlock::createsNewFormattingContext() const 1532 bool LayoutBlock::createsNewFormattingContext() const
1532 { 1533 {
1533 return isInlineBlockOrInlineTable() || isFloatingOrOutOfFlowPositioned() || hasOverflowClip() || isFlexItemIncludingDeprecated() 1534 return isInlineBlockOrInlineTable() || isFloatingOrOutOfFlowPositioned() || hasOverflowClip() || isFlexItemIncludingDeprecated()
1534 || style()->specifiesColumns() || isLayoutFlowThread() || isTableCell() || isTableCaption() || isFieldset() || isWritingModeRoot() 1535 || style()->specifiesColumns() || isLayoutFlowThread() || isTableCell() || isTableCaption() || isFieldset() || isWritingModeRoot()
1535 || isDocumentElement() || (document().regionBasedColumnsEnabled() ? isCo lumnSpanAll() : style()->columnSpan()) || isGridItem(); 1536 || isDocumentElement() || (RuntimeEnabledFeatures::regionBasedColumnsEna bled() ? isColumnSpanAll() : style()->columnSpan()) || isGridItem();
1536 } 1537 }
1537 1538
1538 void LayoutBlock::updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, L ayoutBox& child) 1539 void LayoutBlock::updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, L ayoutBox& child)
1539 { 1540 {
1540 // FIXME: Technically percentage height objects only need a relayout if thei r percentage isn't going to be turned into 1541 // FIXME: Technically percentage height objects only need a relayout if thei r percentage isn't going to be turned into
1541 // an auto value. Add a method to determine this, so that we can avoid the r elayout. 1542 // an auto value. Add a method to determine this, so that we can avoid the r elayout.
1542 bool hasRelativeLogicalHeight = child.hasRelativeLogicalHeight() || (child.i sAnonymous() && this->hasRelativeLogicalHeight()); 1543 bool hasRelativeLogicalHeight = child.hasRelativeLogicalHeight() || (child.i sAnonymous() && this->hasRelativeLogicalHeight());
1543 if (relayoutChildren || (hasRelativeLogicalHeight && !isLayoutView())) 1544 if (relayoutChildren || (hasRelativeLogicalHeight && !isLayoutView()))
1544 child.setChildNeedsLayout(MarkOnlyThis); 1545 child.setChildNeedsLayout(MarkOnlyThis);
1545 1546
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
2600 2601
2601 int LayoutBlock::columnGap() const 2602 int LayoutBlock::columnGap() const
2602 { 2603 {
2603 if (style()->hasNormalColumnGap()) 2604 if (style()->hasNormalColumnGap())
2604 return style()->fontDescription().computedPixelSize(); // "1em" is recom mended as the normal gap setting. Matches <p> margins. 2605 return style()->fontDescription().computedPixelSize(); // "1em" is recom mended as the normal gap setting. Matches <p> margins.
2605 return static_cast<int>(style()->columnGap()); 2606 return static_cast<int>(style()->columnGap());
2606 } 2607 }
2607 2608
2608 void LayoutBlock::calcColumnWidth() 2609 void LayoutBlock::calcColumnWidth()
2609 { 2610 {
2610 if (document().regionBasedColumnsEnabled()) 2611 if (RuntimeEnabledFeatures::regionBasedColumnsEnabled())
2611 return; 2612 return;
2612 2613
2613 // Calculate our column width and column count. 2614 // Calculate our column width and column count.
2614 // FIXME: Can overflow on fast/block/float/float-not-removed-from-next-sibli ng4.html, see https://bugs.webkit.org/show_bug.cgi?id=68744 2615 // FIXME: Can overflow on fast/block/float/float-not-removed-from-next-sibli ng4.html, see https://bugs.webkit.org/show_bug.cgi?id=68744
2615 unsigned desiredColumnCount = 1; 2616 unsigned desiredColumnCount = 1;
2616 LayoutUnit desiredColumnWidth = contentLogicalWidth(); 2617 LayoutUnit desiredColumnWidth = contentLogicalWidth();
2617 2618
2618 // For now, we don't support multi-column layouts when printing, since we ha ve to do a lot of work for proper pagination. 2619 // For now, we don't support multi-column layouts when printing, since we ha ve to do a lot of work for proper pagination.
2619 if (document().paginated() || !style()->specifiesColumns()) { 2620 if (document().paginated() || !style()->specifiesColumns()) {
2620 setDesiredColumnCountAndWidth(desiredColumnCount, desiredColumnWidth); 2621 setDesiredColumnCountAndWidth(desiredColumnCount, desiredColumnWidth);
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
2947 toLayoutBlockFlow(const_cast<LayoutBlock*>(this))->computeInlinePreferre dLogicalWidths(minLogicalWidth, maxLogicalWidth); 2948 toLayoutBlockFlow(const_cast<LayoutBlock*>(this))->computeInlinePreferre dLogicalWidths(minLogicalWidth, maxLogicalWidth);
2948 } else { 2949 } else {
2949 computeBlockPreferredLogicalWidths(minLogicalWidth, maxLogicalWidth); 2950 computeBlockPreferredLogicalWidths(minLogicalWidth, maxLogicalWidth);
2950 } 2951 }
2951 2952
2952 maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth); 2953 maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth);
2953 2954
2954 // The flow thread based multicol implementation will do this adjustment on the flow thread, and 2955 // The flow thread based multicol implementation will do this adjustment on the flow thread, and
2955 // not here on the multicol container, so that spanners won't incorrectly be treated as column 2956 // not here on the multicol container, so that spanners won't incorrectly be treated as column
2956 // content (and have spanners' preferred widths multiplied by the number of columns, etc.). 2957 // content (and have spanners' preferred widths multiplied by the number of columns, etc.).
2957 if (style()->specifiesColumns() && !document().regionBasedColumnsEnabled()) 2958 if (style()->specifiesColumns() && !RuntimeEnabledFeatures::regionBasedColum nsEnabled())
2958 adjustIntrinsicLogicalWidthsForColumns(minLogicalWidth, maxLogicalWidth) ; 2959 adjustIntrinsicLogicalWidthsForColumns(minLogicalWidth, maxLogicalWidth) ;
2959 2960
2960 if (isTableCell()) { 2961 if (isTableCell()) {
2961 Length tableCellWidth = toLayoutTableCell(this)->styleOrColLogicalWidth( ); 2962 Length tableCellWidth = toLayoutTableCell(this)->styleOrColLogicalWidth( );
2962 if (tableCellWidth.isFixed() && tableCellWidth.value() > 0) 2963 if (tableCellWidth.isFixed() && tableCellWidth.value() > 0)
2963 maxLogicalWidth = std::max(minLogicalWidth, adjustContentBoxLogicalW idthForBoxSizing(tableCellWidth.value())); 2964 maxLogicalWidth = std::max(minLogicalWidth, adjustContentBoxLogicalW idthForBoxSizing(tableCellWidth.value()));
2964 } 2965 }
2965 2966
2966 int scrollbarWidth = intrinsicScrollbarLogicalWidth(); 2967 int scrollbarWidth = intrinsicScrollbarLogicalWidth();
2967 maxLogicalWidth += scrollbarWidth; 2968 maxLogicalWidth += scrollbarWidth;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
3002 3003
3003 LayoutUnit borderAndPadding = borderAndPaddingLogicalWidth(); 3004 LayoutUnit borderAndPadding = borderAndPaddingLogicalWidth();
3004 m_minPreferredLogicalWidth += borderAndPadding; 3005 m_minPreferredLogicalWidth += borderAndPadding;
3005 m_maxPreferredLogicalWidth += borderAndPadding; 3006 m_maxPreferredLogicalWidth += borderAndPadding;
3006 3007
3007 clearPreferredLogicalWidthsDirty(); 3008 clearPreferredLogicalWidthsDirty();
3008 } 3009 }
3009 3010
3010 void LayoutBlock::adjustIntrinsicLogicalWidthsForColumns(LayoutUnit& minLogicalW idth, LayoutUnit& maxLogicalWidth) const 3011 void LayoutBlock::adjustIntrinsicLogicalWidthsForColumns(LayoutUnit& minLogicalW idth, LayoutUnit& maxLogicalWidth) const
3011 { 3012 {
3012 ASSERT(!document().regionBasedColumnsEnabled()); 3013 ASSERT(!RuntimeEnabledFeatures::regionBasedColumnsEnabled());
3013 if (!style()->hasAutoColumnCount() || !style()->hasAutoColumnWidth()) { 3014 if (!style()->hasAutoColumnCount() || !style()->hasAutoColumnWidth()) {
3014 // The min/max intrinsic widths calculated really tell how much space el ements need when 3015 // The min/max intrinsic widths calculated really tell how much space el ements need when
3015 // laid out inside the columns. In order to eventually end up with the d esired column width, 3016 // laid out inside the columns. In order to eventually end up with the d esired column width,
3016 // we need to convert them to values pertaining to the multicol containe r. 3017 // we need to convert them to values pertaining to the multicol containe r.
3017 int columnCount = style()->hasAutoColumnCount() ? 1 : style()->columnCou nt(); 3018 int columnCount = style()->hasAutoColumnCount() ? 1 : style()->columnCou nt();
3018 LayoutUnit columnWidth; 3019 LayoutUnit columnWidth;
3019 LayoutUnit gapExtra = (columnCount - 1) * columnGap(); 3020 LayoutUnit gapExtra = (columnCount - 1) * columnGap();
3020 if (style()->hasAutoColumnWidth()) { 3021 if (style()->hasAutoColumnWidth()) {
3021 minLogicalWidth = minLogicalWidth * columnCount + gapExtra; 3022 minLogicalWidth = minLogicalWidth * columnCount + gapExtra;
3022 } else { 3023 } else {
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
3938 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const 3939 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const
3939 { 3940 {
3940 showLayoutObject(); 3941 showLayoutObject();
3941 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 3942 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
3942 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 3943 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
3943 } 3944 }
3944 3945
3945 #endif 3946 #endif
3946 3947
3947 } // namespace blink 3948 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/Settings.in ('k') | Source/core/layout/LayoutBlockFlow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698