Closed Bug 1299046 Opened 8 years ago Closed 8 years ago

Lots of warnings triggered with mouse events on pseudo-elements

Categories

(Core :: DOM: Events, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla51
Tracking Status
firefox51 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

Details

Attachments

(1 file)

So when doing a simple test with pseudo-elements, I trigger tons of assertions when hovering over this.

```
<!doctype html>
<style>
  div::before {
    background: red;
    content: "(test)";
  }
  div {
    background: blue;
  }
  div:hover::before {
    background: green;
  }
</style>
<div></div>
```

The assertion triggered is in EventStateManager::PreHandleEvent, that one that says that nodes and content should be related: http://searchfox.org/mozilla-central/source/dom/events/EventStateManager.cpp#513

The culprit is the call that the pres shell uses to get the content from the generated content frame, that is, mCurrentEventFrame->GetContentForEvent(..), which explicitly discards generated content frames.

I can certainly relax the assertion so it doesn't hit on generated content, I guess, but I also think we might want to not skip generated content, since this might be one of the underlying causes of bugs like bug 1122965 or bug 1177528.
See Also: → 1122965, 1177528
Summary: Lots of assertions triggered with mouse events on pseudo-elements → Lots of warnings triggered with mouse events on pseudo-elements
After digging a bit more, I understand why the target is the non-generated content, I'll post a patch with the warning condition fixed.
Comment on attachment 8786202 [details]
Bug 1299046: Take into account generated content in EventStateManager::PreHandleEvent.

https://reviewboard.mozilla.org/r/75176/#review73160

::: dom/events/EventStateManager.cpp:533
(Diff revision 1)
>                     aTargetFrame->GetContent() == aTargetContent ||
> -                   aTargetFrame->GetContent()->GetFlattenedTreeParent() == aTargetContent,
> +                   aTargetFrame->GetContent()->GetFlattenedTreeParent() == aTargetContent ||
> +                   aTargetFrame->IsGeneratedContentFrame(),
>                     "aTargetFrame should be related with aTargetContent");
> +#if DEBUG
> +  if (aTargetFrame && aTargetFrame->IsGeneratedContentFrame()) {

Make sure to push this to tryserver (debug builds) before landing.
Attachment #8786202 - Flags: review?(bugs) → review+
Assignee: nobody → ecoal95
Try is green modulo unrelated intermittent failures.
Pushed by ecoal95@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/b0cad82d939e
Take into account generated content in EventStateManager::PreHandleEvent. r=smaug
https://hg.mozilla.org/mozilla-central/rev/b0cad82d939e
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: