Diff
Modified: trunk/Source/WebCore/ChangeLog (224599 => 224600)
--- trunk/Source/WebCore/ChangeLog 2017-11-08 23:11:56 UTC (rev 224599)
+++ trunk/Source/WebCore/ChangeLog 2017-11-08 23:13:42 UTC (rev 224600)
@@ -1,3 +1,40 @@
+2017-11-08 Antti Koivisto <an...@apple.com>
+
+ Move inlineElementContinuation function to RenderBoxModelObject and rename to inlineContinuation
+ https://bugs.webkit.org/show_bug.cgi?id=179437
+
+ Reviewed by Zalan Bujtas.
+
+ Unify RenderInline::inlineElementContinuation and RenderBlock::inlineElementContinuation.
+ It is simply a function to find the next RenderInline in the continuation chain.
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::lastChildConsideringContinuation):
+ (WebCore::startOfContinuations):
+ (WebCore::endOfContinuations):
+ (WebCore::childBeforeConsideringContinuations):
+ (WebCore::AccessibilityRenderObject::nextSibling const):
+ (WebCore::nextContinuation):
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::paintObject):
+ (WebCore::RenderBlock::absoluteRects const):
+ (WebCore::RenderBlock::addFocusRingRects):
+ (WebCore::RenderBlock::inlineElementContinuation const): Deleted.
+ * rendering/RenderBlock.h:
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::accumulateInFlowPositionOffsets):
+ (WebCore::RenderBoxModelObject::inlineContinuation const):
+ * rendering/RenderBoxModelObject.h:
+ * rendering/RenderInline.cpp:
+ (WebCore::updateStyleOfAnonymousBlockContinuations):
+ (WebCore::RenderInline::styleDidChange):
+ (WebCore::nextContinuation):
+ (WebCore::RenderInline::positionForPoint):
+ (WebCore::RenderInline::inlineElementContinuation const): Deleted.
+ * rendering/RenderInline.h:
+ * rendering/line/LineInlineHeaders.h:
+ (WebCore::hasInlineDirectionBordersPaddingOrMargin):
+
2017-11-08 Joseph Pecoraro <pecor...@apple.com>
Web Inspector: Eliminate unnecessary hash lookups with NetworkResourceData
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (224599 => 224600)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2017-11-08 23:11:56 UTC (rev 224599)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2017-11-08 23:13:42 UTC (rev 224600)
@@ -199,18 +199,11 @@
return &renderer;
RenderObject* lastChild = downcast<RenderBoxModelObject>(renderer).lastChild();
- RenderBoxModelObject* previous;
for (auto* current = &downcast<RenderBoxModelObject>(renderer); current; ) {
- previous = current;
-
if (RenderObject* newLastChild = current->lastChild())
lastChild = newLastChild;
- if (is<RenderInline>(*current)) {
- current = downcast<RenderInline>(*current).inlineElementContinuation();
- ASSERT_UNUSED(previous, current || !downcast<RenderInline>(*previous).continuation());
- } else
- current = downcast<RenderBlock>(*current).inlineElementContinuation();
+ current = current->inlineContinuation();
}
return lastChild;
@@ -255,8 +248,8 @@
return downcast<RenderInline>(renderer.node()->renderer());
// Blocks with a previous continuation always have a next continuation
- if (is<RenderBlock>(renderElement) && downcast<RenderBlock>(renderElement).inlineElementContinuation())
- return downcast<RenderInline>(downcast<RenderBlock>(renderElement).inlineElementContinuation()->element()->renderer());
+ if (is<RenderBlock>(renderElement) && downcast<RenderBlock>(renderElement).inlineContinuation())
+ return downcast<RenderInline>(downcast<RenderBlock>(renderElement).inlineContinuation()->element()->renderer());
return nullptr;
}
@@ -269,11 +262,7 @@
auto* previous = &downcast<RenderBoxModelObject>(renderer);
for (auto* current = previous; current; ) {
previous = current;
- if (is<RenderInline>(*current)) {
- current = downcast<RenderInline>(*current).inlineElementContinuation();
- ASSERT(current || !downcast<RenderInline>(*previous).continuation());
- } else
- current = downcast<RenderBlock>(*current).inlineElementContinuation();
+ current = current->inlineContinuation();
}
return previous;
@@ -293,13 +282,13 @@
current = current->nextSibling();
}
- currentContainer = downcast<RenderInline>(*currentContainer).continuation();
+ currentContainer = currentContainer->continuation();
} else if (is<RenderBlock>(*currentContainer)) {
if (currentContainer == child)
return previous;
previous = currentContainer;
- currentContainer = downcast<RenderBlock>(*currentContainer).inlineElementContinuation();
+ currentContainer = currentContainer->inlineContinuation();
}
}
@@ -368,7 +357,7 @@
// Case 1: node is a block and has an inline continuation. Next sibling is the inline continuation's
// first child.
RenderInline* inlineContinuation;
- if (is<RenderBlock>(*m_renderer) && (inlineContinuation = downcast<RenderBlock>(*m_renderer).inlineElementContinuation()))
+ if (is<RenderBlock>(*m_renderer) && (inlineContinuation = downcast<RenderBlock>(*m_renderer).inlineContinuation()))
nextSibling = firstChildConsideringContinuation(*inlineContinuation);
// Case 2: Anonymous block parent of the start of a continuation - skip all the way to
@@ -426,7 +415,7 @@
if (is<RenderInline>(renderer) && !renderer.isReplaced())
return downcast<RenderInline>(renderer).continuation();
if (is<RenderBlock>(renderer))
- return downcast<RenderBlock>(renderer).inlineElementContinuation();
+ return downcast<RenderBlock>(renderer).inlineContinuation();
return nullptr;
}
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (224599 => 224600)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2017-11-08 23:11:56 UTC (rev 224599)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2017-11-08 23:13:42 UTC (rev 224600)
@@ -1697,7 +1697,7 @@
// 6. paint continuation outlines.
if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseChildOutlines)) {
- RenderInline* inlineCont = inlineElementContinuation();
+ RenderInline* inlineCont = inlineContinuation();
if (inlineCont && inlineCont->hasOutline() && inlineCont->style().visibility() == VISIBLE) {
RenderInline* inlineRenderer = downcast<RenderInline>(inlineCont->element()->renderer());
RenderBlock* containingBlock = this->containingBlock();
@@ -1730,12 +1730,6 @@
}
}
-RenderInline* RenderBlock::inlineElementContinuation() const
-{
- RenderBoxModelObject* continuation = this->continuation();
- return is<RenderInline>(continuation) ? downcast<RenderInline>(continuation) : nullptr;
-}
-
static ContinuationOutlineTableMap* continuationOutlineTable()
{
static NeverDestroyed<ContinuationOutlineTableMap> table;
@@ -3163,10 +3157,8 @@
if (auto* continuation = this->continuation()) {
// FIXME: This is wrong for block-flows that are horizontal.
// https://bugs.webkit.org/show_bug.cgi?id=46781
- rects.append(snappedIntRect(accumulatedOffset.x(), accumulatedOffset.y() - collapsedMarginBefore(),
- width(), height() + collapsedMarginBefore() + collapsedMarginAfter()));
- continuation->absoluteRects(rects, accumulatedOffset - toLayoutSize(location() +
- inlineElementContinuation()->containingBlock()->location()));
+ rects.append(snappedIntRect(accumulatedOffset.x(), accumulatedOffset.y() - collapsedMarginBefore(), width(), height() + collapsedMarginBefore() + collapsedMarginAfter()));
+ continuation->absoluteRects(rects, accumulatedOffset - toLayoutSize(location() + inlineContinuation()->containingBlock()->location()));
} else
rects.append(snappedIntRect(accumulatedOffset, size()));
}
@@ -3264,13 +3256,14 @@
{
// For blocks inside inlines, we include margins so that we run right up to the inline boxes
// above and below us (thus getting merged with them to form a single irregular shape).
- if (inlineElementContinuation()) {
+ auto* inlineContinuation = this->inlineContinuation();
+ if (inlineContinuation) {
// FIXME: This check really isn't accurate.
- bool nextInlineHasLineBox = inlineElementContinuation()->firstLineBox();
+ bool nextInlineHasLineBox = inlineContinuation->firstLineBox();
// FIXME: This is wrong. The principal renderer may not be the continuation preceding this block.
// FIXME: This is wrong for block-flows that are horizontal.
// https://bugs.webkit.org/show_bug.cgi?id=46781
- bool prevInlineHasLineBox = downcast<RenderInline>(*inlineElementContinuation()->element()->renderer()).firstLineBox();
+ bool prevInlineHasLineBox = downcast<RenderInline>(*inlineContinuation->element()->renderer()).firstLineBox();
float topMargin = prevInlineHasLineBox ? collapsedMarginBefore() : LayoutUnit();
float bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter() : LayoutUnit();
LayoutRect rect(additionalOffset.x(), additionalOffset.y() - topMargin, width(), height() + topMargin + bottomMargin);
@@ -3297,8 +3290,8 @@
}
}
- if (inlineElementContinuation())
- inlineElementContinuation()->addFocusRingRects(rects, flooredLayoutPoint(LayoutPoint(additionalOffset + inlineElementContinuation()->containingBlock()->location() - location())), paintContainer);
+ if (inlineContinuation)
+ inlineContinuation->addFocusRingRects(rects, flooredLayoutPoint(LayoutPoint(additionalOffset + inlineContinuation->containingBlock()->location() - location())), paintContainer);
}
RenderPtr<RenderBlock> RenderBlock::createAnonymousBlockWithStyleAndDisplay(Document& document, const RenderStyle& style, EDisplay display)
Modified: trunk/Source/WebCore/rendering/RenderBlock.h (224599 => 224600)
--- trunk/Source/WebCore/rendering/RenderBlock.h 2017-11-08 23:11:56 UTC (rev 224599)
+++ trunk/Source/WebCore/rendering/RenderBlock.h 2017-11-08 23:13:42 UTC (rev 224600)
@@ -189,8 +189,6 @@
void addContinuationWithOutline(RenderInline*);
bool paintsContinuationOutline(RenderInline*);
- WEBCORE_EXPORT RenderInline* inlineElementContinuation() const;
-
static RenderPtr<RenderBlock> createAnonymousWithParentRendererAndDisplay(const RenderBox& parent, EDisplay = BLOCK);
RenderPtr<RenderBlock> createAnonymousBlock(EDisplay = BLOCK) const;
void dropAnonymousBoxChild(RenderBlock& child);
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (224599 => 224600)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2017-11-08 23:11:56 UTC (rev 224599)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2017-11-08 23:13:42 UTC (rev 224600)
@@ -279,7 +279,7 @@
if (!child->isAnonymousBlock() || !child->isInFlowPositioned())
return LayoutSize();
LayoutSize offset;
- for (RenderElement* parent = downcast<RenderBlock>(*child).inlineElementContinuation(); is<RenderInline>(parent); parent = parent->parent()) {
+ for (RenderElement* parent = downcast<RenderBlock>(*child).inlineContinuation(); is<RenderInline>(parent); parent = parent->parent()) {
if (parent->isInFlowPositioned())
offset += downcast<RenderInline>(*parent).offsetForInFlowPosition();
}
@@ -2507,6 +2507,19 @@
return continuationChainNode.next->renderer.get();
}
+RenderInline* RenderBoxModelObject::inlineContinuation() const
+{
+ if (!hasContinuationChainNode())
+ return nullptr;
+
+ for (auto* next = continuationChainNodeMap().get(this)->next; next; next = next->next) {
+ if (is<RenderInline>(*next->renderer))
+ return downcast<RenderInline>(next->renderer.get());
+ }
+ return nullptr;
+}
+
+
void RenderBoxModelObject::insertIntoContinuationChainAfter(RenderBoxModelObject& afterRenderer)
{
ASSERT(isContinuation());
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.h (224599 => 224600)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.h 2017-11-08 23:11:56 UTC (rev 224599)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.h 2017-11-08 23:13:42 UTC (rev 224600)
@@ -236,6 +236,7 @@
void suspendAnimations(double time = 0);
RenderBoxModelObject* continuation() const;
+ WEBCORE_EXPORT RenderInline* inlineContinuation() const;
void insertIntoContinuationChainAfter(RenderBoxModelObject&);
void removeFromContinuationChain();
Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (224599 => 224600)
--- trunk/Source/WebCore/rendering/RenderInline.cpp 2017-11-08 23:11:56 UTC (rev 224599)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp 2017-11-08 23:13:42 UTC (rev 224600)
@@ -113,18 +113,6 @@
RenderBoxModelObject::willBeDestroyed();
}
-RenderInline* RenderInline::inlineElementContinuation() const
-{
- RenderBoxModelObject* continuation = this->continuation();
- if (!continuation)
- return nullptr;
-
- if (is<RenderInline>(*continuation))
- return downcast<RenderInline>(continuation);
-
- return is<RenderBlock>(*continuation) ? downcast<RenderBlock>(*continuation).inlineElementContinuation() : nullptr;
-}
-
void RenderInline::updateFromStyle()
{
RenderBoxModelObject::updateFromStyle();
@@ -160,7 +148,7 @@
// If we are no longer in-flow positioned but our descendant block(s) still have an in-flow positioned ancestor then
// their containing anonymous block should keep its in-flow positioning.
- RenderInline* continuation = block.inlineElementContinuation();
+ RenderInline* continuation = block.inlineContinuation();
if (oldStyle->hasInFlowPosition() && inFlowPositionedInlineAncestor(continuation))
continue;
auto blockStyle = RenderStyle::createAnonymousStyleWithDisplay(block.style(), BLOCK);
@@ -192,9 +180,9 @@
// and after the block share the same style, but the block doesn't
// need to pass its style on to anyone else.
auto& newStyle = style();
- RenderInline* continuation = inlineElementContinuation();
+ RenderInline* continuation = inlineContinuation();
if (continuation && !isContinuation()) {
- for (RenderInline* currCont = continuation; currCont; currCont = currCont->inlineElementContinuation())
+ for (RenderInline* currCont = continuation; currCont; currCont = currCont->inlineContinuation())
currCont->setStyle(RenderStyle::clone(newStyle));
// If an inline's in-flow positioning has changed and it is part of an active continuation as a descendant of an anonymous containing block,
// then any descendant blocks will need to change their in-flow positioning accordingly.
@@ -286,7 +274,7 @@
{
if (is<RenderInline>(*renderer) && !renderer->isReplaced())
return downcast<RenderInline>(*renderer).continuation();
- return downcast<RenderBlock>(*renderer).inlineElementContinuation();
+ return downcast<RenderBlock>(*renderer).inlineContinuation();
}
RenderBoxModelObject* RenderInline::continuationBefore(RenderObject* beforeChild)
@@ -929,7 +917,7 @@
RenderBlock* currentBlock = continuation->isInline() ? continuation->containingBlock() : downcast<RenderBlock>(continuation);
if (continuation->isInline() || continuation->firstChild())
return continuation->positionForPoint(parentBlockPoint - currentBlock->locationOffset(), fragment);
- continuation = downcast<RenderBlock>(*continuation).inlineElementContinuation();
+ continuation = continuation->inlineContinuation();
}
return RenderBoxModelObject::positionForPoint(point, fragment);
Modified: trunk/Source/WebCore/rendering/RenderInline.h (224599 => 224600)
--- trunk/Source/WebCore/rendering/RenderInline.h 2017-11-08 23:11:56 UTC (rev 224599)
+++ trunk/Source/WebCore/rendering/RenderInline.h 2017-11-08 23:13:42 UTC (rev 224600)
@@ -79,8 +79,6 @@
void absoluteQuadsForSelection(Vector<FloatQuad>& quads) const override;
#endif
- RenderInline* inlineElementContinuation() const;
-
void updateDragState(bool dragOn) final;
LayoutSize offsetForInFlowPositionedInline(const RenderBox* child) const;
Modified: trunk/Source/WebCore/rendering/line/LineInlineHeaders.h (224599 => 224600)
--- trunk/Source/WebCore/rendering/line/LineInlineHeaders.h 2017-11-08 23:11:56 UTC (rev 224599)
+++ trunk/Source/WebCore/rendering/line/LineInlineHeaders.h 2017-11-08 23:13:42 UTC (rev 224600)
@@ -38,7 +38,7 @@
if (shouldApplyStartBorderPaddingOrMargin && (flow.borderStart() || flow.marginStart() || flow.paddingStart()))
return true;
- bool shouldApplyEndBorderPaddingOrMargin = !flow.parent()->isAnonymousBlock() || flow.isContinuation() || !flow.inlineElementContinuation();
+ bool shouldApplyEndBorderPaddingOrMargin = !flow.parent()->isAnonymousBlock() || flow.isContinuation() || !flow.inlineContinuation();
return shouldApplyEndBorderPaddingOrMargin && (flow.borderEnd() || flow.marginEnd() || flow.paddingEnd());
}
Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (224599 => 224600)
--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2017-11-08 23:11:56 UTC (rev 224599)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2017-11-08 23:13:42 UTC (rev 224600)
@@ -975,7 +975,7 @@
node = node->parentElement();
auto* renderer = (node) ? node->renderer() : nullptr;
- return renderer && renderer->childrenInline() && (is<RenderBlock>(*renderer) && !downcast<RenderBlock>(*renderer).inlineElementContinuation()) && !renderer->isTable();
+ return renderer && renderer->childrenInline() && (is<RenderBlock>(*renderer) && !downcast<RenderBlock>(*renderer).inlineContinuation()) && !renderer->isTable();
}
static bool hasCustomLineHeight(Node& node)
@@ -1037,7 +1037,7 @@
if (!renderer || renderer->style().userSelect() == SELECT_NONE)
return nullptr;
- if (renderer->childrenInline() && (is<RenderBlock>(*renderer) && !downcast<RenderBlock>(*renderer).inlineElementContinuation()) && !renderer->isTable()) {
+ if (renderer->childrenInline() && (is<RenderBlock>(*renderer) && !downcast<RenderBlock>(*renderer).inlineContinuation()) && !renderer->isTable()) {
range = enclosingTextUnitOfGranularity(position, WordGranularity, DirectionBackward);
if (range && !range->collapsed())
return range;
Modified: trunk/Source/WebKitLegacy/mac/DOM/DOMUIKitExtensions.mm (224599 => 224600)
--- trunk/Source/WebKitLegacy/mac/DOM/DOMUIKitExtensions.mm 2017-11-08 23:11:56 UTC (rev 224599)
+++ trunk/Source/WebKitLegacy/mac/DOM/DOMUIKitExtensions.mm 2017-11-08 23:13:42 UTC (rev 224600)
@@ -199,7 +199,7 @@
RenderObject* renderer = core(self)->renderer();
return renderer
&& renderer->childrenInline()
- && (is<RenderBlock>(*renderer) && !downcast<RenderBlock>(*renderer).inlineElementContinuation())
+ && (is<RenderBlock>(*renderer) && !downcast<RenderBlock>(*renderer).inlineContinuation())
&& !renderer->isTable();
}
@@ -206,7 +206,7 @@
- (BOOL)isSelectableBlock
{
RenderObject* renderer = core(self)->renderer();
- return renderer && (is<RenderBlockFlow>(*renderer) || (is<RenderBlock>(*renderer) && downcast<RenderBlock>(*renderer).inlineElementContinuation() != nil));
+ return renderer && (is<RenderBlockFlow>(*renderer) || (is<RenderBlock>(*renderer) && downcast<RenderBlock>(*renderer).inlineContinuation() != nil));
}
- (DOMRange *)rangeOfContainingParagraph
@@ -271,7 +271,7 @@
result = INT_MAX;
} else if (!renderer->firstChildSlow()) {
result = 0;
- } else if (is<RenderBlockFlow>(*renderer) || (is<RenderBlock>(*renderer) && downcast<RenderBlock>(*renderer).inlineElementContinuation())) {
+ } else if (is<RenderBlockFlow>(*renderer) || (is<RenderBlock>(*renderer) && downcast<RenderBlock>(*renderer).inlineContinuation())) {
BOOL noCost = NO;
if (is<RenderBox>(*renderer)) {
RenderBox& asBox = renderer->enclosingBox();