| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 | 408 |
| 409 updateAfterLayout(); | 409 updateAfterLayout(); |
| 410 | 410 |
| 411 if (isHTMLDialogElement(node()) && isOutOfFlowPositioned()) | 411 if (isHTMLDialogElement(node()) && isOutOfFlowPositioned()) |
| 412 positionDialog(); | 412 positionDialog(); |
| 413 | 413 |
| 414 clearNeedsLayout(); | 414 clearNeedsLayout(); |
| 415 m_isSelfCollapsing = checkIfIsSelfCollapsingBlock(); | 415 m_isSelfCollapsing = checkIfIsSelfCollapsingBlock(); |
| 416 } | 416 } |
| 417 | 417 |
| 418 DISABLE_CFI_PERF |
| 418 inline bool LayoutBlockFlow::layoutBlockFlow(bool relayoutChildren, LayoutUnit &
pageLogicalHeight, SubtreeLayoutScope& layoutScope) | 419 inline bool LayoutBlockFlow::layoutBlockFlow(bool relayoutChildren, LayoutUnit &
pageLogicalHeight, SubtreeLayoutScope& layoutScope) |
| 419 { | 420 { |
| 420 LayoutUnit oldLeft = logicalLeft(); | 421 LayoutUnit oldLeft = logicalLeft(); |
| 421 bool logicalWidthChanged = updateLogicalWidthAndColumnWidth(); | 422 bool logicalWidthChanged = updateLogicalWidthAndColumnWidth(); |
| 422 relayoutChildren |= logicalWidthChanged; | 423 relayoutChildren |= logicalWidthChanged; |
| 423 | 424 |
| 424 rebuildFloatsFromIntruding(); | 425 rebuildFloatsFromIntruding(); |
| 425 | 426 |
| 426 bool pageLogicalHeightChanged = false; | 427 bool pageLogicalHeightChanged = false; |
| 427 bool hasSpecifiedPageLogicalHeight = false; | 428 bool hasSpecifiedPageLogicalHeight = false; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 LayoutSize offset(-block->logicalLeft(), -block->logicalTop()); | 558 LayoutSize offset(-block->logicalLeft(), -block->logicalTop()); |
| 558 if (!isHorizontalWritingMode()) | 559 if (!isHorizontalWritingMode()) |
| 559 offset = offset.transposedSize(); | 560 offset = offset.transposedSize(); |
| 560 | 561 |
| 561 if (!m_floatingObjects) | 562 if (!m_floatingObjects) |
| 562 createFloatingObjects(); | 563 createFloatingObjects(); |
| 563 FloatingObject* newFloatingObject = m_floatingObjects->add(floatingObject->c
opyToNewContainer(offset, false, true)); | 564 FloatingObject* newFloatingObject = m_floatingObjects->add(floatingObject->c
opyToNewContainer(offset, false, true)); |
| 564 newFloatingObject->setIsLowestNonOverhangingFloatInChild(true); | 565 newFloatingObject->setIsLowestNonOverhangingFloatInChild(true); |
| 565 } | 566 } |
| 566 | 567 |
| 568 DISABLE_CFI_PERF |
| 567 void LayoutBlockFlow::determineLogicalLeftPositionForChild(LayoutBox& child) | 569 void LayoutBlockFlow::determineLogicalLeftPositionForChild(LayoutBox& child) |
| 568 { | 570 { |
| 569 LayoutUnit startPosition = borderStart() + paddingStart(); | 571 LayoutUnit startPosition = borderStart() + paddingStart(); |
| 570 LayoutUnit initialStartPosition = startPosition; | 572 LayoutUnit initialStartPosition = startPosition; |
| 571 if (shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) | 573 if (shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) |
| 572 startPosition -= verticalScrollbarWidth(); | 574 startPosition -= verticalScrollbarWidth(); |
| 573 LayoutUnit totalAvailableLogicalWidth = borderAndPaddingLogicalWidth() + ava
ilableLogicalWidth(); | 575 LayoutUnit totalAvailableLogicalWidth = borderAndPaddingLogicalWidth() + ava
ilableLogicalWidth(); |
| 574 | 576 |
| 575 LayoutUnit childMarginStart = marginStartForChild(child); | 577 LayoutUnit childMarginStart = marginStartForChild(child); |
| 576 LayoutUnit newPosition = startPosition + childMarginStart; | 578 LayoutUnit newPosition = startPosition + childMarginStart; |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 return logicalOffset; // It fits fine where it is. No need to break. | 1014 return logicalOffset; // It fits fine where it is. No need to break. |
| 1013 LayoutUnit paginationStrut = calculatePaginationStrutToFitContent(logicalOff
set, remainingLogicalHeight, childLogicalHeight); | 1015 LayoutUnit paginationStrut = calculatePaginationStrutToFitContent(logicalOff
set, remainingLogicalHeight, childLogicalHeight); |
| 1014 if (paginationStrut == remainingLogicalHeight && remainingLogicalHeight == p
ageLogicalHeight) { | 1016 if (paginationStrut == remainingLogicalHeight && remainingLogicalHeight == p
ageLogicalHeight) { |
| 1015 // Don't break if we were at the top of a page, and we failed to fit the
content | 1017 // Don't break if we were at the top of a page, and we failed to fit the
content |
| 1016 // completely. No point in leaving a page completely blank. | 1018 // completely. No point in leaving a page completely blank. |
| 1017 return logicalOffset; | 1019 return logicalOffset; |
| 1018 } | 1020 } |
| 1019 return logicalOffset + paginationStrut; | 1021 return logicalOffset + paginationStrut; |
| 1020 } | 1022 } |
| 1021 | 1023 |
| 1024 DISABLE_CFI_PERF |
| 1022 void LayoutBlockFlow::rebuildFloatsFromIntruding() | 1025 void LayoutBlockFlow::rebuildFloatsFromIntruding() |
| 1023 { | 1026 { |
| 1024 if (m_floatingObjects) | 1027 if (m_floatingObjects) |
| 1025 m_floatingObjects->setHorizontalWritingMode(isHorizontalWritingMode()); | 1028 m_floatingObjects->setHorizontalWritingMode(isHorizontalWritingMode()); |
| 1026 | 1029 |
| 1027 HashSet<LayoutBox*> oldIntrudingFloatSet; | 1030 HashSet<LayoutBox*> oldIntrudingFloatSet; |
| 1028 if (!childrenInline() && m_floatingObjects) { | 1031 if (!childrenInline() && m_floatingObjects) { |
| 1029 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 1032 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
| 1030 FloatingObjectSetIterator end = floatingObjectSet.end(); | 1033 FloatingObjectSetIterator end = floatingObjectSet.end(); |
| 1031 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end
; ++it) { | 1034 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end
; ++it) { |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1562 | 1565 |
| 1563 if (marginInfo.hasMarginAfterQuirk() && !marginAfter()) { | 1566 if (marginInfo.hasMarginAfterQuirk() && !marginAfter()) { |
| 1564 // We have no bottom margin and our last child has a quirky margin. | 1567 // We have no bottom margin and our last child has a quirky margin. |
| 1565 // We will pick up this quirky margin and pass it through. | 1568 // We will pick up this quirky margin and pass it through. |
| 1566 // This deals with the <td><div><p> case. | 1569 // This deals with the <td><div><p> case. |
| 1567 setHasMarginAfterQuirk(true); | 1570 setHasMarginAfterQuirk(true); |
| 1568 } | 1571 } |
| 1569 } | 1572 } |
| 1570 } | 1573 } |
| 1571 | 1574 |
| 1575 DISABLE_CFI_PERF |
| 1572 void LayoutBlockFlow::marginBeforeEstimateForChild(LayoutBox& child, LayoutUnit&
positiveMarginBefore, LayoutUnit& negativeMarginBefore, bool& discardMarginBefo
re) const | 1576 void LayoutBlockFlow::marginBeforeEstimateForChild(LayoutBox& child, LayoutUnit&
positiveMarginBefore, LayoutUnit& negativeMarginBefore, bool& discardMarginBefo
re) const |
| 1573 { | 1577 { |
| 1574 // Give up if in quirks mode and we're a body/table cell and the top margin
of the child box is quirky. | 1578 // Give up if in quirks mode and we're a body/table cell and the top margin
of the child box is quirky. |
| 1575 // Give up if the child specified -webkit-margin-collapse: separate that pre
vents collapsing. | 1579 // Give up if the child specified -webkit-margin-collapse: separate that pre
vents collapsing. |
| 1576 // FIXME: Use writing mode independent accessor for marginBeforeCollapse. | 1580 // FIXME: Use writing mode independent accessor for marginBeforeCollapse. |
| 1577 if ((document().inQuirksMode() && hasMarginBeforeQuirk(&child) && (isTableCe
ll() || isBody())) || child.style()->marginBeforeCollapse() == MarginCollapseSep
arate) | 1581 if ((document().inQuirksMode() && hasMarginBeforeQuirk(&child) && (isTableCe
ll() || isBody())) || child.style()->marginBeforeCollapse() == MarginCollapseSep
arate) |
| 1578 return; | 1582 return; |
| 1579 | 1583 |
| 1580 // The margins are discarded by a child that specified -webkit-margin-collap
se: discard. | 1584 // The margins are discarded by a child that specified -webkit-margin-collap
se: discard. |
| 1581 // FIXME: Use writing mode independent accessor for marginBeforeCollapse. | 1585 // FIXME: Use writing mode independent accessor for marginBeforeCollapse. |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2247 { | 2251 { |
| 2248 const ComputedStyle* oldStyle = style(); | 2252 const ComputedStyle* oldStyle = style(); |
| 2249 s_canPropagateFloatIntoSibling = oldStyle ? !isFloatingOrOutOfFlowPositioned
() && !avoidsFloats() : false; | 2253 s_canPropagateFloatIntoSibling = oldStyle ? !isFloatingOrOutOfFlowPositioned
() && !avoidsFloats() : false; |
| 2250 if (oldStyle && parent() && diff.needsFullLayout() && oldStyle->position() !
= newStyle.position() | 2254 if (oldStyle && parent() && diff.needsFullLayout() && oldStyle->position() !
= newStyle.position() |
| 2251 && containsFloats() && !isFloating() && !isOutOfFlowPositioned() && newS
tyle.hasOutOfFlowPosition()) | 2255 && containsFloats() && !isFloating() && !isOutOfFlowPositioned() && newS
tyle.hasOutOfFlowPosition()) |
| 2252 markAllDescendantsWithFloatsForLayout(); | 2256 markAllDescendantsWithFloatsForLayout(); |
| 2253 | 2257 |
| 2254 LayoutBlock::styleWillChange(diff, newStyle); | 2258 LayoutBlock::styleWillChange(diff, newStyle); |
| 2255 } | 2259 } |
| 2256 | 2260 |
| 2261 DISABLE_CFI_PERF |
| 2257 void LayoutBlockFlow::styleDidChange(StyleDifference diff, const ComputedStyle*
oldStyle) | 2262 void LayoutBlockFlow::styleDidChange(StyleDifference diff, const ComputedStyle*
oldStyle) |
| 2258 { | 2263 { |
| 2259 bool hadSelfPaintingLayer = hasSelfPaintingLayer(); | 2264 bool hadSelfPaintingLayer = hasSelfPaintingLayer(); |
| 2260 LayoutBlock::styleDidChange(diff, oldStyle); | 2265 LayoutBlock::styleDidChange(diff, oldStyle); |
| 2261 | 2266 |
| 2262 // After our style changed, if we lose our ability to propagate floats into
next sibling | 2267 // After our style changed, if we lose our ability to propagate floats into
next sibling |
| 2263 // blocks, then we need to find the top most parent containing that overhang
ing float and | 2268 // blocks, then we need to find the top most parent containing that overhang
ing float and |
| 2264 // then mark its descendants with floats for layout and clear all floats fro
m its next | 2269 // then mark its descendants with floats for layout and clear all floats fro
m its next |
| 2265 // sibling blocks that exist in our floating objects list. See bug 56299 and
62875. | 2270 // sibling blocks that exist in our floating objects list. See bug 56299 and
62875. |
| 2266 bool canPropagateFloatIntoSibling = !isFloatingOrOutOfFlowPositioned() && !a
voidsFloats(); | 2271 bool canPropagateFloatIntoSibling = !isFloatingOrOutOfFlowPositioned() && !a
voidsFloats(); |
| (...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3743 | 3748 |
| 3744 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); | 3749 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); |
| 3745 } | 3750 } |
| 3746 | 3751 |
| 3747 void LayoutBlockFlow::invalidateDisplayItemClients(PaintInvalidationReason inval
idationReason) const | 3752 void LayoutBlockFlow::invalidateDisplayItemClients(PaintInvalidationReason inval
idationReason) const |
| 3748 { | 3753 { |
| 3749 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients(invalidationRe
ason); | 3754 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients(invalidationRe
ason); |
| 3750 } | 3755 } |
| 3751 | 3756 |
| 3752 } // namespace blink | 3757 } // namespace blink |
| OLD | NEW |