| 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) 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 Loading... |
| 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/style/ContentData.h" | 62 #include "core/style/ContentData.h" |
| 63 #include "core/style/ComputedStyle.h" | 63 #include "core/style/ComputedStyle.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" | |
| 70 #include "platform/geometry/FloatQuad.h" | 69 #include "platform/geometry/FloatQuad.h" |
| 71 #include "platform/geometry/TransformState.h" | 70 #include "platform/geometry/TransformState.h" |
| 72 #include "wtf/StdLibExtras.h" | 71 #include "wtf/StdLibExtras.h" |
| 73 #include "wtf/TemporaryChange.h" | 72 #include "wtf/TemporaryChange.h" |
| 74 | 73 |
| 75 using namespace WTF; | 74 using namespace WTF; |
| 76 using namespace Unicode; | 75 using namespace Unicode; |
| 77 | 76 |
| 78 namespace blink { | 77 namespace blink { |
| 79 | 78 |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 ASSERT(beforeChild->parent() == this); | 842 ASSERT(beforeChild->parent() == this); |
| 844 if (beforeChild->parent() != this) { | 843 if (beforeChild->parent() != this) { |
| 845 // We should never reach here. If we do, we need to use the | 844 // We should never reach here. If we do, we need to use the |
| 846 // safe fallback to use the topmost beforeChild container. | 845 // safe fallback to use the topmost beforeChild container. |
| 847 beforeChild = beforeChildContainer; | 846 beforeChild = beforeChildContainer; |
| 848 } | 847 } |
| 849 } | 848 } |
| 850 } | 849 } |
| 851 | 850 |
| 852 // Check for a spanning element in columns. | 851 // Check for a spanning element in columns. |
| 853 if (gColumnFlowSplitEnabled && !RuntimeEnabledFeatures::regionBasedColumnsEn
abled()) { | 852 if (gColumnFlowSplitEnabled && !document().regionBasedColumnsEnabled()) { |
| 854 LayoutBlockFlow* columnsBlockAncestor = columnsBlockForSpanningElement(n
ewChild); | 853 LayoutBlockFlow* columnsBlockAncestor = columnsBlockForSpanningElement(n
ewChild); |
| 855 if (columnsBlockAncestor) { | 854 if (columnsBlockAncestor) { |
| 856 TemporaryChange<bool> columnFlowSplitEnabled(gColumnFlowSplitEnabled
, false); | 855 TemporaryChange<bool> columnFlowSplitEnabled(gColumnFlowSplitEnabled
, false); |
| 857 // We are placing a column-span element inside a block. | 856 // We are placing a column-span element inside a block. |
| 858 LayoutBlockFlow* newBox = createAnonymousColumnSpanBlock(); | 857 LayoutBlockFlow* newBox = createAnonymousColumnSpanBlock(); |
| 859 | 858 |
| 860 if (columnsBlockAncestor != this && !isLayoutFlowThread()) { | 859 if (columnsBlockAncestor != this && !isLayoutFlowThread()) { |
| 861 // We are nested inside a multi-column element and are being spl
it by the span. We have to break up | 860 // We are nested inside a multi-column element and are being spl
it by the span. We have to break up |
| 862 // our block into continuations. | 861 // our block into continuations. |
| 863 LayoutBoxModelObject* oldContinuation = continuation(); | 862 LayoutBoxModelObject* oldContinuation = continuation(); |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1526 | 1525 |
| 1527 IntRect inflatedRect = pixelSnappedBorderBoxRect(); | 1526 IntRect inflatedRect = pixelSnappedBorderBoxRect(); |
| 1528 LayoutTheme::theme().adjustPaintInvalidationRect(this, inflatedRect); | 1527 LayoutTheme::theme().adjustPaintInvalidationRect(this, inflatedRect); |
| 1529 addVisualOverflow(LayoutRect(inflatedRect)); | 1528 addVisualOverflow(LayoutRect(inflatedRect)); |
| 1530 } | 1529 } |
| 1531 | 1530 |
| 1532 bool LayoutBlock::createsNewFormattingContext() const | 1531 bool LayoutBlock::createsNewFormattingContext() const |
| 1533 { | 1532 { |
| 1534 return isInlineBlockOrInlineTable() || isFloatingOrOutOfFlowPositioned() ||
hasOverflowClip() || isFlexItemIncludingDeprecated() | 1533 return isInlineBlockOrInlineTable() || isFloatingOrOutOfFlowPositioned() ||
hasOverflowClip() || isFlexItemIncludingDeprecated() |
| 1535 || style()->specifiesColumns() || isLayoutFlowThread() || isTableCell()
|| isTableCaption() || isFieldset() || isWritingModeRoot() | 1534 || style()->specifiesColumns() || isLayoutFlowThread() || isTableCell()
|| isTableCaption() || isFieldset() || isWritingModeRoot() |
| 1536 || isDocumentElement() || (RuntimeEnabledFeatures::regionBasedColumnsEna
bled() ? isColumnSpanAll() : style()->columnSpan()) || isGridItem(); | 1535 || isDocumentElement() || (document().regionBasedColumnsEnabled() ? isCo
lumnSpanAll() : style()->columnSpan()) || isGridItem(); |
| 1537 } | 1536 } |
| 1538 | 1537 |
| 1539 void LayoutBlock::updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, L
ayoutBox& child) | 1538 void LayoutBlock::updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, L
ayoutBox& child) |
| 1540 { | 1539 { |
| 1541 // FIXME: Technically percentage height objects only need a relayout if thei
r percentage isn't going to be turned into | 1540 // FIXME: Technically percentage height objects only need a relayout if thei
r percentage isn't going to be turned into |
| 1542 // an auto value. Add a method to determine this, so that we can avoid the r
elayout. | 1541 // an auto value. Add a method to determine this, so that we can avoid the r
elayout. |
| 1543 bool hasRelativeLogicalHeight = child.hasRelativeLogicalHeight() || (child.i
sAnonymous() && this->hasRelativeLogicalHeight()); | 1542 bool hasRelativeLogicalHeight = child.hasRelativeLogicalHeight() || (child.i
sAnonymous() && this->hasRelativeLogicalHeight()); |
| 1544 if (relayoutChildren || (hasRelativeLogicalHeight && !isLayoutView())) | 1543 if (relayoutChildren || (hasRelativeLogicalHeight && !isLayoutView())) |
| 1545 child.setChildNeedsLayout(MarkOnlyThis); | 1544 child.setChildNeedsLayout(MarkOnlyThis); |
| 1546 | 1545 |
| (...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2606 | 2605 |
| 2607 int LayoutBlock::columnGap() const | 2606 int LayoutBlock::columnGap() const |
| 2608 { | 2607 { |
| 2609 if (style()->hasNormalColumnGap()) | 2608 if (style()->hasNormalColumnGap()) |
| 2610 return style()->fontDescription().computedPixelSize(); // "1em" is recom
mended as the normal gap setting. Matches <p> margins. | 2609 return style()->fontDescription().computedPixelSize(); // "1em" is recom
mended as the normal gap setting. Matches <p> margins. |
| 2611 return static_cast<int>(style()->columnGap()); | 2610 return static_cast<int>(style()->columnGap()); |
| 2612 } | 2611 } |
| 2613 | 2612 |
| 2614 void LayoutBlock::calcColumnWidth() | 2613 void LayoutBlock::calcColumnWidth() |
| 2615 { | 2614 { |
| 2616 if (RuntimeEnabledFeatures::regionBasedColumnsEnabled()) | 2615 if (document().regionBasedColumnsEnabled()) |
| 2617 return; | 2616 return; |
| 2618 | 2617 |
| 2619 // Calculate our column width and column count. | 2618 // Calculate our column width and column count. |
| 2620 // 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 | 2619 // 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 |
| 2621 unsigned desiredColumnCount = 1; | 2620 unsigned desiredColumnCount = 1; |
| 2622 LayoutUnit desiredColumnWidth = contentLogicalWidth(); | 2621 LayoutUnit desiredColumnWidth = contentLogicalWidth(); |
| 2623 | 2622 |
| 2624 // For now, we don't support multi-column layouts when printing, since we ha
ve to do a lot of work for proper pagination. | 2623 // For now, we don't support multi-column layouts when printing, since we ha
ve to do a lot of work for proper pagination. |
| 2625 if (document().paginated() || !style()->specifiesColumns()) { | 2624 if (document().paginated() || !style()->specifiesColumns()) { |
| 2626 setDesiredColumnCountAndWidth(desiredColumnCount, desiredColumnWidth); | 2625 setDesiredColumnCountAndWidth(desiredColumnCount, desiredColumnWidth); |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2953 toLayoutBlockFlow(const_cast<LayoutBlock*>(this))->computeInlinePreferre
dLogicalWidths(minLogicalWidth, maxLogicalWidth); | 2952 toLayoutBlockFlow(const_cast<LayoutBlock*>(this))->computeInlinePreferre
dLogicalWidths(minLogicalWidth, maxLogicalWidth); |
| 2954 } else { | 2953 } else { |
| 2955 computeBlockPreferredLogicalWidths(minLogicalWidth, maxLogicalWidth); | 2954 computeBlockPreferredLogicalWidths(minLogicalWidth, maxLogicalWidth); |
| 2956 } | 2955 } |
| 2957 | 2956 |
| 2958 maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth); | 2957 maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth); |
| 2959 | 2958 |
| 2960 // The flow thread based multicol implementation will do this adjustment on
the flow thread, and | 2959 // The flow thread based multicol implementation will do this adjustment on
the flow thread, and |
| 2961 // not here on the multicol container, so that spanners won't incorrectly be
treated as column | 2960 // not here on the multicol container, so that spanners won't incorrectly be
treated as column |
| 2962 // content (and have spanners' preferred widths multiplied by the number of
columns, etc.). | 2961 // content (and have spanners' preferred widths multiplied by the number of
columns, etc.). |
| 2963 if (style()->specifiesColumns() && !RuntimeEnabledFeatures::regionBasedColum
nsEnabled()) | 2962 if (style()->specifiesColumns() && !document().regionBasedColumnsEnabled()) |
| 2964 adjustIntrinsicLogicalWidthsForColumns(minLogicalWidth, maxLogicalWidth)
; | 2963 adjustIntrinsicLogicalWidthsForColumns(minLogicalWidth, maxLogicalWidth)
; |
| 2965 | 2964 |
| 2966 if (isTableCell()) { | 2965 if (isTableCell()) { |
| 2967 Length tableCellWidth = toLayoutTableCell(this)->styleOrColLogicalWidth(
); | 2966 Length tableCellWidth = toLayoutTableCell(this)->styleOrColLogicalWidth(
); |
| 2968 if (tableCellWidth.isFixed() && tableCellWidth.value() > 0) | 2967 if (tableCellWidth.isFixed() && tableCellWidth.value() > 0) |
| 2969 maxLogicalWidth = std::max(minLogicalWidth, adjustContentBoxLogicalW
idthForBoxSizing(tableCellWidth.value())); | 2968 maxLogicalWidth = std::max(minLogicalWidth, adjustContentBoxLogicalW
idthForBoxSizing(tableCellWidth.value())); |
| 2970 } | 2969 } |
| 2971 | 2970 |
| 2972 int scrollbarWidth = intrinsicScrollbarLogicalWidth(); | 2971 int scrollbarWidth = intrinsicScrollbarLogicalWidth(); |
| 2973 maxLogicalWidth += scrollbarWidth; | 2972 maxLogicalWidth += scrollbarWidth; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3008 | 3007 |
| 3009 LayoutUnit borderAndPadding = borderAndPaddingLogicalWidth(); | 3008 LayoutUnit borderAndPadding = borderAndPaddingLogicalWidth(); |
| 3010 m_minPreferredLogicalWidth += borderAndPadding; | 3009 m_minPreferredLogicalWidth += borderAndPadding; |
| 3011 m_maxPreferredLogicalWidth += borderAndPadding; | 3010 m_maxPreferredLogicalWidth += borderAndPadding; |
| 3012 | 3011 |
| 3013 clearPreferredLogicalWidthsDirty(); | 3012 clearPreferredLogicalWidthsDirty(); |
| 3014 } | 3013 } |
| 3015 | 3014 |
| 3016 void LayoutBlock::adjustIntrinsicLogicalWidthsForColumns(LayoutUnit& minLogicalW
idth, LayoutUnit& maxLogicalWidth) const | 3015 void LayoutBlock::adjustIntrinsicLogicalWidthsForColumns(LayoutUnit& minLogicalW
idth, LayoutUnit& maxLogicalWidth) const |
| 3017 { | 3016 { |
| 3018 ASSERT(!RuntimeEnabledFeatures::regionBasedColumnsEnabled()); | 3017 ASSERT(!document().regionBasedColumnsEnabled()); |
| 3019 if (!style()->hasAutoColumnCount() || !style()->hasAutoColumnWidth()) { | 3018 if (!style()->hasAutoColumnCount() || !style()->hasAutoColumnWidth()) { |
| 3020 // The min/max intrinsic widths calculated really tell how much space el
ements need when | 3019 // The min/max intrinsic widths calculated really tell how much space el
ements need when |
| 3021 // laid out inside the columns. In order to eventually end up with the d
esired column width, | 3020 // laid out inside the columns. In order to eventually end up with the d
esired column width, |
| 3022 // we need to convert them to values pertaining to the multicol containe
r. | 3021 // we need to convert them to values pertaining to the multicol containe
r. |
| 3023 int columnCount = style()->hasAutoColumnCount() ? 1 : style()->columnCou
nt(); | 3022 int columnCount = style()->hasAutoColumnCount() ? 1 : style()->columnCou
nt(); |
| 3024 LayoutUnit columnWidth; | 3023 LayoutUnit columnWidth; |
| 3025 LayoutUnit gapExtra = (columnCount - 1) * columnGap(); | 3024 LayoutUnit gapExtra = (columnCount - 1) * columnGap(); |
| 3026 if (style()->hasAutoColumnWidth()) { | 3025 if (style()->hasAutoColumnWidth()) { |
| 3027 minLogicalWidth = minLogicalWidth * columnCount + gapExtra; | 3026 minLogicalWidth = minLogicalWidth * columnCount + gapExtra; |
| 3028 } else { | 3027 } else { |
| (...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3944 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const | 3943 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const |
| 3945 { | 3944 { |
| 3946 showLayoutObject(); | 3945 showLayoutObject(); |
| 3947 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 3946 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
| 3948 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 3947 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
| 3949 } | 3948 } |
| 3950 | 3949 |
| 3951 #endif | 3950 #endif |
| 3952 | 3951 |
| 3953 } // namespace blink | 3952 } // namespace blink |
| OLD | NEW |