Bug 705446: Disable font inflation for preformatted text. [r=dbaron]

This commit is contained in:
Scott Johnson 2012-03-02 11:25:33 -06:00
Родитель d03567ecf9
Коммит 9279b2510d
4 изменённых файлов: 52 добавлений и 3 удалений

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

@ -4734,9 +4734,13 @@ ShouldInflateFontsForContainer(const nsIFrame *aFrame)
// indicates whether the frame is inside something with a constrained
// height (propagating down the tree), but the propagation stops when
// we hit overflow-y: scroll or auto.
return aFrame->GetStyleText()->mTextSizeAdjust !=
NS_STYLE_TEXT_SIZE_ADJUST_NONE &&
!(aFrame->GetStateBits() & NS_FRAME_IN_CONSTRAINED_HEIGHT);
const nsStyleText* styleText = aFrame->GetStyleText();
return styleText->mTextSizeAdjust != NS_STYLE_TEXT_SIZE_ADJUST_NONE &&
!(aFrame->GetStateBits() & NS_FRAME_IN_CONSTRAINED_HEIGHT) &&
// We also want to disable font inflation for containers that have
// preformatted text.
styleText->WhiteSpaceCanWrap();
}
nscoord

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

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<!--
This text is in a preformatted block, and should therefore not be inflated with the fix for bug 705446.
-->
<html>
<head>
<style>
pre { font-size: 12px; line-height: 1.0;}
</style>
<body>
<div>
<pre>
<div class="line" id="line1"><span style="color: red">Firefox</span> is quite neat</div>
<div class="line" id="line2">It browses the web fluidly</div>
<div class="line" id="line3">With no cares at all</div>
</pre>
</div>
</body>
</head>
</html>

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

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<!--
This text is in a preformatted block, and should therefore not be inflated with the fix for bug 705446.
-->
<html>
<head>
<style>
pre { font-size: 12px; line-height: 1.0;}
</style>
<body>
<div>
<pre>
<div class="line" id="line1"><span style="color: red">Firefox</span> is quite neat</div>
<div class="line" id="line2">It browses the web fluidly</div>
<div class="line" id="line3">With no cares at all</div>
</pre>
</div>
</body>
</head>
</html>

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

@ -65,6 +65,7 @@ var gTests = [
"== disable-fontinfl-on-mobile-2.html disable-fontinfl-on-mobile-ref.html",
"== disable-fontinfl-on-mobile-3.html disable-fontinfl-on-mobile-ref.html",
"== disable-fontinfl-on-mobile-4.html disable-fontinfl-on-mobile-ref.html",
"== preformatted-text.html preformatted-text-ref.html",
];
// Maintain a reference count of how many things we're waiting for until