Diff
Modified: trunk/LayoutTests/ChangeLog (182240 => 182241)
--- trunk/LayoutTests/ChangeLog 2015-04-01 18:07:16 UTC (rev 182240)
+++ trunk/LayoutTests/ChangeLog 2015-04-01 18:10:32 UTC (rev 182241)
@@ -1,3 +1,15 @@
+2015-04-01 David Hyatt <[email protected]>
+
+ [New Block-Inside-Inline Model] Floats need to be allowed to intrude into anonymous inline-blocks.
+ https://bugs.webkit.org/show_bug.cgi?id=143307
+
+ Reviewed by Dean Jackson.
+
+ * fast/block/inside-inlines/basic-float-intrusion-expected.html: Added.
+ * fast/block/inside-inlines/basic-float-intrusion.html: Added.
+ * fast/block/inside-inlines/new-model/basic-float-intrusion-expected.html: Added.
+ * fast/block/inside-inlines/new-model/basic-float-intrusion.html: Added.
+
2015-04-01 Hunseop Jeong <[email protected]>
Unreviewed EFL gardening. Remove warning message in layoutTest.
Added: trunk/LayoutTests/fast/block/inside-inlines/basic-float-intrusion-expected.html (0 => 182241)
--- trunk/LayoutTests/fast/block/inside-inlines/basic-float-intrusion-expected.html (rev 0)
+++ trunk/LayoutTests/fast/block/inside-inlines/basic-float-intrusion-expected.html 2015-04-01 18:10:32 UTC (rev 182241)
@@ -0,0 +1,14 @@
+<!doctype html>
+<head>
+<style>
+.box { border:1px solid black; padding:3px; margin:3px }
+.nowrap { white-space: nowrap; }
+.float { float: left; }
+.box div { height:40px; }
+.float { width:100px; height:100px; background-color:cyan }
+</style>
+<body>
+
+<div class="float"></div>
+
+<div class="box"><div>Avoid the float!</div></div>
Added: trunk/LayoutTests/fast/block/inside-inlines/basic-float-intrusion.html (0 => 182241)
--- trunk/LayoutTests/fast/block/inside-inlines/basic-float-intrusion.html (rev 0)
+++ trunk/LayoutTests/fast/block/inside-inlines/basic-float-intrusion.html 2015-04-01 18:10:32 UTC (rev 182241)
@@ -0,0 +1,14 @@
+<!doctype html>
+<head>
+<style>
+.box { border:1px solid black; padding:3px; margin:3px }
+.nowrap { white-space: nowrap; }
+.float { float: left; }
+.box div { height:40px; }
+.float { width:100px; height:100px; background-color:cyan }
+</style>
+<body>
+
+<div class="float"></div>
+
+<div class="box"><a><div>Avoid the float!</div></a></div>
Added: trunk/LayoutTests/fast/block/inside-inlines/new-model/basic-float-intrusion-expected.html (0 => 182241)
--- trunk/LayoutTests/fast/block/inside-inlines/new-model/basic-float-intrusion-expected.html (rev 0)
+++ trunk/LayoutTests/fast/block/inside-inlines/new-model/basic-float-intrusion-expected.html 2015-04-01 18:10:32 UTC (rev 182241)
@@ -0,0 +1,14 @@
+<!doctype html>
+<head>
+<style>
+.box { border:1px solid black; padding:3px; margin:3px }
+.nowrap { white-space: nowrap; }
+.float { float: left; }
+.box div { height:40px; }
+.float { width:100px; height:100px; background-color:cyan }
+</style>
+<body>
+
+<div class="float"></div>
+
+<div class="box"><div>Avoid the float!</div></div>
Added: trunk/LayoutTests/fast/block/inside-inlines/new-model/basic-float-intrusion.html (0 => 182241)
--- trunk/LayoutTests/fast/block/inside-inlines/new-model/basic-float-intrusion.html (rev 0)
+++ trunk/LayoutTests/fast/block/inside-inlines/new-model/basic-float-intrusion.html 2015-04-01 18:10:32 UTC (rev 182241)
@@ -0,0 +1,18 @@
+<!doctype html>
+<head>
+<style>
+.box { border:1px solid black; padding:3px; margin:3px }
+.nowrap { white-space: nowrap; }
+.float { float: left; }
+.box div { height:40px; }
+.float { width:100px; height:100px; background-color:cyan }
+</style>
+<script>
+if (window.internals)
+ window.internals.settings.setNewBlockInsideInlineModelEnabled(true)
+</script>
+<body>
+
+<div class="float"></div>
+
+<div class="box"><a><div>Avoid the float!</div></a></div>
Modified: trunk/Source/WebCore/ChangeLog (182240 => 182241)
--- trunk/Source/WebCore/ChangeLog 2015-04-01 18:07:16 UTC (rev 182240)
+++ trunk/Source/WebCore/ChangeLog 2015-04-01 18:10:32 UTC (rev 182241)
@@ -1,3 +1,52 @@
+2015-04-01 David Hyatt <[email protected]>
+
+ [New Block-Inside-Inline Model] Floats need to be allowed to intrude into anonymous inline-blocks.
+ https://bugs.webkit.org/show_bug.cgi?id=143307
+
+ Reviewed by Dean Jackson.
+
+ Added fast/block/inside-inlines/basic-float-intrusion.html
+
+ * rendering/InlineFlowBox.cpp:
+ (WebCore::InlineFlowBox::placeBoxesInBlockDirection):
+ Make sure to exclude the margins of an anonymous inline-block when considering the height of the line.
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::lineHeight):
+ (WebCore::RenderBlock::baselinePosition):
+ Anonymous inline-block lines ignore line-height and just return the height of the block. For baseline position, the baseline
+ is considered to be at the bottom border edge of the anonymous inline-block.
+
+ * rendering/RenderBlockFlow.cpp:
+ (WebCore::RenderBlockFlow::rebuildFloatingObjectSetFromIntrudingFloats):
+ (WebCore::RenderBlockFlow::addIntrudingFloats):
+ * rendering/RenderBlockFlow.h:
+ Patch float intrusion to handle the case of anonymous inline-blocks. Instead of collecting the floats from our parent(), we
+ collect them from the containingBlock() in the anonymous inline-block case. Patch addIntrudingFloats to pass in the container
+ that acts as the "parent", since it is not the parent() in the anonymous inline-block case.
+
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::updateLogicalInlinePositions):
+ Make sure to use the full available width for content always in the anonymous inline-block case, since we don't avoid the
+ floats, but instead let them intrude into the inline-block.
+
+ (WebCore::RenderBlockFlow::computeInlineDirectionPositionsForLine):
+ Patch callers of updateLogicalInlinePositions to pass in the root line box that we're checking for.
+
+ (WebCore::RenderBlockFlow::layoutLineBoxes):
+ Defer the layout of anonymous inline-blocks, since they need to only lay out once the vertical position to lay them out
+ at is known.
+
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::createsNewFormattingContext):
+ (WebCore::RenderBox::avoidsFloats):
+ Anonymous inline-blocks do not establish a new block formatting context, nor do they avoid floats.
+
+ * rendering/line/BreakingContext.h:
+ (WebCore::BreakingContext::handleReplaced):
+ Add code to do a just-in-time layout of the anonymous inline-block at the time it is being examined (after the break before
+ it was handled).
+
2015-04-01 Eric Carlson <[email protected]>
[Mac] Do not include route button if element does not support target playback
Modified: trunk/Source/WebCore/rendering/InlineFlowBox.cpp (182240 => 182241)
--- trunk/Source/WebCore/rendering/InlineFlowBox.cpp 2015-04-01 18:07:16 UTC (rev 182240)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.cpp 2015-04-01 18:10:32 UTC (rev 182241)
@@ -671,7 +671,7 @@
: boxObject.borderRight() + boxObject.paddingRight();
}
newLogicalTopIncludingMargins = newLogicalTop;
- } else if (!child->renderer().isBR()) {
+ } else if (!child->renderer().isBR() && !child->renderer().isAnonymousInlineBlock()) {
const auto& box = downcast<RenderBox>(child->renderer());
newLogicalTopIncludingMargins = newLogicalTop;
LayoutUnit overSideMargin = child->isHorizontal() ? box.marginTop() : box.marginRight();
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (182240 => 182241)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2015-04-01 18:07:16 UTC (rev 182240)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2015-04-01 18:10:32 UTC (rev 182241)
@@ -2802,6 +2802,10 @@
LayoutUnit RenderBlock::lineHeight(bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
{
+ // Anonymous inline blocks don't include margins or any real line height.
+ if (isAnonymousInlineBlock() && linePositionMode == PositionOnContainingLine)
+ return direction == HorizontalLine ? height() : width();
+
// Inline blocks are replaced elements. Otherwise, just pass off to
// the base class. If we're being queried as though we're the root line
// box, then the fact that we're an inline-block is irrelevant, and we behave
@@ -2825,6 +2829,9 @@
// box, then the fact that we're an inline-block is irrelevant, and we behave
// just like a block.
if (isReplaced() && linePositionMode == PositionOnContainingLine) {
+ if (isAnonymousInlineBlock())
+ return direction == HorizontalLine ? height() : width();
+
// For "leaf" theme objects, let the theme decide what the baseline position is.
// FIXME: Might be better to have a custom CSS property instead, so that if the theme
// is turned off, checkboxes/radios will still have decent baselines.
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (182240 => 182241)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2015-04-01 18:07:16 UTC (rev 182240)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2015-04-01 18:10:32 UTC (rev 182241)
@@ -232,17 +232,20 @@
// We should not process floats if the parent node is not a RenderBlock. Otherwise, we will add
// floats in an invalid context. This will cause a crash arising from a bad cast on the parent.
// See <rdar://problem/8049753>, where float property is applied on a text node in a SVG.
- if (!is<RenderBlockFlow>(parent()))
+ bool isBlockInsideInline = isAnonymousInlineBlock();
+ if (!is<RenderBlockFlow>(parent()) && !isBlockInsideInline)
return;
// First add in floats from the parent. Self-collapsing blocks let their parent track any floats that intrude into
// them (as opposed to floats they contain themselves) so check for those here too.
- RenderBlockFlow& parentBlock = downcast<RenderBlockFlow>(*parent());
- bool parentHasFloats = false;
- RenderBlockFlow* previousBlock = previousSiblingWithOverhangingFloats(parentHasFloats);
+ RenderBlockFlow& parentBlock = downcast<RenderBlockFlow>(isBlockInsideInline ? *containingBlock() : *parent());
+ bool parentHasFloats = isBlockInsideInline ? parentBlock.containsFloats() : false;
+ RenderBlockFlow* previousBlock = nullptr;
+ if (!isBlockInsideInline)
+ previousBlock = previousSiblingWithOverhangingFloats(parentHasFloats);
LayoutUnit logicalTopOffset = logicalTop();
if (parentHasFloats || (parentBlock.lowestFloatLogicalBottom() > logicalTopOffset && previousBlock && previousBlock->isSelfCollapsingBlock()))
- addIntrudingFloats(&parentBlock, parentBlock.logicalLeftOffsetForContent(), logicalTopOffset);
+ addIntrudingFloats(&parentBlock, &parentBlock, parentBlock.logicalLeftOffsetForContent(), logicalTopOffset);
LayoutUnit logicalLeftOffset = 0;
if (previousBlock)
@@ -254,7 +257,7 @@
// Add overhanging floats from the previous RenderBlock, but only if it has a float that intrudes into our space.
if (previousBlock->m_floatingObjects && previousBlock->lowestFloatLogicalBottom() > logicalTopOffset)
- addIntrudingFloats(previousBlock, logicalLeftOffset, logicalTopOffset);
+ addIntrudingFloats(previousBlock, &parentBlock, logicalLeftOffset, logicalTopOffset);
if (childrenInline()) {
LayoutUnit changeLogicalTop = LayoutUnit::max();
@@ -2681,7 +2684,7 @@
return logicalBottomForFloat(it->get()) > logicalHeight();
}
-void RenderBlockFlow::addIntrudingFloats(RenderBlockFlow* prev, LayoutUnit logicalLeftOffset, LayoutUnit logicalTopOffset)
+void RenderBlockFlow::addIntrudingFloats(RenderBlockFlow* prev, RenderBlockFlow* container, LayoutUnit logicalLeftOffset, LayoutUnit logicalTopOffset)
{
ASSERT(!avoidsFloats());
@@ -2711,8 +2714,8 @@
// into account. Only apply this code if prev is the parent, since otherwise the left margin
// will get applied twice.
LayoutSize offset = isHorizontalWritingMode()
- ? LayoutSize(logicalLeftOffset - (prev != parent() ? prev->marginLeft() : LayoutUnit()), logicalTopOffset)
- : LayoutSize(logicalTopOffset, logicalLeftOffset - (prev != parent() ? prev->marginTop() : LayoutUnit()));
+ ? LayoutSize(logicalLeftOffset - (prev != container ? prev->marginLeft() : LayoutUnit()), logicalTopOffset)
+ : LayoutSize(logicalTopOffset, logicalLeftOffset - (prev != container ? prev->marginTop() : LayoutUnit()));
m_floatingObjects->add(floatingObject->copyToNewContainer(offset));
}
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (182240 => 182241)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.h 2015-04-01 18:07:16 UTC (rev 182240)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h 2015-04-01 18:10:32 UTC (rev 182241)
@@ -508,7 +508,7 @@
LayoutUnit addOverhangingFloats(RenderBlockFlow& child, bool makeChildPaintOtherFloats);
bool hasOverhangingFloat(RenderBox&);
- void addIntrudingFloats(RenderBlockFlow* prev, LayoutUnit xoffset, LayoutUnit yoffset);
+ void addIntrudingFloats(RenderBlockFlow* prev, RenderBlockFlow* container, LayoutUnit xoffset, LayoutUnit yoffset);
bool hasOverhangingFloats() { return parent() && containsFloats() && lowestFloatLogicalBottom() > logicalHeight(); }
LayoutUnit getClearDelta(RenderBox& child, LayoutUnit yPos);
Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (182240 => 182241)
--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2015-04-01 18:07:16 UTC (rev 182240)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2015-04-01 18:10:32 UTC (rev 182241)
@@ -685,11 +685,17 @@
}
}
-static void updateLogicalInlinePositions(RenderBlockFlow& block, float& lineLogicalLeft, float& lineLogicalRight, float& availableLogicalWidth, bool firstLine, IndentTextOrNot shouldIndentText, LayoutUnit boxLogicalHeight)
+static void updateLogicalInlinePositions(RenderBlockFlow& block, float& lineLogicalLeft, float& lineLogicalRight, float& availableLogicalWidth, bool firstLine, IndentTextOrNot shouldIndentText, LayoutUnit boxLogicalHeight,
+ RootInlineBox* rootBox)
{
LayoutUnit lineLogicalHeight = block.minLineHeightForReplacedRenderer(firstLine, boxLogicalHeight);
- lineLogicalLeft = block.logicalLeftOffsetForLine(block.logicalHeight(), shouldIndentText == IndentText, lineLogicalHeight);
- lineLogicalRight = block.logicalRightOffsetForLine(block.logicalHeight(), shouldIndentText == IndentText, lineLogicalHeight);
+ if (rootBox->hasAnonymousInlineBlock()) {
+ lineLogicalLeft = block.logicalLeftOffsetForContent(block.logicalHeight());
+ lineLogicalRight = block.logicalRightOffsetForContent(block.logicalHeight());
+ } else {
+ lineLogicalLeft = block.logicalLeftOffsetForLine(block.logicalHeight(), shouldIndentText == IndentText, lineLogicalHeight);
+ lineLogicalRight = block.logicalRightOffsetForLine(block.logicalHeight(), shouldIndentText == IndentText, lineLogicalHeight);
+ }
availableLogicalWidth = lineLogicalRight - lineLogicalLeft;
}
@@ -707,12 +713,12 @@
float lineLogicalLeft;
float lineLogicalRight;
float availableLogicalWidth;
- updateLogicalInlinePositions(*this, lineLogicalLeft, lineLogicalRight, availableLogicalWidth, isFirstLine, shouldIndentText, 0);
+ updateLogicalInlinePositions(*this, lineLogicalLeft, lineLogicalRight, availableLogicalWidth, isFirstLine, shouldIndentText, 0, lineBox);
bool needsWordSpacing;
if (firstRun && firstRun->renderer().isReplaced()) {
RenderBox& renderBox = downcast<RenderBox>(firstRun->renderer());
- updateLogicalInlinePositions(*this, lineLogicalLeft, lineLogicalRight, availableLogicalWidth, isFirstLine, shouldIndentText, renderBox.logicalHeight());
+ updateLogicalInlinePositions(*this, lineLogicalLeft, lineLogicalRight, availableLogicalWidth, isFirstLine, shouldIndentText, renderBox.logicalHeight(), lineBox);
}
computeInlineDirectionPositionsForSegment(lineBox, lineInfo, textAlign, lineLogicalLeft, availableLogicalWidth, firstRun, trailingSpaceRun, textBoxDataMap, verticalPositionCache, wordMeasurements);
@@ -1567,10 +1573,12 @@
else if (isFullLayout || box.needsLayout()) {
// Replaced element.
box.dirtyLineBoxes(isFullLayout);
- if (isFullLayout)
- replacedChildren.append(&box);
- else
- box.layoutIfNeeded();
+ if (!o.isAnonymousInlineBlock()) {
+ if (isFullLayout)
+ replacedChildren.append(&box);
+ else
+ box.layoutIfNeeded();
+ }
}
} else if (o.isTextOrLineBreak() || (is<RenderInline>(o) && !walker.atEndOfInline())) {
if (is<RenderInline>(o))
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (182240 => 182241)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2015-04-01 18:07:16 UTC (rev 182240)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2015-04-01 18:10:32 UTC (rev 182241)
@@ -4302,7 +4302,7 @@
bool RenderBox::createsNewFormattingContext() const
{
- return isInlineBlockOrInlineTable() || isFloatingOrOutOfFlowPositioned() || hasOverflowClip() || isFlexItemIncludingDeprecated()
+ return (isInlineBlockOrInlineTable() && !isAnonymousInlineBlock()) || isFloatingOrOutOfFlowPositioned() || hasOverflowClip() || isFlexItemIncludingDeprecated()
|| isTableCell() || isTableCaption() || isFieldset() || isWritingModeRoot() || isRoot() || isRenderFlowThread() || isRenderRegion()
#if ENABLE(CSS_GRID_LAYOUT)
|| isGridItem()
@@ -4312,7 +4312,7 @@
bool RenderBox::avoidsFloats() const
{
- return isReplaced() || isHR() || isLegend() || createsNewFormattingContext();
+ return (isReplaced() && !isAnonymousInlineBlock()) || isHR() || isLegend() || createsNewFormattingContext();
}
void RenderBox::addVisualEffectOverflow()
Modified: trunk/Source/WebCore/rendering/line/BreakingContext.h (182240 => 182241)
--- trunk/Source/WebCore/rendering/line/BreakingContext.h 2015-04-01 18:07:16 UTC (rev 182240)
+++ trunk/Source/WebCore/rendering/line/BreakingContext.h 2015-04-01 18:10:32 UTC (rev 182241)
@@ -500,6 +500,9 @@
return;
}
}
+
+ if (replacedBox.isAnonymousInlineBlock())
+ replacedBox.layoutIfNeeded();
if (m_ignoringSpaces)
m_lineMidpointState.stopIgnoringSpaces(InlineIterator(0, m_current.renderer(), 0));