Chromium Code Reviews| 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 2938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2949 { | 2949 { |
| 2950 if (childrenInline()) { | 2950 if (childrenInline()) { |
| 2951 // FIXME: Remove this const_cast. | 2951 // FIXME: Remove this const_cast. |
| 2952 toRenderBlockFlow(const_cast<RenderBlock*>(this))->computeInlinePreferre dLogicalWidths(minLogicalWidth, maxLogicalWidth); | 2952 toRenderBlockFlow(const_cast<RenderBlock*>(this))->computeInlinePreferre dLogicalWidths(minLogicalWidth, maxLogicalWidth); |
| 2953 } else { | 2953 } else { |
| 2954 computeBlockPreferredLogicalWidths(minLogicalWidth, maxLogicalWidth); | 2954 computeBlockPreferredLogicalWidths(minLogicalWidth, maxLogicalWidth); |
| 2955 } | 2955 } |
| 2956 | 2956 |
| 2957 maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth); | 2957 maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth); |
| 2958 | 2958 |
| 2959 adjustIntrinsicLogicalWidthsForColumns(minLogicalWidth, maxLogicalWidth); | 2959 // The new ("region based") multicol implementation will do this adjustment on the flow thread, |
|
Julien - ping for review
2015/01/27 09:31:37
Let's remove the use of 'new' as we will want to s
mstensho (USE GERRIT)
2015/01/27 10:20:23
Done.
| |
| 2960 // and not here on the multicol container, so that spanners won't incorrectl y be treated as | |
| 2961 // column content (and have spanners' preferred widths multiplied by the num ber of columns, etc.). | |
| 2962 if (style()->specifiesColumns() && !document().regionBasedColumnsEnabled()) | |
| 2963 adjustIntrinsicLogicalWidthsForColumns(minLogicalWidth, maxLogicalWidth) ; | |
| 2960 | 2964 |
| 2961 if (isTableCell()) { | 2965 if (isTableCell()) { |
| 2962 Length tableCellWidth = toLayoutTableCell(this)->styleOrColLogicalWidth( ); | 2966 Length tableCellWidth = toLayoutTableCell(this)->styleOrColLogicalWidth( ); |
| 2963 if (tableCellWidth.isFixed() && tableCellWidth.value() > 0) | 2967 if (tableCellWidth.isFixed() && tableCellWidth.value() > 0) |
| 2964 maxLogicalWidth = std::max(minLogicalWidth, adjustContentBoxLogicalW idthForBoxSizing(tableCellWidth.value())); | 2968 maxLogicalWidth = std::max(minLogicalWidth, adjustContentBoxLogicalW idthForBoxSizing(tableCellWidth.value())); |
| 2965 } | 2969 } |
| 2966 | 2970 |
| 2967 int scrollbarWidth = intrinsicScrollbarLogicalWidth(); | 2971 int scrollbarWidth = intrinsicScrollbarLogicalWidth(); |
| 2968 maxLogicalWidth += scrollbarWidth; | 2972 maxLogicalWidth += scrollbarWidth; |
| 2969 minLogicalWidth += scrollbarWidth; | 2973 minLogicalWidth += scrollbarWidth; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3034 | 3038 |
| 3035 void RenderBlock::computeBlockPreferredLogicalWidths(LayoutUnit& minLogicalWidth , LayoutUnit& maxLogicalWidth) const | 3039 void RenderBlock::computeBlockPreferredLogicalWidths(LayoutUnit& minLogicalWidth , LayoutUnit& maxLogicalWidth) const |
| 3036 { | 3040 { |
| 3037 RenderStyle* styleToUse = style(); | 3041 RenderStyle* styleToUse = style(); |
| 3038 bool nowrap = styleToUse->whiteSpace() == NOWRAP; | 3042 bool nowrap = styleToUse->whiteSpace() == NOWRAP; |
| 3039 | 3043 |
| 3040 RenderObject* child = firstChild(); | 3044 RenderObject* child = firstChild(); |
| 3041 RenderBlock* containingBlock = this->containingBlock(); | 3045 RenderBlock* containingBlock = this->containingBlock(); |
| 3042 LayoutUnit floatLeftWidth = 0, floatRightWidth = 0; | 3046 LayoutUnit floatLeftWidth = 0, floatRightWidth = 0; |
| 3043 while (child) { | 3047 while (child) { |
| 3044 // Positioned children don't affect the min/max width | 3048 // Positioned children don't affect the min/max width. Spanners only aff ect the min/max |
| 3045 if (child->isOutOfFlowPositioned()) { | 3049 // width of the multicol container, not the flow thread. |
| 3050 if (child->isOutOfFlowPositioned() || child->isColumnSpanAll()) { | |
| 3046 child = child->nextSibling(); | 3051 child = child->nextSibling(); |
| 3047 continue; | 3052 continue; |
| 3048 } | 3053 } |
| 3049 | 3054 |
| 3050 RefPtr<RenderStyle> childStyle = child->style(); | 3055 RefPtr<RenderStyle> childStyle = child->style(); |
| 3051 if (child->isFloating() || (child->isBox() && toRenderBox(child)->avoids Floats())) { | 3056 if (child->isFloating() || (child->isBox() && toRenderBox(child)->avoids Floats())) { |
| 3052 LayoutUnit floatTotalWidth = floatLeftWidth + floatRightWidth; | 3057 LayoutUnit floatTotalWidth = floatLeftWidth + floatRightWidth; |
| 3053 if (childStyle->clear() & CLEFT) { | 3058 if (childStyle->clear() & CLEFT) { |
| 3054 maxLogicalWidth = std::max(floatTotalWidth, maxLogicalWidth); | 3059 maxLogicalWidth = std::max(floatTotalWidth, maxLogicalWidth); |
| 3055 floatLeftWidth = 0; | 3060 floatLeftWidth = 0; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 3076 | 3081 |
| 3077 LayoutUnit childMinPreferredLogicalWidth, childMaxPreferredLogicalWidth; | 3082 LayoutUnit childMinPreferredLogicalWidth, childMaxPreferredLogicalWidth; |
| 3078 if (child->isBox() && child->isHorizontalWritingMode() != isHorizontalWr itingMode()) { | 3083 if (child->isBox() && child->isHorizontalWritingMode() != isHorizontalWr itingMode()) { |
| 3079 RenderBox* childBox = toRenderBox(child); | 3084 RenderBox* childBox = toRenderBox(child); |
| 3080 LogicalExtentComputedValues computedValues; | 3085 LogicalExtentComputedValues computedValues; |
| 3081 childBox->computeLogicalHeight(childBox->borderAndPaddingLogicalHeig ht(), 0, computedValues); | 3086 childBox->computeLogicalHeight(childBox->borderAndPaddingLogicalHeig ht(), 0, computedValues); |
| 3082 childMinPreferredLogicalWidth = childMaxPreferredLogicalWidth = comp utedValues.m_extent; | 3087 childMinPreferredLogicalWidth = childMaxPreferredLogicalWidth = comp utedValues.m_extent; |
| 3083 } else { | 3088 } else { |
| 3084 childMinPreferredLogicalWidth = child->minPreferredLogicalWidth(); | 3089 childMinPreferredLogicalWidth = child->minPreferredLogicalWidth(); |
| 3085 childMaxPreferredLogicalWidth = child->maxPreferredLogicalWidth(); | 3090 childMaxPreferredLogicalWidth = child->maxPreferredLogicalWidth(); |
| 3091 if (child->isRenderFlowThread()) { | |
| 3092 // The preferred intrinsic widths that a flow thread reports per tains to the column | |
| 3093 // width, but here we want the preferred multicol container widt h, so we need to | |
| 3094 // adjust with that in mind. | |
| 3095 adjustIntrinsicLogicalWidthsForColumns(childMinPreferredLogicalW idth, childMaxPreferredLogicalWidth); | |
| 3096 } | |
| 3086 } | 3097 } |
| 3087 | 3098 |
| 3088 LayoutUnit w = childMinPreferredLogicalWidth + margin; | 3099 LayoutUnit w = childMinPreferredLogicalWidth + margin; |
| 3089 minLogicalWidth = std::max(w, minLogicalWidth); | 3100 minLogicalWidth = std::max(w, minLogicalWidth); |
| 3090 | 3101 |
| 3091 // IE ignores tables for calculation of nowrap. Makes some sense. | 3102 // IE ignores tables for calculation of nowrap. Makes some sense. |
| 3092 if (nowrap && !child->isTable()) | 3103 if (nowrap && !child->isTable()) |
| 3093 maxLogicalWidth = std::max(w, maxLogicalWidth); | 3104 maxLogicalWidth = std::max(w, maxLogicalWidth); |
| 3094 | 3105 |
| 3095 w = childMaxPreferredLogicalWidth + margin; | 3106 w = childMaxPreferredLogicalWidth + margin; |
| (...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3941 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const | 3952 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const |
| 3942 { | 3953 { |
| 3943 showRenderObject(); | 3954 showRenderObject(); |
| 3944 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) | 3955 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) |
| 3945 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); | 3956 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); |
| 3946 } | 3957 } |
| 3947 | 3958 |
| 3948 #endif | 3959 #endif |
| 3949 | 3960 |
| 3950 } // namespace blink | 3961 } // namespace blink |
| OLD | NEW |