Bug 774968 - line-height percentage value not computed accurately. r=dbaron

--HG--
extra : rebase_source : 93885c1b2ef72d673a935c135f89cc06bc58136d
This commit is contained in:
Cameron McCormack 2012-07-20 07:03:35 +10:00
parent f46addfd2d
commit e6e89e5e75
4 changed files with 12 additions and 2 deletions

View File

@ -0,0 +1,3 @@
<!DOCTYPE html>
<body style="font-size: 50px">
<p style="line-height: 20.5px">20.5px

View File

@ -0,0 +1,6 @@
<!DOCTYPE html>
<body style="font-size: 50px">
<p style="line-height: 41%">
<script>
document.write(window.getComputedStyle(document.getElementsByTagName("p")[0], "").lineHeight);
</script>

View File

@ -23,6 +23,7 @@ load ligature-with-space-1.html
== line-editing-1d.html line-editing-1-ref.html
== line-editing-1e.html line-editing-1-ref.html
fails-if(cocoaWidget||winWidget) HTTP(..) == lineheight-metrics-1.html lineheight-metrics-1-ref.html # bug 657864
== lineheight-percentage-1.html lineheight-percentage-1-ref.html
== long-1.html long-ref.html
== pre-line-1.html pre-line-1-ref.html
== pre-line-2.html pre-line-2-ref.html

View File

@ -3634,8 +3634,8 @@ nsRuleNode::ComputeTextData(void* aStartStruct,
canStoreInRuleTree = false;
// Use |mFont.size| to pick up minimum font size.
text->mLineHeight.SetCoordValue(
nscoord(float(aContext->GetStyleFont()->mFont.size) *
lineHeightValue->GetPercentValue()));
NSToCoordRound(float(aContext->GetStyleFont()->mFont.size) *
lineHeightValue->GetPercentValue()));
}
else if (eCSSUnit_Initial == lineHeightValue->GetUnit() ||
eCSSUnit_System_Font == lineHeightValue->GetUnit()) {