diff options
Diffstat (limited to 'Source/WebCore/rendering/RenderBox.cpp')
-rw-r--r-- | Source/WebCore/rendering/RenderBox.cpp | 46 |
1 files changed, 34 insertions, 12 deletions
diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index e4809d288..2fe6cbfa8 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -55,6 +55,7 @@ #include "RenderIterator.h" #include "RenderLayer.h" #include "RenderLayerCompositor.h" +#include "RenderMultiColumnFlowThread.h" #include "RenderNamedFlowFragment.h" #include "RenderNamedFlowThread.h" #include "RenderTableCell.h" @@ -2264,6 +2265,21 @@ LayoutRect RenderBox::computeRectForRepaint(const LayoutRect& rect, const Render adjustedRect.expand(locationOffset - flooredLocationOffset); locationOffset = flooredLocationOffset; } + + if (is<RenderMultiColumnFlowThread>(this)) { + // We won't normally run this code. Only when the repaintContainer is null (i.e., we're trying + // to get the rect in view coordinates) will we come in here, since normally repaintContainer + // will be set and we'll stop at the flow thread. This case is mainly hit by the check for whether + // or not images should animate. + // FIXME: Just as with offsetFromContainer, we aren't really handling objects that span + // multiple columns properly. + LayoutPoint physicalPoint(flipForWritingMode(adjustedRect.location())); + if (auto* region = downcast<RenderMultiColumnFlowThread>(*this).physicalTranslationFromFlowToRegion((physicalPoint))) { + adjustedRect.setLocation(region->flipForWritingMode(physicalPoint)); + return region->computeRectForRepaint(adjustedRect, repaintContainer, fixed); + } + } + LayoutPoint topLeft = adjustedRect.location(); topLeft.move(locationOffset); @@ -3107,17 +3123,22 @@ LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(SizeType heightType, Len case Percent: case Calculated: { - auto cb = isOutOfFlowPositioned() ? container() : containingBlock(); - while (cb && cb->isAnonymous() && !is<RenderView>(*cb)) { - cb = cb->containingBlock(); - downcast<RenderBlock>(*cb).addPercentHeightDescendant(const_cast<RenderBox&>(*this)); + auto* container = isOutOfFlowPositioned() ? this->container() : containingBlock(); + while (container && container->isAnonymous()) { + // Stop at rendering context root. + if (is<RenderView>(*container) || is<RenderNamedFlowThread>(*container)) + break; + container = container->containingBlock(); + downcast<RenderBlock>(*container).addPercentHeightDescendant(const_cast<RenderBox&>(*this)); } // FIXME: This calculation is not patched for block-flow yet. // https://bugs.webkit.org/show_bug.cgi?id=46500 - if (cb->isOutOfFlowPositioned() && cb->style().height().isAuto() && !(cb->style().top().isAuto() || cb->style().bottom().isAuto())) { - ASSERT_WITH_SECURITY_IMPLICATION(cb->isRenderBlock()); - RenderBlock& block = downcast<RenderBlock>(*cb); + if (container->isOutOfFlowPositioned() + && container->style().height().isAuto() + && !(container->style().top().isAuto() || container->style().bottom().isAuto())) { + ASSERT_WITH_SECURITY_IMPLICATION(container->isRenderBlock()); + auto& block = downcast<RenderBlock>(*container); LogicalExtentComputedValues computedValues; block.computeLogicalHeight(block.logicalHeight(), 0, computedValues); LayoutUnit newContentHeight = computedValues.m_extent - block.borderAndPaddingLogicalHeight() - block.scrollbarLogicalHeight(); @@ -3130,7 +3151,7 @@ LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(SizeType heightType, Len // https://bugs.webkit.org/show_bug.cgi?id=46496 LayoutUnit availableHeight; if (isOutOfFlowPositioned()) - availableHeight = containingBlockLogicalHeightForPositioned(downcast<RenderBoxModelObject>(cb)); + availableHeight = containingBlockLogicalHeightForPositioned(downcast<RenderBoxModelObject>(container)); else { availableHeight = containingBlockLogicalHeightForContent(IncludeMarginBorderPadding); // It is necessary to use the border-box to match WinIE's broken @@ -3138,15 +3159,16 @@ LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(SizeType heightType, Len // table cells using percentage heights. // FIXME: This needs to be made block-flow-aware. If the cell and image are perpendicular block-flows, this isn't right. // https://bugs.webkit.org/show_bug.cgi?id=46997 - while (cb && !is<RenderView>(*cb) && (cb->style().logicalHeight().isAuto() || cb->style().logicalHeight().isPercentOrCalculated())) { - if (cb->isTableCell()) { + while (container && !is<RenderView>(*container) + && (container->style().logicalHeight().isAuto() || container->style().logicalHeight().isPercentOrCalculated())) { + if (container->isTableCell()) { // Don't let table cells squeeze percent-height replaced elements // <http://bugs.webkit.org/show_bug.cgi?id=15359> availableHeight = std::max(availableHeight, intrinsicLogicalHeight()); return valueForLength(logicalHeight, availableHeight - borderAndPaddingLogicalHeight()); } - downcast<RenderBlock>(*cb).addPercentHeightDescendant(const_cast<RenderBox&>(*this)); - cb = cb->containingBlock(); + downcast<RenderBlock>(*container).addPercentHeightDescendant(const_cast<RenderBox&>(*this)); + container = container->containingBlock(); } } return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logicalHeight, availableHeight)); |