summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/rendering
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/rendering')
-rw-r--r--Source/WebCore/rendering/RenderBlock.cpp8
-rw-r--r--Source/WebCore/rendering/RenderBlock.h3
-rw-r--r--Source/WebCore/rendering/RenderBox.cpp46
-rw-r--r--Source/WebCore/rendering/RenderListItem.cpp2
-rw-r--r--Source/WebCore/rendering/RenderRubyRun.cpp2
-rw-r--r--Source/WebCore/rendering/RenderRubyRun.h4
-rw-r--r--Source/WebCore/rendering/RenderTable.cpp2
-rw-r--r--Source/WebCore/rendering/RenderTable.h4
-rw-r--r--Source/WebCore/rendering/RenderView.cpp5
-rw-r--r--Source/WebCore/rendering/RenderView.h9
-rw-r--r--Source/WebCore/rendering/svg/RenderSVGText.cpp2
-rw-r--r--Source/WebCore/rendering/svg/RenderSVGText.h4
12 files changed, 65 insertions, 26 deletions
diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp
index bf1a78a7f..b2d056f94 100644
--- a/Source/WebCore/rendering/RenderBlock.cpp
+++ b/Source/WebCore/rendering/RenderBlock.cpp
@@ -2751,7 +2751,9 @@ void RenderBlock::computePreferredLogicalWidths()
{
ASSERT(preferredLogicalWidthsDirty());
- updateFirstLetter();
+ // FIXME: Do not even try to reshuffle first letter renderers when we are not in layout
+ // until after webkit.org/b/163848 is fixed.
+ updateFirstLetter(view().frameView().isInRenderTreeLayout() ? RenderTreeMutationIsAllowed::Yes : RenderTreeMutationIsAllowed::No);
m_minPreferredLogicalWidth = 0;
m_maxPreferredLogicalWidth = 0;
@@ -3301,7 +3303,7 @@ void RenderBlock::getFirstLetter(RenderObject*& firstLetter, RenderElement*& fir
firstLetterContainer = nullptr;
}
-void RenderBlock::updateFirstLetter()
+void RenderBlock::updateFirstLetter(RenderTreeMutationIsAllowed mutationAllowedOrNot)
{
RenderObject* firstLetterObj;
RenderElement* firstLetterContainer;
@@ -3322,6 +3324,8 @@ void RenderBlock::updateFirstLetter()
if (!is<RenderText>(*firstLetterObj))
return;
+ if (mutationAllowedOrNot != RenderTreeMutationIsAllowed::Yes)
+ return;
// Our layout state is not valid for the repaints we are going to trigger by
// adding and removing children of firstLetterContainer.
LayoutStateDisabler layoutStateDisabler(view());
diff --git a/Source/WebCore/rendering/RenderBlock.h b/Source/WebCore/rendering/RenderBlock.h
index 49468c586..b8292b138 100644
--- a/Source/WebCore/rendering/RenderBlock.h
+++ b/Source/WebCore/rendering/RenderBlock.h
@@ -243,7 +243,8 @@ public:
LayoutUnit collapsedMarginBeforeForChild(const RenderBox& child) const;
LayoutUnit collapsedMarginAfterForChild(const RenderBox& child) const;
- virtual void updateFirstLetter();
+ enum class RenderTreeMutationIsAllowed { Yes, No };
+ virtual void updateFirstLetter(RenderTreeMutationIsAllowed = RenderTreeMutationIsAllowed::Yes);
void getFirstLetter(RenderObject*& firstLetter, RenderElement*& firstLetterContainer, RenderObject* skipObject = nullptr);
virtual void scrollbarsChanged(bool /*horizontalScrollbarChanged*/, bool /*verticalScrollbarChanged*/) { }
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));
diff --git a/Source/WebCore/rendering/RenderListItem.cpp b/Source/WebCore/rendering/RenderListItem.cpp
index 9ce483c2b..06e75c28d 100644
--- a/Source/WebCore/rendering/RenderListItem.cpp
+++ b/Source/WebCore/rendering/RenderListItem.cpp
@@ -273,7 +273,7 @@ void RenderListItem::insertOrMoveMarkerRendererIfNeeded()
if (!m_marker)
return;
- // FIXME: Do not even try reposition the marker when we are not in layout
+ // FIXME: Do not even try to reposition the marker when we are not in layout
// until after we fixed webkit.org/b/163789.
if (!view().frameView().isInRenderTreeLayout())
return;
diff --git a/Source/WebCore/rendering/RenderRubyRun.cpp b/Source/WebCore/rendering/RenderRubyRun.cpp
index 8abbf9549..3d614add1 100644
--- a/Source/WebCore/rendering/RenderRubyRun.cpp
+++ b/Source/WebCore/rendering/RenderRubyRun.cpp
@@ -106,7 +106,7 @@ RenderBlock* RenderRubyRun::firstLineBlock() const
return 0;
}
-void RenderRubyRun::updateFirstLetter()
+void RenderRubyRun::updateFirstLetter(RenderTreeMutationIsAllowed)
{
}
diff --git a/Source/WebCore/rendering/RenderRubyRun.h b/Source/WebCore/rendering/RenderRubyRun.h
index 65cf224a5..3e59ac5db 100644
--- a/Source/WebCore/rendering/RenderRubyRun.h
+++ b/Source/WebCore/rendering/RenderRubyRun.h
@@ -60,8 +60,8 @@ public:
virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0) override;
virtual void removeChild(RenderObject&) override;
- virtual RenderBlock* firstLineBlock() const override;
- virtual void updateFirstLetter() override;
+ RenderBlock* firstLineBlock() const override;
+ void updateFirstLetter(RenderTreeMutationIsAllowed = RenderTreeMutationIsAllowed::Yes) override;
void getOverhang(bool firstLine, RenderObject* startRenderer, RenderObject* endRenderer, float& startOverhang, float& endOverhang) const;
diff --git a/Source/WebCore/rendering/RenderTable.cpp b/Source/WebCore/rendering/RenderTable.cpp
index b3be2de98..4f325dfb9 100644
--- a/Source/WebCore/rendering/RenderTable.cpp
+++ b/Source/WebCore/rendering/RenderTable.cpp
@@ -1456,7 +1456,7 @@ RenderBlock* RenderTable::firstLineBlock() const
return nullptr;
}
-void RenderTable::updateFirstLetter()
+void RenderTable::updateFirstLetter(RenderTreeMutationIsAllowed)
{
}
diff --git a/Source/WebCore/rendering/RenderTable.h b/Source/WebCore/rendering/RenderTable.h
index e2b585146..f49592569 100644
--- a/Source/WebCore/rendering/RenderTable.h
+++ b/Source/WebCore/rendering/RenderTable.h
@@ -303,8 +303,8 @@ private:
void invalidateCachedColumnOffsets();
- virtual RenderBlock* firstLineBlock() const override final;
- virtual void updateFirstLetter() override final;
+ RenderBlock* firstLineBlock() const final;
+ void updateFirstLetter(RenderTreeMutationIsAllowed = RenderTreeMutationIsAllowed::Yes) final;
virtual void updateLogicalWidth() override final;
diff --git a/Source/WebCore/rendering/RenderView.cpp b/Source/WebCore/rendering/RenderView.cpp
index 3c10cb5cf..5c374092c 100644
--- a/Source/WebCore/rendering/RenderView.cpp
+++ b/Source/WebCore/rendering/RenderView.cpp
@@ -52,6 +52,7 @@
#include "StyleInheritedData.h"
#include "TransformState.h"
#include <wtf/StackStats.h>
+#include <wtf/TemporaryChange.h>
namespace WebCore {
@@ -195,6 +196,10 @@ bool RenderView::hitTest(const HitTestRequest& request, HitTestResult& result)
bool RenderView::hitTest(const HitTestRequest& request, const HitTestLocation& location, HitTestResult& result)
{
document().updateLayout();
+
+#if !ASSERT_DISABLED
+ TemporaryChange<bool> hitTestRestorer { m_inHitTesting, true };
+#endif
FrameFlatteningLayoutDisallower disallower(frameView());
diff --git a/Source/WebCore/rendering/RenderView.h b/Source/WebCore/rendering/RenderView.h
index 40aa58229..9279b9eec 100644
--- a/Source/WebCore/rendering/RenderView.h
+++ b/Source/WebCore/rendering/RenderView.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2006, 2015 Apple Inc.
+ * Copyright (C) 2006, 2015-2016 Apple Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -252,6 +252,10 @@ public:
const HashSet<const RenderBox*>& boxesWithScrollSnapCoordinates() { return m_boxesWithScrollSnapCoordinates; }
#endif
+#if !ASSERT_DISABLED
+ bool inHitTesting() const { return m_inHitTesting; }
+#endif
+
protected:
virtual void mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags, bool* wasFixed) const override;
virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const override;
@@ -369,6 +373,9 @@ private:
bool m_hasSoftwareFilters;
bool m_usesFirstLineRules { false };
bool m_usesFirstLetterRules { false };
+#if !ASSERT_DISABLED
+ bool m_inHitTesting { false };
+#endif
HashSet<RenderElement*> m_renderersWithPausedImageAnimation;
HashSet<RenderElement*> m_visibleInViewportRenderers;
diff --git a/Source/WebCore/rendering/svg/RenderSVGText.cpp b/Source/WebCore/rendering/svg/RenderSVGText.cpp
index 86063acb4..4bb8ef4bf 100644
--- a/Source/WebCore/rendering/svg/RenderSVGText.cpp
+++ b/Source/WebCore/rendering/svg/RenderSVGText.cpp
@@ -547,7 +547,7 @@ RenderBlock* RenderSVGText::firstLineBlock() const
// Fix for <rdar://problem/8048875>. We should not render :first-letter CSS Style
// in a SVG text element context.
-void RenderSVGText::updateFirstLetter()
+void RenderSVGText::updateFirstLetter(RenderTreeMutationIsAllowed)
{
}
diff --git a/Source/WebCore/rendering/svg/RenderSVGText.h b/Source/WebCore/rendering/svg/RenderSVGText.h
index 71be1cde3..b2271954b 100644
--- a/Source/WebCore/rendering/svg/RenderSVGText.h
+++ b/Source/WebCore/rendering/svg/RenderSVGText.h
@@ -91,8 +91,8 @@ private:
virtual AffineTransform localTransform() const override { return m_localTransform; }
virtual std::unique_ptr<RootInlineBox> createRootInlineBox() override;
- virtual RenderBlock* firstLineBlock() const override;
- virtual void updateFirstLetter() override;
+ RenderBlock* firstLineBlock() const override;
+ void updateFirstLetter(RenderTreeMutationIsAllowed = RenderTreeMutationIsAllowed::Yes) override;
bool shouldHandleSubtreeMutations() const;