Index: Source/WebCore/rendering/RenderBlockLineLayout.cpp |
=================================================================== |
--- Source/WebCore/rendering/RenderBlockLineLayout.cpp (revision 109045) |
+++ Source/WebCore/rendering/RenderBlockLineLayout.cpp (working copy) |
@@ -491,6 +491,9 @@ |
if (runCount == 2 && !r->m_object->isListMarker()) |
isOnlyRun = (!style()->isLeftToRightDirection() ? bidiRuns.lastRun() : bidiRuns.firstRun())->m_object->isListMarker(); |
+ if (lineInfo.isEmpty()) |
+ continue; |
+ |
InlineBox* box = createInlineBoxForRenderer(r->m_object, false, isOnlyRun); |
r->m_box = box; |
@@ -1824,14 +1827,22 @@ |
|| (whitespacePosition == TrailingWhitespace && style->whiteSpace() == PRE_WRAP && (!lineInfo.isEmpty() || !lineInfo.previousLineBrokeCleanly())); |
} |
-static bool inlineFlowRequiresLineBox(RenderInline* flow, const LineInfo& lineInfo) |
+static bool requiresLineBoxForContent(RenderInline* flow, const LineInfo& lineInfo) |
{ |
+ RenderObject* parent = flow->parent(); |
+ if (flow->document()->inNoQuirksMode() |
+ && (flow->style(lineInfo.isFirstLine())->lineHeight() != parent->style(lineInfo.isFirstLine())->lineHeight() |
+ || flow->style()->verticalAlign() != parent->style()->verticalAlign() |
+ || !parent->style()->font().fontMetrics().hasIdenticalAscentDescentAndLineGap(flow->style()->font().fontMetrics()))) |
+ return true; |
+ return false; |
+} |
+ |
+static bool alwaysRequiresLineBox(RenderInline* flow, const LineInfo& lineInfo) |
+{ |
// FIXME: Right now, we only allow line boxes for inlines that are truly empty. |
// We need to fix this, though, because at the very least, inlines containing only |
// ignorable whitespace should should also have line boxes. |
- if (!flow->document()->inQuirksMode() && flow->style(lineInfo.isFirstLine())->lineHeight() != flow->parent()->style(lineInfo.isFirstLine())->lineHeight()) |
- return true; |
- |
return !flow->firstChild() && flow->hasInlineDirectionBordersPaddingOrMargin(); |
} |
@@ -1840,7 +1851,7 @@ |
if (it.m_obj->isFloatingOrPositioned()) |
return false; |
- if (it.m_obj->isRenderInline() && !inlineFlowRequiresLineBox(toRenderInline(it.m_obj), lineInfo)) |
+ if (it.m_obj->isRenderInline() && !alwaysRequiresLineBox(toRenderInline(it.m_obj), lineInfo) && !requiresLineBoxForContent(toRenderInline(it.m_obj), lineInfo)) |
return false; |
if (!shouldCollapseWhiteSpace(it.m_obj->style(), lineInfo, whitespacePosition) || it.m_obj->isBR()) |
@@ -2228,8 +2239,12 @@ |
// to make sure that we stop to include this object and then start ignoring spaces again. |
// If this object is at the start of the line, we need to behave like list markers and |
// start ignoring spaces. |
- if (inlineFlowRequiresLineBox(flowBox, lineInfo)) { |
- lineInfo.setEmpty(false, m_block, &width); |
+ bool requiresLineBox = alwaysRequiresLineBox(flowBox, lineInfo); |
+ if (requiresLineBox || requiresLineBoxForContent(flowBox, lineInfo)) { |
+ // An empty inline that only has line-height, vertical-align or font-metrics will only get a |
+ // line box to affect the height of the line if the rest of the line is not empty. |
+ if (requiresLineBox) |
+ lineInfo.setEmpty(false, m_block, &width); |
if (ignoringSpaces) { |
trailingObjects.clear(); |
addMidpoint(lineMidpointState, InlineIterator(0, current.m_obj, 0)); // Stop ignoring spaces. |