Last Comment Bug 11559 - clip should not clip border and background (including padding)
: clip should not clip border and background (including padding)
Status: VERIFIED FIXED
CSS2 spec clarification needed (?)
: css2
Product: Core
Classification: Components
Component: Layout (show other bugs)
: Trunk
: All All
: P3 normal (vote)
: M17
Assigned To: troy
: Christine Hoffman
Mentors:
Depends on: 11565
Blocks:
  Show dependency treegraph
 
Reported: 1999-08-10 13:47 PDT by David Baron :dbaron: ⌚️UTC+2 (mostly busy through August 4; review requests must explain patch)
Modified: 2000-09-19 16:46 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
test case for clipping of backgrounds and borders (840 bytes, text/html)
1999-08-10 13:48 PDT, David Baron :dbaron: ⌚️UTC+2 (mostly busy through August 4; review requests must explain patch)
no flags Details

Description David Baron :dbaron: ⌚️UTC+2 (mostly busy through August 4; review requests must explain patch) 1999-08-10 13:47:21 PDT
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)
Comment 1 David Baron :dbaron: ⌚️UTC+2 (mostly busy through August 4; review requests must explain patch) 1999-08-10 13:48:59 PDT
Created attachment 1193 [details]
test case for clipping of backgrounds and borders
Comment 2 troy 1999-08-16 20:50:59 PDT
David, in light of the discussion in bug #10915, do we want to change this to
"clip should not clip border" instead?
Comment 3 David Baron :dbaron: ⌚️UTC+2 (mostly busy through August 4; review requests must explain patch) 1999-08-17 05:02:59 PDT
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...
Comment 4 troy 1999-08-17 16:26:59 PDT
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. :-)
Comment 5 David Baron :dbaron: ⌚️UTC+2 (mostly busy through August 4; review requests must explain patch) 1999-08-17 17:13:59 PDT
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?)
Comment 6 troy 1999-08-17 17:24:59 PDT
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
Comment 7 Hixie (not reading bugmail) 1999-09-05 13:53:59 PDT
[Hi again. Just installing another radar...]
Comment 8 Hixie (not reading bugmail) 2000-01-13 16:06:59 PST
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...
Comment 9 troy 2000-04-22 22:00:09 PDT
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
Comment 10 bsharma 2000-07-17 14:17:07 PDT
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.
Comment 11 Christine Hoffman 2000-09-19 16:46:41 PDT
Verified fixed on Linux with 09/18 build

Note You need to log in before you can comment on or make changes to this bug.