diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-09 14:16:12 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-09 14:16:12 +0100 |
commit | 03e12282df9aa1e1fb05a8b90f1cfc2e08764cec (patch) | |
tree | 52599cd0ab782b1768e23ad176f7618f98333cb6 /Source/WebCore/rendering/RenderBlockLineLayout.cpp | |
parent | cd44dc59cdfc39534aef4d417e9f3c412e3be139 (diff) | |
download | qtwebkit-03e12282df9aa1e1fb05a8b90f1cfc2e08764cec.tar.gz |
Imported WebKit commit e09a82039aa4273ab318b71122e92d8e5f233525 (http://svn.webkit.org/repository/webkit/trunk@107223)
Diffstat (limited to 'Source/WebCore/rendering/RenderBlockLineLayout.cpp')
-rwxr-xr-x | Source/WebCore/rendering/RenderBlockLineLayout.cpp | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/Source/WebCore/rendering/RenderBlockLineLayout.cpp b/Source/WebCore/rendering/RenderBlockLineLayout.cpp index da74ea6c3..406930fc1 100755 --- a/Source/WebCore/rendering/RenderBlockLineLayout.cpp +++ b/Source/WebCore/rendering/RenderBlockLineLayout.cpp @@ -128,11 +128,11 @@ inline void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::Floa return; if (newFloat->type() == RenderBlock::FloatingObject::FloatLeft) { - m_left = m_block->logicalRightForFloat(newFloat); + m_left = m_block->pixelSnappedLogicalRightForFloat(newFloat); if (m_isFirstLine && m_block->style()->isLeftToRightDirection()) m_left += m_block->textIndentOffset(); } else { - m_right = m_block->logicalLeftForFloat(newFloat); + m_right = m_block->pixelSnappedLogicalLeftForFloat(newFloat); if (m_isFirstLine && !m_block->style()->isLeftToRightDirection()) m_right -= m_block->textIndentOffset(); } @@ -258,7 +258,7 @@ static LayoutUnit inlineLogicalWidth(RenderObject* child, bool start = true, boo return extraWidth; } -static void determineParagraphDirection(TextDirection& dir, InlineIterator iter) +static void determineDirectionality(TextDirection& dir, InlineIterator iter) { while (!iter.atEnd()) { if (iter.atParagraphSeparator()) @@ -970,18 +970,27 @@ static inline void constructBidiRuns(InlineBidiResolver& topResolver, BidiRunLis // tree to see which parent inline is the isolate. We could change enterIsolate // to take a RenderObject and do this logic there, but that would be a layering // violation for BidiResolver (which knows nothing about RenderObject). - RenderInline* isolatedSpan = toRenderInline(containingIsolate(startObj, currentRoot)); + RenderInline* isolatedInline = toRenderInline(containingIsolate(startObj, currentRoot)); InlineBidiResolver isolatedResolver; - isolatedResolver.setStatus(statusWithDirection(isolatedSpan->style()->direction())); + EUnicodeBidi unicodeBidi = isolatedInline->style()->unicodeBidi(); + TextDirection direction; + if (unicodeBidi == Plaintext) + determineDirectionality(direction, InlineIterator(isolatedInline, isolatedRun->object(), 0)); + else { + ASSERT(unicodeBidi == Isolate); + direction = isolatedInline->style()->direction(); + } + isolatedResolver.setStatus(statusWithDirection(direction)); // FIXME: The fact that we have to construct an Iterator here // currently prevents this code from moving into BidiResolver. - if (!bidiFirstSkippingEmptyInlines(isolatedSpan, &isolatedResolver)) + if (!bidiFirstSkippingEmptyInlines(isolatedInline, &isolatedResolver)) continue; + // The starting position is the beginning of the first run within the isolate that was identified // during the earlier call to createBidiRunsForLine. This can be but is not necessarily the // first run within the isolate. - InlineIterator iter = InlineIterator(isolatedSpan, startObj, isolatedRun->m_start); + InlineIterator iter = InlineIterator(isolatedInline, startObj, isolatedRun->m_start); isolatedResolver.setPositionIgnoringNestedIsolates(iter); // We stop at the next end of line; we may re-enter this isolate in the next call to constructBidiRuns(). @@ -1240,7 +1249,7 @@ void RenderBlock::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, Inlin FloatingObject* lastFloatFromPreviousLine = (m_floatingObjects && !m_floatingObjects->set().isEmpty()) ? m_floatingObjects->set().last() : 0; end = lineBreaker.nextLineBreak(resolver, layoutState.lineInfo(), lineBreakIteratorInfo, lastFloatFromPreviousLine, consecutiveHyphenatedLines); if (resolver.position().atEnd()) { - // FIXME: We shouldn't be creating any runs in findNextLineBreak to begin with! + // FIXME: We shouldn't be creating any runs in nextLineBreak to begin with! // Once BidiRunList is separated from BidiResolver this will not be needed. resolver.runs().deleteRuns(); resolver.markCurrentRunEmpty(); // FIXME: This can probably be replaced by an ASSERT (or just removed). @@ -1259,7 +1268,7 @@ void RenderBlock::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, Inlin if (isNewUBAParagraph && styleToUse->unicodeBidi() == Plaintext && !resolver.context()->parent()) { TextDirection direction = styleToUse->direction(); - determineParagraphDirection(direction, resolver.position()); + determineDirectionality(direction, resolver.position()); resolver.setStatus(BidiStatus(direction, styleToUse->unicodeBidi() == Override)); } // FIXME: This ownership is reversed. We should own the BidiRunList and pass it to createBidiRunsForLine. @@ -1441,7 +1450,7 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, LayoutUnit& repain setLogicalHeight(borderBefore() + paddingBefore()); // Lay out our hypothetical grid line as though it occurs at the top of the block. - if (view()->layoutState() && view()->layoutState()->currentLineGrid() == this) + if (view()->layoutState() && view()->layoutState()->lineGrid() == this) layoutLineGridBox(); // Figure out if we should clear out our line boxes. @@ -1668,10 +1677,8 @@ RootInlineBox* RenderBlock::determineStartPosition(LineLayoutState& layoutState, resolver.setStatus(last->lineBreakBidiStatus()); } else { TextDirection direction = style()->direction(); - if (style()->unicodeBidi() == Plaintext) { - // FIXME: Why does "unicode-bidi: plaintext" bidiFirstIncludingEmptyInlines when all other line layout code uses bidiFirstSkippingEmptyInlines? - determineParagraphDirection(direction, InlineIterator(this, bidiFirstIncludingEmptyInlines(this), 0)); - } + if (style()->unicodeBidi() == Plaintext) + determineDirectionality(direction, InlineIterator(this, bidiFirstSkippingEmptyInlines(this), 0)); resolver.setStatus(BidiStatus(direction, style()->unicodeBidi() == Override)); InlineIterator iter = InlineIterator(this, bidiFirstSkippingEmptyInlines(this, &resolver), 0); resolver.setPosition(iter, numberOfIsolateAncestors(iter)); |