Closed Bug 11559 Opened 21 years ago Closed 20 years ago

clip should not clip border and background (including padding)

Categories

(Core :: Layout, defect, P3)

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: dbaron, Assigned: troy)

References

Details

(Keywords: css2, Whiteboard: CSS2 spec clarification needed (?))

Attachments

(1 file)

My interpretation of the CSS2 spec is that clip should not clip the border and
background of an element, only its content.  Currently, you clip border and
background.  However, this is what legacy browsers do, I think, so there is a
chance CSS could be changed (although I would oppose it - it would make the
behavior of overflow: hidden very strange - it would hide the borders too,
assuming that the 'generated box' to which an element is clipped is really the
content edge and not the border edge!).  (The only legacy browser to which I
have access now is actually WinIE4, which only clips positioned elements but
does exhibit the behavior I describe - I don't have NN4 or IE5, or anything non-
Win.)  You should be sure to check with the authors of CSS before fixing this
bug.

See the test case to be attached.

EXPECTED: You should see a 300px*300px div with a medium solid green border,
with a patch of text in the middle that has had its edges clipped off.

ACTUAL: The background and border are being clipped along with the content.

TESTED IN: viewer, Win95, 1999-08-09-09-M9   (bug marked All/All since XP code)
Status: NEW → ASSIGNED
Target Milestone: M11
David, in light of the discussion in bug #10915, do we want to change this to
"clip should not clip border" instead?
No.  Why would you say that?

If you have:

p {
  background: yellow;
  padding: 20px;
  border: medium solid red;
  height: 100px;
  width: 100px;
  overflow: hidden;
  clip: rect(30px, 50px, 50px, 30px); /*new version of rect(): see bug 11565*/
  }

Then you should see a 140px*140px yellow box with a red border all the way
around, with a little bit of text in the 20px*20px area just to the upper-left
of the center (if I did that right).  At least the way CSS2 is written now...
I misread the title of the bug. I thought it mentioned the border and "padding",
but I see it says "background". In reading the bug report again, you don't
actually mention padding in the bug report. Maybe you should, and that way it's
very clear what you expect. Otherwise, I might misread it again. :-)
Summary: clip should not clip border and background → clip should not clip border and background (including padding)
Retitled bug to indicate that THE PADDING IS COVERED BY THE BACKGROUND.  (You
won't miss that, will you? :-)

The point is that clip shouldn't clip border and background even if the clip
rect is set small.  (I think you know that now, but it can't hurt to say it
again.  Or can it?)
I certainly agree with you that clip shouldn't clip border and background even
if the clip rect is set small. And no it didn't hurt to repeat it again.

However, no you've asserted that the padding is covered by the background. Yes,
that's true, but the point I was trying to make (and not doing a very good job
of it :-) is that an open issue was whether the clip rect is relative to the
padding edge or the content edge.

I thought we were thinking padding edge and that should be specified in the bug
as well
Depends on: 11565
Summary: clip should not clip border and background (including padding) → {css2} clip should not clip border and background (including padding)
[Hi again. Just installing another radar...]
Target Milestone: M11 → M13
QA Contact: petersen → chrisd
Whiteboard: CSS2 spec clarification needed (?)
Keywords: css2
Migrating from {css2} to css2 keyword. The {css1}, {css2}, {css3} and {css-moz}
radars should now be considered deprecated in favour of keywords.
I am *really* sorry about the spam...
Summary: {css2} clip should not clip border and background (including padding) → clip should not clip border and background (including padding)
Target Milestone: M15 → M17
The upcoming errata separates out 'clip' from 'overflow' 'hidden'. 'clip' is 
border-edge relative and applies to the entire element including border and 
background. Clipping because of 'overflow' set to 'hidden' is content area 
relative and does not clip border and background

I changed our imnplementation to be in accordance with the new rules
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Verified.
Windows: 2000-07-12-09-M17
NOT Fixed for Linux on build 2000-07-13-08-M17.
I do not see green border on Linux.
Verified fixed on Linux with 09/18 build
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.