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

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: Updated 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
« no previous file with comments | « Source/core/rendering/line/BreakingContext.cpp ('k') | Source/core/rendering/line/TrailingObjects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..ad250d2e3e63a8779ac35a7a54854d1298f96724 100644
--- a/Source/core/rendering/line/BreakingContextInlineHeaders.h
+++ b/Source/core/rendering/line/BreakingContextInlineHeaders.h
@@ -362,7 +362,7 @@ inline void BreakingContext::handleOutOfFlowPositioned(Vector<RenderBox*>& posit
if (isInlineType || box->container()->isRenderInline()) {
if (m_ignoringSpaces)
m_lineMidpointState.ensureLineBoxInsideIgnoredSpaces(box);
- m_trailingObjects.appendBoxIfNeeded(box);
+ m_trailingObjects.appendObjectIfNeeded(box);
} else {
positionedObjects.append(box);
}
@@ -419,25 +419,27 @@ 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_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;
+ } else {
+ // If we are after a trailing space but aren't ignoring spaces yet then ensure we get a linebox
+ // if we encounter collapsible whitepace.
+ m_trailingObjects.appendObjectIfNeeded(m_current.object());
}
}
@@ -769,7 +771,7 @@ inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool
// spaces. Create a midpoint to terminate the run
// before the second space.
m_lineMidpointState.startIgnoringSpaces(m_startOfIgnoredSpaces);
- m_trailingObjects.updateMidpointsForTrailingBoxes(m_lineMidpointState, InlineIterator(), TrailingObjects::DoNotCollapseFirstSpace);
+ m_trailingObjects.updateMidpointsForTrailingObjects(m_lineMidpointState, InlineIterator(), TrailingObjects::DoNotCollapseFirstSpace);
}
}
} else if (m_ignoringSpaces) {
« no previous file with comments | « Source/core/rendering/line/BreakingContext.cpp ('k') | Source/core/rendering/line/TrailingObjects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698