| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 LayoutUnit m_positiveMargin; | 102 LayoutUnit m_positiveMargin; |
| 103 LayoutUnit m_negativeMargin; | 103 LayoutUnit m_negativeMargin; |
| 104 | 104 |
| 105 public: | 105 public: |
| 106 MarginInfo(LayoutBlockFlow*, LayoutUnit beforeBorderPadding, LayoutUnit afte
rBorderPadding); | 106 MarginInfo(LayoutBlockFlow*, LayoutUnit beforeBorderPadding, LayoutUnit afte
rBorderPadding); |
| 107 | 107 |
| 108 void setAtBeforeSideOfBlock(bool b) { m_atBeforeSideOfBlock = b; } | 108 void setAtBeforeSideOfBlock(bool b) { m_atBeforeSideOfBlock = b; } |
| 109 void setAtAfterSideOfBlock(bool b) { m_atAfterSideOfBlock = b; } | 109 void setAtAfterSideOfBlock(bool b) { m_atAfterSideOfBlock = b; } |
| 110 void clearMargin() | 110 void clearMargin() |
| 111 { | 111 { |
| 112 m_positiveMargin = 0; | 112 m_positiveMargin = LayoutUnit(); |
| 113 m_negativeMargin = 0; | 113 m_negativeMargin = LayoutUnit(); |
| 114 } | 114 } |
| 115 void setHasMarginBeforeQuirk(bool b) { m_hasMarginBeforeQuirk = b; } | 115 void setHasMarginBeforeQuirk(bool b) { m_hasMarginBeforeQuirk = b; } |
| 116 void setHasMarginAfterQuirk(bool b) { m_hasMarginAfterQuirk = b; } | 116 void setHasMarginAfterQuirk(bool b) { m_hasMarginAfterQuirk = b; } |
| 117 void setDeterminedMarginBeforeQuirk(bool b) { m_determinedMarginBeforeQuirk
= b; } | 117 void setDeterminedMarginBeforeQuirk(bool b) { m_determinedMarginBeforeQuirk
= b; } |
| 118 void setPositiveMargin(LayoutUnit p) { ASSERT(!m_discardMargin); m_positiveM
argin = p; } | 118 void setPositiveMargin(LayoutUnit p) { ASSERT(!m_discardMargin); m_positiveM
argin = p; } |
| 119 void setNegativeMargin(LayoutUnit n) { ASSERT(!m_discardMargin); m_negativeM
argin = n; } | 119 void setNegativeMargin(LayoutUnit n) { ASSERT(!m_discardMargin); m_negativeM
argin = n; } |
| 120 void setPositiveMarginIfLarger(LayoutUnit p) | 120 void setPositiveMarginIfLarger(LayoutUnit p) |
| 121 { | 121 { |
| 122 ASSERT(!m_discardMargin); | 122 ASSERT(!m_discardMargin); |
| 123 if (p > m_positiveMargin) | 123 if (p > m_positiveMargin) |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 284 |
| 285 if (!relayoutChildren && simplifiedLayout()) | 285 if (!relayoutChildren && simplifiedLayout()) |
| 286 return; | 286 return; |
| 287 | 287 |
| 288 LayoutAnalyzer::BlockScope analyzer(*this); | 288 LayoutAnalyzer::BlockScope analyzer(*this); |
| 289 SubtreeLayoutScope layoutScope(*this); | 289 SubtreeLayoutScope layoutScope(*this); |
| 290 | 290 |
| 291 // Multiple passes might be required for column based layout. | 291 // Multiple passes might be required for column based layout. |
| 292 // The number of passes could be as high as the number of columns. | 292 // The number of passes could be as high as the number of columns. |
| 293 bool done = false; | 293 bool done = false; |
| 294 LayoutUnit pageLogicalHeight = 0; | 294 LayoutUnit pageLogicalHeight; |
| 295 while (!done) | 295 while (!done) |
| 296 done = layoutBlockFlow(relayoutChildren, pageLogicalHeight, layoutScope)
; | 296 done = layoutBlockFlow(relayoutChildren, pageLogicalHeight, layoutScope)
; |
| 297 | 297 |
| 298 LayoutView* layoutView = view(); | 298 LayoutView* layoutView = view(); |
| 299 if (layoutView->layoutState()->pageLogicalHeight()) | 299 if (layoutView->layoutState()->pageLogicalHeight()) |
| 300 setPageLogicalOffset(layoutView->layoutState()->pageLogicalOffset(*this,
logicalTop())); | 300 setPageLogicalOffset(layoutView->layoutState()->pageLogicalOffset(*this,
logicalTop())); |
| 301 | 301 |
| 302 updateLayerTransformAfterLayout(); | 302 updateLayerTransformAfterLayout(); |
| 303 | 303 |
| 304 // Update our scroll information if we're overflow:auto/scroll/hidden now th
at we know if | 304 // Update our scroll information if we're overflow:auto/scroll/hidden now th
at we know if |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 setHasMarginBeforeQuirk(style()->hasMarginBeforeQuirk()); | 353 setHasMarginBeforeQuirk(style()->hasMarginBeforeQuirk()); |
| 354 setHasMarginAfterQuirk(style()->hasMarginAfterQuirk()); | 354 setHasMarginAfterQuirk(style()->hasMarginAfterQuirk()); |
| 355 setPaginationStrutPropagatedFromChild(LayoutUnit()); | 355 setPaginationStrutPropagatedFromChild(LayoutUnit()); |
| 356 } | 356 } |
| 357 | 357 |
| 358 LayoutUnit beforeEdge = borderBefore() + paddingBefore(); | 358 LayoutUnit beforeEdge = borderBefore() + paddingBefore(); |
| 359 LayoutUnit afterEdge = borderAfter() + paddingAfter() + scrollbarLogicalHeig
ht(); | 359 LayoutUnit afterEdge = borderAfter() + paddingAfter() + scrollbarLogicalHeig
ht(); |
| 360 LayoutUnit previousHeight = logicalHeight(); | 360 LayoutUnit previousHeight = logicalHeight(); |
| 361 setLogicalHeight(beforeEdge); | 361 setLogicalHeight(beforeEdge); |
| 362 | 362 |
| 363 m_paintInvalidationLogicalTop = 0; | 363 m_paintInvalidationLogicalTop = LayoutUnit(); |
| 364 m_paintInvalidationLogicalBottom = 0; | 364 m_paintInvalidationLogicalBottom = LayoutUnit(); |
| 365 if (!firstChild() && !isAnonymousBlock()) | 365 if (!firstChild() && !isAnonymousBlock()) |
| 366 setChildrenInline(true); | 366 setChildrenInline(true); |
| 367 | 367 |
| 368 TextAutosizer::LayoutScope textAutosizerLayoutScope(this); | 368 TextAutosizer::LayoutScope textAutosizerLayoutScope(this); |
| 369 | 369 |
| 370 // Reset the flag here instead of in layoutInlineChildren() in case that | 370 // Reset the flag here instead of in layoutInlineChildren() in case that |
| 371 // all inline children are removed from this block. | 371 // all inline children are removed from this block. |
| 372 setContainsInlineWithOutlineAndContinuation(false); | 372 setContainsInlineWithOutlineAndContinuation(false); |
| 373 if (childrenInline()) | 373 if (childrenInline()) |
| 374 layoutInlineChildren(relayoutChildren, m_paintInvalidationLogicalTop, m_
paintInvalidationLogicalBottom, afterEdge); | 374 layoutInlineChildren(relayoutChildren, m_paintInvalidationLogicalTop, m_
paintInvalidationLogicalBottom, afterEdge); |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 // attempt to better satisfy the orphans requirement. | 738 // attempt to better satisfy the orphans requirement. |
| 739 wantsStrutOnBlock = true; | 739 wantsStrutOnBlock = true; |
| 740 } else if (lineBox == block.firstRootBox() && lineLogicalOffset == block.bor
derAndPaddingBefore()) { | 740 } else if (lineBox == block.firstRootBox() && lineLogicalOffset == block.bor
derAndPaddingBefore()) { |
| 741 // This is the first line in the block. We can take the whole block with
us to the next page | 741 // This is the first line in the block. We can take the whole block with
us to the next page |
| 742 // or column, rather than keeping a content-less portion of it in the pr
evious one. Only do | 742 // or column, rather than keeping a content-less portion of it in the pr
evious one. Only do |
| 743 // this if the line is flush with the content edge of the block, though.
If it isn't, it | 743 // this if the line is flush with the content edge of the block, though.
If it isn't, it |
| 744 // means that the line was pushed downwards by preceding floats that did
n't fit beside the | 744 // means that the line was pushed downwards by preceding floats that did
n't fit beside the |
| 745 // line, and we don't want to move all that, since it has already been e
stablished that it | 745 // line, and we don't want to move all that, since it has already been e
stablished that it |
| 746 // fits nicely where it is. | 746 // fits nicely where it is. |
| 747 LayoutUnit lineHeight = lineBox.lineBottomWithLeading() - lineBox.lineTo
pWithLeading(); | 747 LayoutUnit lineHeight = lineBox.lineBottomWithLeading() - lineBox.lineTo
pWithLeading(); |
| 748 LayoutUnit totalLogicalHeight = lineHeight + std::max<LayoutUnit>(0, lin
eLogicalOffset); | 748 LayoutUnit totalLogicalHeight = lineHeight + lineLogicalOffset.clampNega
tiveToZero(); |
| 749 // It's rather pointless to break before the block if the current line i
sn't going to | 749 // It's rather pointless to break before the block if the current line i
sn't going to |
| 750 // fit in the same column or page, so check that as well. | 750 // fit in the same column or page, so check that as well. |
| 751 if (totalLogicalHeight <= pageLogicalHeight) | 751 if (totalLogicalHeight <= pageLogicalHeight) |
| 752 wantsStrutOnBlock = true; | 752 wantsStrutOnBlock = true; |
| 753 } | 753 } |
| 754 return wantsStrutOnBlock && block.allowsPaginationStrut(); | 754 return wantsStrutOnBlock && block.allowsPaginationStrut(); |
| 755 } | 755 } |
| 756 | 756 |
| 757 void LayoutBlockFlow::adjustLinePositionForPagination(RootInlineBox& lineBox, La
youtUnit& delta) | 757 void LayoutBlockFlow::adjustLinePositionForPagination(RootInlineBox& lineBox, La
youtUnit& delta) |
| 758 { | 758 { |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 LayoutUnit logicalTopOffset = logicalTop(); | 926 LayoutUnit logicalTopOffset = logicalTop(); |
| 927 bool parentHasIntrudingFloats = !parentHasFloats && (!prev || toLayoutBlockF
low(prev)->isSelfCollapsingBlock()) && parentBlockFlow->lowestFloatLogicalBottom
() > logicalTopOffset; | 927 bool parentHasIntrudingFloats = !parentHasFloats && (!prev || toLayoutBlockF
low(prev)->isSelfCollapsingBlock()) && parentBlockFlow->lowestFloatLogicalBottom
() > logicalTopOffset; |
| 928 if (parentHasFloats || parentHasIntrudingFloats) | 928 if (parentHasFloats || parentHasIntrudingFloats) |
| 929 addIntrudingFloats(parentBlockFlow, parentBlockFlow->logicalLeftOffsetFo
rContent(), logicalTopOffset); | 929 addIntrudingFloats(parentBlockFlow, parentBlockFlow->logicalLeftOffsetFo
rContent(), logicalTopOffset); |
| 930 | 930 |
| 931 // Add overhanging floats from the previous LayoutBlockFlow, but only if it
has a float that intrudes into our space. | 931 // Add overhanging floats from the previous LayoutBlockFlow, but only if it
has a float that intrudes into our space. |
| 932 if (prev) { | 932 if (prev) { |
| 933 LayoutBlockFlow* blockFlow = toLayoutBlockFlow(prev); | 933 LayoutBlockFlow* blockFlow = toLayoutBlockFlow(prev); |
| 934 logicalTopOffset -= blockFlow->logicalTop(); | 934 logicalTopOffset -= blockFlow->logicalTop(); |
| 935 if (blockFlow->lowestFloatLogicalBottom() > logicalTopOffset) | 935 if (blockFlow->lowestFloatLogicalBottom() > logicalTopOffset) |
| 936 addIntrudingFloats(blockFlow, 0, logicalTopOffset); | 936 addIntrudingFloats(blockFlow, LayoutUnit(), logicalTopOffset); |
| 937 } | 937 } |
| 938 | 938 |
| 939 if (childrenInline()) { | 939 if (childrenInline()) { |
| 940 LayoutUnit changeLogicalTop = LayoutUnit::max(); | 940 LayoutUnit changeLogicalTop = LayoutUnit::max(); |
| 941 LayoutUnit changeLogicalBottom = LayoutUnit::min(); | 941 LayoutUnit changeLogicalBottom = LayoutUnit::min(); |
| 942 if (m_floatingObjects) { | 942 if (m_floatingObjects) { |
| 943 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(
); | 943 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(
); |
| 944 FloatingObjectSetIterator end = floatingObjectSet.end(); | 944 FloatingObjectSetIterator end = floatingObjectSet.end(); |
| 945 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it !=
end; ++it) { | 945 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it !=
end; ++it) { |
| 946 const FloatingObject& floatingObject = *it->get(); | 946 const FloatingObject& floatingObject = *it->get(); |
| 947 FloatingObject* oldFloatingObject = floatMap.get(floatingObject.
layoutObject()); | 947 FloatingObject* oldFloatingObject = floatMap.get(floatingObject.
layoutObject()); |
| 948 LayoutUnit logicalBottom = logicalBottomForFloat(floatingObject)
; | 948 LayoutUnit logicalBottom = logicalBottomForFloat(floatingObject)
; |
| 949 if (oldFloatingObject) { | 949 if (oldFloatingObject) { |
| 950 LayoutUnit oldLogicalBottom = logicalBottomForFloat(*oldFloa
tingObject); | 950 LayoutUnit oldLogicalBottom = logicalBottomForFloat(*oldFloa
tingObject); |
| 951 if (logicalWidthForFloat(floatingObject) != logicalWidthForF
loat(*oldFloatingObject) || logicalLeftForFloat(floatingObject) != logicalLeftFo
rFloat(*oldFloatingObject)) { | 951 if (logicalWidthForFloat(floatingObject) != logicalWidthForF
loat(*oldFloatingObject) || logicalLeftForFloat(floatingObject) != logicalLeftFo
rFloat(*oldFloatingObject)) { |
| 952 changeLogicalTop = 0; | 952 changeLogicalTop = LayoutUnit(); |
| 953 changeLogicalBottom = std::max(changeLogicalBottom, std:
:max(logicalBottom, oldLogicalBottom)); | 953 changeLogicalBottom = std::max(changeLogicalBottom, std:
:max(logicalBottom, oldLogicalBottom)); |
| 954 } else { | 954 } else { |
| 955 if (logicalBottom != oldLogicalBottom) { | 955 if (logicalBottom != oldLogicalBottom) { |
| 956 changeLogicalTop = std::min(changeLogicalTop, std::m
in(logicalBottom, oldLogicalBottom)); | 956 changeLogicalTop = std::min(changeLogicalTop, std::m
in(logicalBottom, oldLogicalBottom)); |
| 957 changeLogicalBottom = std::max(changeLogicalBottom,
std::max(logicalBottom, oldLogicalBottom)); | 957 changeLogicalBottom = std::max(changeLogicalBottom,
std::max(logicalBottom, oldLogicalBottom)); |
| 958 } | 958 } |
| 959 LayoutUnit logicalTop = logicalTopForFloat(floatingObjec
t); | 959 LayoutUnit logicalTop = logicalTopForFloat(floatingObjec
t); |
| 960 LayoutUnit oldLogicalTop = logicalTopForFloat(*oldFloati
ngObject); | 960 LayoutUnit oldLogicalTop = logicalTopForFloat(*oldFloati
ngObject); |
| 961 if (logicalTop != oldLogicalTop) { | 961 if (logicalTop != oldLogicalTop) { |
| 962 changeLogicalTop = std::min(changeLogicalTop, std::m
in(logicalTop, oldLogicalTop)); | 962 changeLogicalTop = std::min(changeLogicalTop, std::m
in(logicalTop, oldLogicalTop)); |
| 963 changeLogicalBottom = std::max(changeLogicalBottom,
std::max(logicalTop, oldLogicalTop)); | 963 changeLogicalBottom = std::max(changeLogicalBottom,
std::max(logicalTop, oldLogicalTop)); |
| 964 } | 964 } |
| 965 } | 965 } |
| 966 | 966 |
| 967 if (oldFloatingObject->originatingLine() && !selfNeedsLayout
()) { | 967 if (oldFloatingObject->originatingLine() && !selfNeedsLayout
()) { |
| 968 ASSERT(oldFloatingObject->originatingLine()->lineLayoutI
tem().isEqual(this)); | 968 ASSERT(oldFloatingObject->originatingLine()->lineLayoutI
tem().isEqual(this)); |
| 969 oldFloatingObject->originatingLine()->markDirty(); | 969 oldFloatingObject->originatingLine()->markDirty(); |
| 970 } | 970 } |
| 971 | 971 |
| 972 floatMap.remove(floatingObject.layoutObject()); | 972 floatMap.remove(floatingObject.layoutObject()); |
| 973 } else { | 973 } else { |
| 974 changeLogicalTop = 0; | 974 changeLogicalTop = LayoutUnit(); |
| 975 changeLogicalBottom = std::max(changeLogicalBottom, logicalB
ottom); | 975 changeLogicalBottom = std::max(changeLogicalBottom, logicalB
ottom); |
| 976 } | 976 } |
| 977 } | 977 } |
| 978 } | 978 } |
| 979 | 979 |
| 980 LayoutBoxToFloatInfoMap::iterator end = floatMap.end(); | 980 LayoutBoxToFloatInfoMap::iterator end = floatMap.end(); |
| 981 for (LayoutBoxToFloatInfoMap::iterator it = floatMap.begin(); it != end;
++it) { | 981 for (LayoutBoxToFloatInfoMap::iterator it = floatMap.begin(); it != end;
++it) { |
| 982 OwnPtr<FloatingObject>& floatingObject = it->value; | 982 OwnPtr<FloatingObject>& floatingObject = it->value; |
| 983 if (!floatingObject->isDescendant()) { | 983 if (!floatingObject->isDescendant()) { |
| 984 changeLogicalTop = 0; | 984 changeLogicalTop = LayoutUnit(); |
| 985 changeLogicalBottom = std::max(changeLogicalBottom, logicalBotto
mForFloat(*floatingObject)); | 985 changeLogicalBottom = std::max(changeLogicalBottom, logicalBotto
mForFloat(*floatingObject)); |
| 986 } | 986 } |
| 987 } | 987 } |
| 988 | 988 |
| 989 markLinesDirtyInBlockRange(changeLogicalTop, changeLogicalBottom); | 989 markLinesDirtyInBlockRange(changeLogicalTop, changeLogicalBottom); |
| 990 } else if (!oldIntrudingFloatSet.isEmpty()) { | 990 } else if (!oldIntrudingFloatSet.isEmpty()) { |
| 991 // If there are previously intruding floats that no longer intrude, then
children with floats | 991 // If there are previously intruding floats that no longer intrude, then
children with floats |
| 992 // should also get layout because they might need their floating object
lists cleared. | 992 // should also get layout because they might need their floating object
lists cleared. |
| 993 if (m_floatingObjects->set().size() < oldIntrudingFloatSet.size()) { | 993 if (m_floatingObjects->set().size() < oldIntrudingFloatSet.size()) { |
| 994 markAllDescendantsWithFloatsForLayout(); | 994 markAllDescendantsWithFloatsForLayout(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1008 dirtyForLayoutFromPercentageHeightDescendants(layoutScope); | 1008 dirtyForLayoutFromPercentageHeightDescendants(layoutScope); |
| 1009 | 1009 |
| 1010 // The margin struct caches all our current margin collapsing state. The com
pact struct caches state when we encounter compacts, | 1010 // The margin struct caches all our current margin collapsing state. The com
pact struct caches state when we encounter compacts, |
| 1011 MarginInfo marginInfo(this, beforeEdge, afterEdge); | 1011 MarginInfo marginInfo(this, beforeEdge, afterEdge); |
| 1012 | 1012 |
| 1013 // Fieldsets need to find their legend and position it inside the border of
the object. | 1013 // Fieldsets need to find their legend and position it inside the border of
the object. |
| 1014 // The legend then gets skipped during normal layout. The same is true for r
uby text. | 1014 // The legend then gets skipped during normal layout. The same is true for r
uby text. |
| 1015 // It doesn't get included in the normal layout process but is instead skipp
ed. | 1015 // It doesn't get included in the normal layout process but is instead skipp
ed. |
| 1016 LayoutObject* childToExclude = layoutSpecialExcludedChild(relayoutChildren,
layoutScope); | 1016 LayoutObject* childToExclude = layoutSpecialExcludedChild(relayoutChildren,
layoutScope); |
| 1017 | 1017 |
| 1018 LayoutUnit previousFloatLogicalBottom = 0; | 1018 LayoutUnit previousFloatLogicalBottom; |
| 1019 | 1019 |
| 1020 LayoutBox* next = firstChildBox(); | 1020 LayoutBox* next = firstChildBox(); |
| 1021 LayoutBox* lastNormalFlowChild = nullptr; | 1021 LayoutBox* lastNormalFlowChild = nullptr; |
| 1022 | 1022 |
| 1023 while (next) { | 1023 while (next) { |
| 1024 LayoutBox* child = next; | 1024 LayoutBox* child = next; |
| 1025 next = child->nextSiblingBox(); | 1025 next = child->nextSiblingBox(); |
| 1026 | 1026 |
| 1027 child->setMayNeedPaintInvalidation(); | 1027 child->setMayNeedPaintInvalidation(); |
| 1028 | 1028 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 m_quirkContainer = blockFlow->isTableCell() || blockFlow->isBody(); | 1091 m_quirkContainer = blockFlow->isTableCell() || blockFlow->isBody(); |
| 1092 | 1092 |
| 1093 m_discardMargin = m_canCollapseMarginBeforeWithChildren && blockFlow->mustDi
scardMarginBefore(); | 1093 m_discardMargin = m_canCollapseMarginBeforeWithChildren && blockFlow->mustDi
scardMarginBefore(); |
| 1094 | 1094 |
| 1095 m_positiveMargin = (m_canCollapseMarginBeforeWithChildren && !blockFlow->mus
tDiscardMarginBefore()) ? blockFlow->maxPositiveMarginBefore() : LayoutUnit(); | 1095 m_positiveMargin = (m_canCollapseMarginBeforeWithChildren && !blockFlow->mus
tDiscardMarginBefore()) ? blockFlow->maxPositiveMarginBefore() : LayoutUnit(); |
| 1096 m_negativeMargin = (m_canCollapseMarginBeforeWithChildren && !blockFlow->mus
tDiscardMarginBefore()) ? blockFlow->maxNegativeMarginBefore() : LayoutUnit(); | 1096 m_negativeMargin = (m_canCollapseMarginBeforeWithChildren && !blockFlow->mus
tDiscardMarginBefore()) ? blockFlow->maxNegativeMarginBefore() : LayoutUnit(); |
| 1097 } | 1097 } |
| 1098 | 1098 |
| 1099 LayoutBlockFlow::MarginValues LayoutBlockFlow::marginValuesForChild(LayoutBox& c
hild) const | 1099 LayoutBlockFlow::MarginValues LayoutBlockFlow::marginValuesForChild(LayoutBox& c
hild) const |
| 1100 { | 1100 { |
| 1101 LayoutUnit childBeforePositive = 0; | 1101 LayoutUnit childBeforePositive; |
| 1102 LayoutUnit childBeforeNegative = 0; | 1102 LayoutUnit childBeforeNegative; |
| 1103 LayoutUnit childAfterPositive = 0; | 1103 LayoutUnit childAfterPositive; |
| 1104 LayoutUnit childAfterNegative = 0; | 1104 LayoutUnit childAfterNegative; |
| 1105 | 1105 |
| 1106 LayoutUnit beforeMargin = 0; | 1106 LayoutUnit beforeMargin; |
| 1107 LayoutUnit afterMargin = 0; | 1107 LayoutUnit afterMargin; |
| 1108 | 1108 |
| 1109 LayoutBlockFlow* childLayoutBlockFlow = child.isLayoutBlockFlow() ? toLayout
BlockFlow(&child) : 0; | 1109 LayoutBlockFlow* childLayoutBlockFlow = child.isLayoutBlockFlow() ? toLayout
BlockFlow(&child) : 0; |
| 1110 | 1110 |
| 1111 // If the child has the same directionality as we do, then we can just retur
n its | 1111 // If the child has the same directionality as we do, then we can just retur
n its |
| 1112 // margins in the same direction. | 1112 // margins in the same direction. |
| 1113 if (!child.isWritingModeRoot()) { | 1113 if (!child.isWritingModeRoot()) { |
| 1114 if (childLayoutBlockFlow) { | 1114 if (childLayoutBlockFlow) { |
| 1115 childBeforePositive = childLayoutBlockFlow->maxPositiveMarginBefore(
); | 1115 childBeforePositive = childLayoutBlockFlow->maxPositiveMarginBefore(
); |
| 1116 childBeforeNegative = childLayoutBlockFlow->maxNegativeMarginBefore(
); | 1116 childBeforeNegative = childLayoutBlockFlow->maxNegativeMarginBefore(
); |
| 1117 childAfterPositive = childLayoutBlockFlow->maxPositiveMarginAfter(); | 1117 childAfterPositive = childLayoutBlockFlow->maxPositiveMarginAfter(); |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1419 { | 1419 { |
| 1420 // Give up if in quirks mode and we're a body/table cell and the top margin
of the child box is quirky. | 1420 // Give up if in quirks mode and we're a body/table cell and the top margin
of the child box is quirky. |
| 1421 // Give up if the child specified -webkit-margin-collapse: separate that pre
vents collapsing. | 1421 // Give up if the child specified -webkit-margin-collapse: separate that pre
vents collapsing. |
| 1422 // FIXME: Use writing mode independent accessor for marginBeforeCollapse. | 1422 // FIXME: Use writing mode independent accessor for marginBeforeCollapse. |
| 1423 if ((document().inQuirksMode() && hasMarginBeforeQuirk(&child) && (isTableCe
ll() || isBody())) || child.style()->marginBeforeCollapse() == MSEPARATE) | 1423 if ((document().inQuirksMode() && hasMarginBeforeQuirk(&child) && (isTableCe
ll() || isBody())) || child.style()->marginBeforeCollapse() == MSEPARATE) |
| 1424 return; | 1424 return; |
| 1425 | 1425 |
| 1426 // The margins are discarded by a child that specified -webkit-margin-collap
se: discard. | 1426 // The margins are discarded by a child that specified -webkit-margin-collap
se: discard. |
| 1427 // FIXME: Use writing mode independent accessor for marginBeforeCollapse. | 1427 // FIXME: Use writing mode independent accessor for marginBeforeCollapse. |
| 1428 if (child.style()->marginBeforeCollapse() == MDISCARD) { | 1428 if (child.style()->marginBeforeCollapse() == MDISCARD) { |
| 1429 positiveMarginBefore = 0; | 1429 positiveMarginBefore = LayoutUnit(); |
| 1430 negativeMarginBefore = 0; | 1430 negativeMarginBefore = LayoutUnit(); |
| 1431 discardMarginBefore = true; | 1431 discardMarginBefore = true; |
| 1432 return; | 1432 return; |
| 1433 } | 1433 } |
| 1434 | 1434 |
| 1435 LayoutUnit beforeChildMargin = marginBeforeForChild(child); | 1435 LayoutUnit beforeChildMargin = marginBeforeForChild(child); |
| 1436 positiveMarginBefore = std::max(positiveMarginBefore, beforeChildMargin); | 1436 positiveMarginBefore = std::max(positiveMarginBefore, beforeChildMargin); |
| 1437 negativeMarginBefore = std::max(negativeMarginBefore, -beforeChildMargin); | 1437 negativeMarginBefore = std::max(negativeMarginBefore, -beforeChildMargin); |
| 1438 | 1438 |
| 1439 if (!child.isLayoutBlockFlow()) | 1439 if (!child.isLayoutBlockFlow()) |
| 1440 return; | 1440 return; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1475 // Collapse the margin of the grandchild box with our own to produce an esti
mate. | 1475 // Collapse the margin of the grandchild box with our own to produce an esti
mate. |
| 1476 childBlockFlow->marginBeforeEstimateForChild(*grandchildBox, positiveMarginB
efore, negativeMarginBefore, discardMarginBefore); | 1476 childBlockFlow->marginBeforeEstimateForChild(*grandchildBox, positiveMarginB
efore, negativeMarginBefore, discardMarginBefore); |
| 1477 } | 1477 } |
| 1478 | 1478 |
| 1479 LayoutUnit LayoutBlockFlow::estimateLogicalTopPosition(LayoutBox& child, const M
arginInfo& marginInfo, LayoutUnit& estimateWithoutPagination) | 1479 LayoutUnit LayoutBlockFlow::estimateLogicalTopPosition(LayoutBox& child, const M
arginInfo& marginInfo, LayoutUnit& estimateWithoutPagination) |
| 1480 { | 1480 { |
| 1481 // FIXME: We need to eliminate the estimation of vertical position, because
when it's wrong we sometimes trigger a pathological | 1481 // FIXME: We need to eliminate the estimation of vertical position, because
when it's wrong we sometimes trigger a pathological |
| 1482 // relayout if there are intruding floats. | 1482 // relayout if there are intruding floats. |
| 1483 LayoutUnit logicalTopEstimate = logicalHeight(); | 1483 LayoutUnit logicalTopEstimate = logicalHeight(); |
| 1484 if (!marginInfo.canCollapseWithMarginBefore()) { | 1484 if (!marginInfo.canCollapseWithMarginBefore()) { |
| 1485 LayoutUnit positiveMarginBefore = 0; | 1485 LayoutUnit positiveMarginBefore; |
| 1486 LayoutUnit negativeMarginBefore = 0; | 1486 LayoutUnit negativeMarginBefore; |
| 1487 bool discardMarginBefore = false; | 1487 bool discardMarginBefore = false; |
| 1488 if (child.selfNeedsLayout()) { | 1488 if (child.selfNeedsLayout()) { |
| 1489 // Try to do a basic estimation of how the collapse is going to go. | 1489 // Try to do a basic estimation of how the collapse is going to go. |
| 1490 marginBeforeEstimateForChild(child, positiveMarginBefore, negativeMa
rginBefore, discardMarginBefore); | 1490 marginBeforeEstimateForChild(child, positiveMarginBefore, negativeMa
rginBefore, discardMarginBefore); |
| 1491 } else { | 1491 } else { |
| 1492 // Use the cached collapsed margin values from a previous layout. Mo
st of the time they | 1492 // Use the cached collapsed margin values from a previous layout. Mo
st of the time they |
| 1493 // will be right. | 1493 // will be right. |
| 1494 LayoutBlockFlow::MarginValues marginValues = marginValuesForChild(ch
ild); | 1494 LayoutBlockFlow::MarginValues marginValues = marginValuesForChild(ch
ild); |
| 1495 positiveMarginBefore = std::max(positiveMarginBefore, marginValues.p
ositiveMarginBefore()); | 1495 positiveMarginBefore = std::max(positiveMarginBefore, marginValues.p
ositiveMarginBefore()); |
| 1496 negativeMarginBefore = std::max(negativeMarginBefore, marginValues.n
egativeMarginBefore()); | 1496 negativeMarginBefore = std::max(negativeMarginBefore, marginValues.n
egativeMarginBefore()); |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1823 } | 1823 } |
| 1824 | 1824 |
| 1825 LayoutUnit LayoutBlockFlow::getClearDelta(LayoutBox* child, LayoutUnit logicalTo
p) | 1825 LayoutUnit LayoutBlockFlow::getClearDelta(LayoutBox* child, LayoutUnit logicalTo
p) |
| 1826 { | 1826 { |
| 1827 // There is no need to compute clearance if we have no floats. | 1827 // There is no need to compute clearance if we have no floats. |
| 1828 if (!containsFloats()) | 1828 if (!containsFloats()) |
| 1829 return LayoutUnit(); | 1829 return LayoutUnit(); |
| 1830 | 1830 |
| 1831 // At least one float is present. We need to perform the clearance computati
on. | 1831 // At least one float is present. We need to perform the clearance computati
on. |
| 1832 bool clearSet = child->style()->clear() != CNONE; | 1832 bool clearSet = child->style()->clear() != CNONE; |
| 1833 LayoutUnit logicalBottom = 0; | 1833 LayoutUnit logicalBottom; |
| 1834 switch (child->style()->clear()) { | 1834 switch (child->style()->clear()) { |
| 1835 case CNONE: | 1835 case CNONE: |
| 1836 break; | 1836 break; |
| 1837 case CLEFT: | 1837 case CLEFT: |
| 1838 logicalBottom = lowestFloatLogicalBottom(FloatingObject::FloatLeft); | 1838 logicalBottom = lowestFloatLogicalBottom(FloatingObject::FloatLeft); |
| 1839 break; | 1839 break; |
| 1840 case CRIGHT: | 1840 case CRIGHT: |
| 1841 logicalBottom = lowestFloatLogicalBottom(FloatingObject::FloatRight); | 1841 logicalBottom = lowestFloatLogicalBottom(FloatingObject::FloatRight); |
| 1842 break; | 1842 break; |
| 1843 case CBOTH: | 1843 case CBOTH: |
| 1844 logicalBottom = lowestFloatLogicalBottom(); | 1844 logicalBottom = lowestFloatLogicalBottom(); |
| 1845 break; | 1845 break; |
| 1846 } | 1846 } |
| 1847 | 1847 |
| 1848 // We also clear floats if we are too big to sit on the same line as a float
(and wish to avoid floats by default). | 1848 // We also clear floats if we are too big to sit on the same line as a float
(and wish to avoid floats by default). |
| 1849 LayoutUnit result = clearSet ? std::max<LayoutUnit>(0, logicalBottom - logic
alTop) : LayoutUnit(); | 1849 LayoutUnit result = clearSet ? (logicalBottom - logicalTop).clampNegativeToZ
ero() : LayoutUnit(); |
| 1850 if (!result && child->avoidsFloats()) { | 1850 if (!result && child->avoidsFloats()) { |
| 1851 LayoutUnit newLogicalTop = logicalTop; | 1851 LayoutUnit newLogicalTop = logicalTop; |
| 1852 LayoutRect borderBox = child->borderBoxRect(); | 1852 LayoutRect borderBox = child->borderBoxRect(); |
| 1853 LayoutUnit childLogicalWidthAtOldLogicalTopOffset = isHorizontalWritingM
ode() ? borderBox.width() : borderBox.height(); | 1853 LayoutUnit childLogicalWidthAtOldLogicalTopOffset = isHorizontalWritingM
ode() ? borderBox.width() : borderBox.height(); |
| 1854 while (true) { | 1854 while (true) { |
| 1855 LayoutUnit availableLogicalWidthAtNewLogicalTopOffset = availableLog
icalWidthForLine(newLogicalTop, DoNotIndentText, logicalHeightForChild(*child)); | 1855 LayoutUnit availableLogicalWidthAtNewLogicalTopOffset = availableLog
icalWidthForLine(newLogicalTop, DoNotIndentText, logicalHeightForChild(*child)); |
| 1856 if (availableLogicalWidthAtNewLogicalTopOffset == availableLogicalWi
dthForContent()) | 1856 if (availableLogicalWidthAtNewLogicalTopOffset == availableLogicalWi
dthForContent()) |
| 1857 return newLogicalTop - logicalTop; | 1857 return newLogicalTop - logicalTop; |
| 1858 | 1858 |
| 1859 LogicalExtentComputedValues computedValues; | 1859 LogicalExtentComputedValues computedValues; |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2087 // Make sure the rect is still non-empty after intersecting for overflow abo
ve | 2087 // Make sure the rect is still non-empty after intersecting for overflow abo
ve |
| 2088 if (!paintInvalidationRect.isEmpty()) { | 2088 if (!paintInvalidationRect.isEmpty()) { |
| 2089 // Hits in media/event-attributes.html | 2089 // Hits in media/event-attributes.html |
| 2090 DisableCompositingQueryAsserts disabler; | 2090 DisableCompositingQueryAsserts disabler; |
| 2091 | 2091 |
| 2092 invalidatePaintRectangle(paintInvalidationRect); // We need to do a part
ial paint invalidation of our content. | 2092 invalidatePaintRectangle(paintInvalidationRect); // We need to do a part
ial paint invalidation of our content. |
| 2093 if (hasReflection()) | 2093 if (hasReflection()) |
| 2094 invalidatePaintRectangle(reflectedRect(paintInvalidationRect)); | 2094 invalidatePaintRectangle(reflectedRect(paintInvalidationRect)); |
| 2095 } | 2095 } |
| 2096 | 2096 |
| 2097 m_paintInvalidationLogicalTop = 0; | 2097 m_paintInvalidationLogicalTop = LayoutUnit(); |
| 2098 m_paintInvalidationLogicalBottom = 0; | 2098 m_paintInvalidationLogicalBottom = LayoutUnit(); |
| 2099 } | 2099 } |
| 2100 | 2100 |
| 2101 void LayoutBlockFlow::paintFloats(const PaintInfo& paintInfo, const LayoutPoint&
paintOffset) const | 2101 void LayoutBlockFlow::paintFloats(const PaintInfo& paintInfo, const LayoutPoint&
paintOffset) const |
| 2102 { | 2102 { |
| 2103 BlockFlowPainter(*this).paintFloats(paintInfo, paintOffset); | 2103 BlockFlowPainter(*this).paintFloats(paintInfo, paintOffset); |
| 2104 } | 2104 } |
| 2105 | 2105 |
| 2106 void LayoutBlockFlow::clipOutFloatingObjects(const LayoutBlock* rootBlock, ClipS
cope& clipScope, | 2106 void LayoutBlockFlow::clipOutFloatingObjects(const LayoutBlock* rootBlock, ClipS
cope& clipScope, |
| 2107 const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRo
otBlock) const | 2107 const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRo
otBlock) const |
| 2108 { | 2108 { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2119 floatBox.move(rootBlockPhysicalPosition.x(), rootBlockPhysicalPosition.y
()); | 2119 floatBox.move(rootBlockPhysicalPosition.x(), rootBlockPhysicalPosition.y
()); |
| 2120 | 2120 |
| 2121 clipScope.clip(floatBox, SkRegion::kDifference_Op); | 2121 clipScope.clip(floatBox, SkRegion::kDifference_Op); |
| 2122 } | 2122 } |
| 2123 } | 2123 } |
| 2124 | 2124 |
| 2125 void LayoutBlockFlow::clearFloats(EClear clear) | 2125 void LayoutBlockFlow::clearFloats(EClear clear) |
| 2126 { | 2126 { |
| 2127 positionNewFloats(); | 2127 positionNewFloats(); |
| 2128 // set y position | 2128 // set y position |
| 2129 LayoutUnit newY = 0; | 2129 LayoutUnit newY; |
| 2130 switch (clear) { | 2130 switch (clear) { |
| 2131 case CLEFT: | 2131 case CLEFT: |
| 2132 newY = lowestFloatLogicalBottom(FloatingObject::FloatLeft); | 2132 newY = lowestFloatLogicalBottom(FloatingObject::FloatLeft); |
| 2133 break; | 2133 break; |
| 2134 case CRIGHT: | 2134 case CRIGHT: |
| 2135 newY = lowestFloatLogicalBottom(FloatingObject::FloatRight); | 2135 newY = lowestFloatLogicalBottom(FloatingObject::FloatRight); |
| 2136 break; | 2136 break; |
| 2137 case CBOTH: | 2137 case CBOTH: |
| 2138 newY = lowestFloatLogicalBottom(); | 2138 newY = lowestFloatLogicalBottom(); |
| 2139 default: | 2139 default: |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2214 LayoutUnit logicalRightOffset; // Constant part of right offset. | 2214 LayoutUnit logicalRightOffset; // Constant part of right offset. |
| 2215 logicalRightOffset = logicalRightOffsetForContent(); | 2215 logicalRightOffset = logicalRightOffsetForContent(); |
| 2216 | 2216 |
| 2217 LayoutUnit floatLogicalWidth = std::min(logicalWidthForFloat(floatingObject)
, logicalRightOffset - logicalLeftOffset); // The width we look for. | 2217 LayoutUnit floatLogicalWidth = std::min(logicalWidthForFloat(floatingObject)
, logicalRightOffset - logicalLeftOffset); // The width we look for. |
| 2218 | 2218 |
| 2219 LayoutUnit floatLogicalLeft; | 2219 LayoutUnit floatLogicalLeft; |
| 2220 | 2220 |
| 2221 bool insideFlowThread = flowThreadContainingBlock(); | 2221 bool insideFlowThread = flowThreadContainingBlock(); |
| 2222 | 2222 |
| 2223 if (childBox->style()->floating() == LeftFloat) { | 2223 if (childBox->style()->floating() == LeftFloat) { |
| 2224 LayoutUnit heightRemainingLeft = 1; | 2224 LayoutUnit heightRemainingLeft = LayoutUnit(1); |
| 2225 LayoutUnit heightRemainingRight = 1; | 2225 LayoutUnit heightRemainingRight = LayoutUnit(1); |
| 2226 floatLogicalLeft = logicalLeftOffsetForPositioningFloat(logicalTopOffset
, logicalLeftOffset, &heightRemainingLeft); | 2226 floatLogicalLeft = logicalLeftOffsetForPositioningFloat(logicalTopOffset
, logicalLeftOffset, &heightRemainingLeft); |
| 2227 while (logicalRightOffsetForPositioningFloat(logicalTopOffset, logicalRi
ghtOffset, &heightRemainingRight) - floatLogicalLeft < floatLogicalWidth) { | 2227 while (logicalRightOffsetForPositioningFloat(logicalTopOffset, logicalRi
ghtOffset, &heightRemainingRight) - floatLogicalLeft < floatLogicalWidth) { |
| 2228 logicalTopOffset += std::min<LayoutUnit>(heightRemainingLeft, height
RemainingRight); | 2228 logicalTopOffset += std::min<LayoutUnit>(heightRemainingLeft, height
RemainingRight); |
| 2229 floatLogicalLeft = logicalLeftOffsetForPositioningFloat(logicalTopOf
fset, logicalLeftOffset, &heightRemainingLeft); | 2229 floatLogicalLeft = logicalLeftOffsetForPositioningFloat(logicalTopOf
fset, logicalLeftOffset, &heightRemainingLeft); |
| 2230 if (insideFlowThread) { | 2230 if (insideFlowThread) { |
| 2231 // Have to re-evaluate all of our offsets, since they may have c
hanged. | 2231 // Have to re-evaluate all of our offsets, since they may have c
hanged. |
| 2232 logicalRightOffset = logicalRightOffsetForContent(); // Constant
part of right offset. | 2232 logicalRightOffset = logicalRightOffsetForContent(); // Constant
part of right offset. |
| 2233 logicalLeftOffset = logicalLeftOffsetForContent(); // Constant p
art of left offset. | 2233 logicalLeftOffset = logicalLeftOffsetForContent(); // Constant p
art of left offset. |
| 2234 floatLogicalWidth = std::min(logicalWidthForFloat(floatingObject
), logicalRightOffset - logicalLeftOffset); | 2234 floatLogicalWidth = std::min(logicalWidthForFloat(floatingObject
), logicalRightOffset - logicalLeftOffset); |
| 2235 } | 2235 } |
| 2236 } | 2236 } |
| 2237 floatLogicalLeft = std::max(logicalLeftOffset - borderAndPaddingLogicalL
eft(), floatLogicalLeft); | 2237 floatLogicalLeft = std::max(logicalLeftOffset - borderAndPaddingLogicalL
eft(), floatLogicalLeft); |
| 2238 } else { | 2238 } else { |
| 2239 LayoutUnit heightRemainingLeft = 1; | 2239 LayoutUnit heightRemainingLeft = LayoutUnit(1); |
| 2240 LayoutUnit heightRemainingRight = 1; | 2240 LayoutUnit heightRemainingRight = LayoutUnit(1); |
| 2241 floatLogicalLeft = logicalRightOffsetForPositioningFloat(logicalTopOffse
t, logicalRightOffset, &heightRemainingRight); | 2241 floatLogicalLeft = logicalRightOffsetForPositioningFloat(logicalTopOffse
t, logicalRightOffset, &heightRemainingRight); |
| 2242 while (floatLogicalLeft - logicalLeftOffsetForPositioningFloat(logicalTo
pOffset, logicalLeftOffset, &heightRemainingLeft) < floatLogicalWidth) { | 2242 while (floatLogicalLeft - logicalLeftOffsetForPositioningFloat(logicalTo
pOffset, logicalLeftOffset, &heightRemainingLeft) < floatLogicalWidth) { |
| 2243 logicalTopOffset += std::min(heightRemainingLeft, heightRemainingRig
ht); | 2243 logicalTopOffset += std::min(heightRemainingLeft, heightRemainingRig
ht); |
| 2244 floatLogicalLeft = logicalRightOffsetForPositioningFloat(logicalTopO
ffset, logicalRightOffset, &heightRemainingRight); | 2244 floatLogicalLeft = logicalRightOffsetForPositioningFloat(logicalTopO
ffset, logicalRightOffset, &heightRemainingRight); |
| 2245 if (insideFlowThread) { | 2245 if (insideFlowThread) { |
| 2246 // Have to re-evaluate all of our offsets, since they may have c
hanged. | 2246 // Have to re-evaluate all of our offsets, since they may have c
hanged. |
| 2247 logicalRightOffset = logicalRightOffsetForContent(); // Constant
part of right offset. | 2247 logicalRightOffset = logicalRightOffsetForContent(); // Constant
part of right offset. |
| 2248 logicalLeftOffset = logicalLeftOffsetForContent(); // Constant p
art of left offset. | 2248 logicalLeftOffset = logicalLeftOffsetForContent(); // Constant p
art of left offset. |
| 2249 floatLogicalWidth = std::min(logicalWidthForFloat(floatingObject
), logicalRightOffset - logicalLeftOffset); | 2249 floatLogicalWidth = std::min(logicalWidthForFloat(floatingObject
), logicalRightOffset - logicalLeftOffset); |
| 2250 } | 2250 } |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2312 } | 2312 } |
| 2313 if (floatingObject.originatingLine()) { | 2313 if (floatingObject.originatingLine()) { |
| 2314 if (!selfNeedsLayout()) { | 2314 if (!selfNeedsLayout()) { |
| 2315 ASSERT(floatingObject.originatingLine()->lineLayoutItem(
).isEqual(this)); | 2315 ASSERT(floatingObject.originatingLine()->lineLayoutItem(
).isEqual(this)); |
| 2316 floatingObject.originatingLine()->markDirty(); | 2316 floatingObject.originatingLine()->markDirty(); |
| 2317 } | 2317 } |
| 2318 #if ENABLE(ASSERT) | 2318 #if ENABLE(ASSERT) |
| 2319 floatingObject.setOriginatingLine(nullptr); | 2319 floatingObject.setOriginatingLine(nullptr); |
| 2320 #endif | 2320 #endif |
| 2321 } | 2321 } |
| 2322 markLinesDirtyInBlockRange(0, logicalBottom); | 2322 markLinesDirtyInBlockRange(LayoutUnit(), logicalBottom); |
| 2323 } | 2323 } |
| 2324 m_floatingObjects->remove(&floatingObject); | 2324 m_floatingObjects->remove(&floatingObject); |
| 2325 } | 2325 } |
| 2326 } | 2326 } |
| 2327 } | 2327 } |
| 2328 | 2328 |
| 2329 void LayoutBlockFlow::removeFloatingObjectsBelow(FloatingObject* lastFloat, int
logicalOffset) | 2329 void LayoutBlockFlow::removeFloatingObjectsBelow(FloatingObject* lastFloat, int
logicalOffset) |
| 2330 { | 2330 { |
| 2331 if (!containsFloats()) | 2331 if (!containsFloats()) |
| 2332 return; | 2332 return; |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2633 LayoutUnit LayoutBlockFlow::logicalRightFloatOffsetForLine(LayoutUnit logicalTop
, LayoutUnit fixedOffset, LayoutUnit logicalHeight) const | 2633 LayoutUnit LayoutBlockFlow::logicalRightFloatOffsetForLine(LayoutUnit logicalTop
, LayoutUnit fixedOffset, LayoutUnit logicalHeight) const |
| 2634 { | 2634 { |
| 2635 if (m_floatingObjects && m_floatingObjects->hasRightObjects()) | 2635 if (m_floatingObjects && m_floatingObjects->hasRightObjects()) |
| 2636 return m_floatingObjects->logicalRightOffset(fixedOffset, logicalTop, lo
gicalHeight); | 2636 return m_floatingObjects->logicalRightOffset(fixedOffset, logicalTop, lo
gicalHeight); |
| 2637 | 2637 |
| 2638 return fixedOffset; | 2638 return fixedOffset; |
| 2639 } | 2639 } |
| 2640 | 2640 |
| 2641 IntRect alignSelectionRectToDevicePixels(LayoutRect& rect) | 2641 IntRect alignSelectionRectToDevicePixels(LayoutRect& rect) |
| 2642 { | 2642 { |
| 2643 LayoutUnit roundedX = rect.x().round(); | 2643 LayoutUnit roundedX = LayoutUnit(rect.x().round()); |
| 2644 return IntRect(roundedX, rect.y().round(), | 2644 return IntRect(roundedX, rect.y().round(), |
| 2645 (rect.maxX() - roundedX).round(), | 2645 (rect.maxX() - roundedX).round(), |
| 2646 snapSizeToPixel(rect.height(), rect.y())); | 2646 snapSizeToPixel(rect.height(), rect.y())); |
| 2647 } | 2647 } |
| 2648 | 2648 |
| 2649 bool LayoutBlockFlow::allowsPaginationStrut() const | 2649 bool LayoutBlockFlow::allowsPaginationStrut() const |
| 2650 { | 2650 { |
| 2651 // The block needs to be contained by a LayoutBlockFlow (and not by e.g. a f
lexbox, grid, or a | 2651 // The block needs to be contained by a LayoutBlockFlow (and not by e.g. a f
lexbox, grid, or a |
| 2652 // table (the latter being the case for table cell or table caption)). The r
eason for this | 2652 // table (the latter being the case for table cell or table caption)). The r
eason for this |
| 2653 // limitation is simply that LayoutBlockFlow child layout code is the only p
lace where we pick | 2653 // limitation is simply that LayoutBlockFlow child layout code is the only p
lace where we pick |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2836 return; | 2836 return; |
| 2837 } | 2837 } |
| 2838 | 2838 |
| 2839 ASSERT(dialog->centeringMode() == HTMLDialogElement::NeedsCentering); | 2839 ASSERT(dialog->centeringMode() == HTMLDialogElement::NeedsCentering); |
| 2840 if (!canCenterDialog) { | 2840 if (!canCenterDialog) { |
| 2841 dialog->setNotCentered(); | 2841 dialog->setNotCentered(); |
| 2842 return; | 2842 return; |
| 2843 } | 2843 } |
| 2844 | 2844 |
| 2845 FrameView* frameView = document().view(); | 2845 FrameView* frameView = document().view(); |
| 2846 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr
ollOffset().height(); | 2846 LayoutUnit top = LayoutUnit((style()->position() == FixedPosition) ? 0 : fra
meView->scrollOffset().height()); |
| 2847 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height(
); | 2847 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height(
); |
| 2848 if (size().height() < visibleHeight) | 2848 if (size().height() < visibleHeight) |
| 2849 top += (visibleHeight - size().height()) / 2; | 2849 top += (visibleHeight - size().height()) / 2; |
| 2850 setY(top); | 2850 setY(top); |
| 2851 dialog->setCentered(top); | 2851 dialog->setCentered(top); |
| 2852 } | 2852 } |
| 2853 | 2853 |
| 2854 } // namespace blink | 2854 } // namespace blink |
| OLD | NEW |