summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/rendering')
-rw-r--r--Source/WebCore/rendering/PaintPhase.h19
-rw-r--r--Source/WebCore/rendering/RenderBoxModelObject.cpp4
-rw-r--r--Source/WebCore/rendering/RenderListItem.cpp5
-rw-r--r--Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp26
-rw-r--r--Source/WebCore/rendering/RenderObject.cpp6
-rw-r--r--Source/WebCore/rendering/RenderObject.h2
-rw-r--r--Source/WebCore/rendering/RenderTableRow.cpp19
-rw-r--r--Source/WebCore/rendering/RenderTextFragment.cpp3
-rw-r--r--Source/WebCore/rendering/RenderVTTCue.cpp2
-rw-r--r--Source/WebCore/rendering/RenderView.cpp6
-rw-r--r--Source/WebCore/rendering/svg/SVGInlineTextBox.cpp3
-rw-r--r--Source/WebCore/rendering/svg/SVGRenderingContext.cpp4
-rw-r--r--Source/WebCore/rendering/svg/SVGRootInlineBox.cpp3
13 files changed, 81 insertions, 21 deletions
diff --git a/Source/WebCore/rendering/PaintPhase.h b/Source/WebCore/rendering/PaintPhase.h
index d46fc4ed4..6e8033047 100644
--- a/Source/WebCore/rendering/PaintPhase.h
+++ b/Source/WebCore/rendering/PaintPhase.h
@@ -54,15 +54,16 @@ enum PaintPhase {
};
enum PaintBehaviorFlags {
- PaintBehaviorNormal = 0,
- PaintBehaviorSelectionOnly = 1 << 0,
- PaintBehaviorForceBlackText = 1 << 1,
- PaintBehaviorForceWhiteText = 1 << 2,
- PaintBehaviorFlattenCompositingLayers = 1 << 3,
- PaintBehaviorRenderingSVGMask = 1 << 4,
- PaintBehaviorSkipRootBackground = 1 << 5,
- PaintBehaviorRootBackgroundOnly = 1 << 6,
- PaintBehaviorSelectionAndBackgroundsOnly = 1 << 7,
+ PaintBehaviorNormal = 0,
+ PaintBehaviorSelectionOnly = 1 << 0,
+ PaintBehaviorSkipSelectionHighlight = 1 << 1,
+ PaintBehaviorForceBlackText = 1 << 2,
+ PaintBehaviorForceWhiteText = 1 << 3,
+ PaintBehaviorFlattenCompositingLayers = 1 << 4,
+ PaintBehaviorRenderingSVGMask = 1 << 5,
+ PaintBehaviorSkipRootBackground = 1 << 6,
+ PaintBehaviorRootBackgroundOnly = 1 << 7,
+ PaintBehaviorSelectionAndBackgroundsOnly = 1 << 8,
};
typedef unsigned PaintBehavior;
diff --git a/Source/WebCore/rendering/RenderBoxModelObject.cpp b/Source/WebCore/rendering/RenderBoxModelObject.cpp
index 749bee2bf..c96929db8 100644
--- a/Source/WebCore/rendering/RenderBoxModelObject.cpp
+++ b/Source/WebCore/rendering/RenderBoxModelObject.cpp
@@ -2571,9 +2571,11 @@ void RenderBoxModelObject::moveChildrenTo(RenderBoxModelObject* toBoxModelObject
// Save our next sibling as moveChildTo will clear it.
RenderObject* nextSibling = child->nextSibling();
+ // FIXME: This logic here fails to detect the first letter in certain cases
+ // and skips a valid sibling renderer (see webkit.org/b/163737).
// Check to make sure we're not saving the firstLetter as the nextSibling.
// When the |child| object will be moved, its firstLetter will be recreated,
- // so saving it now in nextSibling would let us with a destroyed object.
+ // so saving it now in nextSibling would leave us with a stale object.
if (is<RenderTextFragment>(*child) && is<RenderText>(nextSibling)) {
RenderObject* firstLetterObj = nullptr;
if (RenderBlock* block = downcast<RenderTextFragment>(*child).blockForAccompanyingFirstLetter()) {
diff --git a/Source/WebCore/rendering/RenderListItem.cpp b/Source/WebCore/rendering/RenderListItem.cpp
index f9c8ff1ce..9ce483c2b 100644
--- a/Source/WebCore/rendering/RenderListItem.cpp
+++ b/Source/WebCore/rendering/RenderListItem.cpp
@@ -273,6 +273,11 @@ void RenderListItem::insertOrMoveMarkerRendererIfNeeded()
if (!m_marker)
return;
+ // FIXME: Do not even try reposition the marker when we are not in layout
+ // until after we fixed webkit.org/b/163789.
+ if (!view().frameView().isInRenderTreeLayout())
+ return;
+
RenderElement* currentParent = m_marker->parent();
RenderBlock* newParent = getParentOfFirstLineBox(*this, *m_marker);
if (!newParent) {
diff --git a/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp b/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp
index b212f632d..06ff8cd3c 100644
--- a/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp
+++ b/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp
@@ -270,10 +270,34 @@ static bool isValidColumnSpanner(RenderMultiColumnFlowThread* flowThread, Render
return false;
}
+static RenderObject* spannerPlacehoderCandidate(const RenderObject& renderer, const RenderMultiColumnFlowThread& stayWithin)
+{
+ // Spanner candidate is a next sibling/ancestor's next child within the flow thread and
+ // it is in the same inflow/out-of-flow layout context.
+ if (renderer.isOutOfFlowPositioned())
+ return nullptr;
+
+ ASSERT(renderer.isDescendantOf(&stayWithin));
+ auto* current = &renderer;
+ while (true) {
+ // Skip to the first in-flow sibling.
+ auto* nextSibling = current->nextSibling();
+ while (nextSibling && nextSibling->isOutOfFlowPositioned())
+ nextSibling = nextSibling->nextSibling();
+ if (nextSibling)
+ return nextSibling;
+ // No sibling candidate, jump to the parent and check its siblings.
+ current = current->parent();
+ if (!current || current == &stayWithin || current->isOutOfFlowPositioned())
+ return nullptr;
+ }
+ return nullptr;
+}
+
RenderObject* RenderMultiColumnFlowThread::processPossibleSpannerDescendant(RenderObject*& subtreeRoot, RenderObject* descendant)
{
RenderBlockFlow* multicolContainer = multiColumnBlockFlow();
- RenderObject* nextRendererInFlowThread = descendant->nextInPreOrderAfterChildren(this);
+ RenderObject* nextRendererInFlowThread = spannerPlacehoderCandidate(*descendant, *this);
RenderObject* insertBeforeMulticolChild = nullptr;
RenderObject* nextDescendant = descendant;
diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp
index df2cd277d..ca6427995 100644
--- a/Source/WebCore/rendering/RenderObject.cpp
+++ b/Source/WebCore/rendering/RenderObject.cpp
@@ -1243,7 +1243,11 @@ void RenderObject::showRenderObject(bool mark, int depth) const
fprintf(stderr, " \"%s\"", value.utf8().data());
}
}
-
+ if (is<RenderBoxModelObject>(*this)) {
+ auto& renderer = downcast<RenderBoxModelObject>(*this);
+ if (renderer.hasContinuation())
+ fprintf(stderr, " continuation->(%p)", renderer.continuation());
+ }
showRegionsInformation();
fprintf(stderr, "\n");
}
diff --git a/Source/WebCore/rendering/RenderObject.h b/Source/WebCore/rendering/RenderObject.h
index ad2583619..efe708c3b 100644
--- a/Source/WebCore/rendering/RenderObject.h
+++ b/Source/WebCore/rendering/RenderObject.h
@@ -463,7 +463,7 @@ public:
// RenderBlock::createAnonymousBlock(). This includes creating an anonymous
// RenderBlock having a BLOCK or BOX display. Other classes such as RenderTextFragment
// are not RenderBlocks and will return false. See https://bugs.webkit.org/show_bug.cgi?id=56709.
- return isAnonymous() && (style().display() == BLOCK || style().display() == BOX) && style().styleType() == NOPSEUDO && isRenderBlock() && !isListMarker() && !isRenderFlowThread() && !isRenderMultiColumnSet() && !isRenderView()
+ return isAnonymous() && (style().display() == BLOCK || style().display() == BOX) && style().styleType() == NOPSEUDO && isRenderBlock() && !isListMarker() && !isRenderFlowThread() && !isRenderNamedFlowFragment() && !isRenderMultiColumnSet() && !isRenderView()
#if ENABLE(FULLSCREEN_API)
&& !isRenderFullScreen()
&& !isRenderFullScreenPlaceholder()
diff --git a/Source/WebCore/rendering/RenderTableRow.cpp b/Source/WebCore/rendering/RenderTableRow.cpp
index 2bcb4eb1e..3ae703edc 100644
--- a/Source/WebCore/rendering/RenderTableRow.cpp
+++ b/Source/WebCore/rendering/RenderTableRow.cpp
@@ -128,10 +128,21 @@ void RenderTableRow::addChild(RenderObject* child, RenderObject* beforeChild)
}
}
- // If beforeChild is inside an anonymous cell, insert into the cell.
- if (last && !is<RenderTableCell>(*last) && last->parent() && last->parent()->isAnonymous() && !last->parent()->isBeforeOrAfterContent()) {
- last->parent()->addChild(child, beforeChild);
- return;
+ // Try to find an anonymous container for the child.
+ if (last && last->parent() && last->parent()->isAnonymous() && !last->parent()->isBeforeOrAfterContent()) {
+ // If beforeChild is inside an anonymous cell, insert into the cell.
+ if (!is<RenderTableCell>(*last)) {
+ last->parent()->addChild(child, beforeChild);
+ return;
+ }
+ // If beforeChild is inside an anonymous row, insert into the row.
+ auto& parent = *last->parent();
+ if (is<RenderTableRow>(parent)) {
+ RenderTableCell* cell = RenderTableCell::createAnonymousWithParentRenderer(this);
+ parent.addChild(cell, beforeChild);
+ cell->addChild(child);
+ return;
+ }
}
RenderTableCell* cell = RenderTableCell::createAnonymousWithParentRenderer(this);
diff --git a/Source/WebCore/rendering/RenderTextFragment.cpp b/Source/WebCore/rendering/RenderTextFragment.cpp
index 5d29b4457..744d47461 100644
--- a/Source/WebCore/rendering/RenderTextFragment.cpp
+++ b/Source/WebCore/rendering/RenderTextFragment.cpp
@@ -25,6 +25,7 @@
#include "RenderBlock.h"
#include "RenderIterator.h"
+#include "RenderMultiColumnFlowThread.h"
#include "Text.h"
namespace WebCore {
@@ -112,6 +113,8 @@ RenderBlock* RenderTextFragment::blockForAccompanyingFirstLetter()
if (!m_firstLetter)
return nullptr;
for (auto& block : ancestorsOfType<RenderBlock>(*m_firstLetter)) {
+ if (is<RenderMultiColumnFlowThread>(block))
+ break;
if (block.style().hasPseudoStyle(FIRST_LETTER) && block.canHaveChildren())
return &block;
}
diff --git a/Source/WebCore/rendering/RenderVTTCue.cpp b/Source/WebCore/rendering/RenderVTTCue.cpp
index f97ba1c17..92f9007a6 100644
--- a/Source/WebCore/rendering/RenderVTTCue.cpp
+++ b/Source/WebCore/rendering/RenderVTTCue.cpp
@@ -70,6 +70,8 @@ void RenderVTTCue::layout()
bool RenderVTTCue::initializeLayoutParameters(InlineFlowBox*& firstLineBox, LayoutUnit& step, LayoutUnit& position)
{
ASSERT(firstChild());
+ if (!firstChild())
+ return false;
RenderBlock* parentBlock = containingBlock();
diff --git a/Source/WebCore/rendering/RenderView.cpp b/Source/WebCore/rendering/RenderView.cpp
index 433630039..3c10cb5cf 100644
--- a/Source/WebCore/rendering/RenderView.cpp
+++ b/Source/WebCore/rendering/RenderView.cpp
@@ -612,7 +612,11 @@ void RenderView::repaintRootContents()
layer()->setBackingNeedsRepaint(GraphicsLayer::DoNotClipToLayer);
return;
}
- repaint();
+
+ // Always use layoutOverflowRect() to fix rdar://problem/27182267.
+ // This should be cleaned up via webkit.org/b/159913 and webkit.org/b/159914.
+ RenderLayerModelObject* repaintContainer = containerForRepaint();
+ repaintUsingContainer(repaintContainer, computeRectForRepaint(layoutOverflowRect(), repaintContainer));
}
void RenderView::repaintViewRectangle(const LayoutRect& repaintRect) const
diff --git a/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp b/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp
index ddf4a8f5f..669066fdf 100644
--- a/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp
+++ b/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp
@@ -249,6 +249,7 @@ void SVGInlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffse
auto& parentRenderer = parent()->renderer();
bool paintSelectedTextOnly = paintInfo.phase == PaintPhaseSelection;
+ bool shouldPaintSelectionHighlight = !(paintInfo.paintBehavior & PaintBehaviorSkipSelectionHighlight);
bool hasSelection = !parentRenderer.document().printing() && selectionState() != RenderObject::SelectionNone;
if (!hasSelection && paintSelectedTextOnly)
return;
@@ -264,7 +265,7 @@ void SVGInlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffse
bool hasVisibleStroke = svgStyle.hasVisibleStroke();
RenderStyle* selectionStyle = &style;
- if (hasSelection) {
+ if (hasSelection && shouldPaintSelectionHighlight) {
selectionStyle = parentRenderer.getCachedPseudoStyle(SELECTION);
if (selectionStyle) {
const SVGRenderStyle& svgSelectionStyle = selectionStyle->svgStyle();
diff --git a/Source/WebCore/rendering/svg/SVGRenderingContext.cpp b/Source/WebCore/rendering/svg/SVGRenderingContext.cpp
index 879513cb9..2dba13672 100644
--- a/Source/WebCore/rendering/svg/SVGRenderingContext.cpp
+++ b/Source/WebCore/rendering/svg/SVGRenderingContext.cpp
@@ -295,7 +295,9 @@ void SVGRenderingContext::renderSubtreeToImageBuffer(ImageBuffer* image, RenderE
{
ASSERT(image);
- PaintInfo info(image->context(), LayoutRect::infiniteRect(), PaintPhaseForeground, PaintBehaviorNormal);
+ // Rendering into a buffer implies we're being used for masking, clipping, patterns or filters. In each of these
+ // cases we don't want to paint the selection.
+ PaintInfo info(image->context(), LayoutRect::infiniteRect(), PaintPhaseForeground, PaintBehaviorSkipSelectionHighlight);
AffineTransform& contentTransformation = currentContentTransformation();
AffineTransform savedContentTransformation = contentTransformation;
diff --git a/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp b/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp
index be67d7484..c6d23f57c 100644
--- a/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp
+++ b/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp
@@ -53,9 +53,10 @@ void SVGRootInlineBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffse
bool isPrinting = renderSVGText().document().printing();
bool hasSelection = !isPrinting && selectionState() != RenderObject::SelectionNone;
+ bool shouldPaintSelectionHighlight = !(paintInfo.paintBehavior & PaintBehaviorSkipSelectionHighlight);
PaintInfo childPaintInfo(paintInfo);
- if (hasSelection) {
+ if (hasSelection && shouldPaintSelectionHighlight) {
for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
if (is<SVGInlineTextBox>(*child))
downcast<SVGInlineTextBox>(*child).paintSelectionBackground(childPaintInfo);