| 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 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1151 } | 1151 } |
| 1152 } | 1152 } |
| 1153 | 1153 |
| 1154 LayoutUnit LayoutBlock::marginIntrinsicLogicalWidthForChild(LayoutBox& child) co
nst | 1154 LayoutUnit LayoutBlock::marginIntrinsicLogicalWidthForChild(LayoutBox& child) co
nst |
| 1155 { | 1155 { |
| 1156 // A margin has three types: fixed, percentage, and auto (variable). | 1156 // A margin has three types: fixed, percentage, and auto (variable). |
| 1157 // Auto and percentage margins become 0 when computing min/max width. | 1157 // Auto and percentage margins become 0 when computing min/max width. |
| 1158 // Fixed margins can be added in as is. | 1158 // Fixed margins can be added in as is. |
| 1159 Length marginLeft = child.style()->marginStartUsing(style()); | 1159 Length marginLeft = child.style()->marginStartUsing(style()); |
| 1160 Length marginRight = child.style()->marginEndUsing(style()); | 1160 Length marginRight = child.style()->marginEndUsing(style()); |
| 1161 LayoutUnit margin = 0; | 1161 LayoutUnit margin; |
| 1162 if (marginLeft.isFixed()) | 1162 if (marginLeft.isFixed()) |
| 1163 margin += marginLeft.value(); | 1163 margin += marginLeft.value(); |
| 1164 if (marginRight.isFixed()) | 1164 if (marginRight.isFixed()) |
| 1165 margin += marginRight.value(); | 1165 margin += marginRight.value(); |
| 1166 return margin; | 1166 return margin; |
| 1167 } | 1167 } |
| 1168 | 1168 |
| 1169 static bool needsLayoutDueToStaticPosition(LayoutBox* child) | 1169 static bool needsLayoutDueToStaticPosition(LayoutBox* child) |
| 1170 { | 1170 { |
| 1171 // When a non-positioned block element moves, it may have positioned childre
n that are | 1171 // When a non-positioned block element moves, it may have positioned childre
n that are |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1548 box = box->containingBlock(); | 1548 box = box->containingBlock(); |
| 1549 ASSERT(box); | 1549 ASSERT(box); |
| 1550 if (!box) | 1550 if (!box) |
| 1551 break; | 1551 break; |
| 1552 } | 1552 } |
| 1553 } | 1553 } |
| 1554 } | 1554 } |
| 1555 | 1555 |
| 1556 LayoutUnit LayoutBlock::textIndentOffset() const | 1556 LayoutUnit LayoutBlock::textIndentOffset() const |
| 1557 { | 1557 { |
| 1558 LayoutUnit cw = 0; | 1558 LayoutUnit cw; |
| 1559 if (style()->textIndent().hasPercent()) | 1559 if (style()->textIndent().hasPercent()) |
| 1560 cw = containingBlock()->availableLogicalWidth(); | 1560 cw = containingBlock()->availableLogicalWidth(); |
| 1561 return minimumValueForLength(style()->textIndent(), cw); | 1561 return minimumValueForLength(style()->textIndent(), cw); |
| 1562 } | 1562 } |
| 1563 | 1563 |
| 1564 void LayoutBlock::markLinesDirtyInBlockRange(LayoutUnit logicalTop, LayoutUnit l
ogicalBottom, RootInlineBox* highest) | 1564 void LayoutBlock::markLinesDirtyInBlockRange(LayoutUnit logicalTop, LayoutUnit l
ogicalBottom, RootInlineBox* highest) |
| 1565 { | 1565 { |
| 1566 if (logicalTop >= logicalBottom) | 1566 if (logicalTop >= logicalBottom) |
| 1567 return; | 1567 return; |
| 1568 | 1568 |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1974 clearPreferredLogicalWidthsDirty(); | 1974 clearPreferredLogicalWidthsDirty(); |
| 1975 } | 1975 } |
| 1976 | 1976 |
| 1977 void LayoutBlock::computeBlockPreferredLogicalWidths(LayoutUnit& minLogicalWidth
, LayoutUnit& maxLogicalWidth) const | 1977 void LayoutBlock::computeBlockPreferredLogicalWidths(LayoutUnit& minLogicalWidth
, LayoutUnit& maxLogicalWidth) const |
| 1978 { | 1978 { |
| 1979 const ComputedStyle& styleToUse = styleRef(); | 1979 const ComputedStyle& styleToUse = styleRef(); |
| 1980 bool nowrap = styleToUse.whiteSpace() == NOWRAP; | 1980 bool nowrap = styleToUse.whiteSpace() == NOWRAP; |
| 1981 | 1981 |
| 1982 LayoutObject* child = firstChild(); | 1982 LayoutObject* child = firstChild(); |
| 1983 LayoutBlock* containingBlock = this->containingBlock(); | 1983 LayoutBlock* containingBlock = this->containingBlock(); |
| 1984 LayoutUnit floatLeftWidth = 0, floatRightWidth = 0; | 1984 LayoutUnit floatLeftWidth, floatRightWidth; |
| 1985 while (child) { | 1985 while (child) { |
| 1986 // Positioned children don't affect the min/max width. Spanners only aff
ect the min/max | 1986 // Positioned children don't affect the min/max width. Spanners only aff
ect the min/max |
| 1987 // width of the multicol container, not the flow thread. | 1987 // width of the multicol container, not the flow thread. |
| 1988 if (child->isOutOfFlowPositioned() || child->isColumnSpanAll()) { | 1988 if (child->isOutOfFlowPositioned() || child->isColumnSpanAll()) { |
| 1989 child = child->nextSibling(); | 1989 child = child->nextSibling(); |
| 1990 continue; | 1990 continue; |
| 1991 } | 1991 } |
| 1992 | 1992 |
| 1993 RefPtr<ComputedStyle> childStyle = child->mutableStyle(); | 1993 RefPtr<ComputedStyle> childStyle = child->mutableStyle(); |
| 1994 if (child->isFloating() || (child->isBox() && toLayoutBox(child)->avoids
Floats())) { | 1994 if (child->isFloating() || (child->isBox() && toLayoutBox(child)->avoids
Floats())) { |
| 1995 LayoutUnit floatTotalWidth = floatLeftWidth + floatRightWidth; | 1995 LayoutUnit floatTotalWidth = floatLeftWidth + floatRightWidth; |
| 1996 if (childStyle->clear() & CLEFT) { | 1996 if (childStyle->clear() & CLEFT) { |
| 1997 maxLogicalWidth = std::max(floatTotalWidth, maxLogicalWidth); | 1997 maxLogicalWidth = std::max(floatTotalWidth, maxLogicalWidth); |
| 1998 floatLeftWidth = 0; | 1998 floatLeftWidth = 0; |
| 1999 } | 1999 } |
| 2000 if (childStyle->clear() & CRIGHT) { | 2000 if (childStyle->clear() & CRIGHT) { |
| 2001 maxLogicalWidth = std::max(floatTotalWidth, maxLogicalWidth); | 2001 maxLogicalWidth = std::max(floatTotalWidth, maxLogicalWidth); |
| 2002 floatRightWidth = 0; | 2002 floatRightWidth = 0; |
| 2003 } | 2003 } |
| 2004 } | 2004 } |
| 2005 | 2005 |
| 2006 // A margin basically has three types: fixed, percentage, and auto (vari
able). | 2006 // A margin basically has three types: fixed, percentage, and auto (vari
able). |
| 2007 // Auto and percentage margins simply become 0 when computing min/max wi
dth. | 2007 // Auto and percentage margins simply become 0 when computing min/max wi
dth. |
| 2008 // Fixed margins can be added in as is. | 2008 // Fixed margins can be added in as is. |
| 2009 Length startMarginLength = childStyle->marginStartUsing(&styleToUse); | 2009 Length startMarginLength = childStyle->marginStartUsing(&styleToUse); |
| 2010 Length endMarginLength = childStyle->marginEndUsing(&styleToUse); | 2010 Length endMarginLength = childStyle->marginEndUsing(&styleToUse); |
| 2011 LayoutUnit margin = 0; | 2011 LayoutUnit margin; |
| 2012 LayoutUnit marginStart = 0; | 2012 LayoutUnit marginStart; |
| 2013 LayoutUnit marginEnd = 0; | 2013 LayoutUnit marginEnd; |
| 2014 if (startMarginLength.isFixed()) | 2014 if (startMarginLength.isFixed()) |
| 2015 marginStart += startMarginLength.value(); | 2015 marginStart += startMarginLength.value(); |
| 2016 if (endMarginLength.isFixed()) | 2016 if (endMarginLength.isFixed()) |
| 2017 marginEnd += endMarginLength.value(); | 2017 marginEnd += endMarginLength.value(); |
| 2018 margin = marginStart + marginEnd; | 2018 margin = marginStart + marginEnd; |
| 2019 | 2019 |
| 2020 LayoutUnit childMinPreferredLogicalWidth, childMaxPreferredLogicalWidth; | 2020 LayoutUnit childMinPreferredLogicalWidth, childMaxPreferredLogicalWidth; |
| 2021 computeChildPreferredLogicalWidths(*child, childMinPreferredLogicalWidth
, childMaxPreferredLogicalWidth); | 2021 computeChildPreferredLogicalWidths(*child, childMinPreferredLogicalWidth
, childMaxPreferredLogicalWidth); |
| 2022 | 2022 |
| 2023 LayoutUnit w = childMinPreferredLogicalWidth + margin; | 2023 LayoutUnit w = childMinPreferredLogicalWidth + margin; |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2858 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const | 2858 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const |
| 2859 { | 2859 { |
| 2860 showLayoutObject(); | 2860 showLayoutObject(); |
| 2861 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 2861 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
| 2862 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 2862 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
| 2863 } | 2863 } |
| 2864 | 2864 |
| 2865 #endif | 2865 #endif |
| 2866 | 2866 |
| 2867 } // namespace blink | 2867 } // namespace blink |
| OLD | NEW |