summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderBlock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/rendering/RenderBlock.cpp')
-rwxr-xr-xSource/WebCore/rendering/RenderBlock.cpp311
1 files changed, 169 insertions, 142 deletions
diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp
index 4c2899e0f..c3017a425 100755
--- a/Source/WebCore/rendering/RenderBlock.cpp
+++ b/Source/WebCore/rendering/RenderBlock.cpp
@@ -932,6 +932,14 @@ void RenderBlock::addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild,
}
RenderBox::addChild(newChild, beforeChild);
+
+ // Handle positioning of run-ins.
+ if (newChild->isRunIn())
+ moveRunInUnderSiblingBlockIfNeeded(newChild);
+ else if (RenderObject* prevSibling = newChild->previousSibling()) {
+ if (prevSibling->isRunIn())
+ moveRunInUnderSiblingBlockIfNeeded(prevSibling);
+ }
if (madeBoxesNonInline && parent() && isAnonymousBlock() && parent()->isRenderBlock())
toRenderBlock(parent())->removeLeftoverAnonymousBlock(this);
@@ -1038,6 +1046,13 @@ void RenderBlock::makeChildrenNonInline(RenderObject *insertionPoint)
if (!child)
return;
+ // Since we are going to have block children, we have to move
+ // back the run-in to its original place.
+ if (child->isRunIn()) {
+ moveRunInToOriginalPosition(child);
+ child = firstChild();
+ }
+
deleteLineBoxTree();
while (child) {
@@ -1503,7 +1518,7 @@ void RenderBlock::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeigh
statePusher.pop();
if (renderView->layoutState()->m_pageLogicalHeight)
- setPageLogicalOffset(renderView->layoutState()->pageLogicalOffset(logicalTop()));
+ setPageLogicalOffset(renderView->layoutState()->pageLogicalOffset(this, logicalTop()));
updateLayerTransform();
@@ -1724,8 +1739,7 @@ bool RenderBlock::handleSpecialChild(RenderBox* child, const MarginInfo& marginI
{
// Handle in the given order
return handlePositionedChild(child, marginInfo)
- || handleFloatingChild(child, marginInfo)
- || handleRunInChild(child);
+ || handleFloatingChild(child, marginInfo);
}
@@ -1749,77 +1763,115 @@ bool RenderBlock::handleFloatingChild(RenderBox* child, const MarginInfo& margin
return false;
}
-bool RenderBlock::handleRunInChild(RenderBox* child)
+static void destroyRunIn(RenderBoxModelObject* runIn)
{
- // See if we have a run-in element with inline children. If the
- // children aren't inline, then just treat the run-in as a normal
- // block.
- if (!child->isRunIn() || !child->childrenInline())
- return false;
+ ASSERT(runIn->isRunIn());
+ ASSERT(!runIn->firstChild());
+
+ // If it is a block run-in, delete its line box tree as well. This is needed as our
+ // children got moved and our line box tree is no longer valid.
+ if (runIn->isRenderBlock())
+ toRenderBlock(runIn)->deleteLineBoxTree();
+ runIn->destroy();
+}
+
+RenderBoxModelObject* RenderBlock::createReplacementRunIn(RenderBoxModelObject* runIn)
+{
+ ASSERT(runIn->isRunIn());
+
+ // First we destroy any :before/:after content. It will be regenerated by the new run-in.
+ // Exception is if the run-in itself is generated.
+ if (runIn->style()->styleType() != BEFORE && runIn->style()->styleType() != AFTER) {
+ RenderObject* generatedContent;
+ if (runIn->getCachedPseudoStyle(BEFORE) && (generatedContent = runIn->beforePseudoElementRenderer()))
+ generatedContent->destroy();
+ if (runIn->getCachedPseudoStyle(AFTER) && (generatedContent = runIn->afterPseudoElementRenderer()))
+ generatedContent->destroy();
+ }
+
+ bool newRunInShouldBeBlock = !runIn->isRenderBlock();
+ Node* runInNode = runIn->node();
+ RenderBoxModelObject* newRunIn = 0;
+ if (newRunInShouldBeBlock)
+ newRunIn = new (renderArena()) RenderBlock(runInNode ? runInNode : document());
+ else
+ newRunIn = new (renderArena()) RenderInline(runInNode ? runInNode : document());
+ newRunIn->setStyle(runIn->style());
+
+ runIn->moveAllChildrenTo(newRunIn, true);
+
+ // If the run-in had an element, we need to set the new renderer.
+ if (runInNode)
+ runInNode->setRenderer(newRunIn);
+
+ return newRunIn;
+}
+
+void RenderBlock::moveRunInUnderSiblingBlockIfNeeded(RenderObject* runIn)
+{
+ ASSERT(runIn->isRunIn());
+
+ // See if we have inline children. If the children aren't inline,
+ // then just treat the run-in as a normal block.
+ if (!runIn->childrenInline())
+ return;
// FIXME: We don't handle non-block elements with run-in for now.
- if (!child->isRenderBlock())
- return false;
+ if (!runIn->isRenderBlock())
+ return;
- // Run-in child shouldn't intrude into the sibling block if it is part of a
+ // We shouldn't run in into the sibling block if we are part of a
// continuation chain. In that case, treat it as a normal block.
- if (child->isElementContinuation() || child->virtualContinuation())
- return false;
+ if (runIn->isElementContinuation() || runIn->virtualContinuation())
+ return;
// Check if this node is allowed to run-in. E.g. <select> expects its renderer to
// be a RenderListBox or RenderMenuList, and hence cannot be a RenderInline run-in.
- Node* runInNode = child->node();
+ Node* runInNode = runIn->node();
if (runInNode && runInNode->hasTagName(selectTag))
- return false;
+ return;
- RenderBlock* blockRunIn = toRenderBlock(child);
- RenderObject* curr = blockRunIn->nextSibling();
- if (!curr || !curr->isRenderBlock() || !curr->childrenInline() || curr->isRunIn() || curr->isAnonymous() || curr->isFloatingOrPositioned())
- return false;
+ RenderObject* curr = runIn->nextSibling();
+ if (!curr || !curr->isRenderBlock() || !curr->childrenInline())
+ return;
- RenderBlock* currBlock = toRenderBlock(curr);
+ // Per CSS3, "A run-in cannot run in to a block that already starts with a
+ // run-in or that itself is a run-in".
+ if (curr->isRunIn() || (curr->firstChild() && curr->firstChild()->isRunIn()))
+ return;
- // First we destroy any :before/:after content. It will be regenerated by the new inline.
- // Exception is if the run-in itself is generated.
- if (child->style()->styleType() != BEFORE && child->style()->styleType() != AFTER) {
- RenderObject* generatedContent;
- if (child->getCachedPseudoStyle(BEFORE) && (generatedContent = child->beforePseudoElementRenderer()))
- generatedContent->destroy();
- if (child->getCachedPseudoStyle(AFTER) && (generatedContent = child->afterPseudoElementRenderer()))
- generatedContent->destroy();
- }
+ if (curr->isAnonymous() || curr->isFloatingOrPositioned())
+ return;
- // Remove the old child.
- children()->removeChildNode(this, blockRunIn);
+ RenderBoxModelObject* oldRunIn = toRenderBoxModelObject(runIn);
+ RenderBoxModelObject* newRunIn = createReplacementRunIn(oldRunIn);
+ destroyRunIn(oldRunIn);
- // Create an inline.
- RenderInline* inlineRunIn = new (renderArena()) RenderInline(runInNode ? runInNode : document());
- inlineRunIn->setStyle(blockRunIn->style());
+ // Now insert the new child under |curr| block. Use addChild instead of insertChildNode
+ // since it handles correct placement of the children, especially where we cannot insert
+ // anything before the first child. e.g. details tag. See https://bugs.webkit.org/show_bug.cgi?id=58228.
+ curr->addChild(newRunIn, curr->firstChild());
+}
- // Move the nodes from the old child to the new child
- for (RenderObject* runInChild = blockRunIn->firstChild(); runInChild;) {
- RenderObject* nextSibling = runInChild->nextSibling();
- blockRunIn->children()->removeChildNode(blockRunIn, runInChild);
- inlineRunIn->addChild(runInChild); // Use addChild instead of appendChildNode since it handles correct placement of the children relative to :after-generated content.
- runInChild = nextSibling;
- }
+void RenderBlock::moveRunInToOriginalPosition(RenderObject* runIn)
+{
+ ASSERT(runIn->isRunIn());
- // Now insert the new child under |currBlock|. Use addChild instead of insertChildNode since it handles correct placement of the children, esp where we cannot insert
- // anything before the first child. e.g. details tag. See https://bugs.webkit.org/show_bug.cgi?id=58228.
- currBlock->addChild(inlineRunIn, currBlock->firstChild());
-
- // If the run-in had an element, we need to set the new renderer.
- if (runInNode)
- runInNode->setRenderer(inlineRunIn);
+ // If we don't have a parent, there is nothing to move. This might
+ // happen if |this| got detached from parent after |runIn| run into |this|.
+ if (!parent())
+ return;
+
+ // An intruded run-in needs to be an inline.
+ if (!runIn->isRenderInline())
+ return;
- // Destroy the block run-in, which includes deleting its line box tree.
- blockRunIn->deleteLineBoxTree();
- blockRunIn->destroy();
+ RenderBoxModelObject* oldRunIn = toRenderBoxModelObject(runIn);
+ RenderBoxModelObject* newRunIn = createReplacementRunIn(oldRunIn);
+ destroyRunIn(oldRunIn);
- // The block acts like an inline, so just null out its
- // position.
-
- return true;
+ // Add the run-in block as our previous sibling.
+ parent()->addChild(newRunIn, this);
}
LayoutUnit RenderBlock::collapseMargins(RenderBox* child, MarginInfo& marginInfo)
@@ -2478,7 +2530,7 @@ void RenderBlock::markForPaginationRelayoutIfNeeded()
if (needsLayout())
return;
- if (view()->layoutState()->pageLogicalHeightChanged() || (view()->layoutState()->pageLogicalHeight() && view()->layoutState()->pageLogicalOffset(logicalTop()) != pageLogicalOffset()))
+ if (view()->layoutState()->pageLogicalHeightChanged() || (view()->layoutState()->pageLogicalHeight() && view()->layoutState()->pageLogicalOffset(this, logicalTop()) != pageLogicalOffset()))
setChildNeedsLayout(true, MarkOnlyThis);
}
@@ -2621,6 +2673,7 @@ void RenderBlock::paintColumnContents(PaintInfo& paintInfo, const LayoutPoint& p
if (!colCount)
return;
LayoutUnit currLogicalTopOffset = 0;
+ LayoutUnit colGap = columnGap();
for (unsigned i = 0; i < colCount; i++) {
// For each rect, we clip to the rect, and then we adjust our coords.
LayoutRect colRect = columnRectAt(colInfo, i);
@@ -2639,10 +2692,19 @@ void RenderBlock::paintColumnContents(PaintInfo& paintInfo, const LayoutPoint& p
if (!info.rect.isEmpty()) {
GraphicsContextStateSaver stateSaver(*context);
+ LayoutRect clipRect(colRect);
+ if (i < colCount - 1) {
+ if (isHorizontalWritingMode())
+ clipRect.expand(colGap / 2, 0);
+ else
+ clipRect.expand(0, colGap / 2);
+ }
// Each strip pushes a clip, since column boxes are specified as being
// like overflow:hidden.
- context->clip(colRect);
+ // FIXME: Content and column rules that extend outside column boxes at the edges of the multi-column element
+ // are clipped according to the 'overflow' property.
+ context->clip(clipRect);
// Adjust our x and y when painting.
LayoutPoint adjustedPaintOffset = paintOffset + offset;
@@ -3295,6 +3357,7 @@ LayoutRect RenderBlock::logicalLeftSelectionGap(RenderBlock* rootBlock, const La
return LayoutRect();
LayoutRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalPosition, LayoutRect(rootBlockLogicalLeft, rootBlockLogicalTop, rootBlockLogicalWidth, logicalHeight));
+ alignSelectionRectToDevicePixels(gapRect);
if (paintInfo)
paintInfo->context->fillRect(gapRect, selObj->selectionBackgroundColor(), selObj->style()->colorSpace());
return gapRect;
@@ -3311,6 +3374,7 @@ LayoutRect RenderBlock::logicalRightSelectionGap(RenderBlock* rootBlock, const L
return LayoutRect();
LayoutRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalPosition, LayoutRect(rootBlockLogicalLeft, rootBlockLogicalTop, rootBlockLogicalWidth, logicalHeight));
+ alignSelectionRectToDevicePixels(gapRect);
if (paintInfo)
paintInfo->context->fillRect(gapRect, selObj->selectionBackgroundColor(), selObj->style()->colorSpace());
return gapRect;
@@ -4168,9 +4232,8 @@ LayoutUnit RenderBlock::addOverhangingFloats(RenderBlock* child, bool makeChildP
if (logicalBottom > logicalHeight()) {
// If the object is not in the list, we add it now.
if (!containsFloat(r->m_renderer)) {
- LayoutUnit leftOffset = isHorizontalWritingMode() ? -childLogicalLeft : -childLogicalTop;
- LayoutUnit topOffset = isHorizontalWritingMode() ? -childLogicalTop : -childLogicalLeft;
- FloatingObject* floatingObj = new FloatingObject(r->type(), LayoutRect(r->x() - leftOffset, r->y() - topOffset, r->width(), r->height()));
+ LayoutSize offset = isHorizontalWritingMode() ? LayoutSize(-childLogicalLeft, -childLogicalTop) : LayoutSize(-childLogicalTop, -childLogicalLeft);
+ FloatingObject* floatingObj = new FloatingObject(r->type(), LayoutRect(r->frameRect().location() - offset, r->frameRect().size()));
floatingObj->m_renderer = r->m_renderer;
// The nearest enclosing layer always paints the float (so that zindex and stacking
@@ -4237,10 +4300,8 @@ void RenderBlock::addIntrudingFloats(RenderBlock* prev, LayoutUnit logicalLeftOf
FloatingObject* r = *prevIt;
if (logicalBottomForFloat(r) > logicalTopOffset) {
if (!m_floatingObjects || !m_floatingObjects->set().contains(r)) {
- LayoutUnit leftOffset = isHorizontalWritingMode() ? logicalLeftOffset : logicalTopOffset;
- LayoutUnit topOffset = isHorizontalWritingMode() ? logicalTopOffset : logicalLeftOffset;
-
- FloatingObject* floatingObj = new FloatingObject(r->type(), LayoutRect(r->x() - leftOffset, r->y() - topOffset, r->width(), r->height()));
+ LayoutSize offset = isHorizontalWritingMode() ? LayoutSize(logicalLeftOffset, logicalTopOffset) : LayoutSize(logicalTopOffset, logicalLeftOffset);
+ FloatingObject* floatingObj = new FloatingObject(r->type(), LayoutRect(r->frameRect().location() - offset, r->frameRect().size()));
// Applying the child's margin makes no sense in the case where the child was passed in.
// since this margin was added already through the modification of the |logicalLeftOffset| variable
@@ -4931,7 +4992,7 @@ bool RenderBlock::layoutColumns(bool hasSpecifiedPageLogicalHeight, LayoutUnit p
// maximum page break distance.
if (!pageLogicalHeight) {
LayoutUnit distanceBetweenBreaks = max<LayoutUnit>(colInfo->maximumDistanceBetweenForcedBreaks(),
- view()->layoutState()->pageLogicalOffset(borderBefore() + paddingBefore() + contentLogicalHeight()) - colInfo->forcedBreakOffset());
+ view()->layoutState()->pageLogicalOffset(this, borderBefore() + paddingBefore() + contentLogicalHeight()) - colInfo->forcedBreakOffset());
columnHeight = max(colInfo->minimumColumnHeight(), distanceBetweenBreaks);
}
} else if (contentLogicalHeight() > boundedMultiply(pageLogicalHeight, desiredColumnCount)) {
@@ -5167,7 +5228,8 @@ void RenderBlock::computePreferredLogicalWidths()
updateFirstLetter();
RenderStyle* styleToUse = style();
- if (!isTableCell() && styleToUse->logicalWidth().isFixed() && styleToUse->logicalWidth().value() >= 0 && style()->marqueeBehavior() != MALTERNATE)
+ if (!isTableCell() && styleToUse->logicalWidth().isFixed() && styleToUse->logicalWidth().value() >= 0
+ && style()->marqueeBehavior() != MALTERNATE && !(isDeprecatedFlexItem() && !styleToUse->logicalWidth().intValue()))
m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(styleToUse->logicalWidth().value());
else {
m_minPreferredLogicalWidth = 0;
@@ -5701,7 +5763,7 @@ bool RenderBlock::hasLineIfEmpty() const
if (!node())
return false;
- if (node()->rendererIsEditable() && node()->rootEditableElement() == node())
+ if (node()->isRootEditableElement())
return true;
if (node()->isShadowRoot() && (node()->shadowHost()->hasTagName(inputTag)))
@@ -5890,58 +5952,6 @@ static inline bool shouldSkipForFirstLetter(UChar c)
return isSpaceOrNewline(c) || c == noBreakSpace || isPunctuationForFirstLetter(c);
}
-RenderObject* RenderBlock::findLastObjectWithFirstLetterText(RenderObject* child, RenderObject* &firstLetterBlock)
-{
- while (child) {
- RenderObject* nextChild = child->nextSibling();
- // Style and skip over any objects such as quotes or punctuation
- child = findLastObjectAfterFirstLetterPunctuation(child, firstLetterBlock);
- if (child)
- break;
- child = nextChild;
- }
- return child;
-}
-
-RenderObject* RenderBlock::findLastObjectAfterFirstLetterPunctuation(RenderObject* child, RenderObject* &firstLetterBlock)
-{
- if (child->isText()) {
- // CSS 2.1 http://www.w3.org/TR/CSS21/selector.html#first-letter
- // "The first letter must occur on the first formatted line."
- if (child->isBR())
- return child;
-
- // If child is a single punctuation mark or a Render Quote then style it as first-letter now and keep looking for further text,
- bool textQuote = toRenderText(child)->textLength() == 1 && isPunctuationForFirstLetter(toRenderText(child)->characters()[0]);
- if (child->isQuote() || textQuote)
- addFirstLetter(child, firstLetterBlock);
- else if (!toRenderText(child)->isAllCollapsibleWhitespace())
- return child;
- return 0;
- }
-
- if (child->isListMarker())
- return 0;
-
- if (child->isFloatingOrPositioned()) {
- // Floats and positioned objects do not inherit their style from parents so if it is styled
- // inspect its children for text, otherwise move on to its sibling.
- if (child->style()->styleType() == FIRST_LETTER)
- return findLastObjectWithFirstLetterText(child->firstChild(), firstLetterBlock);
- return 0;
- }
-
- if (child->isReplaced() || child->isRenderButton() || child->isMenuList())
- return child;
-
- if (child->style()->hasPseudoStyle(FIRST_LETTER) && child->canHaveChildren()) {
- // We found a lower-level node with first-letter, which supersedes the higher-level style.
- firstLetterBlock = child;
- return findLastObjectWithFirstLetterText(child->firstChild(), firstLetterBlock);
- }
- return findLastObjectWithFirstLetterText(child->firstChild(), firstLetterBlock);
-}
-
static inline RenderObject* findFirstLetterBlock(RenderBlock* start)
{
RenderObject* firstLetterBlock = start;
@@ -6091,36 +6101,47 @@ void RenderBlock::updateFirstLetter()
if (!firstLetterBlock)
return;
- // Check each sibling and drill into its inlines until we find a text node that is not all whitespace
- // or is a line break.
- RenderObject* firstLetterObject = firstLetterBlock->firstChild();
-
- firstLetterObject = findLastObjectWithFirstLetterText(firstLetterObject, firstLetterBlock);
+ // Drill into inlines looking for our first text child.
+ RenderObject* currChild = firstLetterBlock->firstChild();
+ while (currChild) {
+ if (currChild->isText())
+ break;
+ if (currChild->isListMarker())
+ currChild = currChild->nextSibling();
+ else if (currChild->isFloatingOrPositioned()) {
+ if (currChild->style()->styleType() == FIRST_LETTER) {
+ currChild = currChild->firstChild();
+ break;
+ }
+ currChild = currChild->nextSibling();
+ } else if (currChild->isReplaced() || currChild->isRenderButton() || currChild->isMenuList())
+ break;
+ else if (currChild->style()->hasPseudoStyle(FIRST_LETTER) && canHaveGeneratedChildren(currChild)) {
+ // We found a lower-level node with first-letter, which supersedes the higher-level style
+ firstLetterBlock = currChild;
+ currChild = currChild->firstChild();
+ } else
+ currChild = currChild->firstChild();
+ }
- if (!firstLetterObject)
+ if (!currChild)
return;
-
- addFirstLetter(firstLetterObject, firstLetterBlock);
-}
-
-void RenderBlock::addFirstLetter(RenderObject* firstLetterObject, RenderObject* &firstLetterBlock)
-{
// If the child already has style, then it has already been created, so we just want
// to update it.
- if (firstLetterObject->parent()->style()->styleType() == FIRST_LETTER) {
- updateFirstLetterStyle(firstLetterBlock, firstLetterObject);
+ if (currChild->parent()->style()->styleType() == FIRST_LETTER) {
+ updateFirstLetterStyle(firstLetterBlock, currChild);
return;
}
- if (!firstLetterObject->isText() || firstLetterObject->isBR())
+ if (!currChild->isText() || currChild->isBR())
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());
- createFirstLetterRenderer(firstLetterBlock, firstLetterObject);
+ createFirstLetterRenderer(firstLetterBlock, currChild);
}
// Helper methods for obtaining the last line, computing line counts and heights for line counts
@@ -6635,7 +6656,7 @@ LayoutUnit RenderBlock::applyBeforeBreak(RenderBox* child, LayoutUnit logicalOff
|| (checkRegionBreaks && child->style()->regionBreakBefore() == PBALWAYS);
if (checkBeforeAlways && inNormalFlow(child) && hasNextPage(logicalOffset, IncludePageBoundary)) {
if (checkColumnBreaks)
- view()->layoutState()->addForcedColumnBreak(logicalOffset);
+ view()->layoutState()->addForcedColumnBreak(child, logicalOffset);
return nextPageLogicalTop(logicalOffset, IncludePageBoundary);
}
return logicalOffset;
@@ -6652,7 +6673,7 @@ LayoutUnit RenderBlock::applyAfterBreak(RenderBox* child, LayoutUnit logicalOffs
if (checkAfterAlways && inNormalFlow(child) && hasNextPage(logicalOffset, IncludePageBoundary)) {
marginInfo.setMarginAfterQuirk(true); // Cause margins to be discarded for any following content.
if (checkColumnBreaks)
- view()->layoutState()->addForcedColumnBreak(logicalOffset);
+ view()->layoutState()->addForcedColumnBreak(child, logicalOffset);
return nextPageLogicalTop(logicalOffset, IncludePageBoundary);
}
return logicalOffset;
@@ -6776,7 +6797,9 @@ void RenderBlock::adjustLinePositionForPagination(RootInlineBox* lineBox, Layout
lineBox->setPaginationStrut(0);
LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset);
bool hasUniformPageLogicalHeight = !inRenderFlowThread() || enclosingRenderFlowThread()->regionsHaveUniformLogicalHeight();
- if (!pageLogicalHeight || (hasUniformPageLogicalHeight && lineHeight > pageLogicalHeight)
+ // If lineHeight is greater than pageLogicalHeight, but logicalVisualOverflow.height() still fits, we are
+ // still going to add a strut, so that the visible overflow fits on a single page.
+ if (!pageLogicalHeight || (hasUniformPageLogicalHeight && logicalVisualOverflow.height() > pageLogicalHeight)
|| !hasNextPage(logicalOffset))
return;
LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logicalOffset, ExcludePageBoundary);
@@ -6784,6 +6807,10 @@ void RenderBlock::adjustLinePositionForPagination(RootInlineBox* lineBox, Layout
// If we have a non-uniform page height, then we have to shift further possibly.
if (!hasUniformPageLogicalHeight && !pushToNextPageWithMinimumLogicalHeight(remainingLogicalHeight, logicalOffset, lineHeight))
return;
+ if (lineHeight > pageLogicalHeight) {
+ // Split the top margin in order to avoid splitting the visible part of the line.
+ remainingLogicalHeight -= min(lineHeight - pageLogicalHeight, max(ZERO_LAYOUT_UNIT, logicalVisualOverflow.y() - lineBox->lineTopWithLeading()));
+ }
LayoutUnit totalLogicalHeight = lineHeight + max(ZERO_LAYOUT_UNIT, logicalOffset);
LayoutUnit pageLogicalHeightAtNewOffset = hasUniformPageLogicalHeight ? pageLogicalHeight : pageLogicalHeightForOffset(logicalOffset + remainingLogicalHeight);
if (lineBox == firstRootBox() && totalLogicalHeight < pageLogicalHeightAtNewOffset && !isPositioned() && !isTableCell())
@@ -7197,8 +7224,8 @@ inline void RenderBlock::FloatingObjects::decreaseObjectsCount(FloatingObject::T
inline RenderBlock::FloatingObjectInterval RenderBlock::FloatingObjects::intervalForFloatingObject(FloatingObject* floatingObject)
{
if (m_horizontalWritingMode)
- return RenderBlock::FloatingObjectInterval(floatingObject->pixelSnappedY(), floatingObject->pixelSnappedMaxY(), floatingObject);
- return RenderBlock::FloatingObjectInterval(floatingObject->pixelSnappedX(), floatingObject->pixelSnappedMaxX(), floatingObject);
+ return RenderBlock::FloatingObjectInterval(floatingObject->frameRect().pixelSnappedY(), floatingObject->frameRect().pixelSnappedMaxY(), floatingObject);
+ return RenderBlock::FloatingObjectInterval(floatingObject->frameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedMaxX(), floatingObject);
}
void RenderBlock::FloatingObjects::addPlacedObject(FloatingObject* floatingObject)
@@ -7342,7 +7369,7 @@ String ValueToString<int>::string(const int value)
String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::FloatingObject* floatingObject)
{
- return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->pixelSnappedX(), floatingObject->pixelSnappedY(), floatingObject->pixelSnappedMaxX(), floatingObject->pixelSnappedMaxY());
+ return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->frameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floatingObject->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnappedMaxY());
}
#endif