Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(875)

Unified Diff: Source/core/rendering/line/BreakingContextInlineHeaders.h

Issue 300853007: Empty inline elements always get a line box. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/line/BreakingContextInlineHeaders.h
diff --git a/Source/core/rendering/line/BreakingContextInlineHeaders.h b/Source/core/rendering/line/BreakingContextInlineHeaders.h
index 5a148ca4b6a418b208cb766c1f123ac426f0a6dc..f99965e1400b4ed24d6b5b35db7f638ad1b32b4a 100644
--- a/Source/core/rendering/line/BreakingContextInlineHeaders.h
+++ b/Source/core/rendering/line/BreakingContextInlineHeaders.h
@@ -419,23 +419,24 @@ inline void BreakingContext::handleEmptyInline()
RenderInline* flowBox = toRenderInline(m_current.object());
- // Now that some inline flows have line boxes, if we are already ignoring spaces, we need
- // 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.
bool requiresLineBox = alwaysRequiresLineBox(m_current.object());
if (requiresLineBox || requiresLineBoxForContent(flowBox, m_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.
+ // An empty inline that only has line-height, vertical-align or font-metrics will
+ // not force linebox creation (and thus affect the height of the line) if the rest of the line is empty.
if (requiresLineBox)
m_lineInfo.setEmpty(false, m_block, &m_width);
if (m_ignoringSpaces) {
+ // If we are in a run of ignored spaces then ensure we get a linebox if lineboxes are eventually
+ // created for the line...
m_trailingObjects.clear();
m_lineMidpointState.ensureLineBoxInsideIgnoredSpaces(m_current.object());
+ } else if (m_currentCharacterIsSpace) {
+ // .. likewise if we come after a single space.
+ m_lineMidpointState.ensureLineBoxForRenderer(m_current.object());
} else if (m_blockStyle->collapseWhiteSpace() && m_resolver.position().object() == m_current.object()
&& shouldSkipWhitespaceAfterStartObject(m_block, m_current.object(), m_lineMidpointState)) {
- // Like with list markers, we start ignoring spaces to make sure that any
- // additional spaces we see will be discarded.
+ // If this object is at the start of the line, we need to behave like list markers and
+ // start ignoring spaces.
m_currentCharacterShouldCollapseIfPreWap = m_currentCharacterIsSpace = true;
m_ignoringSpaces = true;
}

Powered by Google App Engine
This is Rietveld 408576698