提交 f7731bbd 编写于 作者: A Adam Barth

Switch whitespace mode back to pre-wrap

When we removed position: sticky, we introduced a subtle line breaking
bug to pre-wrap that would cause whitespace to accumulate at the
beginning of lines that follow unclean breaks. This patch adds back the
deleted code (cleansed of the position sticky bits).
上级 229bda2f
......@@ -99,6 +99,8 @@ public:
}
private:
void skipTrailingWhitespace(InlineIterator&, const LineInfo&);
InlineBidiResolver& m_resolver;
InlineIterator m_current;
......@@ -183,6 +185,18 @@ inline bool requiresLineBox(const InlineIterator& it, const LineInfo& lineInfo =
return notJustWhitespace || isEmptyInline(it.object());
}
// FIXME: The entire concept of the skipTrailingWhitespace function is flawed, since we really need to be building
// line boxes even for containers that may ultimately collapse away. Otherwise we'll never get positioned
// elements quite right. In other words, we need to build this function's work into the normal line
// object iteration process.
// NB. this function will insert any floating elements that would otherwise
// be skipped but it will not position them.
inline void BreakingContext::skipTrailingWhitespace(InlineIterator& iterator, const LineInfo& lineInfo)
{
while (!iterator.atEnd() && !requiresLineBox(iterator, lineInfo, TrailingWhitespace))
iterator.increment();
}
inline void BreakingContext::initializeForCurrentObject()
{
m_currentStyle = m_current.object()->style();
......@@ -551,6 +565,7 @@ inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool
if (!m_width.fitsOnLine(charWidth)) {
lineWasTooWide = true;
m_lineBreak.moveTo(m_current.object(), m_current.offset(), m_current.nextBreakablePosition());
skipTrailingWhitespace(m_lineBreak, m_lineInfo);
}
}
if (lineWasTooWide || !m_width.fitsOnLine()) {
......
......@@ -966,7 +966,7 @@ public:
static EPosition initialPosition() { return StaticPosition; }
static EUnicodeBidi initialUnicodeBidi() { return UBNormal; }
static EVisibility initialVisibility() { return VISIBLE; }
static EWhiteSpace initialWhiteSpace() { return PRE_LINE; }
static EWhiteSpace initialWhiteSpace() { return PRE_WRAP; }
static short initialHorizontalBorderSpacing() { return 0; }
static short initialVerticalBorderSpacing() { return 0; }
static Color initialColor() { return Color::white; }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册