diff --git a/mozilla/browser/base/content/browser.xul b/mozilla/browser/base/content/browser.xul index bf8309de0f6..9cf061863b1 100644 --- a/mozilla/browser/base/content/browser.xul +++ b/mozilla/browser/base/content/browser.xul @@ -426,7 +426,6 @@ flex="1" contenttooltip="aHTMLTooltip" contentcontextmenu="contentAreaContextMenu" onnewtab="BrowserOpenTab();" - onkeyup="onBrowserKeyUp(event);" autocompletepopup="PopupAutoComplete" ondragdrop="nsDragAndDrop.drop(event, contentAreaDNDObserver);" onclick="return contentAreaClick(event, false);"/> diff --git a/mozilla/content/events/public/nsIEventStateManager.h b/mozilla/content/events/public/nsIEventStateManager.h index 39a69fef8ce..9ad4bfcd1a5 100644 --- a/mozilla/content/events/public/nsIEventStateManager.h +++ b/mozilla/content/events/public/nsIEventStateManager.h @@ -99,6 +99,9 @@ public: NS_IMETHOD GetFocusedContent(nsIContent **aContent) = 0; NS_IMETHOD SetFocusedContent(nsIContent* aContent) = 0; + // Get the previously-focused content node for this document + NS_IMETHOD GetLastFocusedContent(nsIContent **aContent) = 0; + NS_IMETHOD GetFocusedFrame(nsIFrame **aFrame) = 0; NS_IMETHOD ContentRemoved(nsIContent* aContent) = 0; diff --git a/mozilla/content/events/src/nsEventStateManager.cpp b/mozilla/content/events/src/nsEventStateManager.cpp index 12721fd3214..503b5b66275 100644 --- a/mozilla/content/events/src/nsEventStateManager.cpp +++ b/mozilla/content/events/src/nsEventStateManager.cpp @@ -4169,10 +4169,20 @@ NS_IMETHODIMP nsEventStateManager::SetFocusedContent(nsIContent* aContent) { mCurrentFocus = aContent; + if (mCurrentFocus) + mLastFocus = mCurrentFocus; mCurrentFocusFrame = nsnull; return NS_OK; } +NS_IMETHODIMP +nsEventStateManager::GetLastFocusedContent(nsIContent** aContent) +{ + *aContent = mLastFocus; + NS_IF_ADDREF(*aContent); + return NS_OK; +} + NS_IMETHODIMP nsEventStateManager::GetFocusedFrame(nsIFrame** aFrame) { @@ -4204,6 +4214,11 @@ nsEventStateManager::ContentRemoved(nsIContent* aContent) SetFocusedContent(nsnull); } + if (mLastFocus && + nsContentUtils::ContentIsDescendantOf(mLastFocus, aContent)) { + mLastFocus = nsnull; + } + if (mHoverContent && nsContentUtils::ContentIsDescendantOf(mHoverContent, aContent)) { // Since hover is hierarchical, set the current hover to the @@ -4615,10 +4630,6 @@ nsEventStateManager::FocusElementButNotDocument(nsIContent *aContent) focusController->GetFocusedElement(getter_AddRefs(oldFocusedElement)); nsCOMPtr oldFocusedContent(do_QueryInterface(oldFocusedElement)); - // Notify focus controller of new focus for this document - nsCOMPtr newFocusedElement(do_QueryInterface(aContent)); - focusController->SetFocusedElement(newFocusedElement); - // Temporarily set mCurrentFocus so that esm::GetContentState() tells // layout system to show focus on this element. SetFocusedContent(aContent); // Reset back to null at the end of this method. diff --git a/mozilla/content/events/src/nsEventStateManager.h b/mozilla/content/events/src/nsEventStateManager.h index 5d18d499aa6..9756fe47540 100644 --- a/mozilla/content/events/src/nsEventStateManager.h +++ b/mozilla/content/events/src/nsEventStateManager.h @@ -117,6 +117,7 @@ public: NS_IMETHOD SetContentState(nsIContent *aContent, PRInt32 aState); NS_IMETHOD GetFocusedContent(nsIContent **aContent); NS_IMETHOD SetFocusedContent(nsIContent* aContent); + NS_IMETHOD GetLastFocusedContent(nsIContent **aContent); NS_IMETHOD GetFocusedFrame(nsIFrame **aFrame); NS_IMETHOD ContentRemoved(nsIContent* aContent); NS_IMETHOD EventStatusOK(nsGUIEvent* aEvent, PRBool *aOK); @@ -305,6 +306,7 @@ protected: nsCOMPtr mDragOverContent; nsCOMPtr mURLTargetContent; nsCOMPtr mCurrentFocus; + nsCOMPtr mLastFocus; nsIFrame* mCurrentFocusFrame; PRInt32 mCurrentTabIndex; diff --git a/mozilla/content/xul/content/src/nsXULElement.cpp b/mozilla/content/xul/content/src/nsXULElement.cpp index 6a32e5c16ba..261466b4f6b 100644 --- a/mozilla/content/xul/content/src/nsXULElement.cpp +++ b/mozilla/content/xul/content/src/nsXULElement.cpp @@ -274,52 +274,55 @@ IsEventHandler(nsIAtom* aName) return PR_FALSE; } - return aName == nsLayoutAtoms::onclick || - aName == nsLayoutAtoms::ondblclick || - aName == nsLayoutAtoms::onmousedown || - aName == nsLayoutAtoms::onmouseup || - aName == nsLayoutAtoms::onmouseover || - aName == nsLayoutAtoms::onmouseout || - aName == nsLayoutAtoms::onmousemove || + return aName == nsLayoutAtoms::onclick || + aName == nsLayoutAtoms::ondblclick || + aName == nsLayoutAtoms::onmousedown || + aName == nsLayoutAtoms::onmouseup || + aName == nsLayoutAtoms::onmouseover || + aName == nsLayoutAtoms::onmouseout || + aName == nsLayoutAtoms::onmousemove || - aName == nsLayoutAtoms::onkeydown || - aName == nsLayoutAtoms::onkeyup || - aName == nsLayoutAtoms::onkeypress || + aName == nsLayoutAtoms::onkeydown || + aName == nsLayoutAtoms::onkeyup || + aName == nsLayoutAtoms::onkeypress || - aName == nsLayoutAtoms::onload || - aName == nsLayoutAtoms::onunload || - aName == nsLayoutAtoms::onabort || - aName == nsLayoutAtoms::onerror || + aName == nsLayoutAtoms::oncompositionstart || + aName == nsLayoutAtoms::oncompositionend || - aName == nsLayoutAtoms::onpopupshowing || - aName == nsLayoutAtoms::onpopupshown || - aName == nsLayoutAtoms::onpopuphiding || - aName == nsLayoutAtoms::onpopuphidden || - aName == nsLayoutAtoms::onclose || - aName == nsLayoutAtoms::oncommand || - aName == nsLayoutAtoms::onbroadcast || - aName == nsLayoutAtoms::oncommandupdate || + aName == nsLayoutAtoms::onload || + aName == nsLayoutAtoms::onunload || + aName == nsLayoutAtoms::onabort || + aName == nsLayoutAtoms::onerror || - aName == nsLayoutAtoms::onoverflow || - aName == nsLayoutAtoms::onunderflow || - aName == nsLayoutAtoms::onoverflowchanged || + aName == nsLayoutAtoms::onpopupshowing || + aName == nsLayoutAtoms::onpopupshown || + aName == nsLayoutAtoms::onpopuphiding || + aName == nsLayoutAtoms::onpopuphidden || + aName == nsLayoutAtoms::onclose || + aName == nsLayoutAtoms::oncommand || + aName == nsLayoutAtoms::onbroadcast || + aName == nsLayoutAtoms::oncommandupdate || - aName == nsLayoutAtoms::onfocus || - aName == nsLayoutAtoms::onblur || + aName == nsLayoutAtoms::onoverflow || + aName == nsLayoutAtoms::onunderflow || + aName == nsLayoutAtoms::onoverflowchanged || - aName == nsLayoutAtoms::onsubmit || - aName == nsLayoutAtoms::onreset || - aName == nsLayoutAtoms::onchange || - aName == nsLayoutAtoms::onselect || - aName == nsLayoutAtoms::oninput || + aName == nsLayoutAtoms::onfocus || + aName == nsLayoutAtoms::onblur || - aName == nsLayoutAtoms::onpaint || + aName == nsLayoutAtoms::onsubmit || + aName == nsLayoutAtoms::onreset || + aName == nsLayoutAtoms::onchange || + aName == nsLayoutAtoms::onselect || + aName == nsLayoutAtoms::oninput || - aName == nsLayoutAtoms::ondragenter || - aName == nsLayoutAtoms::ondragover || - aName == nsLayoutAtoms::ondragexit || - aName == nsLayoutAtoms::ondragdrop || - aName == nsLayoutAtoms::ondraggesture || + aName == nsLayoutAtoms::onpaint || + + aName == nsLayoutAtoms::ondragenter || + aName == nsLayoutAtoms::ondragover || + aName == nsLayoutAtoms::ondragexit || + aName == nsLayoutAtoms::ondragdrop || + aName == nsLayoutAtoms::ondraggesture || aName == nsLayoutAtoms::oncontextmenu; } diff --git a/mozilla/toolkit/components/typeaheadfind/content/findBar.inc b/mozilla/toolkit/components/typeaheadfind/content/findBar.inc index 9638deca2b5..38b29c1123e 100755 --- a/mozilla/toolkit/components/typeaheadfind/content/findBar.inc +++ b/mozilla/toolkit/components/typeaheadfind/content/findBar.inc @@ -4,8 +4,10 @@