| 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 bool widthAvailableToChildrenHasChanged = m_widthAvailableToChildrenChanged; | 399 bool widthAvailableToChildrenHasChanged = m_widthAvailableToChildrenChanged; |
| 400 m_widthAvailableToChildrenChanged = false; | 400 m_widthAvailableToChildrenChanged = false; |
| 401 | 401 |
| 402 // If we use border-box sizing, have percentage padding, and our parent has
changed width then the width available to our children has changed even | 402 // If we use border-box sizing, have percentage padding, and our parent has
changed width then the width available to our children has changed even |
| 403 // though our own width has remained the same. | 403 // though our own width has remained the same. |
| 404 widthAvailableToChildrenHasChanged |= style()->boxSizing() == BoxSizingBorde
rBox && needsPreferredWidthsRecalculation() && view()->layoutState()->containing
BlockLogicalWidthChanged(); | 404 widthAvailableToChildrenHasChanged |= style()->boxSizing() == BoxSizingBorde
rBox && needsPreferredWidthsRecalculation() && view()->layoutState()->containing
BlockLogicalWidthChanged(); |
| 405 | 405 |
| 406 return widthAvailableToChildrenHasChanged; | 406 return widthAvailableToChildrenHasChanged; |
| 407 } | 407 } |
| 408 | 408 |
| 409 DISABLE_CFI_PERF |
| 409 bool LayoutBlock::updateLogicalWidthAndColumnWidth() | 410 bool LayoutBlock::updateLogicalWidthAndColumnWidth() |
| 410 { | 411 { |
| 411 LayoutUnit oldWidth = logicalWidth(); | 412 LayoutUnit oldWidth = logicalWidth(); |
| 412 updateLogicalWidth(); | 413 updateLogicalWidth(); |
| 413 return oldWidth != logicalWidth() || widthAvailableToChildrenHasChanged(); | 414 return oldWidth != logicalWidth() || widthAvailableToChildrenHasChanged(); |
| 414 } | 415 } |
| 415 | 416 |
| 416 void LayoutBlock::layoutBlock(bool) | 417 void LayoutBlock::layoutBlock(bool) |
| 417 { | 418 { |
| 418 ASSERT_NOT_REACHED(); | 419 ASSERT_NOT_REACHED(); |
| 419 clearNeedsLayout(); | 420 clearNeedsLayout(); |
| 420 } | 421 } |
| 421 | 422 |
| 422 void LayoutBlock::addOverflowFromChildren() | 423 void LayoutBlock::addOverflowFromChildren() |
| 423 { | 424 { |
| 424 if (childrenInline()) | 425 if (childrenInline()) |
| 425 toLayoutBlockFlow(this)->addOverflowFromInlineChildren(); | 426 toLayoutBlockFlow(this)->addOverflowFromInlineChildren(); |
| 426 else | 427 else |
| 427 addOverflowFromBlockChildren(); | 428 addOverflowFromBlockChildren(); |
| 428 } | 429 } |
| 429 | 430 |
| 431 DISABLE_CFI_PERF |
| 430 void LayoutBlock::computeOverflow(LayoutUnit oldClientAfterEdge, bool) | 432 void LayoutBlock::computeOverflow(LayoutUnit oldClientAfterEdge, bool) |
| 431 { | 433 { |
| 432 m_overflow.reset(); | 434 m_overflow.reset(); |
| 433 | 435 |
| 434 // Add overflow from children. | 436 // Add overflow from children. |
| 435 addOverflowFromChildren(); | 437 addOverflowFromChildren(); |
| 436 | 438 |
| 437 // Add in the overflow from positioned objects. | 439 // Add in the overflow from positioned objects. |
| 438 addOverflowFromPositionedObjects(); | 440 addOverflowFromPositionedObjects(); |
| 439 | 441 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 void LayoutBlock::addVisualOverflowFromTheme() | 487 void LayoutBlock::addVisualOverflowFromTheme() |
| 486 { | 488 { |
| 487 if (!style()->hasAppearance()) | 489 if (!style()->hasAppearance()) |
| 488 return; | 490 return; |
| 489 | 491 |
| 490 IntRect inflatedRect = pixelSnappedBorderBoxRect(); | 492 IntRect inflatedRect = pixelSnappedBorderBoxRect(); |
| 491 LayoutTheme::theme().addVisualOverflow(*this, inflatedRect); | 493 LayoutTheme::theme().addVisualOverflow(*this, inflatedRect); |
| 492 addSelfVisualOverflow(LayoutRect(inflatedRect)); | 494 addSelfVisualOverflow(LayoutRect(inflatedRect)); |
| 493 } | 495 } |
| 494 | 496 |
| 497 DISABLE_CFI_PERF |
| 495 bool LayoutBlock::createsNewFormattingContext() const | 498 bool LayoutBlock::createsNewFormattingContext() const |
| 496 { | 499 { |
| 497 return isInlineBlockOrInlineTable() || isFloatingOrOutOfFlowPositioned() ||
hasOverflowClip() || isFlexItemIncludingDeprecated() | 500 return isInlineBlockOrInlineTable() || isFloatingOrOutOfFlowPositioned() ||
hasOverflowClip() || isFlexItemIncludingDeprecated() |
| 498 || style()->specifiesColumns() || isLayoutFlowThread() || isTableCell()
|| isTableCaption() || isFieldset() || isWritingModeRoot() | 501 || style()->specifiesColumns() || isLayoutFlowThread() || isTableCell()
|| isTableCaption() || isFieldset() || isWritingModeRoot() |
| 499 || isDocumentElement() || isColumnSpanAll() || isGridItem() || style()->
containsPaint() || style()->containsLayout(); | 502 || isDocumentElement() || isColumnSpanAll() || isGridItem() || style()->
containsPaint() || style()->containsLayout(); |
| 500 } | 503 } |
| 501 | 504 |
| 502 static inline bool changeInAvailableLogicalHeightAffectsChild(LayoutBlock* paren
t, LayoutBox& child) | 505 static inline bool changeInAvailableLogicalHeightAffectsChild(LayoutBlock* paren
t, LayoutBox& child) |
| 503 { | 506 { |
| 504 if (parent->style()->boxSizing() != BoxSizingBorderBox) | 507 if (parent->style()->boxSizing() != BoxSizingBorderBox) |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 Length tableCellWidth = toLayoutTableCell(this)->styleOrColLogicalWidth(
); | 1251 Length tableCellWidth = toLayoutTableCell(this)->styleOrColLogicalWidth(
); |
| 1249 if (tableCellWidth.isFixed() && tableCellWidth.value() > 0) | 1252 if (tableCellWidth.isFixed() && tableCellWidth.value() > 0) |
| 1250 maxLogicalWidth = std::max(minLogicalWidth, adjustContentBoxLogicalW
idthForBoxSizing(LayoutUnit(tableCellWidth.value()))); | 1253 maxLogicalWidth = std::max(minLogicalWidth, adjustContentBoxLogicalW
idthForBoxSizing(LayoutUnit(tableCellWidth.value()))); |
| 1251 } | 1254 } |
| 1252 | 1255 |
| 1253 int scrollbarWidth = scrollbarLogicalWidth(); | 1256 int scrollbarWidth = scrollbarLogicalWidth(); |
| 1254 maxLogicalWidth += scrollbarWidth; | 1257 maxLogicalWidth += scrollbarWidth; |
| 1255 minLogicalWidth += scrollbarWidth; | 1258 minLogicalWidth += scrollbarWidth; |
| 1256 } | 1259 } |
| 1257 | 1260 |
| 1261 DISABLE_CFI_PERF |
| 1258 void LayoutBlock::computePreferredLogicalWidths() | 1262 void LayoutBlock::computePreferredLogicalWidths() |
| 1259 { | 1263 { |
| 1260 ASSERT(preferredLogicalWidthsDirty()); | 1264 ASSERT(preferredLogicalWidthsDirty()); |
| 1261 | 1265 |
| 1262 m_minPreferredLogicalWidth = LayoutUnit(); | 1266 m_minPreferredLogicalWidth = LayoutUnit(); |
| 1263 m_maxPreferredLogicalWidth = LayoutUnit(); | 1267 m_maxPreferredLogicalWidth = LayoutUnit(); |
| 1264 | 1268 |
| 1265 // FIXME: The isFixed() calls here should probably be checking for isSpecifi
ed since you | 1269 // FIXME: The isFixed() calls here should probably be checking for isSpecifi
ed since you |
| 1266 // should be able to use percentage, calc or viewport relative values for wi
dth. | 1270 // should be able to use percentage, calc or viewport relative values for wi
dth. |
| 1267 const ComputedStyle& styleToUse = styleRef(); | 1271 const ComputedStyle& styleToUse = styleRef(); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1379 child = child->nextSibling(); | 1383 child = child->nextSibling(); |
| 1380 } | 1384 } |
| 1381 | 1385 |
| 1382 // Always make sure these values are non-negative. | 1386 // Always make sure these values are non-negative. |
| 1383 minLogicalWidth = minLogicalWidth.clampNegativeToZero(); | 1387 minLogicalWidth = minLogicalWidth.clampNegativeToZero(); |
| 1384 maxLogicalWidth = maxLogicalWidth.clampNegativeToZero(); | 1388 maxLogicalWidth = maxLogicalWidth.clampNegativeToZero(); |
| 1385 | 1389 |
| 1386 maxLogicalWidth = std::max(floatLeftWidth + floatRightWidth, maxLogicalWidth
); | 1390 maxLogicalWidth = std::max(floatLeftWidth + floatRightWidth, maxLogicalWidth
); |
| 1387 } | 1391 } |
| 1388 | 1392 |
| 1393 DISABLE_CFI_PERF |
| 1389 void LayoutBlock::computeChildPreferredLogicalWidths(LayoutObject& child, Layout
Unit& minPreferredLogicalWidth, LayoutUnit& maxPreferredLogicalWidth) const | 1394 void LayoutBlock::computeChildPreferredLogicalWidths(LayoutObject& child, Layout
Unit& minPreferredLogicalWidth, LayoutUnit& maxPreferredLogicalWidth) const |
| 1390 { | 1395 { |
| 1391 if (child.isBox() && child.isHorizontalWritingMode() != isHorizontalWritingM
ode()) { | 1396 if (child.isBox() && child.isHorizontalWritingMode() != isHorizontalWritingM
ode()) { |
| 1392 // If the child is an orthogonal flow, child's height determines the wid
th, but the height is not available until layout. | 1397 // If the child is an orthogonal flow, child's height determines the wid
th, but the height is not available until layout. |
| 1393 // http://dev.w3.org/csswg/css-writing-modes-3/#orthogonal-shrink-to-fit | 1398 // http://dev.w3.org/csswg/css-writing-modes-3/#orthogonal-shrink-to-fit |
| 1394 if (!child.needsLayout()) { | 1399 if (!child.needsLayout()) { |
| 1395 minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(ch
ild).logicalHeight(); | 1400 minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(ch
ild).logicalHeight(); |
| 1396 return; | 1401 return; |
| 1397 } | 1402 } |
| 1398 minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(child)
.computeLogicalHeightWithoutLayout(); | 1403 minPreferredLogicalWidth = maxPreferredLogicalWidth = toLayoutBox(child)
.computeLogicalHeightWithoutLayout(); |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1931 | 1936 |
| 1932 return availableHeight; | 1937 return availableHeight; |
| 1933 } | 1938 } |
| 1934 | 1939 |
| 1935 bool LayoutBlock::hasDefiniteLogicalHeight() const | 1940 bool LayoutBlock::hasDefiniteLogicalHeight() const |
| 1936 { | 1941 { |
| 1937 return availableLogicalHeightForPercentageComputation() != LayoutUnit(-1); | 1942 return availableLogicalHeightForPercentageComputation() != LayoutUnit(-1); |
| 1938 } | 1943 } |
| 1939 | 1944 |
| 1940 } // namespace blink | 1945 } // namespace blink |
| OLD | NEW |