-
Masayuki Nakano authored
Bug 1543315 - part 20: Mark `PresShell::ContentStateChanged()` as `MOZ_CAN_RUN_SCRIPT_BOUNDARY` r=smaug While it calls `RestyleManager::ContentStateChanged()`, it blocks script with `nsAutoCauseReflowNotifier`. Therefore, it should be marked as `MOZ_CAN_RUN_SCRIPT_BOUNDARY` at least (looks like the other override, `DocAccessible::ContentStateChanged()` does not run script). There is a concern about the lifetime of `RestyleManager`. It's destroyed when `nsPresContext::DetachPresShell()` is called. It's called by `PresShell::Destroy()` and destructor of `nsPresContext`. The latter is safe since `PresShell` owns `mPresContext` and it's never cleared. However, I'm not sure about the former. It might be better to create blocker of synchronous handling of `PresShell::Destroy()`. And also this does not make `Document::ContentStateChanged()` use `RefPtr<PresShell>` at calling it because it might cause performance regression, but it does not do anything after destroying `nsAutoCauseReflowNotifier`. Finally, for guaranteeing that the lifetime of `PresShell::mPresContext` is longer than `PresShell`, this makes it to `RefPtr<nsPresContext> const`. However, initializing it in constructor breaks other objects' initialization process since they assume that `PresShell::GetPresContext()` won't return valid pointer until the `nsPresContext` is attached. For solving this issue safe, this patch keeps setting `mPresContext` in `Init()` with `const_cast` hack. Differential Revision: https://phabricator.services.mozilla.com/D55804 --HG-- extra : moz-landing-system : lando
271d1b6d