Closed Bug 198883 Opened 21 years ago Closed 21 years ago

<pre> inside <div> is misdrawn when window width is less than the width of <pre> text

Categories

(Core :: Layout: Block and Inline, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 3701

People

(Reporter: finlay_bugzilla_2003, Unassigned)

Details

Attachments

(3 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3) Gecko/20030312
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3) Gecko/20030312

In HTML 4.0 / CSS1 pages where <pre> text is enclosed within a <div>, such as
the following page:

<div style="background: #ff9999">
  <pre>
             1         2         3         4         5         6         7
    1234567890123456789012345678901234567890123456789012345678901234567890     
     
  </pre>
</div>

if the browser window is resized to be too narrow to show all the <pre>
text, the div background isn't drawn properly on the very right side of
the browser window.  It gets worse if the browser is then horizontally 
scrolled.

Reproducible: Always

Steps to Reproduce:
1. load page with above html code 
2. horizontally shrink browser window, until window is too narrow to contain
   desired text.  
3. grab horizontal scrollbar and drag it rightward.

  
Actual Results:  
in 2, above, text is shown outside bounds of its enclosing <div> (in the
      narrow white margin on the extreme right side of the browser window).

in 3, above, exposed area of <div> isn't drawn with div's background colour,
      so now more of the <pre> text appears to be outside its enclosing
      <div>


Expected Results:  
1. there shouldn't be that white margin on the right side of the div block
   when the window is too small - the div should go right the way to the
   end

2. text inside a div shouldn't be drawn outside it

3. the div background should be correctly drawn when it's exposed, as 
   described above.
Attached image view before resize
Attached image view after resize
correction - the <pre> is irrelevant - this happens even without it,
on pages like:

<div style="background: #ff9999">
    1234567890123456789012345678901234567890123456789012345678901234567890     
</div>

If I were a betting man, I'd guess that the code which calculates the
right extend of the div's background block is mistakenly using the width
of the window (minus the margin size) rather than the width of the page
(minus the margin size).  Comparable implementations of CSS1 (Opera7, IE6)
don't show the right margin in the window-too-small case - their divs
go right the way to the very righthand edge of the window.
This reminds me a bit of bug 152273
Duplicate of invalid bug.  Our behavior is correct.

*** This bug has been marked as a duplicate of 3701 ***
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: