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 5693 matching lines...) Loading... |
5704 void RenderBlock::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Lay
outUnit& maxLogicalWidth) const | 5704 void RenderBlock::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Lay
outUnit& maxLogicalWidth) const |
5705 { | 5705 { |
5706 if (childrenInline()) { | 5706 if (childrenInline()) { |
5707 // FIXME: Remove this const_cast. | 5707 // FIXME: Remove this const_cast. |
5708 const_cast<RenderBlock*>(this)->computeInlinePreferredLogicalWidths(minL
ogicalWidth, maxLogicalWidth); | 5708 const_cast<RenderBlock*>(this)->computeInlinePreferredLogicalWidths(minL
ogicalWidth, maxLogicalWidth); |
5709 } else | 5709 } else |
5710 computeBlockPreferredLogicalWidths(minLogicalWidth, maxLogicalWidth); | 5710 computeBlockPreferredLogicalWidths(minLogicalWidth, maxLogicalWidth); |
5711 | 5711 |
5712 maxLogicalWidth = max(minLogicalWidth, maxLogicalWidth); | 5712 maxLogicalWidth = max(minLogicalWidth, maxLogicalWidth); |
5713 | 5713 |
| 5714 adjustIntrinsicLogicalWidthsForColumns(minLogicalWidth, maxLogicalWidth); |
| 5715 |
5714 // A horizontal marquee with inline children has no minimum width. | 5716 // A horizontal marquee with inline children has no minimum width. |
5715 if (childrenInline() && isMarquee() && toRenderMarquee(this)->isHorizontal()
) | 5717 if (childrenInline() && isMarquee() && toRenderMarquee(this)->isHorizontal()
) |
5716 minLogicalWidth = 0; | 5718 minLogicalWidth = 0; |
5717 | 5719 |
5718 if (isTableCell()) { | 5720 if (isTableCell()) { |
5719 Length tableCellWidth = toRenderTableCell(this)->styleOrColLogicalWidth(
); | 5721 Length tableCellWidth = toRenderTableCell(this)->styleOrColLogicalWidth(
); |
5720 if (tableCellWidth.isFixed() && tableCellWidth.value() > 0) | 5722 if (tableCellWidth.isFixed() && tableCellWidth.value() > 0) |
5721 maxLogicalWidth = max(minLogicalWidth, adjustContentBoxLogicalWidthF
orBoxSizing(tableCellWidth.value())); | 5723 maxLogicalWidth = max(minLogicalWidth, adjustContentBoxLogicalWidthF
orBoxSizing(tableCellWidth.value())); |
5722 } | 5724 } |
5723 | 5725 |
(...skipping 36 matching lines...) Loading... |
5760 m_maxPreferredLogicalWidth = m_maxPreferredLogicalWidth.ceil(); | 5762 m_maxPreferredLogicalWidth = m_maxPreferredLogicalWidth.ceil(); |
5761 } | 5763 } |
5762 | 5764 |
5763 LayoutUnit borderAndPadding = borderAndPaddingLogicalWidth(); | 5765 LayoutUnit borderAndPadding = borderAndPaddingLogicalWidth(); |
5764 m_minPreferredLogicalWidth += borderAndPadding; | 5766 m_minPreferredLogicalWidth += borderAndPadding; |
5765 m_maxPreferredLogicalWidth += borderAndPadding; | 5767 m_maxPreferredLogicalWidth += borderAndPadding; |
5766 | 5768 |
5767 clearPreferredLogicalWidthsDirty(); | 5769 clearPreferredLogicalWidthsDirty(); |
5768 } | 5770 } |
5769 | 5771 |
| 5772 void RenderBlock::adjustIntrinsicLogicalWidthsForColumns(LayoutUnit& minLogicalW
idth, LayoutUnit& maxLogicalWidth) const |
| 5773 { |
| 5774 // FIXME: make this method virtual and move the code to RenderMultiColumnBlo
ck once the old |
| 5775 // multicol code is gone. |
| 5776 |
| 5777 if (!style()->hasAutoColumnCount() || !style()->hasAutoColumnWidth()) { |
| 5778 // The min/max intrinsic widths calculated really tell how much space el
ements need when |
| 5779 // laid out inside the columns. In order to eventually end up with the d
esired column width, |
| 5780 // we need to convert them to values pertaining to the multicol containe
r. |
| 5781 int columnCount = style()->hasAutoColumnCount() ? 1 : style()->columnCou
nt(); |
| 5782 LayoutUnit columnWidth; |
| 5783 LayoutUnit gapExtra = (columnCount - 1) * columnGap(); |
| 5784 if (style()->hasAutoColumnWidth()) { |
| 5785 minLogicalWidth = minLogicalWidth * columnCount + gapExtra; |
| 5786 } else { |
| 5787 columnWidth = style()->columnWidth(); |
| 5788 minLogicalWidth = min(minLogicalWidth, columnWidth); |
| 5789 } |
| 5790 // FIXME: If column-count is auto here, we should resolve it to calculat
e the maximum |
| 5791 // intrinsic width, instead of pretending that it's 1. The only way to d
o that is by |
| 5792 // performing a layout pass, but this is not an appropriate time or plac
e for layout. The |
| 5793 // good news is that if height is unconstrained and there are no explici
t breaks, the |
| 5794 // resolved column-count really should be 1. |
| 5795 maxLogicalWidth = max(maxLogicalWidth, columnWidth) * columnCount + gapE
xtra; |
| 5796 } |
| 5797 } |
| 5798 |
5770 struct InlineMinMaxIterator { | 5799 struct InlineMinMaxIterator { |
5771 /* InlineMinMaxIterator is a class that will iterate over all render objects tha
t contribute to | 5800 /* InlineMinMaxIterator is a class that will iterate over all render objects tha
t contribute to |
5772 inline min/max width calculations. Note the following about the way it walks
: | 5801 inline min/max width calculations. Note the following about the way it walks
: |
5773 (1) Positioned content is skipped (since it does not contribute to min/max wi
dth of a block) | 5802 (1) Positioned content is skipped (since it does not contribute to min/max wi
dth of a block) |
5774 (2) We do not drill into the children of floats or replaced elements, since y
ou can't break | 5803 (2) We do not drill into the children of floats or replaced elements, since y
ou can't break |
5775 in the middle of such an element. | 5804 in the middle of such an element. |
5776 (3) Inline flows (e.g., <a>, <span>, <i>) are walked twice, since each side c
an have | 5805 (3) Inline flows (e.g., <a>, <span>, <i>) are walked twice, since each side c
an have |
5777 distinct borders/margin/padding that contribute to the min/max width. | 5806 distinct borders/margin/padding that contribute to the min/max width. |
5778 */ | 5807 */ |
5779 RenderObject* parent; | 5808 RenderObject* parent; |
(...skipping 2197 matching lines...) Loading... |
7977 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 8006 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
7978 { | 8007 { |
7979 showRenderObject(); | 8008 showRenderObject(); |
7980 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 8009 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
7981 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 8010 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
7982 } | 8011 } |
7983 | 8012 |
7984 #endif | 8013 #endif |
7985 | 8014 |
7986 } // namespace WebCore | 8015 } // namespace WebCore |
OLD | NEW |