RESOLVED FIXED 45164
REGRESSION: <a><img align=top></a> Clickable area too large
https://bugs.webkit.org/show_bug.cgi?id=45164
Summary REGRESSION: <a><img align=top></a> Clickable area too large
tbsmark86
Reported 2010-09-02 23:23:34 PDT
Created attachment 66473 [details] Testcase When using a image with align="top" as a link the clickable area may expand above the image, overlapping other links. Only Safari 5 is affected, Safari 4 work as expected. You can acctually see in the Developer Tools that the <a> is highlighted above the <img>.
Attachments
Testcase (782 bytes, text/html)
2010-09-02 23:23 PDT, tbsmark86
no flags
proposed patch (14.98 KB, patch)
2010-12-12 01:42 PST, My Shin
no flags
proposed patch(2nd) (18.14 KB, patch)
2010-12-13 20:30 PST, My Shin
hyatt: review-
Patch to clamp hit testing (6.01 KB, patch)
2011-03-14 13:45 PDT, Dave Hyatt
mitz: review+
Alexey Proskuryakov
Comment 1 2010-09-03 12:21:08 PDT
Broken hit testing == not good.
My Shin
Comment 2 2010-12-12 01:42:47 PST
Created attachment 76315 [details] proposed patch I couldn't make test case because it needs hitTest to verify this issue. And I modified expected files of some test cases on Mac platform to change box position's calculation. I have no idea about expected files on other platform. I don't have environment about other platform. please take look.
Simon Fraser (smfr)
Comment 3 2010-12-12 09:10:25 PST
You can test hit testing with document.elementFromPoint(), or with event sender in DRT.
My Shin
Comment 4 2010-12-13 15:35:03 PST
Thank you. I'll try to make test case.
My Shin
Comment 5 2010-12-13 20:30:52 PST
Created attachment 76489 [details] proposed patch(2nd) I added test case. please review again.
Alexey Proskuryakov
Comment 6 2011-01-20 16:53:38 PST
Dave Hyatt
Comment 7 2011-03-14 12:21:00 PDT
Comment on attachment 76489 [details] proposed patch(2nd) View in context: https://bugs.webkit.org/attachment.cgi?id=76489&action=review This isn't right. > WebCore/rendering/InlineFlowBox.cpp:597 > + int posAdjust = 0; > if ((isInlineFlow && !static_cast<InlineFlowBox*>(curr)->hasTextChildren()) && !curr->boxModelObject()->hasInlineDirectionBordersOrPadding() && !strictMode) > childAffectsTopBottomPos = false; > - int posAdjust = maxAscent - curr->baselinePosition(baselineType); > + else > + posAdjust = maxAscent - curr->baselinePosition(baselineType); I don't understand this at all. There's nothing wrong with this code as far as I can tell. You still have to set the correct logicalTop. You can't just leave it at 0.
Dave Hyatt
Comment 8 2011-03-14 12:40:05 PDT
The actual bug here is in: adjustMaxAscentAndDescent which also needs the notion of setMaxAscent and setMaxDescent (which was added to computeLogicalBoxHeights recently). If those aren't set, then adjustMaxAscentAndDescent needs to make sure both end up set instead of only adjusting one of the two values.
Dave Hyatt
Comment 9 2011-03-14 12:50:49 PDT
This is actually even more complicated. If there is room, you probably want all of the inlines to fit within the space provided by the image. The correct layout would be that adjustMaxAscentAndDescent sets maxAscent to the maxAscent of all the boxes that didn't really affect the line layout instead of just giving all the space to maxDescent. The same goes for vertical-align:bottom and max descent. So I guess in addition to tracking whether or not maxAscent and maxDescent have been set, you also have to track the maxAscent and maxDescent including the additional boxes. Yay for two more member variables.
Dave Hyatt
Comment 10 2011-03-14 12:51:08 PDT
(In reply to comment #9) > Yay for two more member variables. Method parameters. :)
Dave Hyatt
Comment 11 2011-03-14 12:53:17 PDT
By the way another observed bug is that although we properly clip the painting when a box extends above lineTop, we didn't stop hit testing. We really should fix that as well, so you could punt on the harder line layout issue and just patch hit testing to match painting.
Dave Hyatt
Comment 12 2011-03-14 13:45:34 PDT
Created attachment 85713 [details] Patch to clamp hit testing
Dave Hyatt
Comment 13 2011-03-14 13:56:36 PDT
Fixed in r81055.
Dave Hyatt
Comment 14 2011-03-14 13:57:13 PDT
Just closing this out, since I don't think the mis-positioning is interesting enough to bother fixing. No need to make the code more complicated when the positions of those boxes don't really matter.
Note You need to log in before you can comment on or make changes to this bug.