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 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 void LayoutBlockFlow::rebuildFloatsFromIntruding() | 888 void LayoutBlockFlow::rebuildFloatsFromIntruding() |
889 { | 889 { |
890 if (m_floatingObjects) | 890 if (m_floatingObjects) |
891 m_floatingObjects->setHorizontalWritingMode(isHorizontalWritingMode()); | 891 m_floatingObjects->setHorizontalWritingMode(isHorizontalWritingMode()); |
892 | 892 |
893 HashSet<LayoutBox*> oldIntrudingFloatSet; | 893 HashSet<LayoutBox*> oldIntrudingFloatSet; |
894 if (!childrenInline() && m_floatingObjects) { | 894 if (!childrenInline() && m_floatingObjects) { |
895 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 895 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
896 FloatingObjectSetIterator end = floatingObjectSet.end(); | 896 FloatingObjectSetIterator end = floatingObjectSet.end(); |
897 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end
; ++it) { | 897 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end
; ++it) { |
898 FloatingObject* floatingObject = it->get(); | 898 const FloatingObject& floatingObject = *it->get(); |
899 if (!floatingObject->isDescendant()) | 899 if (!floatingObject.isDescendant()) |
900 oldIntrudingFloatSet.add(floatingObject->layoutObject()); | 900 oldIntrudingFloatSet.add(floatingObject.layoutObject()); |
901 } | 901 } |
902 } | 902 } |
903 | 903 |
904 // Inline blocks are covered by the isReplaced() check in the avoidFloats me
thod. | 904 // Inline blocks are covered by the isReplaced() check in the avoidFloats me
thod. |
905 if (avoidsFloats() || isDocumentElement() || isLayoutView() || isFloatingOrO
utOfFlowPositioned() || isTableCell()) { | 905 if (avoidsFloats() || isDocumentElement() || isLayoutView() || isFloatingOrO
utOfFlowPositioned() || isTableCell()) { |
906 if (m_floatingObjects) { | 906 if (m_floatingObjects) { |
907 m_floatingObjects->clear(); | 907 m_floatingObjects->clear(); |
908 } | 908 } |
909 if (!oldIntrudingFloatSet.isEmpty()) | 909 if (!oldIntrudingFloatSet.isEmpty()) |
910 markAllDescendantsWithFloatsForLayout(); | 910 markAllDescendantsWithFloatsForLayout(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 addIntrudingFloats(blockFlow, 0, logicalTopOffset); | 953 addIntrudingFloats(blockFlow, 0, logicalTopOffset); |
954 } | 954 } |
955 | 955 |
956 if (childrenInline()) { | 956 if (childrenInline()) { |
957 LayoutUnit changeLogicalTop = LayoutUnit::max(); | 957 LayoutUnit changeLogicalTop = LayoutUnit::max(); |
958 LayoutUnit changeLogicalBottom = LayoutUnit::min(); | 958 LayoutUnit changeLogicalBottom = LayoutUnit::min(); |
959 if (m_floatingObjects) { | 959 if (m_floatingObjects) { |
960 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(
); | 960 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(
); |
961 FloatingObjectSetIterator end = floatingObjectSet.end(); | 961 FloatingObjectSetIterator end = floatingObjectSet.end(); |
962 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it !=
end; ++it) { | 962 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it !=
end; ++it) { |
963 FloatingObject* floatingObject = it->get(); | 963 const FloatingObject& floatingObject = *it->get(); |
964 FloatingObject* oldFloatingObject = floatMap.get(floatingObject-
>layoutObject()); | 964 FloatingObject* oldFloatingObject = floatMap.get(floatingObject.
layoutObject()); |
965 LayoutUnit logicalBottom = logicalBottomForFloat(floatingObject)
; | 965 LayoutUnit logicalBottom = logicalBottomForFloat(floatingObject)
; |
966 if (oldFloatingObject) { | 966 if (oldFloatingObject) { |
967 LayoutUnit oldLogicalBottom = logicalBottomForFloat(oldFloat
ingObject); | 967 LayoutUnit oldLogicalBottom = logicalBottomForFloat(*oldFloa
tingObject); |
968 if (logicalWidthForFloat(floatingObject) != logicalWidthForF
loat(oldFloatingObject) || logicalLeftForFloat(floatingObject) != logicalLeftFor
Float(oldFloatingObject)) { | 968 if (logicalWidthForFloat(floatingObject) != logicalWidthForF
loat(*oldFloatingObject) || logicalLeftForFloat(floatingObject) != logicalLeftFo
rFloat(*oldFloatingObject)) { |
969 changeLogicalTop = 0; | 969 changeLogicalTop = 0; |
970 changeLogicalBottom = std::max(changeLogicalBottom, std:
:max(logicalBottom, oldLogicalBottom)); | 970 changeLogicalBottom = std::max(changeLogicalBottom, std:
:max(logicalBottom, oldLogicalBottom)); |
971 } else { | 971 } else { |
972 if (logicalBottom != oldLogicalBottom) { | 972 if (logicalBottom != oldLogicalBottom) { |
973 changeLogicalTop = std::min(changeLogicalTop, std::m
in(logicalBottom, oldLogicalBottom)); | 973 changeLogicalTop = std::min(changeLogicalTop, std::m
in(logicalBottom, oldLogicalBottom)); |
974 changeLogicalBottom = std::max(changeLogicalBottom,
std::max(logicalBottom, oldLogicalBottom)); | 974 changeLogicalBottom = std::max(changeLogicalBottom,
std::max(logicalBottom, oldLogicalBottom)); |
975 } | 975 } |
976 LayoutUnit logicalTop = logicalTopForFloat(floatingObjec
t); | 976 LayoutUnit logicalTop = logicalTopForFloat(floatingObjec
t); |
977 LayoutUnit oldLogicalTop = logicalTopForFloat(oldFloatin
gObject); | 977 LayoutUnit oldLogicalTop = logicalTopForFloat(*oldFloati
ngObject); |
978 if (logicalTop != oldLogicalTop) { | 978 if (logicalTop != oldLogicalTop) { |
979 changeLogicalTop = std::min(changeLogicalTop, std::m
in(logicalTop, oldLogicalTop)); | 979 changeLogicalTop = std::min(changeLogicalTop, std::m
in(logicalTop, oldLogicalTop)); |
980 changeLogicalBottom = std::max(changeLogicalBottom,
std::max(logicalTop, oldLogicalTop)); | 980 changeLogicalBottom = std::max(changeLogicalBottom,
std::max(logicalTop, oldLogicalTop)); |
981 } | 981 } |
982 } | 982 } |
983 | 983 |
984 if (oldFloatingObject->originatingLine() && !selfNeedsLayout
()) { | 984 if (oldFloatingObject->originatingLine() && !selfNeedsLayout
()) { |
985 ASSERT(oldFloatingObject->originatingLine()->layoutObjec
t() == this); | 985 ASSERT(oldFloatingObject->originatingLine()->layoutObjec
t() == this); |
986 oldFloatingObject->originatingLine()->markDirty(); | 986 oldFloatingObject->originatingLine()->markDirty(); |
987 } | 987 } |
988 | 988 |
989 floatMap.remove(floatingObject->layoutObject()); | 989 floatMap.remove(floatingObject.layoutObject()); |
990 } else { | 990 } else { |
991 changeLogicalTop = 0; | 991 changeLogicalTop = 0; |
992 changeLogicalBottom = std::max(changeLogicalBottom, logicalB
ottom); | 992 changeLogicalBottom = std::max(changeLogicalBottom, logicalB
ottom); |
993 } | 993 } |
994 } | 994 } |
995 } | 995 } |
996 | 996 |
997 LayoutBoxToFloatInfoMap::iterator end = floatMap.end(); | 997 LayoutBoxToFloatInfoMap::iterator end = floatMap.end(); |
998 for (LayoutBoxToFloatInfoMap::iterator it = floatMap.begin(); it != end;
++it) { | 998 for (LayoutBoxToFloatInfoMap::iterator it = floatMap.begin(); it != end;
++it) { |
999 OwnPtr<FloatingObject>& floatingObject = it->value; | 999 OwnPtr<FloatingObject>& floatingObject = it->value; |
1000 if (!floatingObject->isDescendant()) { | 1000 if (!floatingObject->isDescendant()) { |
1001 changeLogicalTop = 0; | 1001 changeLogicalTop = 0; |
1002 changeLogicalBottom = std::max(changeLogicalBottom, logicalBotto
mForFloat(floatingObject.get())); | 1002 changeLogicalBottom = std::max(changeLogicalBottom, logicalBotto
mForFloat(*floatingObject)); |
1003 } | 1003 } |
1004 } | 1004 } |
1005 | 1005 |
1006 markLinesDirtyInBlockRange(changeLogicalTop, changeLogicalBottom); | 1006 markLinesDirtyInBlockRange(changeLogicalTop, changeLogicalBottom); |
1007 } else if (!oldIntrudingFloatSet.isEmpty()) { | 1007 } else if (!oldIntrudingFloatSet.isEmpty()) { |
1008 // If there are previously intruding floats that no longer intrude, then
children with floats | 1008 // If there are previously intruding floats that no longer intrude, then
children with floats |
1009 // should also get layout because they might need their floating object
lists cleared. | 1009 // should also get layout because they might need their floating object
lists cleared. |
1010 if (m_floatingObjects->set().size() < oldIntrudingFloatSet.size()) { | 1010 if (m_floatingObjects->set().size() < oldIntrudingFloatSet.size()) { |
1011 markAllDescendantsWithFloatsForLayout(); | 1011 markAllDescendantsWithFloatsForLayout(); |
1012 } else { | 1012 } else { |
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1779 } | 1779 } |
1780 | 1780 |
1781 void LayoutBlockFlow::addOverflowFromFloats() | 1781 void LayoutBlockFlow::addOverflowFromFloats() |
1782 { | 1782 { |
1783 if (!m_floatingObjects) | 1783 if (!m_floatingObjects) |
1784 return; | 1784 return; |
1785 | 1785 |
1786 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 1786 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
1787 FloatingObjectSetIterator end = floatingObjectSet.end(); | 1787 FloatingObjectSetIterator end = floatingObjectSet.end(); |
1788 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { | 1788 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { |
1789 FloatingObject* floatingObject = it->get(); | 1789 const FloatingObject& floatingObject = *it->get(); |
1790 if (floatingObject->isDescendant()) | 1790 if (floatingObject.isDescendant()) |
1791 addOverflowFromChild(floatingObject->layoutObject(), LayoutSize(xPos
itionForFloatIncludingMargin(floatingObject), yPositionForFloatIncludingMargin(f
loatingObject))); | 1791 addOverflowFromChild(floatingObject.layoutObject(), LayoutSize(xPosi
tionForFloatIncludingMargin(floatingObject), yPositionForFloatIncludingMargin(fl
oatingObject))); |
1792 } | 1792 } |
1793 } | 1793 } |
1794 | 1794 |
1795 void LayoutBlockFlow::computeOverflow(LayoutUnit oldClientAfterEdge, bool recomp
uteFloats) | 1795 void LayoutBlockFlow::computeOverflow(LayoutUnit oldClientAfterEdge, bool recomp
uteFloats) |
1796 { | 1796 { |
1797 LayoutBlock::computeOverflow(oldClientAfterEdge, recomputeFloats); | 1797 LayoutBlock::computeOverflow(oldClientAfterEdge, recomputeFloats); |
1798 if (!hasColumns() && (recomputeFloats || createsNewFormattingContext() || ha
sSelfPaintingLayer())) | 1798 if (!hasColumns() && (recomputeFloats || createsNewFormattingContext() || ha
sSelfPaintingLayer())) |
1799 addOverflowFromFloats(); | 1799 addOverflowFromFloats(); |
1800 } | 1800 } |
1801 | 1801 |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2047 // displayed. | 2047 // displayed. |
2048 // See bug https://code.google.com/p/chromium/issues/detail?id=230907 | 2048 // See bug https://code.google.com/p/chromium/issues/detail?id=230907 |
2049 if (m_floatingObjects) { | 2049 if (m_floatingObjects) { |
2050 if (!toBlockFlow->m_floatingObjects) | 2050 if (!toBlockFlow->m_floatingObjects) |
2051 toBlockFlow->createFloatingObjects(); | 2051 toBlockFlow->createFloatingObjects(); |
2052 | 2052 |
2053 const FloatingObjectSet& fromFloatingObjectSet = m_floatingObjects->set(
); | 2053 const FloatingObjectSet& fromFloatingObjectSet = m_floatingObjects->set(
); |
2054 FloatingObjectSetIterator end = fromFloatingObjectSet.end(); | 2054 FloatingObjectSetIterator end = fromFloatingObjectSet.end(); |
2055 | 2055 |
2056 for (FloatingObjectSetIterator it = fromFloatingObjectSet.begin(); it !=
end; ++it) { | 2056 for (FloatingObjectSetIterator it = fromFloatingObjectSet.begin(); it !=
end; ++it) { |
2057 FloatingObject* floatingObject = it->get(); | 2057 const FloatingObject& floatingObject = *it->get(); |
2058 | 2058 |
2059 // Don't insert the object again if it's already in the list | 2059 // Don't insert the object again if it's already in the list |
2060 if (toBlockFlow->containsFloat(floatingObject->layoutObject())) | 2060 if (toBlockFlow->containsFloat(floatingObject.layoutObject())) |
2061 continue; | 2061 continue; |
2062 | 2062 |
2063 toBlockFlow->m_floatingObjects->add(floatingObject->unsafeClone()); | 2063 toBlockFlow->m_floatingObjects->add(floatingObject.unsafeClone()); |
2064 } | 2064 } |
2065 } | 2065 } |
2066 | 2066 |
2067 } | 2067 } |
2068 | 2068 |
2069 void LayoutBlockFlow::invalidatePaintForOverhangingFloats(bool paintAllDescendan
ts) | 2069 void LayoutBlockFlow::invalidatePaintForOverhangingFloats(bool paintAllDescendan
ts) |
2070 { | 2070 { |
2071 // Invalidate paint of any overhanging floats (if we know we're the one to p
aint them). | 2071 // Invalidate paint of any overhanging floats (if we know we're the one to p
aint them). |
2072 // Otherwise, bail out. | 2072 // Otherwise, bail out. |
2073 if (!hasOverhangingFloats()) | 2073 if (!hasOverhangingFloats()) |
2074 return; | 2074 return; |
2075 | 2075 |
2076 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 2076 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
2077 FloatingObjectSetIterator end = floatingObjectSet.end(); | 2077 FloatingObjectSetIterator end = floatingObjectSet.end(); |
2078 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { | 2078 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { |
2079 FloatingObject* floatingObject = it->get(); | 2079 const FloatingObject& floatingObject = *it->get(); |
2080 // Only issue paint invaldiations for the object if it is overhanging, i
s not in its own layer, and | 2080 // Only issue paint invaldiations for the object if it is overhanging, i
s not in its own layer, and |
2081 // is our responsibility to paint (m_shouldPaint is set). When paintAllD
escendants is true, the latter | 2081 // is our responsibility to paint (m_shouldPaint is set). When paintAllD
escendants is true, the latter |
2082 // condition is replaced with being a descendant of us. | 2082 // condition is replaced with being a descendant of us. |
2083 if (logicalBottomForFloat(floatingObject) > logicalHeight() | 2083 if (logicalBottomForFloat(floatingObject) > logicalHeight() |
2084 && !floatingObject->layoutObject()->hasSelfPaintingLayer() | 2084 && !floatingObject.layoutObject()->hasSelfPaintingLayer() |
2085 && (floatingObject->shouldPaint() || (paintAllDescendants && floatin
gObject->layoutObject()->isDescendantOf(this)))) { | 2085 && (floatingObject.shouldPaint() || (paintAllDescendants && floating
Object.layoutObject()->isDescendantOf(this)))) { |
2086 | 2086 |
2087 LayoutBox* floatingLayoutBox = floatingObject->layoutObject(); | 2087 LayoutBox* floatingLayoutBox = floatingObject.layoutObject(); |
2088 floatingLayoutBox->setShouldDoFullPaintInvalidation(); | 2088 floatingLayoutBox->setShouldDoFullPaintInvalidation(); |
2089 floatingLayoutBox->invalidatePaintForOverhangingFloats(false); | 2089 floatingLayoutBox->invalidatePaintForOverhangingFloats(false); |
2090 } | 2090 } |
2091 } | 2091 } |
2092 } | 2092 } |
2093 | 2093 |
2094 void LayoutBlockFlow::invalidatePaintForOverflow() | 2094 void LayoutBlockFlow::invalidatePaintForOverflow() |
2095 { | 2095 { |
2096 // FIXME: We could tighten up the left and right invalidation points if we l
et layoutInlineChildren fill them in based off the particular lines | 2096 // FIXME: We could tighten up the left and right invalidation points if we l
et layoutInlineChildren fill them in based off the particular lines |
2097 // it had to lay out. We wouldn't need the hasOverflowClip() hack in that ca
se either. | 2097 // it had to lay out. We wouldn't need the hasOverflowClip() hack in that ca
se either. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2148 | 2148 |
2149 void LayoutBlockFlow::clipOutFloatingObjects(const LayoutBlock* rootBlock, ClipS
cope& clipScope, | 2149 void LayoutBlockFlow::clipOutFloatingObjects(const LayoutBlock* rootBlock, ClipS
cope& clipScope, |
2150 const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRo
otBlock) const | 2150 const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRo
otBlock) const |
2151 { | 2151 { |
2152 if (!m_floatingObjects) | 2152 if (!m_floatingObjects) |
2153 return; | 2153 return; |
2154 | 2154 |
2155 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 2155 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
2156 FloatingObjectSetIterator end = floatingObjectSet.end(); | 2156 FloatingObjectSetIterator end = floatingObjectSet.end(); |
2157 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { | 2157 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { |
2158 FloatingObject* floatingObject = it->get(); | 2158 const FloatingObject& floatingObject = *it->get(); |
2159 LayoutRect floatBox(LayoutPoint(offsetFromRootBlock), floatingObject->la
youtObject()->size()); | 2159 LayoutRect floatBox(LayoutPoint(offsetFromRootBlock), floatingObject.lay
outObject()->size()); |
2160 floatBox.move(positionForFloatIncludingMargin(floatingObject)); | 2160 floatBox.move(positionForFloatIncludingMargin(floatingObject)); |
2161 rootBlock->flipForWritingMode(floatBox); | 2161 rootBlock->flipForWritingMode(floatBox); |
2162 floatBox.move(rootBlockPhysicalPosition.x(), rootBlockPhysicalPosition.y
()); | 2162 floatBox.move(rootBlockPhysicalPosition.x(), rootBlockPhysicalPosition.y
()); |
2163 | 2163 |
2164 clipScope.clip(floatBox, SkRegion::kDifference_Op); | 2164 clipScope.clip(floatBox, SkRegion::kDifference_Op); |
2165 } | 2165 } |
2166 } | 2166 } |
2167 | 2167 |
2168 void LayoutBlockFlow::clearFloats(EClear clear) | 2168 void LayoutBlockFlow::clearFloats(EClear clear) |
2169 { | 2169 { |
(...skipping 24 matching lines...) Expand all Loading... |
2194 void LayoutBlockFlow::removeFloatingObjects() | 2194 void LayoutBlockFlow::removeFloatingObjects() |
2195 { | 2195 { |
2196 if (!m_floatingObjects) | 2196 if (!m_floatingObjects) |
2197 return; | 2197 return; |
2198 | 2198 |
2199 markSiblingsWithFloatsForLayout(); | 2199 markSiblingsWithFloatsForLayout(); |
2200 | 2200 |
2201 m_floatingObjects->clear(); | 2201 m_floatingObjects->clear(); |
2202 } | 2202 } |
2203 | 2203 |
2204 LayoutPoint LayoutBlockFlow::flipFloatForWritingModeForChild(const FloatingObjec
t* child, const LayoutPoint& point) const | 2204 LayoutPoint LayoutBlockFlow::flipFloatForWritingModeForChild(const FloatingObjec
t& child, const LayoutPoint& point) const |
2205 { | 2205 { |
2206 if (!style()->isFlippedBlocksWritingMode()) | 2206 if (!style()->isFlippedBlocksWritingMode()) |
2207 return point; | 2207 return point; |
2208 | 2208 |
2209 // This is similar to LayoutBox::flipForWritingModeForChild. We have to subt
ract out our left/top offsets twice, since | 2209 // This is similar to LayoutBox::flipForWritingModeForChild. We have to subt
ract out our left/top offsets twice, since |
2210 // it's going to get added back in. We hide this complication here so that t
he calling code looks normal for the unflipped | 2210 // it's going to get added back in. We hide this complication here so that t
he calling code looks normal for the unflipped |
2211 // case. | 2211 // case. |
2212 if (isHorizontalWritingMode()) | 2212 if (isHorizontalWritingMode()) |
2213 return LayoutPoint(point.x(), point.y() + size().height() - child->layou
tObject()->size().height() - 2 * yPositionForFloatIncludingMargin(child)); | 2213 return LayoutPoint(point.x(), point.y() + size().height() - child.layout
Object()->size().height() - 2 * yPositionForFloatIncludingMargin(child)); |
2214 return LayoutPoint(point.x() + size().width() - child->layoutObject()->size(
).width() - 2 * xPositionForFloatIncludingMargin(child), point.y()); | 2214 return LayoutPoint(point.x() + size().width() - child.layoutObject()->size()
.width() - 2 * xPositionForFloatIncludingMargin(child), point.y()); |
2215 } | 2215 } |
2216 | 2216 |
2217 LayoutUnit LayoutBlockFlow::logicalLeftOffsetForPositioningFloat(LayoutUnit logi
calTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemainin
g) const | 2217 LayoutUnit LayoutBlockFlow::logicalLeftOffsetForPositioningFloat(LayoutUnit logi
calTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemainin
g) const |
2218 { | 2218 { |
2219 LayoutUnit offset = fixedOffset; | 2219 LayoutUnit offset = fixedOffset; |
2220 if (m_floatingObjects && m_floatingObjects->hasLeftObjects()) | 2220 if (m_floatingObjects && m_floatingObjects->hasLeftObjects()) |
2221 offset = m_floatingObjects->logicalLeftOffsetForPositioningFloat(fixedOf
fset, logicalTop, heightRemaining); | 2221 offset = m_floatingObjects->logicalLeftOffsetForPositioningFloat(fixedOf
fset, logicalTop, heightRemaining); |
2222 return adjustLogicalLeftOffsetForLine(offset, applyTextIndent); | 2222 return adjustLogicalLeftOffsetForLine(offset, applyTextIndent); |
2223 } | 2223 } |
2224 | 2224 |
(...skipping 18 matching lines...) Expand all Loading... |
2243 LayoutUnit LayoutBlockFlow::adjustLogicalRightOffsetForLine(LayoutUnit offsetFro
mFloats, bool applyTextIndent) const | 2243 LayoutUnit LayoutBlockFlow::adjustLogicalRightOffsetForLine(LayoutUnit offsetFro
mFloats, bool applyTextIndent) const |
2244 { | 2244 { |
2245 LayoutUnit right = offsetFromFloats; | 2245 LayoutUnit right = offsetFromFloats; |
2246 | 2246 |
2247 if (applyTextIndent && !style()->isLeftToRightDirection()) | 2247 if (applyTextIndent && !style()->isLeftToRightDirection()) |
2248 right -= textIndentOffset(); | 2248 right -= textIndentOffset(); |
2249 | 2249 |
2250 return right; | 2250 return right; |
2251 } | 2251 } |
2252 | 2252 |
2253 LayoutPoint LayoutBlockFlow::computeLogicalLocationForFloat(const FloatingObject
* floatingObject, LayoutUnit logicalTopOffset) const | 2253 LayoutPoint LayoutBlockFlow::computeLogicalLocationForFloat(const FloatingObject
& floatingObject, LayoutUnit logicalTopOffset) const |
2254 { | 2254 { |
2255 LayoutBox* childBox = floatingObject->layoutObject(); | 2255 LayoutBox* childBox = floatingObject.layoutObject(); |
2256 LayoutUnit logicalLeftOffset = logicalLeftOffsetForContent(); // Constant pa
rt of left offset. | 2256 LayoutUnit logicalLeftOffset = logicalLeftOffsetForContent(); // Constant pa
rt of left offset. |
2257 LayoutUnit logicalRightOffset; // Constant part of right offset. | 2257 LayoutUnit logicalRightOffset; // Constant part of right offset. |
2258 logicalRightOffset = logicalRightOffsetForContent(); | 2258 logicalRightOffset = logicalRightOffsetForContent(); |
2259 | 2259 |
2260 LayoutUnit floatLogicalWidth = std::min(logicalWidthForFloat(floatingObject)
, logicalRightOffset - logicalLeftOffset); // The width we look for. | 2260 LayoutUnit floatLogicalWidth = std::min(logicalWidthForFloat(floatingObject)
, logicalRightOffset - logicalLeftOffset); // The width we look for. |
2261 | 2261 |
2262 LayoutUnit floatLogicalLeft; | 2262 LayoutUnit floatLogicalLeft; |
2263 | 2263 |
2264 bool insideFlowThread = flowThreadContainingBlock(); | 2264 bool insideFlowThread = flowThreadContainingBlock(); |
2265 | 2265 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2327 floatBox.setChildNeedsLayout(MarkOnlyThis); | 2327 floatBox.setChildNeedsLayout(MarkOnlyThis); |
2328 | 2328 |
2329 bool needsBlockDirectionLocationSetBeforeLayout = isChildLayoutBlock && view
()->layoutState()->needsBlockDirectionLocationSetBeforeLayout(); | 2329 bool needsBlockDirectionLocationSetBeforeLayout = isChildLayoutBlock && view
()->layoutState()->needsBlockDirectionLocationSetBeforeLayout(); |
2330 if (!needsBlockDirectionLocationSetBeforeLayout || isWritingModeRoot()) { //
We are unsplittable if we're a block flow root. | 2330 if (!needsBlockDirectionLocationSetBeforeLayout || isWritingModeRoot()) { //
We are unsplittable if we're a block flow root. |
2331 floatBox.layoutIfNeeded(); | 2331 floatBox.layoutIfNeeded(); |
2332 } else { | 2332 } else { |
2333 floatBox.updateLogicalWidth(); | 2333 floatBox.updateLogicalWidth(); |
2334 floatBox.computeAndSetBlockDirectionMargins(this); | 2334 floatBox.computeAndSetBlockDirectionMargins(this); |
2335 } | 2335 } |
2336 | 2336 |
2337 setLogicalWidthForFloat(newObj.get(), logicalWidthForChild(floatBox) + margi
nStartForChild(floatBox) + marginEndForChild(floatBox)); | 2337 setLogicalWidthForFloat(*newObj, logicalWidthForChild(floatBox) + marginStar
tForChild(floatBox) + marginEndForChild(floatBox)); |
2338 | 2338 |
2339 return m_floatingObjects->add(newObj.release()); | 2339 return m_floatingObjects->add(newObj.release()); |
2340 } | 2340 } |
2341 | 2341 |
2342 void LayoutBlockFlow::removeFloatingObject(LayoutBox* floatBox) | 2342 void LayoutBlockFlow::removeFloatingObject(LayoutBox* floatBox) |
2343 { | 2343 { |
2344 if (m_floatingObjects) { | 2344 if (m_floatingObjects) { |
2345 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 2345 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
2346 FloatingObjectSetIterator it = floatingObjectSet.find<FloatingObjectHash
Translator>(floatBox); | 2346 FloatingObjectSetIterator it = floatingObjectSet.find<FloatingObjectHash
Translator>(floatBox); |
2347 if (it != floatingObjectSet.end()) { | 2347 if (it != floatingObjectSet.end()) { |
2348 FloatingObject* floatingObject = it->get(); | 2348 FloatingObject& floatingObject = *it->get(); |
2349 if (childrenInline()) { | 2349 if (childrenInline()) { |
2350 LayoutUnit logicalTop = logicalTopForFloat(floatingObject); | 2350 LayoutUnit logicalTop = logicalTopForFloat(floatingObject); |
2351 LayoutUnit logicalBottom = logicalBottomForFloat(floatingObject)
; | 2351 LayoutUnit logicalBottom = logicalBottomForFloat(floatingObject)
; |
2352 | 2352 |
2353 // Fix for https://bugs.webkit.org/show_bug.cgi?id=54995. | 2353 // Fix for https://bugs.webkit.org/show_bug.cgi?id=54995. |
2354 if (logicalBottom < 0 || logicalBottom < logicalTop || logicalTo
p == LayoutUnit::max()) { | 2354 if (logicalBottom < 0 || logicalBottom < logicalTop || logicalTo
p == LayoutUnit::max()) { |
2355 logicalBottom = LayoutUnit::max(); | 2355 logicalBottom = LayoutUnit::max(); |
2356 } else { | 2356 } else { |
2357 // Special-case zero- and less-than-zero-height floats: thos
e don't touch | 2357 // Special-case zero- and less-than-zero-height floats: thos
e don't touch |
2358 // the line that they're on, but it still needs to be dirtie
d. This is | 2358 // the line that they're on, but it still needs to be dirtie
d. This is |
2359 // accomplished by pretending they have a height of 1. | 2359 // accomplished by pretending they have a height of 1. |
2360 logicalBottom = std::max(logicalBottom, logicalTop + 1); | 2360 logicalBottom = std::max(logicalBottom, logicalTop + 1); |
2361 } | 2361 } |
2362 if (floatingObject->originatingLine()) { | 2362 if (floatingObject.originatingLine()) { |
2363 if (!selfNeedsLayout()) { | 2363 if (!selfNeedsLayout()) { |
2364 ASSERT(floatingObject->originatingLine()->layoutObject()
== this); | 2364 ASSERT(floatingObject.originatingLine()->layoutObject()
== this); |
2365 floatingObject->originatingLine()->markDirty(); | 2365 floatingObject.originatingLine()->markDirty(); |
2366 } | 2366 } |
2367 #if ENABLE(ASSERT) | 2367 #if ENABLE(ASSERT) |
2368 floatingObject->setOriginatingLine(0); | 2368 floatingObject.setOriginatingLine(0); |
2369 #endif | 2369 #endif |
2370 } | 2370 } |
2371 markLinesDirtyInBlockRange(0, logicalBottom); | 2371 markLinesDirtyInBlockRange(0, logicalBottom); |
2372 } | 2372 } |
2373 m_floatingObjects->remove(floatingObject); | 2373 m_floatingObjects->remove(&floatingObject); |
2374 } | 2374 } |
2375 } | 2375 } |
2376 } | 2376 } |
2377 | 2377 |
2378 void LayoutBlockFlow::removeFloatingObjectsBelow(FloatingObject* lastFloat, int
logicalOffset) | 2378 void LayoutBlockFlow::removeFloatingObjectsBelow(FloatingObject* lastFloat, int
logicalOffset) |
2379 { | 2379 { |
2380 if (!containsFloats()) | 2380 if (!containsFloats()) |
2381 return; | 2381 return; |
2382 | 2382 |
2383 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 2383 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
2384 FloatingObject* curr = floatingObjectSet.last().get(); | 2384 FloatingObject* curr = floatingObjectSet.last().get(); |
2385 while (curr != lastFloat && (!curr->isPlaced() || logicalTopForFloat(curr) >
= logicalOffset)) { | 2385 while (curr != lastFloat && (!curr->isPlaced() || logicalTopForFloat(*curr)
>= logicalOffset)) { |
2386 m_floatingObjects->remove(curr); | 2386 m_floatingObjects->remove(curr); |
2387 if (floatingObjectSet.isEmpty()) | 2387 if (floatingObjectSet.isEmpty()) |
2388 break; | 2388 break; |
2389 curr = floatingObjectSet.last().get(); | 2389 curr = floatingObjectSet.last().get(); |
2390 } | 2390 } |
2391 } | 2391 } |
2392 | 2392 |
2393 bool LayoutBlockFlow::positionNewFloats(LineWidth* width) | 2393 bool LayoutBlockFlow::positionNewFloats(LineWidth* width) |
2394 { | 2394 { |
2395 if (!m_floatingObjects) | 2395 if (!m_floatingObjects) |
(...skipping 20 matching lines...) Expand all Loading... |
2416 lastPlacedFloatingObject = it->get(); | 2416 lastPlacedFloatingObject = it->get(); |
2417 ++it; | 2417 ++it; |
2418 break; | 2418 break; |
2419 } | 2419 } |
2420 } | 2420 } |
2421 | 2421 |
2422 LayoutUnit logicalTop = logicalHeight(); | 2422 LayoutUnit logicalTop = logicalHeight(); |
2423 | 2423 |
2424 // The float cannot start above the top position of the last positioned floa
t. | 2424 // The float cannot start above the top position of the last positioned floa
t. |
2425 if (lastPlacedFloatingObject) | 2425 if (lastPlacedFloatingObject) |
2426 logicalTop = std::max(logicalTopForFloat(lastPlacedFloatingObject), logi
calTop); | 2426 logicalTop = std::max(logicalTopForFloat(*lastPlacedFloatingObject), log
icalTop); |
2427 | 2427 |
2428 FloatingObjectSetIterator end = floatingObjectSet.end(); | 2428 FloatingObjectSetIterator end = floatingObjectSet.end(); |
2429 // Now walk through the set of unpositioned floats and place them. | 2429 // Now walk through the set of unpositioned floats and place them. |
2430 for (; it != end; ++it) { | 2430 for (; it != end; ++it) { |
2431 FloatingObject* floatingObject = it->get(); | 2431 FloatingObject& floatingObject = *it->get(); |
2432 // The containing block is responsible for positioning floats, so if we
have floats in our | 2432 // The containing block is responsible for positioning floats, so if we
have floats in our |
2433 // list that come from somewhere else, do not attempt to position them. | 2433 // list that come from somewhere else, do not attempt to position them. |
2434 if (floatingObject->layoutObject()->containingBlock() != this) | 2434 if (floatingObject.layoutObject()->containingBlock() != this) |
2435 continue; | 2435 continue; |
2436 | 2436 |
2437 LayoutBox* childBox = floatingObject->layoutObject(); | 2437 LayoutBox* childBox = floatingObject.layoutObject(); |
2438 | 2438 |
2439 // FIXME Investigate if this can be removed. crbug.com/370006 | 2439 // FIXME Investigate if this can be removed. crbug.com/370006 |
2440 childBox->setMayNeedPaintInvalidation(); | 2440 childBox->setMayNeedPaintInvalidation(); |
2441 | 2441 |
2442 LayoutUnit childLogicalLeftMargin = style()->isLeftToRightDirection() ?
marginStartForChild(*childBox) : marginEndForChild(*childBox); | 2442 LayoutUnit childLogicalLeftMargin = style()->isLeftToRightDirection() ?
marginStartForChild(*childBox) : marginEndForChild(*childBox); |
2443 if (childBox->style()->clear() & CLEFT) | 2443 if (childBox->style()->clear() & CLEFT) |
2444 logicalTop = std::max(lowestFloatLogicalBottom(FloatingObject::Float
Left), logicalTop); | 2444 logicalTop = std::max(lowestFloatLogicalBottom(FloatingObject::Float
Left), logicalTop); |
2445 if (childBox->style()->clear() & CRIGHT) | 2445 if (childBox->style()->clear() & CRIGHT) |
2446 logicalTop = std::max(lowestFloatLogicalBottom(FloatingObject::Float
Right), logicalTop); | 2446 logicalTop = std::max(lowestFloatLogicalBottom(FloatingObject::Float
Right), logicalTop); |
2447 | 2447 |
(...skipping 20 matching lines...) Expand all Loading... |
2468 // See if we have a pagination strut that is making us move down fur
ther. | 2468 // See if we have a pagination strut that is making us move down fur
ther. |
2469 // Note that an unsplittable child can't also have a pagination stru
t, so this is | 2469 // Note that an unsplittable child can't also have a pagination stru
t, so this is |
2470 // exclusive with the case above. | 2470 // exclusive with the case above. |
2471 LayoutBlockFlow* childBlockFlow = childBox->isLayoutBlockFlow() ? to
LayoutBlockFlow(childBox) : 0; | 2471 LayoutBlockFlow* childBlockFlow = childBox->isLayoutBlockFlow() ? to
LayoutBlockFlow(childBox) : 0; |
2472 if (childBlockFlow && childBlockFlow->paginationStrut()) { | 2472 if (childBlockFlow && childBlockFlow->paginationStrut()) { |
2473 newLogicalTop += childBlockFlow->paginationStrut(); | 2473 newLogicalTop += childBlockFlow->paginationStrut(); |
2474 childBlockFlow->setPaginationStrut(0); | 2474 childBlockFlow->setPaginationStrut(0); |
2475 } | 2475 } |
2476 | 2476 |
2477 if (newLogicalTop != floatLogicalLocation.y()) { | 2477 if (newLogicalTop != floatLogicalLocation.y()) { |
2478 floatingObject->setPaginationStrut(newLogicalTop - floatLogicalL
ocation.y()); | 2478 floatingObject.setPaginationStrut(newLogicalTop - floatLogicalLo
cation.y()); |
2479 | 2479 |
2480 floatLogicalLocation = computeLogicalLocationForFloat(floatingOb
ject, newLogicalTop); | 2480 floatLogicalLocation = computeLogicalLocationForFloat(floatingOb
ject, newLogicalTop); |
2481 setLogicalLeftForFloat(floatingObject, floatLogicalLocation.x())
; | 2481 setLogicalLeftForFloat(floatingObject, floatLogicalLocation.x())
; |
2482 | 2482 |
2483 setLogicalLeftForChild(*childBox, floatLogicalLocation.x() + chi
ldLogicalLeftMargin); | 2483 setLogicalLeftForChild(*childBox, floatLogicalLocation.x() + chi
ldLogicalLeftMargin); |
2484 setLogicalTopForChild(*childBox, floatLogicalLocation.y() + marg
inBeforeForChild(*childBox)); | 2484 setLogicalTopForChild(*childBox, floatLogicalLocation.y() + marg
inBeforeForChild(*childBox)); |
2485 | 2485 |
2486 if (childBox->isLayoutBlock()) | 2486 if (childBox->isLayoutBlock()) |
2487 childBox->setChildNeedsLayout(MarkOnlyThis); | 2487 childBox->setChildNeedsLayout(MarkOnlyThis); |
2488 childBox->layoutIfNeeded(); | 2488 childBox->layoutIfNeeded(); |
(...skipping 18 matching lines...) Expand all Loading... |
2507 bool LayoutBlockFlow::hasOverhangingFloat(LayoutBox* layoutBox) | 2507 bool LayoutBlockFlow::hasOverhangingFloat(LayoutBox* layoutBox) |
2508 { | 2508 { |
2509 if (!m_floatingObjects || hasColumns() || !parent()) | 2509 if (!m_floatingObjects || hasColumns() || !parent()) |
2510 return false; | 2510 return false; |
2511 | 2511 |
2512 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 2512 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
2513 FloatingObjectSetIterator it = floatingObjectSet.find<FloatingObjectHashTran
slator>(layoutBox); | 2513 FloatingObjectSetIterator it = floatingObjectSet.find<FloatingObjectHashTran
slator>(layoutBox); |
2514 if (it == floatingObjectSet.end()) | 2514 if (it == floatingObjectSet.end()) |
2515 return false; | 2515 return false; |
2516 | 2516 |
2517 return logicalBottomForFloat(it->get()) > logicalHeight(); | 2517 return logicalBottomForFloat(*it->get()) > logicalHeight(); |
2518 } | 2518 } |
2519 | 2519 |
2520 void LayoutBlockFlow::addIntrudingFloats(LayoutBlockFlow* prev, LayoutUnit logic
alLeftOffset, LayoutUnit logicalTopOffset) | 2520 void LayoutBlockFlow::addIntrudingFloats(LayoutBlockFlow* prev, LayoutUnit logic
alLeftOffset, LayoutUnit logicalTopOffset) |
2521 { | 2521 { |
2522 ASSERT(!avoidsFloats()); | 2522 ASSERT(!avoidsFloats()); |
2523 | 2523 |
2524 // If we create our own block formatting context then our contents don't int
eract with floats outside it, even those from our parent. | 2524 // If we create our own block formatting context then our contents don't int
eract with floats outside it, even those from our parent. |
2525 if (createsNewFormattingContext()) | 2525 if (createsNewFormattingContext()) |
2526 return; | 2526 return; |
2527 | 2527 |
2528 // If the parent or previous sibling doesn't have any floats to add, don't b
other. | 2528 // If the parent or previous sibling doesn't have any floats to add, don't b
other. |
2529 if (!prev->m_floatingObjects) | 2529 if (!prev->m_floatingObjects) |
2530 return; | 2530 return; |
2531 | 2531 |
2532 logicalLeftOffset += marginLogicalLeft(); | 2532 logicalLeftOffset += marginLogicalLeft(); |
2533 | 2533 |
2534 const FloatingObjectSet& prevSet = prev->m_floatingObjects->set(); | 2534 const FloatingObjectSet& prevSet = prev->m_floatingObjects->set(); |
2535 FloatingObjectSetIterator prevEnd = prevSet.end(); | 2535 FloatingObjectSetIterator prevEnd = prevSet.end(); |
2536 for (FloatingObjectSetIterator prevIt = prevSet.begin(); prevIt != prevEnd;
++prevIt) { | 2536 for (FloatingObjectSetIterator prevIt = prevSet.begin(); prevIt != prevEnd;
++prevIt) { |
2537 FloatingObject* floatingObject = prevIt->get(); | 2537 FloatingObject& floatingObject = *prevIt->get(); |
2538 if (logicalBottomForFloat(floatingObject) > logicalTopOffset) { | 2538 if (logicalBottomForFloat(floatingObject) > logicalTopOffset) { |
2539 if (!m_floatingObjects || !m_floatingObjects->set().contains(floatin
gObject)) { | 2539 if (!m_floatingObjects || !m_floatingObjects->set().contains(&floati
ngObject)) { |
2540 // We create the floating object list lazily. | 2540 // We create the floating object list lazily. |
2541 if (!m_floatingObjects) | 2541 if (!m_floatingObjects) |
2542 createFloatingObjects(); | 2542 createFloatingObjects(); |
2543 | 2543 |
2544 // Applying the child's margin makes no sense in the case where
the child was passed in. | 2544 // Applying the child's margin makes no sense in the case where
the child was passed in. |
2545 // since this margin was added already through the modification
of the |logicalLeftOffset| variable | 2545 // since this margin was added already through the modification
of the |logicalLeftOffset| variable |
2546 // above. |logicalLeftOffset| will equal the margin in this case
, so it's already been taken | 2546 // above. |logicalLeftOffset| will equal the margin in this case
, so it's already been taken |
2547 // into account. Only apply this code if prev is the parent, sin
ce otherwise the left margin | 2547 // into account. Only apply this code if prev is the parent, sin
ce otherwise the left margin |
2548 // will get applied twice. | 2548 // will get applied twice. |
2549 LayoutSize offset = isHorizontalWritingMode() | 2549 LayoutSize offset = isHorizontalWritingMode() |
2550 ? LayoutSize(logicalLeftOffset - (prev != parent() ? prev->m
arginLeft() : LayoutUnit()), logicalTopOffset) | 2550 ? LayoutSize(logicalLeftOffset - (prev != parent() ? prev->m
arginLeft() : LayoutUnit()), logicalTopOffset) |
2551 : LayoutSize(logicalTopOffset, logicalLeftOffset - (prev !=
parent() ? prev->marginTop() : LayoutUnit())); | 2551 : LayoutSize(logicalTopOffset, logicalLeftOffset - (prev !=
parent() ? prev->marginTop() : LayoutUnit())); |
2552 | 2552 |
2553 m_floatingObjects->add(floatingObject->copyToNewContainer(offset
)); | 2553 m_floatingObjects->add(floatingObject.copyToNewContainer(offset)
); |
2554 } | 2554 } |
2555 } | 2555 } |
2556 } | 2556 } |
2557 } | 2557 } |
2558 | 2558 |
2559 void LayoutBlockFlow::addOverhangingFloats(LayoutBlockFlow* child, bool makeChil
dPaintOtherFloats) | 2559 void LayoutBlockFlow::addOverhangingFloats(LayoutBlockFlow* child, bool makeChil
dPaintOtherFloats) |
2560 { | 2560 { |
2561 // Prevent floats from being added to the canvas by the root element, e.g.,
<html>. | 2561 // Prevent floats from being added to the canvas by the root element, e.g.,
<html>. |
2562 if (!child->containsFloats() || child->createsNewFormattingContext()) | 2562 if (!child->containsFloats() || child->createsNewFormattingContext()) |
2563 return; | 2563 return; |
2564 | 2564 |
2565 LayoutUnit childLogicalTop = child->logicalTop(); | 2565 LayoutUnit childLogicalTop = child->logicalTop(); |
2566 LayoutUnit childLogicalLeft = child->logicalLeft(); | 2566 LayoutUnit childLogicalLeft = child->logicalLeft(); |
2567 | 2567 |
2568 // Floats that will remain the child's responsibility to paint should factor
into its | 2568 // Floats that will remain the child's responsibility to paint should factor
into its |
2569 // overflow. | 2569 // overflow. |
2570 FloatingObjectSetIterator childEnd = child->m_floatingObjects->set().end(); | 2570 FloatingObjectSetIterator childEnd = child->m_floatingObjects->set().end(); |
2571 for (FloatingObjectSetIterator childIt = child->m_floatingObjects->set().beg
in(); childIt != childEnd; ++childIt) { | 2571 for (FloatingObjectSetIterator childIt = child->m_floatingObjects->set().beg
in(); childIt != childEnd; ++childIt) { |
2572 FloatingObject* floatingObject = childIt->get(); | 2572 FloatingObject& floatingObject = *childIt->get(); |
2573 LayoutUnit logicalBottomForFloat = std::min(this->logicalBottomForFloat(
floatingObject), LayoutUnit::max() - childLogicalTop); | 2573 LayoutUnit logicalBottomForFloat = std::min(this->logicalBottomForFloat(
floatingObject), LayoutUnit::max() - childLogicalTop); |
2574 LayoutUnit logicalBottom = childLogicalTop + logicalBottomForFloat; | 2574 LayoutUnit logicalBottom = childLogicalTop + logicalBottomForFloat; |
2575 | 2575 |
2576 if (logicalBottom > logicalHeight()) { | 2576 if (logicalBottom > logicalHeight()) { |
2577 // If the object is not in the list, we add it now. | 2577 // If the object is not in the list, we add it now. |
2578 if (!containsFloat(floatingObject->layoutObject())) { | 2578 if (!containsFloat(floatingObject.layoutObject())) { |
2579 LayoutSize offset = isHorizontalWritingMode() ? LayoutSize(-chil
dLogicalLeft, -childLogicalTop) : LayoutSize(-childLogicalTop, -childLogicalLeft
); | 2579 LayoutSize offset = isHorizontalWritingMode() ? LayoutSize(-chil
dLogicalLeft, -childLogicalTop) : LayoutSize(-childLogicalTop, -childLogicalLeft
); |
2580 bool shouldPaint = false; | 2580 bool shouldPaint = false; |
2581 | 2581 |
2582 // The nearest enclosing layer always paints the float (so that
zindex and stacking | 2582 // The nearest enclosing layer always paints the float (so that
zindex and stacking |
2583 // behaves properly). We always want to propagate the desire to
paint the float as | 2583 // behaves properly). We always want to propagate the desire to
paint the float as |
2584 // far out as we can, to the outermost block that overlaps the f
loat, stopping only | 2584 // far out as we can, to the outermost block that overlaps the f
loat, stopping only |
2585 // if we hit a self-painting layer boundary. | 2585 // if we hit a self-painting layer boundary. |
2586 if (floatingObject->layoutObject()->enclosingFloatPaintingLayer(
) == enclosingFloatPaintingLayer()) { | 2586 if (floatingObject.layoutObject()->enclosingFloatPaintingLayer()
== enclosingFloatPaintingLayer()) { |
2587 floatingObject->setShouldPaint(false); | 2587 floatingObject.setShouldPaint(false); |
2588 shouldPaint = true; | 2588 shouldPaint = true; |
2589 } | 2589 } |
2590 // We create the floating object list lazily. | 2590 // We create the floating object list lazily. |
2591 if (!m_floatingObjects) | 2591 if (!m_floatingObjects) |
2592 createFloatingObjects(); | 2592 createFloatingObjects(); |
2593 | 2593 |
2594 m_floatingObjects->add(floatingObject->copyToNewContainer(offset
, shouldPaint, true)); | 2594 m_floatingObjects->add(floatingObject.copyToNewContainer(offset,
shouldPaint, true)); |
2595 } | 2595 } |
2596 } else { | 2596 } else { |
2597 if (makeChildPaintOtherFloats && !floatingObject->shouldPaint() && !
floatingObject->layoutObject()->hasSelfPaintingLayer() | 2597 if (makeChildPaintOtherFloats && !floatingObject.shouldPaint() && !f
loatingObject.layoutObject()->hasSelfPaintingLayer() |
2598 && floatingObject->layoutObject()->isDescendantOf(child) && floa
tingObject->layoutObject()->enclosingFloatPaintingLayer() == child->enclosingFlo
atPaintingLayer()) { | 2598 && floatingObject.layoutObject()->isDescendantOf(child) && float
ingObject.layoutObject()->enclosingFloatPaintingLayer() == child->enclosingFloat
PaintingLayer()) { |
2599 // The float is not overhanging from this block, so if it is a d
escendant of the child, the child should | 2599 // The float is not overhanging from this block, so if it is a d
escendant of the child, the child should |
2600 // paint it (the other case is that it is intruding into the chi
ld), unless it has its own layer or enclosing | 2600 // paint it (the other case is that it is intruding into the chi
ld), unless it has its own layer or enclosing |
2601 // layer. | 2601 // layer. |
2602 // If makeChildPaintOtherFloats is false, it means that the chil
d must already know about all the floats | 2602 // If makeChildPaintOtherFloats is false, it means that the chil
d must already know about all the floats |
2603 // it should paint. | 2603 // it should paint. |
2604 floatingObject->setShouldPaint(true); | 2604 floatingObject.setShouldPaint(true); |
2605 } | 2605 } |
2606 | 2606 |
2607 // Since the float doesn't overhang, it didn't get put into our list
. We need to go ahead and add its overflow in to the | 2607 // Since the float doesn't overhang, it didn't get put into our list
. We need to go ahead and add its overflow in to the |
2608 // child now. | 2608 // child now. |
2609 if (floatingObject->isDescendant()) | 2609 if (floatingObject.isDescendant()) |
2610 child->addOverflowFromChild(floatingObject->layoutObject(), Layo
utSize(xPositionForFloatIncludingMargin(floatingObject), yPositionForFloatInclud
ingMargin(floatingObject))); | 2610 child->addOverflowFromChild(floatingObject.layoutObject(), Layou
tSize(xPositionForFloatIncludingMargin(floatingObject), yPositionForFloatIncludi
ngMargin(floatingObject))); |
2611 } | 2611 } |
2612 } | 2612 } |
2613 } | 2613 } |
2614 | 2614 |
2615 LayoutUnit LayoutBlockFlow::lowestFloatLogicalBottom(FloatingObject::Type floatT
ype) const | 2615 LayoutUnit LayoutBlockFlow::lowestFloatLogicalBottom(FloatingObject::Type floatT
ype) const |
2616 { | 2616 { |
2617 if (!m_floatingObjects) | 2617 if (!m_floatingObjects) |
2618 return LayoutUnit(); | 2618 return LayoutUnit(); |
2619 | 2619 |
2620 return m_floatingObjects->lowestFloatLogicalBottom(floatType); | 2620 return m_floatingObjects->lowestFloatLogicalBottom(floatType); |
2621 } | 2621 } |
2622 | 2622 |
2623 LayoutUnit LayoutBlockFlow::nextFloatLogicalBottomBelow(LayoutUnit logicalHeight
, ShapeOutsideFloatOffsetMode offsetMode) const | 2623 LayoutUnit LayoutBlockFlow::nextFloatLogicalBottomBelow(LayoutUnit logicalHeight
, ShapeOutsideFloatOffsetMode offsetMode) const |
2624 { | 2624 { |
2625 if (!m_floatingObjects) | 2625 if (!m_floatingObjects) |
2626 return logicalHeight; | 2626 return logicalHeight; |
2627 | 2627 |
2628 LayoutUnit logicalBottom; | 2628 LayoutUnit logicalBottom; |
2629 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 2629 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
2630 FloatingObjectSetIterator end = floatingObjectSet.end(); | 2630 FloatingObjectSetIterator end = floatingObjectSet.end(); |
2631 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { | 2631 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { |
2632 FloatingObject* floatingObject = it->get(); | 2632 const FloatingObject& floatingObject = *it->get(); |
2633 LayoutUnit floatLogicalBottom = logicalBottomForFloat(floatingObject); | 2633 LayoutUnit floatLogicalBottom = logicalBottomForFloat(floatingObject); |
2634 ShapeOutsideInfo* shapeOutside = floatingObject->layoutObject()->shapeOu
tsideInfo(); | 2634 ShapeOutsideInfo* shapeOutside = floatingObject.layoutObject()->shapeOut
sideInfo(); |
2635 if (shapeOutside && (offsetMode == ShapeOutsideFloatShapeOffset)) { | 2635 if (shapeOutside && (offsetMode == ShapeOutsideFloatShapeOffset)) { |
2636 LayoutUnit shapeLogicalBottom = logicalTopForFloat(floatingObject) +
marginBeforeForChild(*(floatingObject->layoutObject())) + shapeOutside->shapeLo
gicalBottom(); | 2636 LayoutUnit shapeLogicalBottom = logicalTopForFloat(floatingObject) +
marginBeforeForChild(*(floatingObject.layoutObject())) + shapeOutside->shapeLog
icalBottom(); |
2637 // Use the shapeLogicalBottom unless it extends outside of the margi
n box, in which case it is clipped. | 2637 // Use the shapeLogicalBottom unless it extends outside of the margi
n box, in which case it is clipped. |
2638 if (shapeLogicalBottom < floatLogicalBottom) | 2638 if (shapeLogicalBottom < floatLogicalBottom) |
2639 floatLogicalBottom = shapeLogicalBottom; | 2639 floatLogicalBottom = shapeLogicalBottom; |
2640 } | 2640 } |
2641 if (floatLogicalBottom > logicalHeight) | 2641 if (floatLogicalBottom > logicalHeight) |
2642 logicalBottom = logicalBottom ? std::min(floatLogicalBottom, logical
Bottom) : floatLogicalBottom; | 2642 logicalBottom = logicalBottom ? std::min(floatLogicalBottom, logical
Bottom) : floatLogicalBottom; |
2643 } | 2643 } |
2644 | 2644 |
2645 return logicalBottom; | 2645 return logicalBottom; |
2646 } | 2646 } |
2647 | 2647 |
2648 bool LayoutBlockFlow::hitTestFloats(HitTestResult& result, const HitTestLocation
& locationInContainer, const LayoutPoint& accumulatedOffset) | 2648 bool LayoutBlockFlow::hitTestFloats(HitTestResult& result, const HitTestLocation
& locationInContainer, const LayoutPoint& accumulatedOffset) |
2649 { | 2649 { |
2650 if (!m_floatingObjects) | 2650 if (!m_floatingObjects) |
2651 return false; | 2651 return false; |
2652 | 2652 |
2653 LayoutPoint adjustedLocation = accumulatedOffset; | 2653 LayoutPoint adjustedLocation = accumulatedOffset; |
2654 if (isLayoutView()) { | 2654 if (isLayoutView()) { |
2655 DoublePoint position = toLayoutView(this)->frameView()->scrollPositionDo
uble(); | 2655 DoublePoint position = toLayoutView(this)->frameView()->scrollPositionDo
uble(); |
2656 adjustedLocation.move(position.x(), position.y()); | 2656 adjustedLocation.move(position.x(), position.y()); |
2657 } | 2657 } |
2658 | 2658 |
2659 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 2659 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
2660 FloatingObjectSetIterator begin = floatingObjectSet.begin(); | 2660 FloatingObjectSetIterator begin = floatingObjectSet.begin(); |
2661 for (FloatingObjectSetIterator it = floatingObjectSet.end(); it != begin;) { | 2661 for (FloatingObjectSetIterator it = floatingObjectSet.end(); it != begin;) { |
2662 --it; | 2662 --it; |
2663 FloatingObject* floatingObject = it->get(); | 2663 const FloatingObject& floatingObject = *it->get(); |
2664 if (floatingObject->shouldPaint() && !floatingObject->layoutObject()->ha
sSelfPaintingLayer()) { | 2664 if (floatingObject.shouldPaint() && !floatingObject.layoutObject()->hasS
elfPaintingLayer()) { |
2665 LayoutUnit xOffset = xPositionForFloatIncludingMargin(floatingObject
) - floatingObject->layoutObject()->location().x(); | 2665 LayoutUnit xOffset = xPositionForFloatIncludingMargin(floatingObject
) - floatingObject.layoutObject()->location().x(); |
2666 LayoutUnit yOffset = yPositionForFloatIncludingMargin(floatingObject
) - floatingObject->layoutObject()->location().y(); | 2666 LayoutUnit yOffset = yPositionForFloatIncludingMargin(floatingObject
) - floatingObject.layoutObject()->location().y(); |
2667 LayoutPoint childPoint = flipFloatForWritingModeForChild(floatingObj
ect, adjustedLocation + LayoutSize(xOffset, yOffset)); | 2667 LayoutPoint childPoint = flipFloatForWritingModeForChild(floatingObj
ect, adjustedLocation + LayoutSize(xOffset, yOffset)); |
2668 if (floatingObject->layoutObject()->hitTest(result, locationInContai
ner, childPoint)) { | 2668 if (floatingObject.layoutObject()->hitTest(result, locationInContain
er, childPoint)) { |
2669 updateHitTestResult(result, locationInContainer.point() - toLayo
utSize(childPoint)); | 2669 updateHitTestResult(result, locationInContainer.point() - toLayo
utSize(childPoint)); |
2670 return true; | 2670 return true; |
2671 } | 2671 } |
2672 } | 2672 } |
2673 } | 2673 } |
2674 | 2674 |
2675 return false; | 2675 return false; |
2676 } | 2676 } |
2677 | 2677 |
2678 LayoutUnit LayoutBlockFlow::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop,
LayoutUnit fixedOffset, LayoutUnit logicalHeight) const | 2678 LayoutUnit LayoutBlockFlow::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop,
LayoutUnit fixedOffset, LayoutUnit logicalHeight) const |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3150 FrameView* frameView = document().view(); | 3150 FrameView* frameView = document().view(); |
3151 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr
ollOffset().height(); | 3151 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr
ollOffset().height(); |
3152 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height(
); | 3152 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height(
); |
3153 if (size().height() < visibleHeight) | 3153 if (size().height() < visibleHeight) |
3154 top += (visibleHeight - size().height()) / 2; | 3154 top += (visibleHeight - size().height()) / 2; |
3155 setY(top); | 3155 setY(top); |
3156 dialog->setCentered(top); | 3156 dialog->setCentered(top); |
3157 } | 3157 } |
3158 | 3158 |
3159 } // namespace blink | 3159 } // namespace blink |
OLD | NEW |