Enable bidi when a frame has right-to-left direction during style post-processing instead of frame construction to catch dynamic changes to direction. Bug 489517, r+sr=dbaron

This commit is contained in:
Simon Montagu 2009-04-23 09:09:47 +03:00
Родитель 6902ba3cec
Коммит 57f67d585e
9 изменённых файлов: 98 добавлений и 10 удалений

Просмотреть файл

@ -5432,16 +5432,6 @@ nsCSSFrameConstructor::ConstructFramesFromItem(nsFrameConstructorState& aState,
aFrameItems);
}
// If the page contains markup that overrides text direction, and
// does not contain any characters that would activate the Unicode
// bidi algorithm, we need to call |SetBidiEnabled| on the pres
// context before reflow starts. This requires us to resolve some
// style information now. See bug 115921.
{
if (styleContext->GetStyleVisibility()->mDirection ==
NS_STYLE_DIRECTION_RTL)
aState.mPresContext->SetBidiEnabled();
}
// Start background loads during frame construction. This is just
// a hint; the paint code will do the right thing in any case.
{

Просмотреть файл

@ -581,6 +581,14 @@ nsFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
// stop and restart the image loading/notification
PresContext()->SetupBorderImageLoaders(this, GetStyleBorder());
}
// If the page contains markup that overrides text direction, and
// does not contain any characters that would activate the Unicode
// bidi algorithm, we need to call |SetBidiEnabled| on the pres
// context before reflow starts. See bug 115921.
if (GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
PresContext()->SetBidiEnabled();
}
}
/* virtual */ nsMargin

Просмотреть файл

@ -0,0 +1,14 @@
<!DOCTYPE HTML>
<html>
<head>
<title>bidi overrides</title>
</head><body>
&amp;#x202d; forces ltr<br />
&amp;#x202e; forces rtl<br />
&amp;#x202c; restores bidi<br />
<blockquote>
this is ltr: hello<br />
this is rtl: olleh
</blockquote>
</body>
</html>

Просмотреть файл

@ -0,0 +1,14 @@
<!DOCTYPE HTML>
<html>
<head>
<title>bidi overrides</title>
</head><body>
&amp;#x202d; forces ltr<br />
&amp;#x202e; forces rtl<br />
&amp;#x202c; restores bidi<br />
<blockquote>
this is ltr: &#x202d;hello&#x202c;<br />
this is rtl: &#x202e;hello&#x202c;
</blockquote>
</body>
</html>

Просмотреть файл

@ -0,0 +1,14 @@
<!DOCTYPE HTML>
<html>
<head>
<title>bidi overrides</title>
</head><body>
&lt;bdo dir="LTR"&gt; forces ltr<br />
&lt;bdo dir="RTL"&gt; forces rtl<br />
&lt;/bdo&gt; restores bidi<br />
<blockquote>
this is ltr: hello<br />
this is rtl: olleh
</blockquote>
</body>
</html>

Просмотреть файл

@ -0,0 +1,14 @@
<!DOCTYPE HTML>
<html>
<head>
<title>bidi overrides</title>
</head><body>
&lt;bdo dir="LTR"&gt; forces ltr<br />
&lt;bdo dir="RTL"&gt; forces rtl<br />
&lt;/bdo&gt; restores bidi<br />
<blockquote>
this is ltr: <bdo dir="LTR">hello</bdo><br />
this is rtl: <bdo dir="RTL">hello</bdo>
</blockquote>
</body>
</html>

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.flipped { direction: rtl; unicode-bidi: bidi-override; }
</style>
</head>
<body><div class="flipped">AB</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.flipped { direction: rtl; unicode-bidi: bidi-override; }
</style>
<script type="text/javascript">
function boom()
{
document.getElementById("outer").className = "flipped";
}
</script>
</head>
<body onload="boom();"><div id="outer">AB</div>
</body>
</html>

Просмотреть файл

@ -21,6 +21,8 @@ random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == mixedChartype-03-j.html mixedChartype-0
== with-first-letter-1b.html with-first-letter-1-ref.html
== with-first-letter-2a.html with-first-letter-2-ref.html
== with-first-letter-2b.html with-first-letter-2-ref.html
== 115921-1.html 115921-1-ref.html
== 115921-2.html 115921-2-ref.html
== 258928-1.html 258928-1-ref.html
== 299065-1.html 299065-1-ref.html
== 305643-1.html 305643-1-ref.html
@ -32,3 +34,4 @@ random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 386339.html 386339-ref.html
== 413928-2.html 413928-2-ref.html
== 425338-1a.html 425338-1-ref.html
== 425338-1b.html 425338-1-ref.html
== 489517-1.html 489517-1-ref.html