Closed Bug 490003 Opened 15 years ago Closed 14 years ago

Invalidation and hit testing does not account for border or patting on outer-<svg>

Categories

(Core :: SVG, defect, P2)

defect

Tracking

()

RESOLVED FIXED
Tracking Status
blocking2.0 --- beta1+

People

(Reporter: jwatt, Assigned: longsonr)

References

Details

Attachments

(4 files, 1 obsolete file)

Invalidation and hit testing does not account for border or patting on outer-<svg>.
Assignee: nobody → jwatt
Attached image testcase - invalidation
Attached image testcase - hit testing
Attached patch patchSplinter Review
I'm not sure how to create an automated test for the hit testing. I need a way to dispatch an event to a given point on the screen, not to a particular target.
Attachment #374491 - Flags: review?(roc)
For hit-testing, use the elementFromPoint DOM API.

+  nsMargin bp = GetUsedBorderAndPadding();
+  ApplySkipSides(bp);
+  const nsPoint point = aPoint - nsPoint(bp.left, bp.top);
   nsRect thisRect(nsPoint(0,0), GetSize());
-  if (!thisRect.Contains(aPoint)) {
+  if (!thisRect.Contains(point)) {

This can't be right, you're still using the size of the border-rect for your hit-test. Same goes for the other places.
Comment on attachment 374491 [details] [diff] [review]
patch

Patch needs to be updated per comment #4
Attachment #374491 - Flags: review?(roc) → review-
We should really fix this....
blocking2.0: --- → ?
jwatt, do you mind if I take this?
Attached patch what I've got (obsolete) — Splinter Review
Attachment #444148 - Flags: review?(roc)
Instead of calling GetUsedBorderAndPadding and ApplySkipSides, I advise you to just use GetContentRect - GetPosition. Otherwise looks good.
Attachment #444148 - Attachment is obsolete: true
Attachment #444246 - Flags: review?(roc)
Attachment #444148 - Flags: review?(roc)
-  nsRect thisRect(nsPoint(0,0), static_cast<nsSVGOuterSVGFrame*>(mFrame)->GetSize());
+  nsRect thisRect(nsPoint(0,0), outerSVGFrame->GetSize());
   if (!thisRect.Intersects(rectAtOrigin))
     return;

I'm not sure what this check is for, actually. Should we just take it out?
A check for the point being within the overall bounds for the outer svg element I guess. I guess that might not be valid in the case of overflow: visible but we have bug 378923 for that so how about leaving the code as it is and putting a note in bug 378923 to look more closely into this code as part of that bug. I might even take bug 378923 next.
Whiteboard: [needs landing]
Pushed final patch on longsonr's behalf:
http://hg.mozilla.org/mozilla-central/rev/fbca3a801c22
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Whiteboard: [needs landing]
Version: unspecified → Trunk
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: