| 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 27 matching lines...) Expand all Loading... |
| 38 #include "core/rendering/LayoutRepainter.h" | 38 #include "core/rendering/LayoutRepainter.h" |
| 39 #include "core/rendering/RenderFlowThread.h" | 39 #include "core/rendering/RenderFlowThread.h" |
| 40 #include "core/rendering/RenderLayer.h" | 40 #include "core/rendering/RenderLayer.h" |
| 41 #include "core/rendering/RenderMultiColumnFlowThread.h" | 41 #include "core/rendering/RenderMultiColumnFlowThread.h" |
| 42 #include "core/rendering/RenderText.h" | 42 #include "core/rendering/RenderText.h" |
| 43 #include "core/rendering/RenderView.h" | 43 #include "core/rendering/RenderView.h" |
| 44 #include "core/rendering/line/LineWidth.h" | 44 #include "core/rendering/line/LineWidth.h" |
| 45 #include "core/rendering/svg/SVGTextRunRenderingContext.h" | 45 #include "core/rendering/svg/SVGTextRunRenderingContext.h" |
| 46 #include "platform/text/BidiTextRun.h" | 46 #include "platform/text/BidiTextRun.h" |
| 47 | 47 |
| 48 using namespace std; | |
| 49 | |
| 50 namespace WebCore { | 48 namespace WebCore { |
| 51 | 49 |
| 52 bool RenderBlockFlow::s_canPropagateFloatIntoSibling = false; | 50 bool RenderBlockFlow::s_canPropagateFloatIntoSibling = false; |
| 53 | 51 |
| 54 struct SameSizeAsMarginInfo { | 52 struct SameSizeAsMarginInfo { |
| 55 uint16_t bitfields; | 53 uint16_t bitfields; |
| 56 LayoutUnit margins[2]; | 54 LayoutUnit margins[2]; |
| 57 }; | 55 }; |
| 58 | 56 |
| 59 COMPILE_ASSERT(sizeof(RenderBlockFlow::MarginValues) == sizeof(LayoutUnit[4]), M
arginValues_should_stay_small); | 57 COMPILE_ASSERT(sizeof(RenderBlockFlow::MarginValues) == sizeof(LayoutUnit[4]), M
arginValues_should_stay_small); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 // FIXME: We don't balance properly at all in the presence of forced page br
eaks. We need to understand what | 243 // FIXME: We don't balance properly at all in the presence of forced page br
eaks. We need to understand what |
| 246 // the distance between forced page breaks is so that we can avoid making th
e minimum column height too tall. | 244 // the distance between forced page breaks is so that we can avoid making th
e minimum column height too tall. |
| 247 ColumnInfo* colInfo = columnInfo(); | 245 ColumnInfo* colInfo = columnInfo(); |
| 248 LayoutUnit columnHeight = pageLogicalHeight; | 246 LayoutUnit columnHeight = pageLogicalHeight; |
| 249 const int minColumnCount = colInfo->forcedBreaks() + 1; | 247 const int minColumnCount = colInfo->forcedBreaks() + 1; |
| 250 const int desiredColumnCount = colInfo->desiredColumnCount(); | 248 const int desiredColumnCount = colInfo->desiredColumnCount(); |
| 251 if (minColumnCount >= desiredColumnCount) { | 249 if (minColumnCount >= desiredColumnCount) { |
| 252 // The forced page breaks are in control of the balancing. Just set the
column height to the | 250 // The forced page breaks are in control of the balancing. Just set the
column height to the |
| 253 // maximum page break distance. | 251 // maximum page break distance. |
| 254 if (!pageLogicalHeight) { | 252 if (!pageLogicalHeight) { |
| 255 LayoutUnit distanceBetweenBreaks = max<LayoutUnit>(colInfo->maximumD
istanceBetweenForcedBreaks(), | 253 LayoutUnit distanceBetweenBreaks = std::max<LayoutUnit>(colInfo->max
imumDistanceBetweenForcedBreaks(), |
| 256 view()->layoutState()->pageLogicalOffset(*this, borderBefore() +
paddingBefore() + layoutOverflowLogicalBottom) - colInfo->forcedBreakOffset()); | 254 view()->layoutState()->pageLogicalOffset(*this, borderBefore() +
paddingBefore() + layoutOverflowLogicalBottom) - colInfo->forcedBreakOffset()); |
| 257 columnHeight = max(colInfo->minimumColumnHeight(), distanceBetweenBr
eaks); | 255 columnHeight = std::max(colInfo->minimumColumnHeight(), distanceBetw
eenBreaks); |
| 258 } | 256 } |
| 259 } else if (layoutOverflowLogicalBottom > boundedMultiply(pageLogicalHeight,
desiredColumnCount)) { | 257 } else if (layoutOverflowLogicalBottom > boundedMultiply(pageLogicalHeight,
desiredColumnCount)) { |
| 260 // Now that we know the intrinsic height of the columns, we have to reba
lance them. | 258 // Now that we know the intrinsic height of the columns, we have to reba
lance them. |
| 261 columnHeight = max<LayoutUnit>(colInfo->minimumColumnHeight(), ceilf(lay
outOverflowLogicalBottom.toFloat() / desiredColumnCount)); | 259 columnHeight = std::max<LayoutUnit>(colInfo->minimumColumnHeight(), ceil
f(layoutOverflowLogicalBottom.toFloat() / desiredColumnCount)); |
| 262 } | 260 } |
| 263 | 261 |
| 264 if (columnHeight && columnHeight != pageLogicalHeight) { | 262 if (columnHeight && columnHeight != pageLogicalHeight) { |
| 265 pageLogicalHeight = columnHeight; | 263 pageLogicalHeight = columnHeight; |
| 266 return true; | 264 return true; |
| 267 } | 265 } |
| 268 | 266 |
| 269 return false; | 267 return false; |
| 270 } | 268 } |
| 271 | 269 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 markDescendantsWithFloats = true; | 522 markDescendantsWithFloats = true; |
| 525 } else if (UNLIKELY(logicalTopEstimate.mightBeSaturated())) { | 523 } else if (UNLIKELY(logicalTopEstimate.mightBeSaturated())) { |
| 526 // logicalTopEstimate, returned by estimateLogicalTopPosition, might be
saturated for | 524 // logicalTopEstimate, returned by estimateLogicalTopPosition, might be
saturated for |
| 527 // very large elements. If it does the comparison with oldLogicalTop mig
ht yield a | 525 // very large elements. If it does the comparison with oldLogicalTop mig
ht yield a |
| 528 // false negative as adding and removing margins, borders etc from a sat
urated number | 526 // false negative as adding and removing margins, borders etc from a sat
urated number |
| 529 // might yield incorrect results. If this is the case always mark for la
yout. | 527 // might yield incorrect results. If this is the case always mark for la
yout. |
| 530 markDescendantsWithFloats = true; | 528 markDescendantsWithFloats = true; |
| 531 } else if (!child->avoidsFloats() || child->shrinkToAvoidFloats()) { | 529 } else if (!child->avoidsFloats() || child->shrinkToAvoidFloats()) { |
| 532 // If an element might be affected by the presence of floats, then alway
s mark it for | 530 // If an element might be affected by the presence of floats, then alway
s mark it for |
| 533 // layout. | 531 // layout. |
| 534 LayoutUnit fb = max(previousFloatLogicalBottom, lowestFloatLogicalBottom
()); | 532 LayoutUnit fb = std::max(previousFloatLogicalBottom, lowestFloatLogicalB
ottom()); |
| 535 if (fb > logicalTopEstimate) | 533 if (fb > logicalTopEstimate) |
| 536 markDescendantsWithFloats = true; | 534 markDescendantsWithFloats = true; |
| 537 } | 535 } |
| 538 | 536 |
| 539 if (childRenderBlockFlow) { | 537 if (childRenderBlockFlow) { |
| 540 if (markDescendantsWithFloats) | 538 if (markDescendantsWithFloats) |
| 541 childRenderBlockFlow->markAllDescendantsWithFloatsForLayout(); | 539 childRenderBlockFlow->markAllDescendantsWithFloatsForLayout(); |
| 542 if (!child->isWritingModeRoot()) | 540 if (!child->isWritingModeRoot()) |
| 543 previousFloatLogicalBottom = max(previousFloatLogicalBottom, oldLogi
calTop + childRenderBlockFlow->lowestFloatLogicalBottom()); | 541 previousFloatLogicalBottom = std::max(previousFloatLogicalBottom, ol
dLogicalTop + childRenderBlockFlow->lowestFloatLogicalBottom()); |
| 544 } | 542 } |
| 545 | 543 |
| 546 SubtreeLayoutScope layoutScope(*child); | 544 SubtreeLayoutScope layoutScope(*child); |
| 547 if (!child->needsLayout()) | 545 if (!child->needsLayout()) |
| 548 child->markForPaginationRelayoutIfNeeded(layoutScope); | 546 child->markForPaginationRelayoutIfNeeded(layoutScope); |
| 549 | 547 |
| 550 bool childHadLayout = child->everHadLayout(); | 548 bool childHadLayout = child->everHadLayout(); |
| 551 bool childNeededLayout = child->needsLayout(); | 549 bool childNeededLayout = child->needsLayout(); |
| 552 if (childNeededLayout) | 550 if (childNeededLayout) |
| 553 child->layout(); | 551 child->layout(); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(
); | 820 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(
); |
| 823 FloatingObjectSetIterator end = floatingObjectSet.end(); | 821 FloatingObjectSetIterator end = floatingObjectSet.end(); |
| 824 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it !=
end; ++it) { | 822 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it !=
end; ++it) { |
| 825 FloatingObject* floatingObject = it->get(); | 823 FloatingObject* floatingObject = it->get(); |
| 826 FloatingObject* oldFloatingObject = floatMap.get(floatingObject-
>renderer()); | 824 FloatingObject* oldFloatingObject = floatMap.get(floatingObject-
>renderer()); |
| 827 LayoutUnit logicalBottom = logicalBottomForFloat(floatingObject)
; | 825 LayoutUnit logicalBottom = logicalBottomForFloat(floatingObject)
; |
| 828 if (oldFloatingObject) { | 826 if (oldFloatingObject) { |
| 829 LayoutUnit oldLogicalBottom = logicalBottomForFloat(oldFloat
ingObject); | 827 LayoutUnit oldLogicalBottom = logicalBottomForFloat(oldFloat
ingObject); |
| 830 if (logicalWidthForFloat(floatingObject) != logicalWidthForF
loat(oldFloatingObject) || logicalLeftForFloat(floatingObject) != logicalLeftFor
Float(oldFloatingObject)) { | 828 if (logicalWidthForFloat(floatingObject) != logicalWidthForF
loat(oldFloatingObject) || logicalLeftForFloat(floatingObject) != logicalLeftFor
Float(oldFloatingObject)) { |
| 831 changeLogicalTop = 0; | 829 changeLogicalTop = 0; |
| 832 changeLogicalBottom = max(changeLogicalBottom, max(logic
alBottom, oldLogicalBottom)); | 830 changeLogicalBottom = std::max(changeLogicalBottom, std:
:max(logicalBottom, oldLogicalBottom)); |
| 833 } else { | 831 } else { |
| 834 if (logicalBottom != oldLogicalBottom) { | 832 if (logicalBottom != oldLogicalBottom) { |
| 835 changeLogicalTop = min(changeLogicalTop, min(logical
Bottom, oldLogicalBottom)); | 833 changeLogicalTop = std::min(changeLogicalTop, std::m
in(logicalBottom, oldLogicalBottom)); |
| 836 changeLogicalBottom = max(changeLogicalBottom, max(l
ogicalBottom, oldLogicalBottom)); | 834 changeLogicalBottom = std::max(changeLogicalBottom,
std::max(logicalBottom, oldLogicalBottom)); |
| 837 } | 835 } |
| 838 LayoutUnit logicalTop = logicalTopForFloat(floatingObjec
t); | 836 LayoutUnit logicalTop = logicalTopForFloat(floatingObjec
t); |
| 839 LayoutUnit oldLogicalTop = logicalTopForFloat(oldFloatin
gObject); | 837 LayoutUnit oldLogicalTop = logicalTopForFloat(oldFloatin
gObject); |
| 840 if (logicalTop != oldLogicalTop) { | 838 if (logicalTop != oldLogicalTop) { |
| 841 changeLogicalTop = min(changeLogicalTop, min(logical
Top, oldLogicalTop)); | 839 changeLogicalTop = std::min(changeLogicalTop, std::m
in(logicalTop, oldLogicalTop)); |
| 842 changeLogicalBottom = max(changeLogicalBottom, max(l
ogicalTop, oldLogicalTop)); | 840 changeLogicalBottom = std::max(changeLogicalBottom,
std::max(logicalTop, oldLogicalTop)); |
| 843 } | 841 } |
| 844 } | 842 } |
| 845 | 843 |
| 846 if (oldFloatingObject->originatingLine() && !selfNeedsLayout
()) { | 844 if (oldFloatingObject->originatingLine() && !selfNeedsLayout
()) { |
| 847 ASSERT(oldFloatingObject->originatingLine()->renderer()
== this); | 845 ASSERT(oldFloatingObject->originatingLine()->renderer()
== this); |
| 848 oldFloatingObject->originatingLine()->markDirty(); | 846 oldFloatingObject->originatingLine()->markDirty(); |
| 849 } | 847 } |
| 850 | 848 |
| 851 floatMap.remove(floatingObject->renderer()); | 849 floatMap.remove(floatingObject->renderer()); |
| 852 } else { | 850 } else { |
| 853 changeLogicalTop = 0; | 851 changeLogicalTop = 0; |
| 854 changeLogicalBottom = max(changeLogicalBottom, logicalBottom
); | 852 changeLogicalBottom = std::max(changeLogicalBottom, logicalB
ottom); |
| 855 } | 853 } |
| 856 } | 854 } |
| 857 } | 855 } |
| 858 | 856 |
| 859 RendererToFloatInfoMap::iterator end = floatMap.end(); | 857 RendererToFloatInfoMap::iterator end = floatMap.end(); |
| 860 for (RendererToFloatInfoMap::iterator it = floatMap.begin(); it != end;
++it) { | 858 for (RendererToFloatInfoMap::iterator it = floatMap.begin(); it != end;
++it) { |
| 861 OwnPtr<FloatingObject>& floatingObject = it->value; | 859 OwnPtr<FloatingObject>& floatingObject = it->value; |
| 862 if (!floatingObject->isDescendant()) { | 860 if (!floatingObject->isDescendant()) { |
| 863 changeLogicalTop = 0; | 861 changeLogicalTop = 0; |
| 864 changeLogicalBottom = max(changeLogicalBottom, logicalBottomForF
loat(floatingObject.get())); | 862 changeLogicalBottom = std::max(changeLogicalBottom, logicalBotto
mForFloat(floatingObject.get())); |
| 865 } | 863 } |
| 866 } | 864 } |
| 867 | 865 |
| 868 markLinesDirtyInBlockRange(changeLogicalTop, changeLogicalBottom); | 866 markLinesDirtyInBlockRange(changeLogicalTop, changeLogicalBottom); |
| 869 } else if (!oldIntrudingFloatSet.isEmpty()) { | 867 } else if (!oldIntrudingFloatSet.isEmpty()) { |
| 870 // If there are previously intruding floats that no longer intrude, then
children with floats | 868 // If there are previously intruding floats that no longer intrude, then
children with floats |
| 871 // should also get layout because they might need their floating object
lists cleared. | 869 // should also get layout because they might need their floating object
lists cleared. |
| 872 if (m_floatingObjects->set().size() < oldIntrudingFloatSet.size()) { | 870 if (m_floatingObjects->set().size() < oldIntrudingFloatSet.size()) { |
| 873 markAllDescendantsWithFloatsForLayout(); | 871 markAllDescendantsWithFloatsForLayout(); |
| 874 } else { | 872 } else { |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 // Get the four margin values for the child and cache them. | 1032 // Get the four margin values for the child and cache them. |
| 1035 const RenderBlockFlow::MarginValues childMargins = marginValuesForChild(chil
d); | 1033 const RenderBlockFlow::MarginValues childMargins = marginValuesForChild(chil
d); |
| 1036 | 1034 |
| 1037 // Get our max pos and neg top margins. | 1035 // Get our max pos and neg top margins. |
| 1038 LayoutUnit posTop = childMargins.positiveMarginBefore(); | 1036 LayoutUnit posTop = childMargins.positiveMarginBefore(); |
| 1039 LayoutUnit negTop = childMargins.negativeMarginBefore(); | 1037 LayoutUnit negTop = childMargins.negativeMarginBefore(); |
| 1040 | 1038 |
| 1041 // For self-collapsing blocks, collapse our bottom margins into our | 1039 // For self-collapsing blocks, collapse our bottom margins into our |
| 1042 // top to get new posTop and negTop values. | 1040 // top to get new posTop and negTop values. |
| 1043 if (childIsSelfCollapsing) { | 1041 if (childIsSelfCollapsing) { |
| 1044 posTop = max(posTop, childMargins.positiveMarginAfter()); | 1042 posTop = std::max(posTop, childMargins.positiveMarginAfter()); |
| 1045 negTop = max(negTop, childMargins.negativeMarginAfter()); | 1043 negTop = std::max(negTop, childMargins.negativeMarginAfter()); |
| 1046 } | 1044 } |
| 1047 | 1045 |
| 1048 // See if the top margin is quirky. We only care if this child has | 1046 // See if the top margin is quirky. We only care if this child has |
| 1049 // margins that will collapse with us. | 1047 // margins that will collapse with us. |
| 1050 bool topQuirk = hasMarginBeforeQuirk(child); | 1048 bool topQuirk = hasMarginBeforeQuirk(child); |
| 1051 | 1049 |
| 1052 if (marginInfo.canCollapseWithMarginBefore()) { | 1050 if (marginInfo.canCollapseWithMarginBefore()) { |
| 1053 if (!childDiscardMarginBefore && !marginInfo.discardMargin()) { | 1051 if (!childDiscardMarginBefore && !marginInfo.discardMargin()) { |
| 1054 // This child is collapsing with the top of the | 1052 // This child is collapsing with the top of the |
| 1055 // block. If it has larger margin values, then we need to update | 1053 // block. If it has larger margin values, then we need to update |
| 1056 // our own maximal values. | 1054 // our own maximal values. |
| 1057 if (!document().inQuirksMode() || !marginInfo.quirkContainer() || !t
opQuirk) | 1055 if (!document().inQuirksMode() || !marginInfo.quirkContainer() || !t
opQuirk) |
| 1058 setMaxMarginBeforeValues(max(posTop, maxPositiveMarginBefore()),
max(negTop, maxNegativeMarginBefore())); | 1056 setMaxMarginBeforeValues(std::max(posTop, maxPositiveMarginBefor
e()), std::max(negTop, maxNegativeMarginBefore())); |
| 1059 | 1057 |
| 1060 // The minute any of the margins involved isn't a quirk, don't | 1058 // The minute any of the margins involved isn't a quirk, don't |
| 1061 // collapse it away, even if the margin is smaller (www.webreference
.com | 1059 // collapse it away, even if the margin is smaller (www.webreference
.com |
| 1062 // has an example of this, a <dt> with 0.8em author-specified inside | 1060 // has an example of this, a <dt> with 0.8em author-specified inside |
| 1063 // a <dl> inside a <td>. | 1061 // a <dl> inside a <td>. |
| 1064 if (!marginInfo.determinedMarginBeforeQuirk() && !topQuirk && (posTo
p - negTop)) { | 1062 if (!marginInfo.determinedMarginBeforeQuirk() && !topQuirk && (posTo
p - negTop)) { |
| 1065 setHasMarginBeforeQuirk(false); | 1063 setHasMarginBeforeQuirk(false); |
| 1066 marginInfo.setDeterminedMarginBeforeQuirk(true); | 1064 marginInfo.setDeterminedMarginBeforeQuirk(true); |
| 1067 } | 1065 } |
| 1068 | 1066 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 setLogicalHeight(logicalHeight() - clearanceForSelfCollapsingBlock); | 1101 setLogicalHeight(logicalHeight() - clearanceForSelfCollapsingBlock); |
| 1104 } | 1102 } |
| 1105 | 1103 |
| 1106 if (childIsSelfCollapsing) { | 1104 if (childIsSelfCollapsing) { |
| 1107 // For a self collapsing block both the before and after margins get dis
carded. The block doesn't contribute anything to the height of the block. | 1105 // For a self collapsing block both the before and after margins get dis
carded. The block doesn't contribute anything to the height of the block. |
| 1108 // Also, the child's top position equals the logical height of the conta
iner. | 1106 // Also, the child's top position equals the logical height of the conta
iner. |
| 1109 if (!childDiscardMarginBefore && !marginInfo.discardMargin()) { | 1107 if (!childDiscardMarginBefore && !marginInfo.discardMargin()) { |
| 1110 // This child has no height. We need to compute our | 1108 // This child has no height. We need to compute our |
| 1111 // position before we collapse the child's margins together, | 1109 // position before we collapse the child's margins together, |
| 1112 // so that we can get an accurate position for the zero-height block
. | 1110 // so that we can get an accurate position for the zero-height block
. |
| 1113 LayoutUnit collapsedBeforePos = max(marginInfo.positiveMargin(), chi
ldMargins.positiveMarginBefore()); | 1111 LayoutUnit collapsedBeforePos = std::max(marginInfo.positiveMargin()
, childMargins.positiveMarginBefore()); |
| 1114 LayoutUnit collapsedBeforeNeg = max(marginInfo.negativeMargin(), chi
ldMargins.negativeMarginBefore()); | 1112 LayoutUnit collapsedBeforeNeg = std::max(marginInfo.negativeMargin()
, childMargins.negativeMarginBefore()); |
| 1115 marginInfo.setMargin(collapsedBeforePos, collapsedBeforeNeg); | 1113 marginInfo.setMargin(collapsedBeforePos, collapsedBeforeNeg); |
| 1116 | 1114 |
| 1117 // Now collapse the child's margins together, which means examining
our | 1115 // Now collapse the child's margins together, which means examining
our |
| 1118 // bottom margin values as well. | 1116 // bottom margin values as well. |
| 1119 marginInfo.setPositiveMarginIfLarger(childMargins.positiveMarginAfte
r()); | 1117 marginInfo.setPositiveMarginIfLarger(childMargins.positiveMarginAfte
r()); |
| 1120 marginInfo.setNegativeMarginIfLarger(childMargins.negativeMarginAfte
r()); | 1118 marginInfo.setNegativeMarginIfLarger(childMargins.negativeMarginAfte
r()); |
| 1121 | 1119 |
| 1122 if (!marginInfo.canCollapseWithMarginBefore()) { | 1120 if (!marginInfo.canCollapseWithMarginBefore()) { |
| 1123 // We need to make sure that the position of the self-collapsing
block | 1121 // We need to make sure that the position of the self-collapsing
block |
| 1124 // is correct, since it could have overflowing content | 1122 // is correct, since it could have overflowing content |
| 1125 // that needs to be positioned correctly (e.g., a block that | 1123 // that needs to be positioned correctly (e.g., a block that |
| 1126 // had a specified height of 0 but that actually had subcontent)
. | 1124 // had a specified height of 0 but that actually had subcontent)
. |
| 1127 logicalTop = logicalHeight() + collapsedBeforePos - collapsedBef
oreNeg; | 1125 logicalTop = logicalHeight() + collapsedBeforePos - collapsedBef
oreNeg; |
| 1128 } | 1126 } |
| 1129 } | 1127 } |
| 1130 } else { | 1128 } else { |
| 1131 if (mustSeparateMarginBeforeForChild(child)) { | 1129 if (mustSeparateMarginBeforeForChild(child)) { |
| 1132 ASSERT(!marginInfo.discardMargin() || (marginInfo.discardMargin() &&
!marginInfo.margin())); | 1130 ASSERT(!marginInfo.discardMargin() || (marginInfo.discardMargin() &&
!marginInfo.margin())); |
| 1133 // If we are at the before side of the block and we collapse, ignore
the computed margin | 1131 // If we are at the before side of the block and we collapse, ignore
the computed margin |
| 1134 // and just add the child margin to the container height. This will
correctly position | 1132 // and just add the child margin to the container height. This will
correctly position |
| 1135 // the child inside the container. | 1133 // the child inside the container. |
| 1136 LayoutUnit separateMargin = !marginInfo.canCollapseWithMarginBefore(
) ? marginInfo.margin() : LayoutUnit(0); | 1134 LayoutUnit separateMargin = !marginInfo.canCollapseWithMarginBefore(
) ? marginInfo.margin() : LayoutUnit(0); |
| 1137 setLogicalHeight(logicalHeight() + separateMargin + marginBeforeForC
hild(child)); | 1135 setLogicalHeight(logicalHeight() + separateMargin + marginBeforeForC
hild(child)); |
| 1138 logicalTop = logicalHeight(); | 1136 logicalTop = logicalHeight(); |
| 1139 } else if (!marginInfo.discardMargin() && (!marginInfo.atBeforeSideOfBlo
ck() | 1137 } else if (!marginInfo.discardMargin() && (!marginInfo.atBeforeSideOfBlo
ck() |
| 1140 || (!marginInfo.canCollapseMarginBeforeWithChildren() | 1138 || (!marginInfo.canCollapseMarginBeforeWithChildren() |
| 1141 && (!document().inQuirksMode() || !marginInfo.quirkContainer() || !m
arginInfo.hasMarginBeforeQuirk())))) { | 1139 && (!document().inQuirksMode() || !marginInfo.quirkContainer() || !m
arginInfo.hasMarginBeforeQuirk())))) { |
| 1142 // We're collapsing with a previous sibling's margins and not | 1140 // We're collapsing with a previous sibling's margins and not |
| 1143 // with the top of the block. | 1141 // with the top of the block. |
| 1144 setLogicalHeight(logicalHeight() + max(marginInfo.positiveMargin(),
posTop) - max(marginInfo.negativeMargin(), negTop)); | 1142 setLogicalHeight(logicalHeight() + std::max(marginInfo.positiveMargi
n(), posTop) - std::max(marginInfo.negativeMargin(), negTop)); |
| 1145 logicalTop = logicalHeight(); | 1143 logicalTop = logicalHeight(); |
| 1146 } | 1144 } |
| 1147 | 1145 |
| 1148 marginInfo.setDiscardMargin(childDiscardMarginAfter); | 1146 marginInfo.setDiscardMargin(childDiscardMarginAfter); |
| 1149 | 1147 |
| 1150 if (!marginInfo.discardMargin()) { | 1148 if (!marginInfo.discardMargin()) { |
| 1151 marginInfo.setPositiveMargin(childMargins.positiveMarginAfter()); | 1149 marginInfo.setPositiveMargin(childMargins.positiveMarginAfter()); |
| 1152 marginInfo.setNegativeMargin(childMargins.negativeMarginAfter()); | 1150 marginInfo.setNegativeMargin(childMargins.negativeMarginAfter()); |
| 1153 } else { | 1151 } else { |
| 1154 marginInfo.clearMargin(); | 1152 marginInfo.clearMargin(); |
| 1155 } | 1153 } |
| 1156 | 1154 |
| 1157 if (marginInfo.margin()) | 1155 if (marginInfo.margin()) |
| 1158 marginInfo.setHasMarginAfterQuirk(hasMarginAfterQuirk(child)); | 1156 marginInfo.setHasMarginAfterQuirk(hasMarginAfterQuirk(child)); |
| 1159 } | 1157 } |
| 1160 | 1158 |
| 1161 // If margins would pull us past the top of the next page, then we need to p
ull back and pretend like the margins | 1159 // If margins would pull us past the top of the next page, then we need to p
ull back and pretend like the margins |
| 1162 // collapsed into the page edge. | 1160 // collapsed into the page edge. |
| 1163 LayoutState* layoutState = view()->layoutState(); | 1161 LayoutState* layoutState = view()->layoutState(); |
| 1164 if (layoutState->isPaginated() && layoutState->pageLogicalHeight() && logica
lTop > beforeCollapseLogicalTop) { | 1162 if (layoutState->isPaginated() && layoutState->pageLogicalHeight() && logica
lTop > beforeCollapseLogicalTop) { |
| 1165 LayoutUnit oldLogicalTop = logicalTop; | 1163 LayoutUnit oldLogicalTop = logicalTop; |
| 1166 logicalTop = min(logicalTop, nextPageLogicalTop(beforeCollapseLogicalTop
)); | 1164 logicalTop = std::min(logicalTop, nextPageLogicalTop(beforeCollapseLogic
alTop)); |
| 1167 setLogicalHeight(logicalHeight() + (logicalTop - oldLogicalTop)); | 1165 setLogicalHeight(logicalHeight() + (logicalTop - oldLogicalTop)); |
| 1168 } | 1166 } |
| 1169 | 1167 |
| 1170 if (previousBlockFlow) { | 1168 if (previousBlockFlow) { |
| 1171 // If |child| is a self-collapsing block it may have collapsed into a pr
evious sibling and although it hasn't reduced the height of the parent yet | 1169 // If |child| is a self-collapsing block it may have collapsed into a pr
evious sibling and although it hasn't reduced the height of the parent yet |
| 1172 // any floats from the parent will now overhang. | 1170 // any floats from the parent will now overhang. |
| 1173 LayoutUnit oldLogicalHeight = logicalHeight(); | 1171 LayoutUnit oldLogicalHeight = logicalHeight(); |
| 1174 setLogicalHeight(logicalTop); | 1172 setLogicalHeight(logicalTop); |
| 1175 if (!previousBlockFlow->avoidsFloats() && (previousBlockFlow->logicalTop
() + previousBlockFlow->lowestFloatLogicalBottom()) > logicalTop) | 1173 if (!previousBlockFlow->avoidsFloats() && (previousBlockFlow->logicalTop
() + previousBlockFlow->lowestFloatLogicalBottom()) > logicalTop) |
| 1176 addOverhangingFloats(previousBlockFlow, false); | 1174 addOverhangingFloats(previousBlockFlow, false); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1218 // Add in our start margin. | 1216 // Add in our start margin. |
| 1219 LayoutUnit oldPosition = startPosition + childMarginStart; | 1217 LayoutUnit oldPosition = startPosition + childMarginStart; |
| 1220 LayoutUnit newPosition = oldPosition; | 1218 LayoutUnit newPosition = oldPosition; |
| 1221 | 1219 |
| 1222 LayoutUnit blockOffset = logicalTopForChild(child); | 1220 LayoutUnit blockOffset = logicalTopForChild(child); |
| 1223 LayoutUnit startOff = startOffsetForLine(blockOffset, false, logicalHeightFo
rChild(child)); | 1221 LayoutUnit startOff = startOffsetForLine(blockOffset, false, logicalHeightFo
rChild(child)); |
| 1224 | 1222 |
| 1225 if (style()->textAlign() != WEBKIT_CENTER && !child->style()->marginStartUsi
ng(style()).isAuto()) { | 1223 if (style()->textAlign() != WEBKIT_CENTER && !child->style()->marginStartUsi
ng(style()).isAuto()) { |
| 1226 if (childMarginStart < 0) | 1224 if (childMarginStart < 0) |
| 1227 startOff += childMarginStart; | 1225 startOff += childMarginStart; |
| 1228 newPosition = max(newPosition, startOff); // Let the float sit in the ch
ild's margin if it can fit. | 1226 newPosition = std::max(newPosition, startOff); // Let the float sit in t
he child's margin if it can fit. |
| 1229 } else if (startOff != startPosition) { | 1227 } else if (startOff != startPosition) { |
| 1230 newPosition = startOff + childMarginStart; | 1228 newPosition = startOff + childMarginStart; |
| 1231 } | 1229 } |
| 1232 | 1230 |
| 1233 return newPosition - oldPosition; | 1231 return newPosition - oldPosition; |
| 1234 } | 1232 } |
| 1235 | 1233 |
| 1236 LayoutUnit RenderBlockFlow::clearFloatsIfNeeded(RenderBox* child, MarginInfo& ma
rginInfo, LayoutUnit oldTopPosMargin, LayoutUnit oldTopNegMargin, LayoutUnit yPo
s, bool childIsSelfCollapsing) | 1234 LayoutUnit RenderBlockFlow::clearFloatsIfNeeded(RenderBox* child, MarginInfo& ma
rginInfo, LayoutUnit oldTopPosMargin, LayoutUnit oldTopNegMargin, LayoutUnit yPo
s, bool childIsSelfCollapsing) |
| 1237 { | 1235 { |
| 1238 LayoutUnit heightIncrease = getClearDelta(child, yPos); | 1236 LayoutUnit heightIncrease = getClearDelta(child, yPos); |
| 1239 if (!heightIncrease) | 1237 if (!heightIncrease) |
| 1240 return yPos; | 1238 return yPos; |
| 1241 | 1239 |
| 1242 if (childIsSelfCollapsing) { | 1240 if (childIsSelfCollapsing) { |
| 1243 bool childDiscardMargin = mustDiscardMarginBeforeForChild(child) || must
DiscardMarginAfterForChild(child); | 1241 bool childDiscardMargin = mustDiscardMarginBeforeForChild(child) || must
DiscardMarginAfterForChild(child); |
| 1244 | 1242 |
| 1245 // For self-collapsing blocks that clear, they can still collapse their | 1243 // For self-collapsing blocks that clear, they can still collapse their |
| 1246 // margins with following siblings. Reset the current margins to represe
nt | 1244 // margins with following siblings. Reset the current margins to represe
nt |
| 1247 // the self-collapsing block's margins only. | 1245 // the self-collapsing block's margins only. |
| 1248 // If DISCARD is specified for -webkit-margin-collapse, reset the margin
values. | 1246 // If DISCARD is specified for -webkit-margin-collapse, reset the margin
values. |
| 1249 RenderBlockFlow::MarginValues childMargins = marginValuesForChild(child)
; | 1247 RenderBlockFlow::MarginValues childMargins = marginValuesForChild(child)
; |
| 1250 if (!childDiscardMargin) { | 1248 if (!childDiscardMargin) { |
| 1251 marginInfo.setPositiveMargin(max(childMargins.positiveMarginBefore()
, childMargins.positiveMarginAfter())); | 1249 marginInfo.setPositiveMargin(std::max(childMargins.positiveMarginBef
ore(), childMargins.positiveMarginAfter())); |
| 1252 marginInfo.setNegativeMargin(max(childMargins.negativeMarginBefore()
, childMargins.negativeMarginAfter())); | 1250 marginInfo.setNegativeMargin(std::max(childMargins.negativeMarginBef
ore(), childMargins.negativeMarginAfter())); |
| 1253 } else { | 1251 } else { |
| 1254 marginInfo.clearMargin(); | 1252 marginInfo.clearMargin(); |
| 1255 } | 1253 } |
| 1256 marginInfo.setDiscardMargin(childDiscardMargin); | 1254 marginInfo.setDiscardMargin(childDiscardMargin); |
| 1257 | 1255 |
| 1258 // CSS2.1 states: | 1256 // CSS2.1 states: |
| 1259 // "If the top and bottom margins of an element with clearance are adjoi
ning, its margins collapse with | 1257 // "If the top and bottom margins of an element with clearance are adjoi
ning, its margins collapse with |
| 1260 // the adjoining margins of following siblings but that resulting margin
does not collapse with the bottom margin of the parent block." | 1258 // the adjoining margins of following siblings but that resulting margin
does not collapse with the bottom margin of the parent block." |
| 1261 // So the parent's bottom margin cannot collapse through this block or a
ny subsequent self-collapsing blocks. Set a bit to ensure | 1259 // So the parent's bottom margin cannot collapse through this block or a
ny subsequent self-collapsing blocks. Set a bit to ensure |
| 1262 // this happens; it will get reset if we encounter an in-flow sibling th
at is not self-collapsing. | 1260 // this happens; it will get reset if we encounter an in-flow sibling th
at is not self-collapsing. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1293 if (marginInfo.canCollapseWithMarginAfter() && !marginInfo.canCollapseWithMa
rginBefore()) { | 1291 if (marginInfo.canCollapseWithMarginAfter() && !marginInfo.canCollapseWithMa
rginBefore()) { |
| 1294 // Update the after side margin of the container to discard if the after
margin of the last child also discards and we collapse with it. | 1292 // Update the after side margin of the container to discard if the after
margin of the last child also discards and we collapse with it. |
| 1295 // Don't update the max margin values because we won't need them anyway. | 1293 // Don't update the max margin values because we won't need them anyway. |
| 1296 if (marginInfo.discardMargin()) { | 1294 if (marginInfo.discardMargin()) { |
| 1297 setMustDiscardMarginAfter(); | 1295 setMustDiscardMarginAfter(); |
| 1298 return; | 1296 return; |
| 1299 } | 1297 } |
| 1300 | 1298 |
| 1301 // Update our max pos/neg bottom margins, since we collapsed our bottom
margins | 1299 // Update our max pos/neg bottom margins, since we collapsed our bottom
margins |
| 1302 // with our children. | 1300 // with our children. |
| 1303 setMaxMarginAfterValues(max(maxPositiveMarginAfter(), marginInfo.positiv
eMargin()), max(maxNegativeMarginAfter(), marginInfo.negativeMargin())); | 1301 setMaxMarginAfterValues(std::max(maxPositiveMarginAfter(), marginInfo.po
sitiveMargin()), std::max(maxNegativeMarginAfter(), marginInfo.negativeMargin())
); |
| 1304 | 1302 |
| 1305 if (!marginInfo.hasMarginAfterQuirk()) | 1303 if (!marginInfo.hasMarginAfterQuirk()) |
| 1306 setHasMarginAfterQuirk(false); | 1304 setHasMarginAfterQuirk(false); |
| 1307 | 1305 |
| 1308 if (marginInfo.hasMarginAfterQuirk() && !marginAfter()) { | 1306 if (marginInfo.hasMarginAfterQuirk() && !marginAfter()) { |
| 1309 // We have no bottom margin and our last child has a quirky margin. | 1307 // We have no bottom margin and our last child has a quirky margin. |
| 1310 // We will pick up this quirky margin and pass it through. | 1308 // We will pick up this quirky margin and pass it through. |
| 1311 // This deals with the <td><div><p> case. | 1309 // This deals with the <td><div><p> case. |
| 1312 setHasMarginAfterQuirk(true); | 1310 setHasMarginAfterQuirk(true); |
| 1313 } | 1311 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1325 // The margins are discarded by a child that specified -webkit-margin-collap
se: discard. | 1323 // The margins are discarded by a child that specified -webkit-margin-collap
se: discard. |
| 1326 // FIXME: Use writing mode independent accessor for marginBeforeCollapse. | 1324 // FIXME: Use writing mode independent accessor for marginBeforeCollapse. |
| 1327 if (child->style()->marginBeforeCollapse() == MDISCARD) { | 1325 if (child->style()->marginBeforeCollapse() == MDISCARD) { |
| 1328 positiveMarginBefore = 0; | 1326 positiveMarginBefore = 0; |
| 1329 negativeMarginBefore = 0; | 1327 negativeMarginBefore = 0; |
| 1330 discardMarginBefore = true; | 1328 discardMarginBefore = true; |
| 1331 return; | 1329 return; |
| 1332 } | 1330 } |
| 1333 | 1331 |
| 1334 LayoutUnit beforeChildMargin = marginBeforeForChild(child); | 1332 LayoutUnit beforeChildMargin = marginBeforeForChild(child); |
| 1335 positiveMarginBefore = max(positiveMarginBefore, beforeChildMargin); | 1333 positiveMarginBefore = std::max(positiveMarginBefore, beforeChildMargin); |
| 1336 negativeMarginBefore = max(negativeMarginBefore, -beforeChildMargin); | 1334 negativeMarginBefore = std::max(negativeMarginBefore, -beforeChildMargin); |
| 1337 | 1335 |
| 1338 if (!child->isRenderBlockFlow()) | 1336 if (!child->isRenderBlockFlow()) |
| 1339 return; | 1337 return; |
| 1340 | 1338 |
| 1341 RenderBlockFlow* childBlockFlow = toRenderBlockFlow(child); | 1339 RenderBlockFlow* childBlockFlow = toRenderBlockFlow(child); |
| 1342 if (childBlockFlow->childrenInline() || childBlockFlow->isWritingModeRoot()) | 1340 if (childBlockFlow->childrenInline() || childBlockFlow->isWritingModeRoot()) |
| 1343 return; | 1341 return; |
| 1344 | 1342 |
| 1345 MarginInfo childMarginInfo(childBlockFlow, childBlockFlow->borderBefore() +
childBlockFlow->paddingBefore(), childBlockFlow->borderAfter() + childBlockFlow-
>paddingAfter()); | 1343 MarginInfo childMarginInfo(childBlockFlow, childBlockFlow->borderBefore() +
childBlockFlow->paddingBefore(), childBlockFlow->borderAfter() + childBlockFlow-
>paddingAfter()); |
| 1346 if (!childMarginInfo.canCollapseMarginBeforeWithChildren()) | 1344 if (!childMarginInfo.canCollapseMarginBeforeWithChildren()) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1379 LayoutUnit positiveMarginBefore = 0; | 1377 LayoutUnit positiveMarginBefore = 0; |
| 1380 LayoutUnit negativeMarginBefore = 0; | 1378 LayoutUnit negativeMarginBefore = 0; |
| 1381 bool discardMarginBefore = false; | 1379 bool discardMarginBefore = false; |
| 1382 if (child->selfNeedsLayout()) { | 1380 if (child->selfNeedsLayout()) { |
| 1383 // Try to do a basic estimation of how the collapse is going to go. | 1381 // Try to do a basic estimation of how the collapse is going to go. |
| 1384 marginBeforeEstimateForChild(child, positiveMarginBefore, negativeMa
rginBefore, discardMarginBefore); | 1382 marginBeforeEstimateForChild(child, positiveMarginBefore, negativeMa
rginBefore, discardMarginBefore); |
| 1385 } else { | 1383 } else { |
| 1386 // Use the cached collapsed margin values from a previous layout. Mo
st of the time they | 1384 // Use the cached collapsed margin values from a previous layout. Mo
st of the time they |
| 1387 // will be right. | 1385 // will be right. |
| 1388 RenderBlockFlow::MarginValues marginValues = marginValuesForChild(ch
ild); | 1386 RenderBlockFlow::MarginValues marginValues = marginValuesForChild(ch
ild); |
| 1389 positiveMarginBefore = max(positiveMarginBefore, marginValues.positi
veMarginBefore()); | 1387 positiveMarginBefore = std::max(positiveMarginBefore, marginValues.p
ositiveMarginBefore()); |
| 1390 negativeMarginBefore = max(negativeMarginBefore, marginValues.negati
veMarginBefore()); | 1388 negativeMarginBefore = std::max(negativeMarginBefore, marginValues.n
egativeMarginBefore()); |
| 1391 discardMarginBefore = mustDiscardMarginBeforeForChild(child); | 1389 discardMarginBefore = mustDiscardMarginBeforeForChild(child); |
| 1392 } | 1390 } |
| 1393 | 1391 |
| 1394 // Collapse the result with our current margins. | 1392 // Collapse the result with our current margins. |
| 1395 if (!discardMarginBefore) | 1393 if (!discardMarginBefore) |
| 1396 logicalTopEstimate += max(marginInfo.positiveMargin(), positiveMargi
nBefore) - max(marginInfo.negativeMargin(), negativeMarginBefore); | 1394 logicalTopEstimate += std::max(marginInfo.positiveMargin(), positive
MarginBefore) - std::max(marginInfo.negativeMargin(), negativeMarginBefore); |
| 1397 } | 1395 } |
| 1398 | 1396 |
| 1399 // Adjust logicalTopEstimate down to the next page if the margins are so lar
ge that we don't fit on the current | 1397 // Adjust logicalTopEstimate down to the next page if the margins are so lar
ge that we don't fit on the current |
| 1400 // page. | 1398 // page. |
| 1401 LayoutState* layoutState = view()->layoutState(); | 1399 LayoutState* layoutState = view()->layoutState(); |
| 1402 if (layoutState->isPaginated() && layoutState->pageLogicalHeight() && logica
lTopEstimate > logicalHeight()) | 1400 if (layoutState->isPaginated() && layoutState->pageLogicalHeight() && logica
lTopEstimate > logicalHeight()) |
| 1403 logicalTopEstimate = min(logicalTopEstimate, nextPageLogicalTop(logicalH
eight())); | 1401 logicalTopEstimate = std::min(logicalTopEstimate, nextPageLogicalTop(log
icalHeight())); |
| 1404 | 1402 |
| 1405 logicalTopEstimate += getClearDelta(child, logicalTopEstimate); | 1403 logicalTopEstimate += getClearDelta(child, logicalTopEstimate); |
| 1406 | 1404 |
| 1407 estimateWithoutPagination = logicalTopEstimate; | 1405 estimateWithoutPagination = logicalTopEstimate; |
| 1408 | 1406 |
| 1409 if (layoutState->isPaginated()) { | 1407 if (layoutState->isPaginated()) { |
| 1410 // If the object has a page or column break value of "before", then we s
hould shift to the top of the next page. | 1408 // If the object has a page or column break value of "before", then we s
hould shift to the top of the next page. |
| 1411 logicalTopEstimate = applyBeforeBreak(child, logicalTopEstimate); | 1409 logicalTopEstimate = applyBeforeBreak(child, logicalTopEstimate); |
| 1412 | 1410 |
| 1413 // For replaced elements and scrolled elements, we want to shift them to
the next page if they don't fit on the current one. | 1411 // For replaced elements and scrolled elements, we want to shift them to
the next page if they don't fit on the current one. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1466 // If we can't collapse with children then go ahead and add in the bottom ma
rgin. | 1464 // If we can't collapse with children then go ahead and add in the bottom ma
rgin. |
| 1467 if (!marginInfo.discardMargin() && (!marginInfo.canCollapseWithMarginAfter()
&& !marginInfo.canCollapseWithMarginBefore() | 1465 if (!marginInfo.discardMargin() && (!marginInfo.canCollapseWithMarginAfter()
&& !marginInfo.canCollapseWithMarginBefore() |
| 1468 && (!document().inQuirksMode() || !marginInfo.quirkContainer() || !margi
nInfo.hasMarginAfterQuirk()))) | 1466 && (!document().inQuirksMode() || !marginInfo.quirkContainer() || !margi
nInfo.hasMarginAfterQuirk()))) |
| 1469 setLogicalHeight(logicalHeight() + marginInfo.margin()); | 1467 setLogicalHeight(logicalHeight() + marginInfo.margin()); |
| 1470 | 1468 |
| 1471 // Now add in our bottom border/padding. | 1469 // Now add in our bottom border/padding. |
| 1472 setLogicalHeight(logicalHeight() + afterSide); | 1470 setLogicalHeight(logicalHeight() + afterSide); |
| 1473 | 1471 |
| 1474 // Negative margins can cause our height to shrink below our minimal height
(border/padding). | 1472 // Negative margins can cause our height to shrink below our minimal height
(border/padding). |
| 1475 // If this happens, ensure that the computed height is increased to the mini
mal height. | 1473 // If this happens, ensure that the computed height is increased to the mini
mal height. |
| 1476 setLogicalHeight(max(logicalHeight(), beforeSide + afterSide)); | 1474 setLogicalHeight(std::max(logicalHeight(), beforeSide + afterSide)); |
| 1477 | 1475 |
| 1478 // Update our bottom collapsed margin info. | 1476 // Update our bottom collapsed margin info. |
| 1479 setCollapsedBottomMargin(marginInfo); | 1477 setCollapsedBottomMargin(marginInfo); |
| 1480 } | 1478 } |
| 1481 | 1479 |
| 1482 void RenderBlockFlow::setMustDiscardMarginBefore(bool value) | 1480 void RenderBlockFlow::setMustDiscardMarginBefore(bool value) |
| 1483 { | 1481 { |
| 1484 if (style()->marginBeforeCollapse() == MDISCARD) { | 1482 if (style()->marginBeforeCollapse() == MDISCARD) { |
| 1485 ASSERT(value); | 1483 ASSERT(value); |
| 1486 return; | 1484 return; |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1757 break; | 1755 break; |
| 1758 case CRIGHT: | 1756 case CRIGHT: |
| 1759 logicalBottom = lowestFloatLogicalBottom(FloatingObject::FloatRight); | 1757 logicalBottom = lowestFloatLogicalBottom(FloatingObject::FloatRight); |
| 1760 break; | 1758 break; |
| 1761 case CBOTH: | 1759 case CBOTH: |
| 1762 logicalBottom = lowestFloatLogicalBottom(); | 1760 logicalBottom = lowestFloatLogicalBottom(); |
| 1763 break; | 1761 break; |
| 1764 } | 1762 } |
| 1765 | 1763 |
| 1766 // 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). | 1764 // 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). |
| 1767 LayoutUnit result = clearSet ? max<LayoutUnit>(0, logicalBottom - logicalTop
) : LayoutUnit(); | 1765 LayoutUnit result = clearSet ? std::max<LayoutUnit>(0, logicalBottom - logic
alTop) : LayoutUnit(); |
| 1768 if (!result && child->avoidsFloats()) { | 1766 if (!result && child->avoidsFloats()) { |
| 1769 LayoutUnit newLogicalTop = logicalTop; | 1767 LayoutUnit newLogicalTop = logicalTop; |
| 1770 while (true) { | 1768 while (true) { |
| 1771 LayoutUnit availableLogicalWidthAtNewLogicalTopOffset = availableLog
icalWidthForLine(newLogicalTop, false, logicalHeightForChild(child)); | 1769 LayoutUnit availableLogicalWidthAtNewLogicalTopOffset = availableLog
icalWidthForLine(newLogicalTop, false, logicalHeightForChild(child)); |
| 1772 if (availableLogicalWidthAtNewLogicalTopOffset == availableLogicalWi
dthForContent()) | 1770 if (availableLogicalWidthAtNewLogicalTopOffset == availableLogicalWi
dthForContent()) |
| 1773 return newLogicalTop - logicalTop; | 1771 return newLogicalTop - logicalTop; |
| 1774 | 1772 |
| 1775 LayoutRect borderBox = child->borderBoxRect(); | 1773 LayoutRect borderBox = child->borderBoxRect(); |
| 1776 LayoutUnit childLogicalWidthAtOldLogicalTopOffset = isHorizontalWrit
ingMode() ? borderBox.width() : borderBox.height(); | 1774 LayoutUnit childLogicalWidthAtOldLogicalTopOffset = isHorizontalWrit
ingMode() ? borderBox.width() : borderBox.height(); |
| 1777 | 1775 |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1963 void RenderBlockFlow::invalidatePaintForOverflow() | 1961 void RenderBlockFlow::invalidatePaintForOverflow() |
| 1964 { | 1962 { |
| 1965 // FIXME: We could tighten up the left and right invalidation points if we l
et layoutInlineChildren fill them in based off the particular lines | 1963 // FIXME: We could tighten up the left and right invalidation points if we l
et layoutInlineChildren fill them in based off the particular lines |
| 1966 // it had to lay out. We wouldn't need the hasOverflowClip() hack in that ca
se either. | 1964 // it had to lay out. We wouldn't need the hasOverflowClip() hack in that ca
se either. |
| 1967 LayoutUnit repaintLogicalLeft = logicalLeftVisualOverflow(); | 1965 LayoutUnit repaintLogicalLeft = logicalLeftVisualOverflow(); |
| 1968 LayoutUnit repaintLogicalRight = logicalRightVisualOverflow(); | 1966 LayoutUnit repaintLogicalRight = logicalRightVisualOverflow(); |
| 1969 if (hasOverflowClip()) { | 1967 if (hasOverflowClip()) { |
| 1970 // If we have clipped overflow, we should use layout overflow as well, s
ince visual overflow from lines didn't propagate to our block's overflow. | 1968 // If we have clipped overflow, we should use layout overflow as well, s
ince visual overflow from lines didn't propagate to our block's overflow. |
| 1971 // Note the old code did this as well but even for overflow:visible. The
addition of hasOverflowClip() at least tightens up the hack a bit. | 1969 // Note the old code did this as well but even for overflow:visible. The
addition of hasOverflowClip() at least tightens up the hack a bit. |
| 1972 // layoutInlineChildren should be patched to compute the entire repaint
rect. | 1970 // layoutInlineChildren should be patched to compute the entire repaint
rect. |
| 1973 repaintLogicalLeft = min(repaintLogicalLeft, logicalLeftLayoutOverflow()
); | 1971 repaintLogicalLeft = std::min(repaintLogicalLeft, logicalLeftLayoutOverf
low()); |
| 1974 repaintLogicalRight = max(repaintLogicalRight, logicalRightLayoutOverflo
w()); | 1972 repaintLogicalRight = std::max(repaintLogicalRight, logicalRightLayoutOv
erflow()); |
| 1975 } | 1973 } |
| 1976 | 1974 |
| 1977 LayoutRect repaintRect; | 1975 LayoutRect repaintRect; |
| 1978 if (isHorizontalWritingMode()) | 1976 if (isHorizontalWritingMode()) |
| 1979 repaintRect = LayoutRect(repaintLogicalLeft, m_repaintLogicalTop, repain
tLogicalRight - repaintLogicalLeft, m_repaintLogicalBottom - m_repaintLogicalTop
); | 1977 repaintRect = LayoutRect(repaintLogicalLeft, m_repaintLogicalTop, repain
tLogicalRight - repaintLogicalLeft, m_repaintLogicalBottom - m_repaintLogicalTop
); |
| 1980 else | 1978 else |
| 1981 repaintRect = LayoutRect(m_repaintLogicalTop, repaintLogicalLeft, m_repa
intLogicalBottom - m_repaintLogicalTop, repaintLogicalRight - repaintLogicalLeft
); | 1979 repaintRect = LayoutRect(m_repaintLogicalTop, repaintLogicalLeft, m_repa
intLogicalBottom - m_repaintLogicalTop, repaintLogicalRight - repaintLogicalLeft
); |
| 1982 | 1980 |
| 1983 // The repaint rect may be split across columns, in which case adjustRectFor
Columns() will return the union. | 1981 // The repaint rect may be split across columns, in which case adjustRectFor
Columns() will return the union. |
| 1984 adjustRectForColumns(repaintRect); | 1982 adjustRectForColumns(repaintRect); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2137 return right; | 2135 return right; |
| 2138 } | 2136 } |
| 2139 | 2137 |
| 2140 LayoutPoint RenderBlockFlow::computeLogicalLocationForFloat(const FloatingObject
* floatingObject, LayoutUnit logicalTopOffset) const | 2138 LayoutPoint RenderBlockFlow::computeLogicalLocationForFloat(const FloatingObject
* floatingObject, LayoutUnit logicalTopOffset) const |
| 2141 { | 2139 { |
| 2142 RenderBox* childBox = floatingObject->renderer(); | 2140 RenderBox* childBox = floatingObject->renderer(); |
| 2143 LayoutUnit logicalLeftOffset = logicalLeftOffsetForContent(); // Constant pa
rt of left offset. | 2141 LayoutUnit logicalLeftOffset = logicalLeftOffsetForContent(); // Constant pa
rt of left offset. |
| 2144 LayoutUnit logicalRightOffset; // Constant part of right offset. | 2142 LayoutUnit logicalRightOffset; // Constant part of right offset. |
| 2145 logicalRightOffset = logicalRightOffsetForContent(); | 2143 logicalRightOffset = logicalRightOffsetForContent(); |
| 2146 | 2144 |
| 2147 LayoutUnit floatLogicalWidth = min(logicalWidthForFloat(floatingObject), log
icalRightOffset - logicalLeftOffset); // The width we look for. | 2145 LayoutUnit floatLogicalWidth = std::min(logicalWidthForFloat(floatingObject)
, logicalRightOffset - logicalLeftOffset); // The width we look for. |
| 2148 | 2146 |
| 2149 LayoutUnit floatLogicalLeft; | 2147 LayoutUnit floatLogicalLeft; |
| 2150 | 2148 |
| 2151 bool insideFlowThread = flowThreadContainingBlock(); | 2149 bool insideFlowThread = flowThreadContainingBlock(); |
| 2152 | 2150 |
| 2153 if (childBox->style()->floating() == LeftFloat) { | 2151 if (childBox->style()->floating() == LeftFloat) { |
| 2154 LayoutUnit heightRemainingLeft = 1; | 2152 LayoutUnit heightRemainingLeft = 1; |
| 2155 LayoutUnit heightRemainingRight = 1; | 2153 LayoutUnit heightRemainingRight = 1; |
| 2156 floatLogicalLeft = logicalLeftOffsetForPositioningFloat(logicalTopOffset
, logicalLeftOffset, false, &heightRemainingLeft); | 2154 floatLogicalLeft = logicalLeftOffsetForPositioningFloat(logicalTopOffset
, logicalLeftOffset, false, &heightRemainingLeft); |
| 2157 while (logicalRightOffsetForPositioningFloat(logicalTopOffset, logicalRi
ghtOffset, false, &heightRemainingRight) - floatLogicalLeft < floatLogicalWidth)
{ | 2155 while (logicalRightOffsetForPositioningFloat(logicalTopOffset, logicalRi
ghtOffset, false, &heightRemainingRight) - floatLogicalLeft < floatLogicalWidth)
{ |
| 2158 logicalTopOffset += min(heightRemainingLeft, heightRemainingRight); | 2156 logicalTopOffset += std::min(heightRemainingLeft, heightRemainingRig
ht); |
| 2159 floatLogicalLeft = logicalLeftOffsetForPositioningFloat(logicalTopOf
fset, logicalLeftOffset, false, &heightRemainingLeft); | 2157 floatLogicalLeft = logicalLeftOffsetForPositioningFloat(logicalTopOf
fset, logicalLeftOffset, false, &heightRemainingLeft); |
| 2160 if (insideFlowThread) { | 2158 if (insideFlowThread) { |
| 2161 // Have to re-evaluate all of our offsets, since they may have c
hanged. | 2159 // Have to re-evaluate all of our offsets, since they may have c
hanged. |
| 2162 logicalRightOffset = logicalRightOffsetForContent(); // Constant
part of right offset. | 2160 logicalRightOffset = logicalRightOffsetForContent(); // Constant
part of right offset. |
| 2163 logicalLeftOffset = logicalLeftOffsetForContent(); // Constant p
art of left offset. | 2161 logicalLeftOffset = logicalLeftOffsetForContent(); // Constant p
art of left offset. |
| 2164 floatLogicalWidth = min(logicalWidthForFloat(floatingObject), lo
gicalRightOffset - logicalLeftOffset); | 2162 floatLogicalWidth = std::min(logicalWidthForFloat(floatingObject
), logicalRightOffset - logicalLeftOffset); |
| 2165 } | 2163 } |
| 2166 } | 2164 } |
| 2167 floatLogicalLeft = max(logicalLeftOffset - borderAndPaddingLogicalLeft()
, floatLogicalLeft); | 2165 floatLogicalLeft = std::max(logicalLeftOffset - borderAndPaddingLogicalL
eft(), floatLogicalLeft); |
| 2168 } else { | 2166 } else { |
| 2169 LayoutUnit heightRemainingLeft = 1; | 2167 LayoutUnit heightRemainingLeft = 1; |
| 2170 LayoutUnit heightRemainingRight = 1; | 2168 LayoutUnit heightRemainingRight = 1; |
| 2171 floatLogicalLeft = logicalRightOffsetForPositioningFloat(logicalTopOffse
t, logicalRightOffset, false, &heightRemainingRight); | 2169 floatLogicalLeft = logicalRightOffsetForPositioningFloat(logicalTopOffse
t, logicalRightOffset, false, &heightRemainingRight); |
| 2172 while (floatLogicalLeft - logicalLeftOffsetForPositioningFloat(logicalTo
pOffset, logicalLeftOffset, false, &heightRemainingLeft) < floatLogicalWidth) { | 2170 while (floatLogicalLeft - logicalLeftOffsetForPositioningFloat(logicalTo
pOffset, logicalLeftOffset, false, &heightRemainingLeft) < floatLogicalWidth) { |
| 2173 logicalTopOffset += min(heightRemainingLeft, heightRemainingRight); | 2171 logicalTopOffset += std::min(heightRemainingLeft, heightRemainingRig
ht); |
| 2174 floatLogicalLeft = logicalRightOffsetForPositioningFloat(logicalTopO
ffset, logicalRightOffset, false, &heightRemainingRight); | 2172 floatLogicalLeft = logicalRightOffsetForPositioningFloat(logicalTopO
ffset, logicalRightOffset, false, &heightRemainingRight); |
| 2175 if (insideFlowThread) { | 2173 if (insideFlowThread) { |
| 2176 // Have to re-evaluate all of our offsets, since they may have c
hanged. | 2174 // Have to re-evaluate all of our offsets, since they may have c
hanged. |
| 2177 logicalRightOffset = logicalRightOffsetForContent(); // Constant
part of right offset. | 2175 logicalRightOffset = logicalRightOffsetForContent(); // Constant
part of right offset. |
| 2178 logicalLeftOffset = logicalLeftOffsetForContent(); // Constant p
art of left offset. | 2176 logicalLeftOffset = logicalLeftOffsetForContent(); // Constant p
art of left offset. |
| 2179 floatLogicalWidth = min(logicalWidthForFloat(floatingObject), lo
gicalRightOffset - logicalLeftOffset); | 2177 floatLogicalWidth = std::min(logicalWidthForFloat(floatingObject
), logicalRightOffset - logicalLeftOffset); |
| 2180 } | 2178 } |
| 2181 } | 2179 } |
| 2182 // Use the original width of the float here, since the local variable | 2180 // Use the original width of the float here, since the local variable |
| 2183 // |floatLogicalWidth| was capped to the available line width. See | 2181 // |floatLogicalWidth| was capped to the available line width. See |
| 2184 // fast/block/float/clamped-right-float.html. | 2182 // fast/block/float/clamped-right-float.html. |
| 2185 floatLogicalLeft -= logicalWidthForFloat(floatingObject); | 2183 floatLogicalLeft -= logicalWidthForFloat(floatingObject); |
| 2186 } | 2184 } |
| 2187 | 2185 |
| 2188 return LayoutPoint(floatLogicalLeft, logicalTopOffset); | 2186 return LayoutPoint(floatLogicalLeft, logicalTopOffset); |
| 2189 } | 2187 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2237 LayoutUnit logicalTop = logicalTopForFloat(floatingObject); | 2235 LayoutUnit logicalTop = logicalTopForFloat(floatingObject); |
| 2238 LayoutUnit logicalBottom = logicalBottomForFloat(floatingObject)
; | 2236 LayoutUnit logicalBottom = logicalBottomForFloat(floatingObject)
; |
| 2239 | 2237 |
| 2240 // Fix for https://bugs.webkit.org/show_bug.cgi?id=54995. | 2238 // Fix for https://bugs.webkit.org/show_bug.cgi?id=54995. |
| 2241 if (logicalBottom < 0 || logicalBottom < logicalTop || logicalTo
p == LayoutUnit::max()) { | 2239 if (logicalBottom < 0 || logicalBottom < logicalTop || logicalTo
p == LayoutUnit::max()) { |
| 2242 logicalBottom = LayoutUnit::max(); | 2240 logicalBottom = LayoutUnit::max(); |
| 2243 } else { | 2241 } else { |
| 2244 // Special-case zero- and less-than-zero-height floats: thos
e don't touch | 2242 // Special-case zero- and less-than-zero-height floats: thos
e don't touch |
| 2245 // the line that they're on, but it still needs to be dirtie
d. This is | 2243 // the line that they're on, but it still needs to be dirtie
d. This is |
| 2246 // accomplished by pretending they have a height of 1. | 2244 // accomplished by pretending they have a height of 1. |
| 2247 logicalBottom = max(logicalBottom, logicalTop + 1); | 2245 logicalBottom = std::max(logicalBottom, logicalTop + 1); |
| 2248 } | 2246 } |
| 2249 if (floatingObject->originatingLine()) { | 2247 if (floatingObject->originatingLine()) { |
| 2250 if (!selfNeedsLayout()) { | 2248 if (!selfNeedsLayout()) { |
| 2251 ASSERT(floatingObject->originatingLine()->renderer() ==
this); | 2249 ASSERT(floatingObject->originatingLine()->renderer() ==
this); |
| 2252 floatingObject->originatingLine()->markDirty(); | 2250 floatingObject->originatingLine()->markDirty(); |
| 2253 } | 2251 } |
| 2254 #if ASSERT_ENABLED | 2252 #if ASSERT_ENABLED |
| 2255 floatingObject->setOriginatingLine(0); | 2253 floatingObject->setOriginatingLine(0); |
| 2256 #endif | 2254 #endif |
| 2257 } | 2255 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2303 lastPlacedFloatingObject = it->get(); | 2301 lastPlacedFloatingObject = it->get(); |
| 2304 ++it; | 2302 ++it; |
| 2305 break; | 2303 break; |
| 2306 } | 2304 } |
| 2307 } | 2305 } |
| 2308 | 2306 |
| 2309 LayoutUnit logicalTop = logicalHeight(); | 2307 LayoutUnit logicalTop = logicalHeight(); |
| 2310 | 2308 |
| 2311 // The float cannot start above the top position of the last positioned floa
t. | 2309 // The float cannot start above the top position of the last positioned floa
t. |
| 2312 if (lastPlacedFloatingObject) | 2310 if (lastPlacedFloatingObject) |
| 2313 logicalTop = max(logicalTopForFloat(lastPlacedFloatingObject), logicalTo
p); | 2311 logicalTop = std::max(logicalTopForFloat(lastPlacedFloatingObject), logi
calTop); |
| 2314 | 2312 |
| 2315 FloatingObjectSetIterator end = floatingObjectSet.end(); | 2313 FloatingObjectSetIterator end = floatingObjectSet.end(); |
| 2316 // Now walk through the set of unpositioned floats and place them. | 2314 // Now walk through the set of unpositioned floats and place them. |
| 2317 for (; it != end; ++it) { | 2315 for (; it != end; ++it) { |
| 2318 FloatingObject* floatingObject = it->get(); | 2316 FloatingObject* floatingObject = it->get(); |
| 2319 // The containing block is responsible for positioning floats, so if we
have floats in our | 2317 // The containing block is responsible for positioning floats, so if we
have floats in our |
| 2320 // list that come from somewhere else, do not attempt to position them. | 2318 // list that come from somewhere else, do not attempt to position them. |
| 2321 if (floatingObject->renderer()->containingBlock() != this) | 2319 if (floatingObject->renderer()->containingBlock() != this) |
| 2322 continue; | 2320 continue; |
| 2323 | 2321 |
| 2324 RenderBox* childBox = floatingObject->renderer(); | 2322 RenderBox* childBox = floatingObject->renderer(); |
| 2325 | 2323 |
| 2326 // FIXME Investigate if this can be removed. crbug.com/370006 | 2324 // FIXME Investigate if this can be removed. crbug.com/370006 |
| 2327 childBox->setMayNeedPaintInvalidation(true); | 2325 childBox->setMayNeedPaintInvalidation(true); |
| 2328 | 2326 |
| 2329 LayoutUnit childLogicalLeftMargin = style()->isLeftToRightDirection() ?
marginStartForChild(childBox) : marginEndForChild(childBox); | 2327 LayoutUnit childLogicalLeftMargin = style()->isLeftToRightDirection() ?
marginStartForChild(childBox) : marginEndForChild(childBox); |
| 2330 LayoutRect oldRect = childBox->frameRect(); | 2328 LayoutRect oldRect = childBox->frameRect(); |
| 2331 | 2329 |
| 2332 if (childBox->style()->clear() & CLEFT) | 2330 if (childBox->style()->clear() & CLEFT) |
| 2333 logicalTop = max(lowestFloatLogicalBottom(FloatingObject::FloatLeft)
, logicalTop); | 2331 logicalTop = std::max(lowestFloatLogicalBottom(FloatingObject::Float
Left), logicalTop); |
| 2334 if (childBox->style()->clear() & CRIGHT) | 2332 if (childBox->style()->clear() & CRIGHT) |
| 2335 logicalTop = max(lowestFloatLogicalBottom(FloatingObject::FloatRight
), logicalTop); | 2333 logicalTop = std::max(lowestFloatLogicalBottom(FloatingObject::Float
Right), logicalTop); |
| 2336 | 2334 |
| 2337 LayoutPoint floatLogicalLocation = computeLogicalLocationForFloat(floati
ngObject, logicalTop); | 2335 LayoutPoint floatLogicalLocation = computeLogicalLocationForFloat(floati
ngObject, logicalTop); |
| 2338 | 2336 |
| 2339 setLogicalLeftForFloat(floatingObject, floatLogicalLocation.x()); | 2337 setLogicalLeftForFloat(floatingObject, floatLogicalLocation.x()); |
| 2340 | 2338 |
| 2341 setLogicalLeftForChild(childBox, floatLogicalLocation.x() + childLogical
LeftMargin); | 2339 setLogicalLeftForChild(childBox, floatLogicalLocation.x() + childLogical
LeftMargin); |
| 2342 setLogicalTopForChild(childBox, floatLogicalLocation.y() + marginBeforeF
orChild(childBox)); | 2340 setLogicalTopForChild(childBox, floatLogicalLocation.y() + marginBeforeF
orChild(childBox)); |
| 2343 | 2341 |
| 2344 SubtreeLayoutScope layoutScope(*childBox); | 2342 SubtreeLayoutScope layoutScope(*childBox); |
| 2345 LayoutState* layoutState = view()->layoutState(); | 2343 LayoutState* layoutState = view()->layoutState(); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2454 return; | 2452 return; |
| 2455 | 2453 |
| 2456 LayoutUnit childLogicalTop = child->logicalTop(); | 2454 LayoutUnit childLogicalTop = child->logicalTop(); |
| 2457 LayoutUnit childLogicalLeft = child->logicalLeft(); | 2455 LayoutUnit childLogicalLeft = child->logicalLeft(); |
| 2458 | 2456 |
| 2459 // Floats that will remain the child's responsibility to paint should factor
into its | 2457 // Floats that will remain the child's responsibility to paint should factor
into its |
| 2460 // overflow. | 2458 // overflow. |
| 2461 FloatingObjectSetIterator childEnd = child->m_floatingObjects->set().end(); | 2459 FloatingObjectSetIterator childEnd = child->m_floatingObjects->set().end(); |
| 2462 for (FloatingObjectSetIterator childIt = child->m_floatingObjects->set().beg
in(); childIt != childEnd; ++childIt) { | 2460 for (FloatingObjectSetIterator childIt = child->m_floatingObjects->set().beg
in(); childIt != childEnd; ++childIt) { |
| 2463 FloatingObject* floatingObject = childIt->get(); | 2461 FloatingObject* floatingObject = childIt->get(); |
| 2464 LayoutUnit logicalBottomForFloat = min(this->logicalBottomForFloat(float
ingObject), LayoutUnit::max() - childLogicalTop); | 2462 LayoutUnit logicalBottomForFloat = std::min(this->logicalBottomForFloat(
floatingObject), LayoutUnit::max() - childLogicalTop); |
| 2465 LayoutUnit logicalBottom = childLogicalTop + logicalBottomForFloat; | 2463 LayoutUnit logicalBottom = childLogicalTop + logicalBottomForFloat; |
| 2466 | 2464 |
| 2467 if (logicalBottom > logicalHeight()) { | 2465 if (logicalBottom > logicalHeight()) { |
| 2468 // If the object is not in the list, we add it now. | 2466 // If the object is not in the list, we add it now. |
| 2469 if (!containsFloat(floatingObject->renderer())) { | 2467 if (!containsFloat(floatingObject->renderer())) { |
| 2470 LayoutSize offset = isHorizontalWritingMode() ? LayoutSize(-chil
dLogicalLeft, -childLogicalTop) : LayoutSize(-childLogicalTop, -childLogicalLeft
); | 2468 LayoutSize offset = isHorizontalWritingMode() ? LayoutSize(-chil
dLogicalLeft, -childLogicalTop) : LayoutSize(-childLogicalTop, -childLogicalLeft
); |
| 2471 bool shouldPaint = false; | 2469 bool shouldPaint = false; |
| 2472 | 2470 |
| 2473 // The nearest enclosing layer always paints the float (so that
zindex and stacking | 2471 // The nearest enclosing layer always paints the float (so that
zindex and stacking |
| 2474 // behaves properly). We always want to propagate the desire to
paint the float as | 2472 // behaves properly). We always want to propagate the desire to
paint the float as |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2523 FloatingObject* floatingObject = it->get(); | 2521 FloatingObject* floatingObject = it->get(); |
| 2524 LayoutUnit floatLogicalBottom = logicalBottomForFloat(floatingObject); | 2522 LayoutUnit floatLogicalBottom = logicalBottomForFloat(floatingObject); |
| 2525 ShapeOutsideInfo* shapeOutside = floatingObject->renderer()->shapeOutsid
eInfo(); | 2523 ShapeOutsideInfo* shapeOutside = floatingObject->renderer()->shapeOutsid
eInfo(); |
| 2526 if (shapeOutside && (offsetMode == ShapeOutsideFloatShapeOffset)) { | 2524 if (shapeOutside && (offsetMode == ShapeOutsideFloatShapeOffset)) { |
| 2527 LayoutUnit shapeLogicalBottom = logicalTopForFloat(floatingObject) +
marginBeforeForChild(floatingObject->renderer()) + shapeOutside->shapeLogicalBo
ttom(); | 2525 LayoutUnit shapeLogicalBottom = logicalTopForFloat(floatingObject) +
marginBeforeForChild(floatingObject->renderer()) + shapeOutside->shapeLogicalBo
ttom(); |
| 2528 // Use the shapeLogicalBottom unless it extends outside of the margi
n box, in which case it is clipped. | 2526 // Use the shapeLogicalBottom unless it extends outside of the margi
n box, in which case it is clipped. |
| 2529 if (shapeLogicalBottom < floatLogicalBottom) | 2527 if (shapeLogicalBottom < floatLogicalBottom) |
| 2530 floatLogicalBottom = shapeLogicalBottom; | 2528 floatLogicalBottom = shapeLogicalBottom; |
| 2531 } | 2529 } |
| 2532 if (floatLogicalBottom > logicalHeight) | 2530 if (floatLogicalBottom > logicalHeight) |
| 2533 logicalBottom = logicalBottom ? min(floatLogicalBottom, logicalBotto
m) : floatLogicalBottom; | 2531 logicalBottom = logicalBottom ? std::min(floatLogicalBottom, logical
Bottom) : floatLogicalBottom; |
| 2534 } | 2532 } |
| 2535 | 2533 |
| 2536 return logicalBottom; | 2534 return logicalBottom; |
| 2537 } | 2535 } |
| 2538 | 2536 |
| 2539 bool RenderBlockFlow::hitTestFloats(const HitTestRequest& request, HitTestResult
& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumul
atedOffset) | 2537 bool RenderBlockFlow::hitTestFloats(const HitTestRequest& request, HitTestResult
& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumul
atedOffset) |
| 2540 { | 2538 { |
| 2541 if (!m_floatingObjects) | 2539 if (!m_floatingObjects) |
| 2542 return false; | 2540 return false; |
| 2543 | 2541 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2570 RenderBlock::adjustForBorderFit(x, left, right); | 2568 RenderBlock::adjustForBorderFit(x, left, right); |
| 2571 if (m_floatingObjects && style()->visibility() == VISIBLE) { | 2569 if (m_floatingObjects && style()->visibility() == VISIBLE) { |
| 2572 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 2570 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
| 2573 FloatingObjectSetIterator end = floatingObjectSet.end(); | 2571 FloatingObjectSetIterator end = floatingObjectSet.end(); |
| 2574 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end
; ++it) { | 2572 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end
; ++it) { |
| 2575 FloatingObject* floatingObject = it->get(); | 2573 FloatingObject* floatingObject = it->get(); |
| 2576 // Only examine the object if our m_shouldPaint flag is set. | 2574 // Only examine the object if our m_shouldPaint flag is set. |
| 2577 if (floatingObject->shouldPaint()) { | 2575 if (floatingObject->shouldPaint()) { |
| 2578 LayoutUnit floatLeft = xPositionForFloatIncludingMargin(floating
Object) - floatingObject->renderer()->x(); | 2576 LayoutUnit floatLeft = xPositionForFloatIncludingMargin(floating
Object) - floatingObject->renderer()->x(); |
| 2579 LayoutUnit floatRight = floatLeft + floatingObject->renderer()->
width(); | 2577 LayoutUnit floatRight = floatLeft + floatingObject->renderer()->
width(); |
| 2580 left = min(left, floatLeft); | 2578 left = std::min(left, floatLeft); |
| 2581 right = max(right, floatRight); | 2579 right = std::max(right, floatRight); |
| 2582 } | 2580 } |
| 2583 } | 2581 } |
| 2584 } | 2582 } |
| 2585 } | 2583 } |
| 2586 | 2584 |
| 2587 LayoutUnit RenderBlockFlow::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop,
LayoutUnit fixedOffset, LayoutUnit logicalHeight) const | 2585 LayoutUnit RenderBlockFlow::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop,
LayoutUnit fixedOffset, LayoutUnit logicalHeight) const |
| 2588 { | 2586 { |
| 2589 if (m_floatingObjects && m_floatingObjects->hasLeftObjects()) | 2587 if (m_floatingObjects && m_floatingObjects->hasLeftObjects()) |
| 2590 return m_floatingObjects->logicalLeftOffset(fixedOffset, logicalTop, log
icalHeight); | 2588 return m_floatingObjects->logicalLeftOffset(fixedOffset, logicalTop, log
icalHeight); |
| 2591 | 2589 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2803 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() | 2801 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() |
| 2804 { | 2802 { |
| 2805 if (m_rareData) | 2803 if (m_rareData) |
| 2806 return *m_rareData; | 2804 return *m_rareData; |
| 2807 | 2805 |
| 2808 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); | 2806 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); |
| 2809 return *m_rareData; | 2807 return *m_rareData; |
| 2810 } | 2808 } |
| 2811 | 2809 |
| 2812 } // namespace WebCore | 2810 } // namespace WebCore |
| OLD | NEW |