зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1680167 - Part 8: MOZ_CAN_RUN_SCRIPT_BOUNDARY in toolkit r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D98631
This commit is contained in:
Родитель
24a88545bc
Коммит
9fc2fee9e3
|
@ -346,8 +346,7 @@ void nsWebBrowserFind::SetSelectionAndScroll(nsPIDOMWindowOuter* aWindow,
|
|||
selection->AddRangeAndSelectFramesAndNotifyListeners(*aRange,
|
||||
IgnoreErrors());
|
||||
|
||||
nsFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
if (fm) {
|
||||
if (RefPtr<nsFocusManager> fm = nsFocusManager::GetFocusManager()) {
|
||||
if (tcFrame) {
|
||||
RefPtr<Element> newFocusedElement = Element::FromNode(content);
|
||||
fm->SetFocus(newFocusedElement, nsIFocusManager::FLAG_NOSCROLL);
|
||||
|
@ -749,7 +748,7 @@ nsresult nsWebBrowserFind::OnFind(nsPIDOMWindowOuter* aFoundWindow) {
|
|||
ClearFrameSelection(lastFocusedWindow);
|
||||
}
|
||||
|
||||
if (nsFocusManager* fm = nsFocusManager::GetFocusManager()) {
|
||||
if (RefPtr<nsFocusManager> fm = nsFocusManager::GetFocusManager()) {
|
||||
// get the containing frame and focus it. For top-level windows, the right
|
||||
// window should already be focused.
|
||||
if (RefPtr<Element> frameElement =
|
||||
|
|
|
@ -59,7 +59,7 @@ class nsWebBrowserFind : public nsIWebBrowserFind,
|
|||
nsPIDOMWindowOuter* aWindow);
|
||||
nsresult ClearFrameSelection(nsPIDOMWindowOuter* aWindow);
|
||||
|
||||
nsresult OnFind(nsPIDOMWindowOuter* aFoundWindow);
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult OnFind(nsPIDOMWindowOuter* aFoundWindow);
|
||||
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY void SetSelectionAndScroll(
|
||||
nsPIDOMWindowOuter* aWindow, nsRange* aRange);
|
||||
|
|
|
@ -499,7 +499,7 @@ nsresult nsTypeAheadFind::FindItNow(uint32_t aMode, bool aIsLinksOnly,
|
|||
NS_ASSERTION(window, "document has no window");
|
||||
if (!window) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
RefPtr<nsFocusManager> fm = nsFocusManager::GetFocusManager();
|
||||
if (usesIndependentSelection) {
|
||||
/* If a search result is found inside an editable element, we'll focus
|
||||
* the element only if focus is in our content window, i.e.
|
||||
|
@ -524,7 +524,7 @@ nsresult nsTypeAheadFind::FindItNow(uint32_t aMode, bool aIsLinksOnly,
|
|||
// We may be inside an editable element, and therefore the selection
|
||||
// may be controlled by a different selection controller. Walk up the
|
||||
// chain of parent nodes to see if we find one.
|
||||
nsCOMPtr<nsINode> node = returnRange->GetStartContainer();
|
||||
nsINode* node = returnRange->GetStartContainer();
|
||||
while (node) {
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
if (RefPtr<HTMLInputElement> input =
|
||||
|
@ -557,7 +557,8 @@ nsresult nsTypeAheadFind::FindItNow(uint32_t aMode, bool aIsLinksOnly,
|
|||
|
||||
// Otherwise move focus/caret to editable element
|
||||
if (fm) {
|
||||
fm->SetFocus(mFoundEditable, 0);
|
||||
nsCOMPtr<Element> newFocusElement = mFoundEditable;
|
||||
fm->SetFocus(newFocusElement, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче