зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
6902ba3cec
Коммит
57f67d585e
|
@ -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>
|
||||
&#x202d; forces ltr<br />
|
||||
&#x202e; forces rtl<br />
|
||||
&#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>
|
||||
&#x202d; forces ltr<br />
|
||||
&#x202e; forces rtl<br />
|
||||
&#x202c; restores bidi<br />
|
||||
<blockquote>
|
||||
this is ltr: ‭hello‬<br />
|
||||
this is rtl: ‮hello‬
|
||||
</blockquote>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>bidi overrides</title>
|
||||
</head><body>
|
||||
<bdo dir="LTR"> forces ltr<br />
|
||||
<bdo dir="RTL"> forces rtl<br />
|
||||
</bdo> 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>
|
||||
<bdo dir="LTR"> forces ltr<br />
|
||||
<bdo dir="RTL"> forces rtl<br />
|
||||
</bdo> 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
|
||||
|
|
Загрузка…
Ссылка в новой задаче