| 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 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 void RenderBlockFlow::rebuildFloatsFromIntruding() | 750 void RenderBlockFlow::rebuildFloatsFromIntruding() |
| 751 { | 751 { |
| 752 if (m_floatingObjects) | 752 if (m_floatingObjects) |
| 753 m_floatingObjects->setHorizontalWritingMode(isHorizontalWritingMode()); | 753 m_floatingObjects->setHorizontalWritingMode(isHorizontalWritingMode()); |
| 754 | 754 |
| 755 HashSet<RenderBox*> oldIntrudingFloatSet; | 755 HashSet<RenderBox*> oldIntrudingFloatSet; |
| 756 if (!childrenInline() && m_floatingObjects) { | 756 if (!childrenInline() && m_floatingObjects) { |
| 757 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 757 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
| 758 FloatingObjectSetIterator end = floatingObjectSet.end(); | 758 FloatingObjectSetIterator end = floatingObjectSet.end(); |
| 759 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end
; ++it) { | 759 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end
; ++it) { |
| 760 FloatingObject* floatingObject = (*it).get(); | 760 FloatingObject* floatingObject = it->get(); |
| 761 if (!floatingObject->isDescendant()) | 761 if (!floatingObject->isDescendant()) |
| 762 oldIntrudingFloatSet.add(floatingObject->renderer()); | 762 oldIntrudingFloatSet.add(floatingObject->renderer()); |
| 763 } | 763 } |
| 764 } | 764 } |
| 765 | 765 |
| 766 // Inline blocks are covered by the isReplaced() check in the avoidFloats me
thod. | 766 // Inline blocks are covered by the isReplaced() check in the avoidFloats me
thod. |
| 767 if (avoidsOrIgnoresFloats() || isRenderView()) { | 767 if (avoidsOrIgnoresFloats() || isRenderView()) { |
| 768 if (m_floatingObjects) { | 768 if (m_floatingObjects) { |
| 769 m_floatingObjects->clear(); | 769 m_floatingObjects->clear(); |
| 770 } | 770 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 addIntrudingFloats(blockFlow, 0, logicalTopOffset); | 815 addIntrudingFloats(blockFlow, 0, logicalTopOffset); |
| 816 } | 816 } |
| 817 | 817 |
| 818 if (childrenInline()) { | 818 if (childrenInline()) { |
| 819 LayoutUnit changeLogicalTop = LayoutUnit::max(); | 819 LayoutUnit changeLogicalTop = LayoutUnit::max(); |
| 820 LayoutUnit changeLogicalBottom = LayoutUnit::min(); | 820 LayoutUnit changeLogicalBottom = LayoutUnit::min(); |
| 821 if (m_floatingObjects) { | 821 if (m_floatingObjects) { |
| 822 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(
); | 822 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(
); |
| 823 FloatingObjectSetIterator end = floatingObjectSet.end(); | 823 FloatingObjectSetIterator end = floatingObjectSet.end(); |
| 824 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it !=
end; ++it) { | 824 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it !=
end; ++it) { |
| 825 FloatingObject* floatingObject = (*it).get(); | 825 FloatingObject* floatingObject = it->get(); |
| 826 FloatingObject* oldFloatingObject = floatMap.get(floatingObject-
>renderer()); | 826 FloatingObject* oldFloatingObject = floatMap.get(floatingObject-
>renderer()); |
| 827 LayoutUnit logicalBottom = logicalBottomForFloat(floatingObject)
; | 827 LayoutUnit logicalBottom = logicalBottomForFloat(floatingObject)
; |
| 828 if (oldFloatingObject) { | 828 if (oldFloatingObject) { |
| 829 LayoutUnit oldLogicalBottom = logicalBottomForFloat(oldFloat
ingObject); | 829 LayoutUnit oldLogicalBottom = logicalBottomForFloat(oldFloat
ingObject); |
| 830 if (logicalWidthForFloat(floatingObject) != logicalWidthForF
loat(oldFloatingObject) || logicalLeftForFloat(floatingObject) != logicalLeftFor
Float(oldFloatingObject)) { | 830 if (logicalWidthForFloat(floatingObject) != logicalWidthForF
loat(oldFloatingObject) || logicalLeftForFloat(floatingObject) != logicalLeftFor
Float(oldFloatingObject)) { |
| 831 changeLogicalTop = 0; | 831 changeLogicalTop = 0; |
| 832 changeLogicalBottom = max(changeLogicalBottom, max(logic
alBottom, oldLogicalBottom)); | 832 changeLogicalBottom = max(changeLogicalBottom, max(logic
alBottom, oldLogicalBottom)); |
| 833 } else { | 833 } else { |
| 834 if (logicalBottom != oldLogicalBottom) { | 834 if (logicalBottom != oldLogicalBottom) { |
| 835 changeLogicalTop = min(changeLogicalTop, min(logical
Bottom, oldLogicalBottom)); | 835 changeLogicalTop = min(changeLogicalTop, min(logical
Bottom, oldLogicalBottom)); |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1649 } | 1649 } |
| 1650 | 1650 |
| 1651 void RenderBlockFlow::addOverflowFromFloats() | 1651 void RenderBlockFlow::addOverflowFromFloats() |
| 1652 { | 1652 { |
| 1653 if (!m_floatingObjects) | 1653 if (!m_floatingObjects) |
| 1654 return; | 1654 return; |
| 1655 | 1655 |
| 1656 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 1656 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
| 1657 FloatingObjectSetIterator end = floatingObjectSet.end(); | 1657 FloatingObjectSetIterator end = floatingObjectSet.end(); |
| 1658 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { | 1658 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { |
| 1659 FloatingObject* floatingObject = (*it).get(); | 1659 FloatingObject* floatingObject = it->get(); |
| 1660 if (floatingObject->isDescendant()) | 1660 if (floatingObject->isDescendant()) |
| 1661 addOverflowFromChild(floatingObject->renderer(), IntSize(xPositionFo
rFloatIncludingMargin(floatingObject), yPositionForFloatIncludingMargin(floating
Object))); | 1661 addOverflowFromChild(floatingObject->renderer(), IntSize(xPositionFo
rFloatIncludingMargin(floatingObject), yPositionForFloatIncludingMargin(floating
Object))); |
| 1662 } | 1662 } |
| 1663 } | 1663 } |
| 1664 | 1664 |
| 1665 void RenderBlockFlow::computeOverflow(LayoutUnit oldClientAfterEdge, bool recomp
uteFloats) | 1665 void RenderBlockFlow::computeOverflow(LayoutUnit oldClientAfterEdge, bool recomp
uteFloats) |
| 1666 { | 1666 { |
| 1667 RenderBlock::computeOverflow(oldClientAfterEdge, recomputeFloats); | 1667 RenderBlock::computeOverflow(oldClientAfterEdge, recomputeFloats); |
| 1668 if (!hasColumns() && (recomputeFloats || createsBlockFormattingContext() ||
hasSelfPaintingLayer())) | 1668 if (!hasColumns() && (recomputeFloats || createsBlockFormattingContext() ||
hasSelfPaintingLayer())) |
| 1669 addOverflowFromFloats(); | 1669 addOverflowFromFloats(); |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1908 // displayed. | 1908 // displayed. |
| 1909 // See bug https://code.google.com/p/chromium/issues/detail?id=230907 | 1909 // See bug https://code.google.com/p/chromium/issues/detail?id=230907 |
| 1910 if (m_floatingObjects) { | 1910 if (m_floatingObjects) { |
| 1911 if (!toBlockFlow->m_floatingObjects) | 1911 if (!toBlockFlow->m_floatingObjects) |
| 1912 toBlockFlow->createFloatingObjects(); | 1912 toBlockFlow->createFloatingObjects(); |
| 1913 | 1913 |
| 1914 const FloatingObjectSet& fromFloatingObjectSet = m_floatingObjects->set(
); | 1914 const FloatingObjectSet& fromFloatingObjectSet = m_floatingObjects->set(
); |
| 1915 FloatingObjectSetIterator end = fromFloatingObjectSet.end(); | 1915 FloatingObjectSetIterator end = fromFloatingObjectSet.end(); |
| 1916 | 1916 |
| 1917 for (FloatingObjectSetIterator it = fromFloatingObjectSet.begin(); it !=
end; ++it) { | 1917 for (FloatingObjectSetIterator it = fromFloatingObjectSet.begin(); it !=
end; ++it) { |
| 1918 FloatingObject* floatingObject = (*it).get(); | 1918 FloatingObject* floatingObject = it->get(); |
| 1919 | 1919 |
| 1920 // Don't insert the object again if it's already in the list | 1920 // Don't insert the object again if it's already in the list |
| 1921 if (toBlockFlow->containsFloat(floatingObject->renderer())) | 1921 if (toBlockFlow->containsFloat(floatingObject->renderer())) |
| 1922 continue; | 1922 continue; |
| 1923 | 1923 |
| 1924 toBlockFlow->m_floatingObjects->add(floatingObject->unsafeClone()); | 1924 toBlockFlow->m_floatingObjects->add(floatingObject->unsafeClone()); |
| 1925 } | 1925 } |
| 1926 } | 1926 } |
| 1927 | 1927 |
| 1928 } | 1928 } |
| 1929 | 1929 |
| 1930 void RenderBlockFlow::repaintOverhangingFloats(bool paintAllDescendants) | 1930 void RenderBlockFlow::repaintOverhangingFloats(bool paintAllDescendants) |
| 1931 { | 1931 { |
| 1932 // Repaint any overhanging floats (if we know we're the one to paint them). | 1932 // Repaint any overhanging floats (if we know we're the one to paint them). |
| 1933 // Otherwise, bail out. | 1933 // Otherwise, bail out. |
| 1934 if (!hasOverhangingFloats()) | 1934 if (!hasOverhangingFloats()) |
| 1935 return; | 1935 return; |
| 1936 | 1936 |
| 1937 // FIXME: Avoid disabling LayoutState. At the very least, don't disable it f
or floats originating | 1937 // FIXME: Avoid disabling LayoutState. At the very least, don't disable it f
or floats originating |
| 1938 // in this block. Better yet would be to push extra state for the containers
of other floats. | 1938 // in this block. Better yet would be to push extra state for the containers
of other floats. |
| 1939 LayoutStateDisabler layoutStateDisabler(*this); | 1939 LayoutStateDisabler layoutStateDisabler(*this); |
| 1940 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 1940 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
| 1941 FloatingObjectSetIterator end = floatingObjectSet.end(); | 1941 FloatingObjectSetIterator end = floatingObjectSet.end(); |
| 1942 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { | 1942 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { |
| 1943 FloatingObject* floatingObject = (*it).get(); | 1943 FloatingObject* floatingObject = it->get(); |
| 1944 // Only repaint the object if it is overhanging, is not in its own layer
, and | 1944 // Only repaint the object if it is overhanging, is not in its own layer
, and |
| 1945 // is our responsibility to paint (m_shouldPaint is set). When paintAllD
escendants is true, the latter | 1945 // is our responsibility to paint (m_shouldPaint is set). When paintAllD
escendants is true, the latter |
| 1946 // condition is replaced with being a descendant of us. | 1946 // condition is replaced with being a descendant of us. |
| 1947 if (logicalBottomForFloat(floatingObject) > logicalHeight() | 1947 if (logicalBottomForFloat(floatingObject) > logicalHeight() |
| 1948 && !floatingObject->renderer()->hasSelfPaintingLayer() | 1948 && !floatingObject->renderer()->hasSelfPaintingLayer() |
| 1949 && (floatingObject->shouldPaint() || (paintAllDescendants && floatin
gObject->renderer()->isDescendantOf(this)))) { | 1949 && (floatingObject->shouldPaint() || (paintAllDescendants && floatin
gObject->renderer()->isDescendantOf(this)))) { |
| 1950 | 1950 |
| 1951 RenderBox* floatingRenderer = floatingObject->renderer(); | 1951 RenderBox* floatingRenderer = floatingObject->renderer(); |
| 1952 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) | 1952 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) |
| 1953 floatingRenderer->setShouldDoFullRepaintAfterLayout(true); | 1953 floatingRenderer->setShouldDoFullRepaintAfterLayout(true); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2005 } | 2005 } |
| 2006 | 2006 |
| 2007 void RenderBlockFlow::paintFloats(PaintInfo& paintInfo, const LayoutPoint& paint
Offset, bool preservePhase) | 2007 void RenderBlockFlow::paintFloats(PaintInfo& paintInfo, const LayoutPoint& paint
Offset, bool preservePhase) |
| 2008 { | 2008 { |
| 2009 if (!m_floatingObjects) | 2009 if (!m_floatingObjects) |
| 2010 return; | 2010 return; |
| 2011 | 2011 |
| 2012 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 2012 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
| 2013 FloatingObjectSetIterator end = floatingObjectSet.end(); | 2013 FloatingObjectSetIterator end = floatingObjectSet.end(); |
| 2014 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { | 2014 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { |
| 2015 FloatingObject* floatingObject = (*it).get(); | 2015 FloatingObject* floatingObject = it->get(); |
| 2016 // Only paint the object if our m_shouldPaint flag is set. | 2016 // Only paint the object if our m_shouldPaint flag is set. |
| 2017 if (floatingObject->shouldPaint() && !floatingObject->renderer()->hasSel
fPaintingLayer()) { | 2017 if (floatingObject->shouldPaint() && !floatingObject->renderer()->hasSel
fPaintingLayer()) { |
| 2018 PaintInfo currentPaintInfo(paintInfo); | 2018 PaintInfo currentPaintInfo(paintInfo); |
| 2019 currentPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhas
eBlockBackground; | 2019 currentPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhas
eBlockBackground; |
| 2020 // FIXME: LayoutPoint version of xPositionForFloatIncludingMargin wo
uld make this much cleaner. | 2020 // FIXME: LayoutPoint version of xPositionForFloatIncludingMargin wo
uld make this much cleaner. |
| 2021 LayoutPoint childPoint = flipFloatForWritingModeForChild(floatingObj
ect, LayoutPoint(paintOffset.x() + xPositionForFloatIncludingMargin(floatingObje
ct) - floatingObject->renderer()->x(), paintOffset.y() + yPositionForFloatInclud
ingMargin(floatingObject) - floatingObject->renderer()->y())); | 2021 LayoutPoint childPoint = flipFloatForWritingModeForChild(floatingObj
ect, LayoutPoint(paintOffset.x() + xPositionForFloatIncludingMargin(floatingObje
ct) - floatingObject->renderer()->x(), paintOffset.y() + yPositionForFloatInclud
ingMargin(floatingObject) - floatingObject->renderer()->y())); |
| 2022 floatingObject->renderer()->paint(currentPaintInfo, childPoint); | 2022 floatingObject->renderer()->paint(currentPaintInfo, childPoint); |
| 2023 if (!preservePhase) { | 2023 if (!preservePhase) { |
| 2024 currentPaintInfo.phase = PaintPhaseChildBlockBackgrounds; | 2024 currentPaintInfo.phase = PaintPhaseChildBlockBackgrounds; |
| 2025 floatingObject->renderer()->paint(currentPaintInfo, childPoint); | 2025 floatingObject->renderer()->paint(currentPaintInfo, childPoint); |
| 2026 currentPaintInfo.phase = PaintPhaseFloat; | 2026 currentPaintInfo.phase = PaintPhaseFloat; |
| 2027 floatingObject->renderer()->paint(currentPaintInfo, childPoint); | 2027 floatingObject->renderer()->paint(currentPaintInfo, childPoint); |
| 2028 currentPaintInfo.phase = PaintPhaseForeground; | 2028 currentPaintInfo.phase = PaintPhaseForeground; |
| 2029 floatingObject->renderer()->paint(currentPaintInfo, childPoint); | 2029 floatingObject->renderer()->paint(currentPaintInfo, childPoint); |
| 2030 currentPaintInfo.phase = PaintPhaseOutline; | 2030 currentPaintInfo.phase = PaintPhaseOutline; |
| 2031 floatingObject->renderer()->paint(currentPaintInfo, childPoint); | 2031 floatingObject->renderer()->paint(currentPaintInfo, childPoint); |
| 2032 } | 2032 } |
| 2033 } | 2033 } |
| 2034 } | 2034 } |
| 2035 } | 2035 } |
| 2036 | 2036 |
| 2037 void RenderBlockFlow::clipOutFloatingObjects(RenderBlock* rootBlock, const Paint
Info* paintInfo, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize&
offsetFromRootBlock) | 2037 void RenderBlockFlow::clipOutFloatingObjects(RenderBlock* rootBlock, const Paint
Info* paintInfo, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize&
offsetFromRootBlock) |
| 2038 { | 2038 { |
| 2039 if (m_floatingObjects) { | 2039 if (m_floatingObjects) { |
| 2040 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 2040 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
| 2041 FloatingObjectSetIterator end = floatingObjectSet.end(); | 2041 FloatingObjectSetIterator end = floatingObjectSet.end(); |
| 2042 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end
; ++it) { | 2042 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end
; ++it) { |
| 2043 FloatingObject* floatingObject = (*it).get(); | 2043 FloatingObject* floatingObject = it->get(); |
| 2044 LayoutRect floatBox(offsetFromRootBlock.width() + xPositionForFloatI
ncludingMargin(floatingObject), | 2044 LayoutRect floatBox(offsetFromRootBlock.width() + xPositionForFloatI
ncludingMargin(floatingObject), |
| 2045 offsetFromRootBlock.height() + yPositionForFloatIncludingMargin(
floatingObject), | 2045 offsetFromRootBlock.height() + yPositionForFloatIncludingMargin(
floatingObject), |
| 2046 floatingObject->renderer()->width(), floatingObject->renderer()-
>height()); | 2046 floatingObject->renderer()->width(), floatingObject->renderer()-
>height()); |
| 2047 rootBlock->flipForWritingMode(floatBox); | 2047 rootBlock->flipForWritingMode(floatBox); |
| 2048 floatBox.move(rootBlockPhysicalPosition.x(), rootBlockPhysicalPositi
on.y()); | 2048 floatBox.move(rootBlockPhysicalPosition.x(), rootBlockPhysicalPositi
on.y()); |
| 2049 paintInfo->context->clipOut(pixelSnappedIntRect(floatBox)); | 2049 paintInfo->context->clipOut(pixelSnappedIntRect(floatBox)); |
| 2050 } | 2050 } |
| 2051 } | 2051 } |
| 2052 } | 2052 } |
| 2053 | 2053 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2192 ASSERT(floatBox->isFloating()); | 2192 ASSERT(floatBox->isFloating()); |
| 2193 | 2193 |
| 2194 // Create the list of special objects if we don't aleady have one | 2194 // Create the list of special objects if we don't aleady have one |
| 2195 if (!m_floatingObjects) { | 2195 if (!m_floatingObjects) { |
| 2196 createFloatingObjects(); | 2196 createFloatingObjects(); |
| 2197 } else { | 2197 } else { |
| 2198 // Don't insert the object again if it's already in the list | 2198 // Don't insert the object again if it's already in the list |
| 2199 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 2199 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
| 2200 FloatingObjectSetIterator it = floatingObjectSet.find<FloatingObjectHash
Translator>(floatBox); | 2200 FloatingObjectSetIterator it = floatingObjectSet.find<FloatingObjectHash
Translator>(floatBox); |
| 2201 if (it != floatingObjectSet.end()) | 2201 if (it != floatingObjectSet.end()) |
| 2202 return (*it).get(); | 2202 return it->get(); |
| 2203 } | 2203 } |
| 2204 | 2204 |
| 2205 // Create the special object entry & append it to the list | 2205 // Create the special object entry & append it to the list |
| 2206 | 2206 |
| 2207 OwnPtr<FloatingObject> newObj = FloatingObject::create(floatBox); | 2207 OwnPtr<FloatingObject> newObj = FloatingObject::create(floatBox); |
| 2208 | 2208 |
| 2209 // Our location is irrelevant if we're unsplittable or no pagination is in e
ffect. | 2209 // Our location is irrelevant if we're unsplittable or no pagination is in e
ffect. |
| 2210 // Just go ahead and lay out the float. | 2210 // Just go ahead and lay out the float. |
| 2211 bool isChildRenderBlock = floatBox->isRenderBlock(); | 2211 bool isChildRenderBlock = floatBox->isRenderBlock(); |
| 2212 if (isChildRenderBlock && !floatBox->needsLayout() && view()->layoutState()-
>pageLogicalHeightChanged()) | 2212 if (isChildRenderBlock && !floatBox->needsLayout() && view()->layoutState()-
>pageLogicalHeightChanged()) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2224 | 2224 |
| 2225 return m_floatingObjects->add(newObj.release()); | 2225 return m_floatingObjects->add(newObj.release()); |
| 2226 } | 2226 } |
| 2227 | 2227 |
| 2228 void RenderBlockFlow::removeFloatingObject(RenderBox* floatBox) | 2228 void RenderBlockFlow::removeFloatingObject(RenderBox* floatBox) |
| 2229 { | 2229 { |
| 2230 if (m_floatingObjects) { | 2230 if (m_floatingObjects) { |
| 2231 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 2231 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
| 2232 FloatingObjectSetIterator it = floatingObjectSet.find<FloatingObjectHash
Translator>(floatBox); | 2232 FloatingObjectSetIterator it = floatingObjectSet.find<FloatingObjectHash
Translator>(floatBox); |
| 2233 if (it != floatingObjectSet.end()) { | 2233 if (it != floatingObjectSet.end()) { |
| 2234 FloatingObject* floatingObject = (*it).get(); | 2234 FloatingObject* floatingObject = it->get(); |
| 2235 if (childrenInline()) { | 2235 if (childrenInline()) { |
| 2236 LayoutUnit logicalTop = logicalTopForFloat(floatingObject); | 2236 LayoutUnit logicalTop = logicalTopForFloat(floatingObject); |
| 2237 LayoutUnit logicalBottom = logicalBottomForFloat(floatingObject)
; | 2237 LayoutUnit logicalBottom = logicalBottomForFloat(floatingObject)
; |
| 2238 | 2238 |
| 2239 // Fix for https://bugs.webkit.org/show_bug.cgi?id=54995. | 2239 // Fix for https://bugs.webkit.org/show_bug.cgi?id=54995. |
| 2240 if (logicalBottom < 0 || logicalBottom < logicalTop || logicalTo
p == LayoutUnit::max()) { | 2240 if (logicalBottom < 0 || logicalBottom < logicalTop || logicalTo
p == LayoutUnit::max()) { |
| 2241 logicalBottom = LayoutUnit::max(); | 2241 logicalBottom = LayoutUnit::max(); |
| 2242 } else { | 2242 } else { |
| 2243 // Special-case zero- and less-than-zero-height floats: thos
e don't touch | 2243 // Special-case zero- and less-than-zero-height floats: thos
e don't touch |
| 2244 // the line that they're on, but it still needs to be dirtie
d. This is | 2244 // the line that they're on, but it still needs to be dirtie
d. This is |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2292 // Move backwards through our floating object list until we find a float tha
t has | 2292 // Move backwards through our floating object list until we find a float tha
t has |
| 2293 // already been positioned. Then we'll be able to move forward, positioning
all of | 2293 // already been positioned. Then we'll be able to move forward, positioning
all of |
| 2294 // the new floats that need it. | 2294 // the new floats that need it. |
| 2295 FloatingObjectSetIterator it = floatingObjectSet.end(); | 2295 FloatingObjectSetIterator it = floatingObjectSet.end(); |
| 2296 --it; // Go to last item. | 2296 --it; // Go to last item. |
| 2297 FloatingObjectSetIterator begin = floatingObjectSet.begin(); | 2297 FloatingObjectSetIterator begin = floatingObjectSet.begin(); |
| 2298 FloatingObject* lastPlacedFloatingObject = 0; | 2298 FloatingObject* lastPlacedFloatingObject = 0; |
| 2299 while (it != begin) { | 2299 while (it != begin) { |
| 2300 --it; | 2300 --it; |
| 2301 if ((*it)->isPlaced()) { | 2301 if ((*it)->isPlaced()) { |
| 2302 lastPlacedFloatingObject = (*it).get(); | 2302 lastPlacedFloatingObject = it->get(); |
| 2303 ++it; | 2303 ++it; |
| 2304 break; | 2304 break; |
| 2305 } | 2305 } |
| 2306 } | 2306 } |
| 2307 | 2307 |
| 2308 LayoutUnit logicalTop = logicalHeight(); | 2308 LayoutUnit logicalTop = logicalHeight(); |
| 2309 | 2309 |
| 2310 // The float cannot start above the top position of the last positioned floa
t. | 2310 // The float cannot start above the top position of the last positioned floa
t. |
| 2311 if (lastPlacedFloatingObject) | 2311 if (lastPlacedFloatingObject) |
| 2312 logicalTop = max(logicalTopForFloat(lastPlacedFloatingObject), logicalTo
p); | 2312 logicalTop = max(logicalTopForFloat(lastPlacedFloatingObject), logicalTo
p); |
| 2313 | 2313 |
| 2314 FloatingObjectSetIterator end = floatingObjectSet.end(); | 2314 FloatingObjectSetIterator end = floatingObjectSet.end(); |
| 2315 // Now walk through the set of unpositioned floats and place them. | 2315 // Now walk through the set of unpositioned floats and place them. |
| 2316 for (; it != end; ++it) { | 2316 for (; it != end; ++it) { |
| 2317 FloatingObject* floatingObject = (*it).get(); | 2317 FloatingObject* floatingObject = it->get(); |
| 2318 // The containing block is responsible for positioning floats, so if we
have floats in our | 2318 // The containing block is responsible for positioning floats, so if we
have floats in our |
| 2319 // list that come from somewhere else, do not attempt to position them. | 2319 // list that come from somewhere else, do not attempt to position them. |
| 2320 if (floatingObject->renderer()->containingBlock() != this) | 2320 if (floatingObject->renderer()->containingBlock() != this) |
| 2321 continue; | 2321 continue; |
| 2322 | 2322 |
| 2323 RenderBox* childBox = floatingObject->renderer(); | 2323 RenderBox* childBox = floatingObject->renderer(); |
| 2324 | 2324 |
| 2325 // FIXME Investigate if this can be removed. crbug.com/370006 | 2325 // FIXME Investigate if this can be removed. crbug.com/370006 |
| 2326 childBox->setMayNeedInvalidation(true); | 2326 childBox->setMayNeedInvalidation(true); |
| 2327 | 2327 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2397 bool RenderBlockFlow::hasOverhangingFloat(RenderBox* renderer) | 2397 bool RenderBlockFlow::hasOverhangingFloat(RenderBox* renderer) |
| 2398 { | 2398 { |
| 2399 if (!m_floatingObjects || hasColumns() || !parent()) | 2399 if (!m_floatingObjects || hasColumns() || !parent()) |
| 2400 return false; | 2400 return false; |
| 2401 | 2401 |
| 2402 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 2402 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
| 2403 FloatingObjectSetIterator it = floatingObjectSet.find<FloatingObjectHashTran
slator>(renderer); | 2403 FloatingObjectSetIterator it = floatingObjectSet.find<FloatingObjectHashTran
slator>(renderer); |
| 2404 if (it == floatingObjectSet.end()) | 2404 if (it == floatingObjectSet.end()) |
| 2405 return false; | 2405 return false; |
| 2406 | 2406 |
| 2407 return logicalBottomForFloat((*it).get()) > logicalHeight(); | 2407 return logicalBottomForFloat(it->get()) > logicalHeight(); |
| 2408 } | 2408 } |
| 2409 | 2409 |
| 2410 void RenderBlockFlow::addIntrudingFloats(RenderBlockFlow* prev, LayoutUnit logic
alLeftOffset, LayoutUnit logicalTopOffset) | 2410 void RenderBlockFlow::addIntrudingFloats(RenderBlockFlow* prev, LayoutUnit logic
alLeftOffset, LayoutUnit logicalTopOffset) |
| 2411 { | 2411 { |
| 2412 ASSERT(!avoidsFloats()); | 2412 ASSERT(!avoidsFloats()); |
| 2413 | 2413 |
| 2414 // If we create our own block formatting context then our contents don't int
eract with floats outside it, even those from our parent. | 2414 // If we create our own block formatting context then our contents don't int
eract with floats outside it, even those from our parent. |
| 2415 if (createsBlockFormattingContext()) | 2415 if (createsBlockFormattingContext()) |
| 2416 return; | 2416 return; |
| 2417 | 2417 |
| 2418 // If the parent or previous sibling doesn't have any floats to add, don't b
other. | 2418 // If the parent or previous sibling doesn't have any floats to add, don't b
other. |
| 2419 if (!prev->m_floatingObjects) | 2419 if (!prev->m_floatingObjects) |
| 2420 return; | 2420 return; |
| 2421 | 2421 |
| 2422 logicalLeftOffset += marginLogicalLeft(); | 2422 logicalLeftOffset += marginLogicalLeft(); |
| 2423 | 2423 |
| 2424 const FloatingObjectSet& prevSet = prev->m_floatingObjects->set(); | 2424 const FloatingObjectSet& prevSet = prev->m_floatingObjects->set(); |
| 2425 FloatingObjectSetIterator prevEnd = prevSet.end(); | 2425 FloatingObjectSetIterator prevEnd = prevSet.end(); |
| 2426 for (FloatingObjectSetIterator prevIt = prevSet.begin(); prevIt != prevEnd;
++prevIt) { | 2426 for (FloatingObjectSetIterator prevIt = prevSet.begin(); prevIt != prevEnd;
++prevIt) { |
| 2427 FloatingObject* floatingObject = (*prevIt).get(); | 2427 FloatingObject* floatingObject = prevIt->get(); |
| 2428 if (logicalBottomForFloat(floatingObject) > logicalTopOffset) { | 2428 if (logicalBottomForFloat(floatingObject) > logicalTopOffset) { |
| 2429 if (!m_floatingObjects || !m_floatingObjects->set().contains(floatin
gObject)) { | 2429 if (!m_floatingObjects || !m_floatingObjects->set().contains(floatin
gObject)) { |
| 2430 // We create the floating object list lazily. | 2430 // We create the floating object list lazily. |
| 2431 if (!m_floatingObjects) | 2431 if (!m_floatingObjects) |
| 2432 createFloatingObjects(); | 2432 createFloatingObjects(); |
| 2433 | 2433 |
| 2434 // Applying the child's margin makes no sense in the case where
the child was passed in. | 2434 // Applying the child's margin makes no sense in the case where
the child was passed in. |
| 2435 // since this margin was added already through the modification
of the |logicalLeftOffset| variable | 2435 // since this margin was added already through the modification
of the |logicalLeftOffset| variable |
| 2436 // above. |logicalLeftOffset| will equal the margin in this case
, so it's already been taken | 2436 // above. |logicalLeftOffset| will equal the margin in this case
, so it's already been taken |
| 2437 // into account. Only apply this code if prev is the parent, sin
ce otherwise the left margin | 2437 // into account. Only apply this code if prev is the parent, sin
ce otherwise the left margin |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2452 if (!child->containsFloats() || child->isRenderRegion() || child->createsBlo
ckFormattingContext()) | 2452 if (!child->containsFloats() || child->isRenderRegion() || child->createsBlo
ckFormattingContext()) |
| 2453 return; | 2453 return; |
| 2454 | 2454 |
| 2455 LayoutUnit childLogicalTop = child->logicalTop(); | 2455 LayoutUnit childLogicalTop = child->logicalTop(); |
| 2456 LayoutUnit childLogicalLeft = child->logicalLeft(); | 2456 LayoutUnit childLogicalLeft = child->logicalLeft(); |
| 2457 | 2457 |
| 2458 // Floats that will remain the child's responsibility to paint should factor
into its | 2458 // Floats that will remain the child's responsibility to paint should factor
into its |
| 2459 // overflow. | 2459 // overflow. |
| 2460 FloatingObjectSetIterator childEnd = child->m_floatingObjects->set().end(); | 2460 FloatingObjectSetIterator childEnd = child->m_floatingObjects->set().end(); |
| 2461 for (FloatingObjectSetIterator childIt = child->m_floatingObjects->set().beg
in(); childIt != childEnd; ++childIt) { | 2461 for (FloatingObjectSetIterator childIt = child->m_floatingObjects->set().beg
in(); childIt != childEnd; ++childIt) { |
| 2462 FloatingObject* floatingObject = (*childIt).get(); | 2462 FloatingObject* floatingObject = childIt->get(); |
| 2463 LayoutUnit logicalBottomForFloat = min(this->logicalBottomForFloat(float
ingObject), LayoutUnit::max() - childLogicalTop); | 2463 LayoutUnit logicalBottomForFloat = min(this->logicalBottomForFloat(float
ingObject), LayoutUnit::max() - childLogicalTop); |
| 2464 LayoutUnit logicalBottom = childLogicalTop + logicalBottomForFloat; | 2464 LayoutUnit logicalBottom = childLogicalTop + logicalBottomForFloat; |
| 2465 | 2465 |
| 2466 if (logicalBottom > logicalHeight()) { | 2466 if (logicalBottom > logicalHeight()) { |
| 2467 // If the object is not in the list, we add it now. | 2467 // If the object is not in the list, we add it now. |
| 2468 if (!containsFloat(floatingObject->renderer())) { | 2468 if (!containsFloat(floatingObject->renderer())) { |
| 2469 LayoutSize offset = isHorizontalWritingMode() ? LayoutSize(-chil
dLogicalLeft, -childLogicalTop) : LayoutSize(-childLogicalTop, -childLogicalLeft
); | 2469 LayoutSize offset = isHorizontalWritingMode() ? LayoutSize(-chil
dLogicalLeft, -childLogicalTop) : LayoutSize(-childLogicalTop, -childLogicalLeft
); |
| 2470 bool shouldPaint = false; | 2470 bool shouldPaint = false; |
| 2471 | 2471 |
| 2472 // The nearest enclosing layer always paints the float (so that
zindex and stacking | 2472 // The nearest enclosing layer always paints the float (so that
zindex and stacking |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2512 | 2512 |
| 2513 LayoutUnit RenderBlockFlow::nextFloatLogicalBottomBelow(LayoutUnit logicalHeight
, ShapeOutsideFloatOffsetMode offsetMode) const | 2513 LayoutUnit RenderBlockFlow::nextFloatLogicalBottomBelow(LayoutUnit logicalHeight
, ShapeOutsideFloatOffsetMode offsetMode) const |
| 2514 { | 2514 { |
| 2515 if (!m_floatingObjects) | 2515 if (!m_floatingObjects) |
| 2516 return logicalHeight; | 2516 return logicalHeight; |
| 2517 | 2517 |
| 2518 LayoutUnit logicalBottom; | 2518 LayoutUnit logicalBottom; |
| 2519 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 2519 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
| 2520 FloatingObjectSetIterator end = floatingObjectSet.end(); | 2520 FloatingObjectSetIterator end = floatingObjectSet.end(); |
| 2521 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { | 2521 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++
it) { |
| 2522 FloatingObject* floatingObject = (*it).get(); | 2522 FloatingObject* floatingObject = it->get(); |
| 2523 LayoutUnit floatLogicalBottom = logicalBottomForFloat(floatingObject); | 2523 LayoutUnit floatLogicalBottom = logicalBottomForFloat(floatingObject); |
| 2524 ShapeOutsideInfo* shapeOutside = floatingObject->renderer()->shapeOutsid
eInfo(); | 2524 ShapeOutsideInfo* shapeOutside = floatingObject->renderer()->shapeOutsid
eInfo(); |
| 2525 if (shapeOutside && (offsetMode == ShapeOutsideFloatShapeOffset)) { | 2525 if (shapeOutside && (offsetMode == ShapeOutsideFloatShapeOffset)) { |
| 2526 LayoutUnit shapeLogicalBottom = logicalTopForFloat(floatingObject) +
marginBeforeForChild(floatingObject->renderer()) + shapeOutside->shapeLogicalBo
ttom(); | 2526 LayoutUnit shapeLogicalBottom = logicalTopForFloat(floatingObject) +
marginBeforeForChild(floatingObject->renderer()) + shapeOutside->shapeLogicalBo
ttom(); |
| 2527 // Use the shapeLogicalBottom unless it extends outside of the margi
n box, in which case it is clipped. | 2527 // Use the shapeLogicalBottom unless it extends outside of the margi
n box, in which case it is clipped. |
| 2528 if (shapeLogicalBottom < floatLogicalBottom) | 2528 if (shapeLogicalBottom < floatLogicalBottom) |
| 2529 floatLogicalBottom = shapeLogicalBottom; | 2529 floatLogicalBottom = shapeLogicalBottom; |
| 2530 } | 2530 } |
| 2531 if (floatLogicalBottom > logicalHeight) | 2531 if (floatLogicalBottom > logicalHeight) |
| 2532 logicalBottom = logicalBottom ? min(floatLogicalBottom, logicalBotto
m) : floatLogicalBottom; | 2532 logicalBottom = logicalBottom ? min(floatLogicalBottom, logicalBotto
m) : floatLogicalBottom; |
| 2533 } | 2533 } |
| 2534 | 2534 |
| 2535 return logicalBottom; | 2535 return logicalBottom; |
| 2536 } | 2536 } |
| 2537 | 2537 |
| 2538 bool RenderBlockFlow::hitTestFloats(const HitTestRequest& request, HitTestResult
& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumul
atedOffset) | 2538 bool RenderBlockFlow::hitTestFloats(const HitTestRequest& request, HitTestResult
& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumul
atedOffset) |
| 2539 { | 2539 { |
| 2540 if (!m_floatingObjects) | 2540 if (!m_floatingObjects) |
| 2541 return false; | 2541 return false; |
| 2542 | 2542 |
| 2543 LayoutPoint adjustedLocation = accumulatedOffset; | 2543 LayoutPoint adjustedLocation = accumulatedOffset; |
| 2544 if (isRenderView()) { | 2544 if (isRenderView()) { |
| 2545 adjustedLocation += toLayoutSize(toRenderView(this)->frameView()->scroll
Position()); | 2545 adjustedLocation += toLayoutSize(toRenderView(this)->frameView()->scroll
Position()); |
| 2546 } | 2546 } |
| 2547 | 2547 |
| 2548 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 2548 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
| 2549 FloatingObjectSetIterator begin = floatingObjectSet.begin(); | 2549 FloatingObjectSetIterator begin = floatingObjectSet.begin(); |
| 2550 for (FloatingObjectSetIterator it = floatingObjectSet.end(); it != begin;) { | 2550 for (FloatingObjectSetIterator it = floatingObjectSet.end(); it != begin;) { |
| 2551 --it; | 2551 --it; |
| 2552 FloatingObject* floatingObject = (*it).get(); | 2552 FloatingObject* floatingObject = it->get(); |
| 2553 if (floatingObject->shouldPaint() && !floatingObject->renderer()->hasSel
fPaintingLayer()) { | 2553 if (floatingObject->shouldPaint() && !floatingObject->renderer()->hasSel
fPaintingLayer()) { |
| 2554 LayoutUnit xOffset = xPositionForFloatIncludingMargin(floatingObject
) - floatingObject->renderer()->x(); | 2554 LayoutUnit xOffset = xPositionForFloatIncludingMargin(floatingObject
) - floatingObject->renderer()->x(); |
| 2555 LayoutUnit yOffset = yPositionForFloatIncludingMargin(floatingObject
) - floatingObject->renderer()->y(); | 2555 LayoutUnit yOffset = yPositionForFloatIncludingMargin(floatingObject
) - floatingObject->renderer()->y(); |
| 2556 LayoutPoint childPoint = flipFloatForWritingModeForChild(floatingObj
ect, adjustedLocation + LayoutSize(xOffset, yOffset)); | 2556 LayoutPoint childPoint = flipFloatForWritingModeForChild(floatingObj
ect, adjustedLocation + LayoutSize(xOffset, yOffset)); |
| 2557 if (floatingObject->renderer()->hitTest(request, result, locationInC
ontainer, childPoint)) { | 2557 if (floatingObject->renderer()->hitTest(request, result, locationInC
ontainer, childPoint)) { |
| 2558 updateHitTestResult(result, locationInContainer.point() - toLayo
utSize(childPoint)); | 2558 updateHitTestResult(result, locationInContainer.point() - toLayo
utSize(childPoint)); |
| 2559 return true; | 2559 return true; |
| 2560 } | 2560 } |
| 2561 } | 2561 } |
| 2562 } | 2562 } |
| 2563 | 2563 |
| 2564 return false; | 2564 return false; |
| 2565 } | 2565 } |
| 2566 | 2566 |
| 2567 void RenderBlockFlow::adjustForBorderFit(LayoutUnit x, LayoutUnit& left, LayoutU
nit& right) const | 2567 void RenderBlockFlow::adjustForBorderFit(LayoutUnit x, LayoutUnit& left, LayoutU
nit& right) const |
| 2568 { | 2568 { |
| 2569 RenderBlock::adjustForBorderFit(x, left, right); | 2569 RenderBlock::adjustForBorderFit(x, left, right); |
| 2570 if (m_floatingObjects && style()->visibility() == VISIBLE) { | 2570 if (m_floatingObjects && style()->visibility() == VISIBLE) { |
| 2571 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 2571 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
| 2572 FloatingObjectSetIterator end = floatingObjectSet.end(); | 2572 FloatingObjectSetIterator end = floatingObjectSet.end(); |
| 2573 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end
; ++it) { | 2573 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end
; ++it) { |
| 2574 FloatingObject* floatingObject = (*it).get(); | 2574 FloatingObject* floatingObject = it->get(); |
| 2575 // Only examine the object if our m_shouldPaint flag is set. | 2575 // Only examine the object if our m_shouldPaint flag is set. |
| 2576 if (floatingObject->shouldPaint()) { | 2576 if (floatingObject->shouldPaint()) { |
| 2577 LayoutUnit floatLeft = xPositionForFloatIncludingMargin(floating
Object) - floatingObject->renderer()->x(); | 2577 LayoutUnit floatLeft = xPositionForFloatIncludingMargin(floating
Object) - floatingObject->renderer()->x(); |
| 2578 LayoutUnit floatRight = floatLeft + floatingObject->renderer()->
width(); | 2578 LayoutUnit floatRight = floatLeft + floatingObject->renderer()->
width(); |
| 2579 left = min(left, floatLeft); | 2579 left = min(left, floatLeft); |
| 2580 right = max(right, floatRight); | 2580 right = max(right, floatRight); |
| 2581 } | 2581 } |
| 2582 } | 2582 } |
| 2583 } | 2583 } |
| 2584 } | 2584 } |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2802 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() | 2802 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() |
| 2803 { | 2803 { |
| 2804 if (m_rareData) | 2804 if (m_rareData) |
| 2805 return *m_rareData; | 2805 return *m_rareData; |
| 2806 | 2806 |
| 2807 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); | 2807 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); |
| 2808 return *m_rareData; | 2808 return *m_rareData; |
| 2809 } | 2809 } |
| 2810 | 2810 |
| 2811 } // namespace WebCore | 2811 } // namespace WebCore |
| OLD | NEW |