RESOLVED FIXED Bug 9217
padding-bottom not working for <a>
https://bugs.webkit.org/show_bug.cgi?id=9217
Summary padding-bottom not working for <a>
Miles Lubin
Reported 2006-06-01 15:03:06 PDT
The css style padding-bottom is apparently not followed for <a> tags. Knoyzz.com uses it in its navigation bar to create an underline-like-border under the link. On firefox and IE, the borders are well under the text, but on Safari the borders are on top of the text. The relevent css is at the end of http://knoyzz.com/style.css
Attachments
screenshot of difference (29.79 KB, image/png)
2006-06-01 17:26 PDT, Alice Liu
no flags
reduced test case (291 bytes, text/html)
2006-06-01 18:16 PDT, Sam Weinig
no flags
strict mode (502 bytes, application/xhtml+xml)
2006-06-01 18:35 PDT, Miles Lubin
no flags
patch (6.40 KB, patch)
2006-06-04 12:31 PDT, Sam Weinig
hyatt: review-
inlineInInline.diff (6.40 KB, patch)
2006-06-04 16:56 PDT, Miles Lubin
hyatt: review-
inlineInInline.diff (6.50 KB, patch)
2006-06-05 17:06 PDT, Miles Lubin
hyatt: review-
Alice Liu
Comment 1 2006-06-01 17:26:11 PDT
Created attachment 8654 [details] screenshot of difference screenshot of difference. Safari on left, FF on right.
Alice Liu
Comment 2 2006-06-01 17:27:02 PDT
confirming, moving to new. added screenshot of difference, safari on left, FF on right.
Sam Weinig
Comment 3 2006-06-01 18:16:52 PDT
Created attachment 8655 [details] reduced test case
Dave Hyatt
Comment 4 2006-06-01 18:24:37 PDT
Bet this works in strict mode.
Miles Lubin
Comment 5 2006-06-01 18:35:45 PDT
Created attachment 8656 [details] strict mode You were right, it does work correctly in strict mode.
Dave Hyatt
Comment 6 2006-06-01 18:44:47 PDT
This is related to the quirk involving hasTextChildren() and shrinkBoxesWithNoTextChildren() in InlineFlowBox.cpp. Right now we shrink any inline boxes that have no immediate text children. We should either propagate the bit up so that an ancestor is also considered to have text children (not sure if this is right though), or we could check for a bottom border along with hasTextChildren.
Dave Hyatt
Comment 7 2006-06-01 18:50:06 PDT
Firefox disables the quirk when border-bottom is set, so I think that's the way we should go too.
Dave Hyatt
Comment 8 2006-06-01 18:51:33 PDT
Same with padding-bottom. They actually turn off the quirk even if top border/padding is set, but I think that's overkill.
Dave Hyatt
Comment 9 2006-06-01 18:52:51 PDT
I'll leave this to someone else to code up the fix for. Just need to replace most of the hasTextChildren()s with a new method like shouldShrinkBox() that could check hasTextChildren(), bottom border/padding, and strict mode all together.
David Carson
Comment 10 2006-06-02 18:52:52 PDT
Changed component to Layout and Rendering, as it seems to be in the layout. InlineFlowBox.cpp does checks for strictMode || hasTextChildren(). Seams like an easy fix.
Sam Weinig
Comment 11 2006-06-04 12:31:24 PDT
Created attachment 8698 [details] patch Makes fix and cleans up some surrounding code a little bit.
Dave Hyatt
Comment 12 2006-06-04 14:38:02 PDT
Comment on attachment 8698 [details] patch You want to shrink the boxes if you *aren't* in strict mode. Change the strictMode check to !strictMode.
Miles Lubin
Comment 13 2006-06-04 14:58:04 PDT
If I have it correctly, we don't want to shrink the box if it's in struct mode, or if there are text children, or if there is a bottom border, or if there is bottom padding. The expression "(strictMode || hasTextChildren() || object()->borderBottom() || object()->paddingBottom())" looks like it does the exact opposite, it will shrink if any of those are true. Putting a ! before the expression should produce the correct logic. I'm currently building webkit with this patch and will report on how it comes out.
Miles Lubin
Comment 14 2006-06-04 15:45:09 PDT
my change doesn't seem to do it
Miles Lubin
Comment 15 2006-06-04 16:56:55 PDT
Created attachment 8704 [details] inlineInInline.diff Fixed patch with hyatt's suggested change. Tested and is working properly.
Miles Lubin
Comment 16 2006-06-04 21:08:08 PDT
After running the regression tests, this patch causes 31 cases to have a minor aesthetic change in their layout. I did not see any real problems, though I will look at it more tomorrow if someone else doesn't do it before then.
Dave Hyatt
Comment 17 2006-06-04 21:28:42 PDT
Comment on attachment 8704 [details] inlineInInline.diff I see a missed spot that still needs to be patched with shouldShrinkBox... There's an if (hasTextChildren() || strictMode) left in the code still.
Miles Lubin
Comment 18 2006-06-05 17:06:07 PDT
Created attachment 8721 [details] inlineInInline.diff Fixed logic based on IRC discussion, and replaced the (hasTextChildren() || strictMode) that were left over. Compiles and appears to work as desired.
Dave Hyatt
Comment 19 2006-06-07 01:07:14 PDT
Comment on attachment 8721 [details] inlineInInline.diff r=me
David Kilzer (:ddkilzer)
Comment 20 2006-06-08 05:37:19 PDT
(In reply to comment #19) > (From update of attachment 8721 [details] [edit]) > r=me I saw a lot of layout failures when I applied this patch and ran run-webkit-tests. Please run all of the layout tests before applying this patch.
Dave Hyatt
Comment 21 2006-06-08 13:13:30 PDT
Comment on attachment 8721 [details] inlineInInline.diff I wouldn't expect to see a lot of layout test failures so something must be wrong. Minusing.
Adam Roben (:aroben)
Comment 22 2006-09-02 01:15:05 PDT
This seems to be fixed in the latest nightly. Resolving.
Note You need to log in before you can comment on or make changes to this bug.