Index: Source/WebCore/ChangeLog =================================================================== --- Source/WebCore/ChangeLog (revision 103262) +++ Source/WebCore/ChangeLog (working copy) @@ -1,3 +1,36 @@ +2011-12-19 Levi Weintraub + + unicode-bidi:plaintext is supposed to be effective on display:inline elements too + https://bugs.webkit.org/show_bug.cgi?id=73310 + + Reviewed by NOBODY (OOPS!). + + Adding support for unicode-bidi: plaintext as a property on inlines. These are treated + like unicode-bidi: isolate with the addition of their directionality being determined + by the UBA. + + Tests: fast/text/international/inline-plaintext-is-isolated-expected.html + fast/text/international/inline-plaintext-is-isolated.html + fast/text/international/inline-plaintext-relayout-with-leading-neutrals-expected.html + fast/text/international/inline-plaintext-relayout-with-leading-neutrals.html + fast/text/international/inline-plaintext-with-generated-content-expected.html + fast/text/international/inline-plaintext-with-generated-content.html + + * platform/text/UnicodeBidi.h: + (WebCore::isIsolated): Added this convenience function as Plaintext and Isolate Unicode-Bidi values + are both treated as isolated content. + * rendering/InlineIterator.h: + (WebCore::notifyObserverEnteredObject): Inline now supports Unicode-Bidi Plaintext. + (WebCore::notifyObserverWillExitObject): Ditto. + (WebCore::bidiFirstSkippingEmptyInlines): Changed to support being called without a resolver. + (WebCore::isIsolatedInline): Inline now supports Unicode-Bidi: Plaintext. + * rendering/RenderBlockLineLayout.cpp: + (WebCore::determineDirectionality): Generalized for inlines. + (WebCore::constructBidiRuns): Added support for Unicode-Bidi: Plaintext as an isolated inline. + (WebCore::RenderBlock::layoutRunsAndFloatsInRange): Fixed comment. + (WebCore::RenderBlock::determineStartPosition): Fixed comment and switched to updated + bidiFirstSkippingEmptyInlines. + 2011-12-19 Mike Reed [skia] cache typeface in FontPlatformData Index: Source/WebCore/platform/text/UnicodeBidi.h =================================================================== --- Source/WebCore/platform/text/UnicodeBidi.h (revision 103262) +++ Source/WebCore/platform/text/UnicodeBidi.h (working copy) @@ -34,7 +34,12 @@ enum EUnicodeBidi { Override, Isolate, Plaintext -}; +}; + +inline bool isIsolated(const EUnicodeBidi& unicodeBidi) +{ + return unicodeBidi == Isolate || unicodeBidi == Plaintext; +} } Index: Source/WebCore/rendering/InlineIterator.h =================================================================== --- Source/WebCore/rendering/InlineIterator.h (revision 103262) +++ Source/WebCore/rendering/InlineIterator.h (working copy) @@ -131,14 +131,13 @@ static inline void notifyObserverEntered // Thus we ignore any possible dir= attribute on the span. return; } - if (unicodeBidi == Isolate) { + if (isIsolated(unicodeBidi)) { observer->enterIsolate(); // Embedding/Override characters implied by dir= are handled when // we process the isolated span, not when laying out the "parent" run. return; } - // FIXME: Should unicode-bidi: plaintext really be embedding override/embed characters here? if (!observer->inIsolate()) observer->embed(embedCharFromDirection(style->direction(), unicodeBidi), FromStyleOrDOM); } @@ -152,7 +151,7 @@ static inline void notifyObserverWillExi EUnicodeBidi unicodeBidi = object->style()->unicodeBidi(); if (unicodeBidi == UBNormal) return; // Nothing to do for unicode-bidi: normal - if (unicodeBidi == Isolate) { + if (isIsolated(unicodeBidi)) { observer->exitIsolate(); return; } @@ -255,9 +254,8 @@ static inline RenderObject* bidiNextIncl return bidiNextShared(root, current, observer, IncludeEmptyInlines, endOfInlinePtr); } -static inline RenderObject* bidiFirstSkippingEmptyInlines(RenderObject* root, InlineBidiResolver* resolver) +static inline RenderObject* bidiFirstSkippingEmptyInlines(RenderObject* root, InlineBidiResolver* resolver = 0) { - ASSERT(resolver); RenderObject* o = root->firstChild(); if (!o) return 0; @@ -278,7 +276,8 @@ static inline RenderObject* bidiFirstSki if (o && !isIteratorTarget(o)) o = bidiNextSkippingEmptyInlines(root, o, resolver); - resolver->commitExplicitEmbedding(); + if (resolver) + resolver->commitExplicitEmbedding(); return o; } @@ -392,7 +391,7 @@ inline void InlineBidiResolver::incremen static inline bool isIsolatedInline(RenderObject* object) { ASSERT(object); - return object->isRenderInline() && object->style()->unicodeBidi() == Isolate; + return object->isRenderInline() && isIsolated(object->style()->unicodeBidi()); } static inline RenderObject* containingIsolate(RenderObject* object, RenderObject* root) Index: Source/WebCore/rendering/RenderBlockLineLayout.cpp =================================================================== --- Source/WebCore/rendering/RenderBlockLineLayout.cpp (revision 103262) +++ Source/WebCore/rendering/RenderBlockLineLayout.cpp (working copy) @@ -253,7 +253,7 @@ static LayoutUnit inlineLogicalWidth(Ren return extraWidth; } -static void determineParagraphDirection(TextDirection& dir, InlineIterator iter) +static void determineDirectionality(TextDirection& dir, InlineIterator iter) { while (!iter.atEnd()) { if (iter.atParagraphSeparator()) @@ -964,18 +964,27 @@ static inline void constructBidiRuns(Inl // 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(). @@ -1232,7 +1241,7 @@ void RenderBlock::layoutRunsAndFloatsInR 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). @@ -1251,7 +1260,7 @@ void RenderBlock::layoutRunsAndFloatsInR if (isNewUBAParagraph && style()->unicodeBidi() == Plaintext && !resolver.context()->parent()) { TextDirection direction = style()->direction(); - determineParagraphDirection(direction, resolver.position()); + determineDirectionality(direction, resolver.position()); resolver.setStatus(BidiStatus(direction, style()->unicodeBidi() == Override)); } // FIXME: This ownership is reversed. We should own the BidiRunList and pass it to createBidiRunsForLine. @@ -1656,10 +1665,8 @@ RootInlineBox* RenderBlock::determineSta 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, bidiFirstIncludingEmptyInlines(this), 0)); resolver.setStatus(BidiStatus(direction, style()->unicodeBidi() == Override)); InlineIterator iter = InlineIterator(this, bidiFirstSkippingEmptyInlines(this, &resolver), 0); resolver.setPosition(iter, numberOfIsolateAncestors(iter)); Index: LayoutTests/ChangeLog =================================================================== --- LayoutTests/ChangeLog (revision 103262) +++ LayoutTests/ChangeLog (working copy) @@ -1,3 +1,19 @@ +2011-12-19 Levi Weintraub + + unicode-bidi:plaintext is supposed to be effective on display:inline elements too + https://bugs.webkit.org/show_bug.cgi?id=73310 + + Reviewed by NOBODY (OOPS!). + + Ref tests for unicode-bidi: plaintext on inlines. + + * fast/text/international/inline-plaintext-is-isolated-expected.html: Added. + * fast/text/international/inline-plaintext-is-isolated.html: Added. + * fast/text/international/inline-plaintext-relayout-with-leading-neutrals-expected.html: Added. + * fast/text/international/inline-plaintext-relayout-with-leading-neutrals.html: Added. + * fast/text/international/inline-plaintext-with-generated-content-expected.html: Added. + * fast/text/international/inline-plaintext-with-generated-content.html: Added. + 2011-12-19 Adrienne Walker [chromium] Mark all the media-controller-playback tests as failing. Index: LayoutTests/fast/text/international/inline-plaintext-is-isolated-expected.html =================================================================== --- LayoutTests/fast/text/international/inline-plaintext-is-isolated-expected.html (revision 0) +++ LayoutTests/fast/text/international/inline-plaintext-is-isolated-expected.html (revision 0) @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + +
1 א!‎ 2should look the same as1 א!‎ 2
1 a!
א!‎ 2
should look the same as1 a!
א!‎ 2
+ \ No newline at end of file Index: LayoutTests/fast/text/international/inline-plaintext-is-isolated.html =================================================================== --- LayoutTests/fast/text/international/inline-plaintext-is-isolated.html (revision 0) +++ LayoutTests/fast/text/international/inline-plaintext-is-isolated.html (revision 0) @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + +
1 א! 2should look the same as1 א!‎ 2
1 a!
א!
2
should look the same as1 a!
א!‎ 2
+ Index: LayoutTests/fast/text/international/inline-plaintext-relayout-with-leading-neutrals-expected.html =================================================================== --- LayoutTests/fast/text/international/inline-plaintext-relayout-with-leading-neutrals-expected.html (revision 0) +++ LayoutTests/fast/text/international/inline-plaintext-relayout-with-leading-neutrals-expected.html (revision 0) @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + +
1... .... ....אshould look the same as1... .... ....א
2... .... ....ashould look the same as2... .... ....a
+ \ No newline at end of file Index: LayoutTests/fast/text/international/inline-plaintext-relayout-with-leading-neutrals.html =================================================================== --- LayoutTests/fast/text/international/inline-plaintext-relayout-with-leading-neutrals.html (revision 0) +++ LayoutTests/fast/text/international/inline-plaintext-relayout-with-leading-neutrals.html (revision 0) @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + +
1... .... ....ashould look the same as1... .... ....א
2... .... ....אshould look the same as2... .... ....a
+ \ No newline at end of file Index: LayoutTests/fast/text/international/inline-plaintext-with-generated-content-expected.html =================================================================== --- LayoutTests/fast/text/international/inline-plaintext-with-generated-content-expected.html (revision 0) +++ LayoutTests/fast/text/international/inline-plaintext-with-generated-content-expected.html (revision 0) @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + +
aא!should look the same asaא!
אa!should look the same asאa!
+ \ No newline at end of file Index: LayoutTests/fast/text/international/inline-plaintext-with-generated-content.html =================================================================== --- LayoutTests/fast/text/international/inline-plaintext-with-generated-content.html (revision 0) +++ LayoutTests/fast/text/international/inline-plaintext-with-generated-content.html (revision 0) @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + +
aא!should look the same asaא!
אa!should look the same asאa!
+ \ No newline at end of file