Closed Bug 1046469 Opened 10 years ago Closed 10 years ago

height value returned in GetComputedStyle does not fully allow for descenders

Categories

(Core :: General, defect)

29 Branch
x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: phunter, Unassigned)

Details

Attachments

(1 file)

Attached file resultant PDF file
User Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E)

Steps to reproduce:

Use GetComputedStyle to determine width and height of simple HTML file.
Used these values to set PaperWidth and PaperHeight attributes in PrinterSettings and then print to PDF, follows is essence of html file

<style type="text/css">
 
.Body 
{
        width:10rem;
        line-height: 100%;
        border-width:0 px;
        margin: 0 0 0 0;
        padding: 0 0 0 0;
}
</style>
</head>
<body class="Body">
    The quick brown fox jumps over the lazy dog    
</body>


Actual results:

In PDF file, character descenders in last line are (partially) cut off


Expected results:

PDF file should show complete descenders
>        line-height: 100%;

This is purposefully restricting the line height to the font size, which means the lines might not be tall enough for descenders.  You can probably see this trivially if you add background colors to both <html> and <body> to see where the boundaries of those blocks are.

But more importantly, the height of elements has nothing to do with the size of the document, in general.  So using getComputedStyle for this task is just going to fail in all sorts of ways.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → INVALID
(In reply to Boris Zbarsky [:bz] (On vacation Aug 5-18) from comment #1)
> >        line-height: 100%;
> 
> This is purposefully restricting the line height to the font size, which
> means the lines might not be tall enough for descenders.  You can probably
> see this trivially if you add background colors to both <html> and <body> to
> see where the boundaries of those blocks are.
> 
> But more importantly, the height of elements has nothing to do with the size
> of the document, in general.  So using getComputedStyle for this task is
> just going to fail in all sorts of ways.

are you able to indicate how I should get correct document size ?
Using the max of the <html> and <body>'s scrollHeight might work... kinda.  It rounds to integer pixels.  That's assuming that for documents that you want the height to exceed the viewport height if the document would scroll vertically.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: