Bug 147335 - Nonstandard centering of absolutely positioned boxes
Summary: Nonstandard centering of absolutely positioned boxes
Status: RESOLVED NOT A BUG
Alias: None
Product: konqueror
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Debian stable Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-28 18:51 UTC by Olivier Vitrat
Modified: 2007-07-06 10:27 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Vitrat 2007-06-28 18:51:06 UTC
Version:            (using KDE KDE 3.5.5)
Installed from:    Debian stable Packages

Reported in Debian BTS at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=357019

Package: konqueror
Version: 4:3.3.2-1sarge1

Test Case:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
  <title>
    Faulty Centering
  </title>
  <style>
    body {
      color: white;
      background: black;
      padding: 0;
    }
    div {
      position: absolute;
      top: 0px;
      right: 0px;
      bottom: 0px;
      left: 0px;
      color: black;
      background: white;
      margin: auto;
      width: 640px;
      height: 400px;
    }
  </style>
</head>

<body>
  <div>
    Fully centered white box with important information...
  </div>
</body>

</html>

If the browser window is large enought, one gets a fully centered white
box with text on black background.  If one resizes the window until the
box does not fit anymore (reload necessary), parts of the box get
inaccessible and the text gets lost.  The left/top margin must not get
negative so that the white box stays left and/or top aligned (cf. CSS 2.1,
10.3.7 and 10.6.4: If none of the three is 'auto'...).  Firefox does this
correctly.
Comment 1 Moritz Schmidt 2007-07-05 17:59:01 UTC
running Konqueror 3.5.7 on a Gentoo box, I can confirm the described behaviour. 
btw, in contrast to Firefox, Opera 9.21 does the same.
Comment 2 Germain Garand 2007-07-06 10:27:53 UTC
it is correct that left/right margins must not become negative in LTR/RTL in that configuration, and that is what khtml does.

However,

  10.6.4:
  If none of the three are 'auto': If both 'margin-top' and 'margin-bottom' are
  'auto', solve the equation under the extra constraint that the two margins
  get equal values.

does not state to solve for zero margin-top.

Equal values might not be the most sensible choice given the default top-to-bottom layout, but that is the current specification.

=> complain to CSS working group.