diff --git a/mozilla/content/events/public/nsIEventStateManager.h b/mozilla/content/events/public/nsIEventStateManager.h index 592c24e4f77..4406e22730a 100644 --- a/mozilla/content/events/public/nsIEventStateManager.h +++ b/mozilla/content/events/public/nsIEventStateManager.h @@ -108,8 +108,8 @@ public: NS_IMETHOD ConsumeFocusEvents(PRBool aDoConsume) = 0; // Access Key Registration - NS_IMETHOD RegisterAccessKey(nsIFrame * aFrame, nsIContent* aContent, PRUint32 aKey) = 0; - NS_IMETHOD UnregisterAccessKey(nsIFrame * aFrame, nsIContent* aContent, PRUint32 aKey) = 0; + NS_IMETHOD RegisterAccessKey(nsIContent* aContent, PRUint32 aKey) = 0; + NS_IMETHOD UnregisterAccessKey(nsIContent* aContent, PRUint32 aKey) = 0; NS_IMETHOD SetCursor(PRInt32 aCursor, nsIWidget* aWidget, PRBool aLockCursor) = 0; diff --git a/mozilla/content/events/src/nsEventStateManager.cpp b/mozilla/content/events/src/nsEventStateManager.cpp index 42314c29ba0..2160287eb1f 100644 --- a/mozilla/content/events/src/nsEventStateManager.cpp +++ b/mozilla/content/events/src/nsEventStateManager.cpp @@ -3953,7 +3953,7 @@ nsEventStateManager::EventStatusOK(nsGUIEvent* aEvent, PRBool *aOK) // Access Key Registration //------------------------------------------- NS_IMETHODIMP -nsEventStateManager::RegisterAccessKey(nsIFrame * aFrame, nsIContent* aContent, PRUint32 aKey) +nsEventStateManager::RegisterAccessKey(nsIContent* aContent, PRUint32 aKey) { if (!mAccessKeys) { mAccessKeys = new nsSupportsHashtable(); @@ -3962,15 +3962,7 @@ nsEventStateManager::RegisterAccessKey(nsIFrame * aFrame, nsIContent* aContent, } } - nsCOMPtr content; - if (!aContent) { - aFrame->GetContent(getter_AddRefs(content)); - } - else { - content = aContent; - } - - if (content) { + if (aContent) { PRUnichar accKey = nsCRT::ToLower((char)aKey); nsVoidKey key(NS_INT32_TO_PTR(accKey)); @@ -3979,36 +3971,29 @@ nsEventStateManager::RegisterAccessKey(nsIFrame * aFrame, nsIContent* aContent, nsCOMPtr oldContent = dont_AddRef(NS_STATIC_CAST(nsIContent*, mAccessKeys->Get(&key))); NS_ASSERTION(!oldContent, "Overwriting accesskey registration"); #endif - mAccessKeys->Put(&key, content); + mAccessKeys->Put(&key, aContent); } return NS_OK; } NS_IMETHODIMP -nsEventStateManager::UnregisterAccessKey(nsIFrame * aFrame, nsIContent* aContent, PRUint32 aKey) +nsEventStateManager::UnregisterAccessKey(nsIContent* aContent, PRUint32 aKey) { if (!mAccessKeys) { return NS_ERROR_FAILURE; } - nsCOMPtr content; - if (!aContent) { - aFrame->GetContent(getter_AddRefs(content)); - } - else { - content = aContent; - } - if (content) { + if (aContent) { PRUnichar accKey = nsCRT::ToLower((char)aKey); nsVoidKey key(NS_INT32_TO_PTR(accKey)); nsCOMPtr oldContent = dont_AddRef(NS_STATIC_CAST(nsIContent*, mAccessKeys->Get(&key))); #ifdef DEBUG_jag - NS_ASSERTION(oldContent == content, "Trying to unregister wrong content"); + NS_ASSERTION(oldContent == aContent, "Trying to unregister wrong content"); #endif - if (oldContent != content) + if (oldContent != aContent) return NS_OK; mAccessKeys->Remove(&key); diff --git a/mozilla/content/events/src/nsEventStateManager.h b/mozilla/content/events/src/nsEventStateManager.h index a83552a0d4b..3777fd642aa 100644 --- a/mozilla/content/events/src/nsEventStateManager.h +++ b/mozilla/content/events/src/nsEventStateManager.h @@ -123,8 +123,8 @@ public: NS_IMETHOD ConsumeFocusEvents(PRBool aDoConsume) { mConsumeFocusEvents = aDoConsume; return NS_OK; } // Access Key Registration - NS_IMETHOD RegisterAccessKey(nsIFrame * aFrame, nsIContent* aContent, PRUint32 aKey); - NS_IMETHOD UnregisterAccessKey(nsIFrame * aFrame, nsIContent* aContent, PRUint32 aKey); + NS_IMETHOD RegisterAccessKey(nsIContent* aContent, PRUint32 aKey); + NS_IMETHOD UnregisterAccessKey(nsIContent* aContent, PRUint32 aKey); NS_IMETHOD SetCursor(PRInt32 aCursor, nsIWidget* aWidget, PRBool aLockCursor); diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp index f40d4f23d74..6fe36407363 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp @@ -4581,6 +4581,34 @@ nsGenericHTMLElement::SetElementFocus(PRBool aDoFocus) return RemoveFocus(presContext); } +nsresult nsGenericHTMLElement::RegUnRegAccessKey(PRBool aDoReg) +{ + // first check to see if we have an access key + nsAutoString accessKey; + nsresult rv = GetAttr(kNameSpaceID_None, nsHTMLAtoms::accesskey, accessKey); + NS_ENSURE_SUCCESS(rv, rv); + if (NS_CONTENT_ATTR_NOT_THERE == rv || accessKey.IsEmpty()) { + return NS_OK; + } + + // We have an access key, so get the ESM from the pres context. + nsCOMPtr presContext; + GetPresContext(this, getter_AddRefs(presContext)); + NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE); + + nsCOMPtr esm; + presContext->GetEventStateManager(getter_AddRefs(esm)); + NS_ENSURE_TRUE(esm, NS_ERROR_FAILURE); + + // Register or unregister as appropriate. + if (aDoReg) { + rv = esm->RegisterAccessKey(this, (PRUint32)accessKey.First()); + } else { + rv = esm->UnregisterAccessKey(this, (PRUint32)accessKey.First()); + } + return rv; +} + // static nsresult nsGenericHTMLElement::SetProtocolInHrefString(const nsAString &aHref, diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.h b/mozilla/content/html/content/src/nsGenericHTMLElement.h index 5a053fae4bb..71c84f1934f 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.h +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.h @@ -509,6 +509,7 @@ public: nsAString& aHash); protected: nsresult SetElementFocus(PRBool aDoFocus); + nsresult RegUnRegAccessKey(PRBool aDoReg); PRBool IsEventName(nsIAtom* aName); }; diff --git a/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp b/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp index 0851db290e4..f4186622cf0 100644 --- a/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp @@ -126,15 +126,14 @@ public: NS_IMETHOD SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, PRBool aNotify); - NS_IMETHOD UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify); + NS_IMETHOD UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, + PRBool aNotify); #ifdef DEBUG NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const; #endif protected: - nsresult RegUnRegAccessKey(PRBool aDoReg); - // The cached visited state nsLinkState mLinkState; @@ -231,86 +230,23 @@ NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Rev, rev) NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Shape, shape) NS_IMPL_INT_ATTR(nsHTMLAnchorElement, TabIndex, tabindex) NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, Type, type) +NS_IMPL_STRING_ATTR(nsHTMLAnchorElement, AccessKey, accesskey) -NS_IMETHODIMP -nsHTMLAnchorElement::GetAccessKey(nsAString& aValue) -{ - GetAttr(kNameSpaceID_None, nsHTMLAtoms::accesskey, aValue); - return NS_OK; -} - -NS_IMETHODIMP -nsHTMLAnchorElement::SetAccessKey(const nsAString& aValue) -{ - RegUnRegAccessKey(PR_FALSE); - - nsresult rv = SetAttr(kNameSpaceID_None, nsHTMLAtoms::accesskey, aValue, - PR_TRUE); - - if (!aValue.IsEmpty()) { - RegUnRegAccessKey(PR_TRUE); - } - - return rv; -} - - -// This goes and gets the proper PresContext in order -// for it to get the EventStateManager so it can register -// the access key -nsresult nsHTMLAnchorElement::RegUnRegAccessKey(PRBool aDoReg) -{ - // first check to see if it even has an acess key - nsAutoString accessKey; - nsresult rv; - - rv = GetAttr(kNameSpaceID_None, nsHTMLAtoms::accesskey, accessKey); - - if (NS_CONTENT_ATTR_NOT_THERE != rv) { - nsCOMPtr presContext; - GetPresContext(this, getter_AddRefs(presContext)); - - // With a valid PresContext we can get the EVM - // and register the access key - if (presContext) { - nsCOMPtr stateManager; - presContext->GetEventStateManager(getter_AddRefs(stateManager)); - - if (stateManager) { - if (aDoReg) { - return stateManager->RegisterAccessKey(nsnull, this, - (PRUint32)accessKey.First()); - } else { - return stateManager->UnregisterAccessKey(nsnull, this, - (PRUint32)accessKey.First()); - } - } - } - } - - return NS_ERROR_FAILURE; -} - NS_IMETHODIMP nsHTMLAnchorElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers) { - // The document gets set to null before it is destroyed, - // so we unregister the the access key here (if it has one) - // before setting it to null - if (aDocument == nsnull) { + // Unregister the access key for the old document. + if (mDocument) { RegUnRegAccessKey(PR_FALSE); } - nsresult rv; - rv = nsGenericHTMLContainerElement::SetDocument(aDocument, - aDeep, - aCompileEventHandlers); + nsresult rv = nsGenericHTMLContainerElement::SetDocument(aDocument, aDeep, + aCompileEventHandlers); - // Register the access key here (if it has one) - // if the document isn't null - if (aDocument != nsnull) { + // Register the access key for the new document. + if (mDocument) { RegUnRegAccessKey(PR_TRUE); } @@ -440,10 +376,6 @@ nsHTMLAnchorElement::GetHref(nsAString& aValue) NS_IMETHODIMP nsHTMLAnchorElement::SetHref(const nsAString& aValue) { - // Clobber our "cache", so we'll recompute it the next time - // somebody asks for it. - mLinkState = eLinkState_Unknown; - return SetAttr(kNameSpaceID_None, nsHTMLAtoms::href, aValue, PR_TRUE); } @@ -793,7 +725,19 @@ nsHTMLAnchorElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, } } - return nsGenericHTMLElement::SetAttr(aNameSpaceID, aName, aValue, aNotify); + if (aName == nsHTMLAtoms::accesskey && kNameSpaceID_None == aNameSpaceID) { + RegUnRegAccessKey(PR_FALSE); + } + + nsresult rv = + nsGenericHTMLElement::SetAttr(aNameSpaceID, aName, aValue, aNotify); + + if (aName == nsHTMLAtoms::accesskey && kNameSpaceID_None == aNameSpaceID && + !aValue.IsEmpty()) { + RegUnRegAccessKey(PR_TRUE); + } + + return rv; } NS_IMETHODIMP @@ -804,12 +748,17 @@ nsHTMLAnchorElement::SetAttr(nsINodeInfo* aNodeInfo, return nsGenericHTMLElement::SetAttr(aNodeInfo, aValue, aNotify); } -nsresult +NS_IMETHODIMP nsHTMLAnchorElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify) { if (aAttribute == nsHTMLAtoms::href && kNameSpaceID_None == aNameSpaceID) { - SetLinkState(eLinkState_Unknown); + SetLinkState(eLinkState_Unknown); } - // We still rely on the old way of setting the attribute. + + if (aAttribute == nsHTMLAtoms::accesskey && + kNameSpaceID_None == aNameSpaceID) { + RegUnRegAccessKey(PR_FALSE); + } + return nsGenericHTMLElement::UnsetAttr(aNameSpaceID, aAttribute, aNotify); } diff --git a/mozilla/content/html/content/src/nsHTMLLabelElement.cpp b/mozilla/content/html/content/src/nsHTMLLabelElement.cpp index 3ec81a813b9..7345dee1aab 100644 --- a/mozilla/content/html/content/src/nsHTMLLabelElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLLabelElement.cpp @@ -176,12 +176,27 @@ public: nsIContent* aSubmitElement); // nsIContent + NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, + PRBool aCompileEventHandlers); NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, nsIDOMEvent** aDOMEvent, PRUint32 aFlags, nsEventStatus* aEventStatus); + NS_IMETHOD SetFocus(nsIPresContext* aContext); + NS_IMETHOD SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, PRBool aNotify); + NS_IMETHOD SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, + PRBool aNotify); + NS_IMETHOD UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, + PRBool aNotify); #ifdef DEBUG NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const; #endif + +protected: + already_AddRefed GetForContent(); + + // XXX It would be nice if we could use an event flag instead. + PRBool mHandlingEvent; }; // construction, destruction @@ -213,6 +228,7 @@ NS_NewHTMLLabelElement(nsIHTMLContent** aInstancePtrResult, nsHTMLLabelElement::nsHTMLLabelElement() + : mHandlingEvent(PR_FALSE) { } @@ -308,6 +324,26 @@ nsHTMLLabelElement::SetHtmlFor(const nsAString& aValue) value, PR_TRUE); } +NS_IMETHODIMP +nsHTMLLabelElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, + PRBool aCompileEventHandlers) +{ + // Unregister the access key for the old document. + if (mDocument) { + RegUnRegAccessKey(PR_FALSE); + } + + nsresult rv = nsGenericHTMLContainerFormElement::SetDocument(aDocument, + aDeep, aCompileEventHandlers); + + // Register the access key for the new document. + if (mDocument) { + RegUnRegAccessKey(PR_TRUE); + } + + return rv; +} + NS_IMETHODIMP nsHTMLLabelElement::HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, @@ -316,90 +352,68 @@ nsHTMLLabelElement::HandleDOMEvent(nsIPresContext* aPresContext, nsEventStatus* aEventStatus) { NS_ENSURE_ARG_POINTER(aEventStatus); - nsresult rv; - rv = nsGenericHTMLContainerFormElement::HandleDOMEvent(aPresContext, - aEvent, - aDOMEvent, - aFlags, - aEventStatus); - // Now a little special trickery because we are a label: - // We need to pass this event on to our child iff it is a focus, - // keypress/up/dn, mouseclick/dblclick/up/down. - if ((NS_OK == rv) && (NS_EVENT_FLAG_INIT & aFlags) && - ((nsEventStatus_eIgnore == *aEventStatus) || - (nsEventStatus_eConsumeNoDefault == *aEventStatus)) ) { - PRBool isFormElement = PR_FALSE; - nsCOMPtr content; // Node we are a label for + nsresult rv = nsGenericHTMLContainerFormElement::HandleDOMEvent(aPresContext, + aEvent, aDOMEvent, aFlags, aEventStatus); + if (NS_FAILED(rv)) + return rv; + + if (mHandlingEvent || + *aEventStatus == nsEventStatus_eConsumeNoDefault || + (aEvent->message != NS_MOUSE_LEFT_CLICK && + aEvent->message != NS_FOCUS_CONTENT) || + aFlags & NS_EVENT_FLAG_CAPTURE) + return NS_OK; + + nsCOMPtr content = GetForContent(); + if (content) { + mHandlingEvent = PR_TRUE; switch (aEvent->message) { - case NS_FOCUS_CONTENT: - -// Bug 49897: According to the spec, the following should not be passed -// Bug 7554: Despite the spec, IE passes left click events, so for -// compatability: case NS_MOUSE_LEFT_CLICK: -// case NS_MOUSE_LEFT_DOUBLECLICK: -// case NS_MOUSE_LEFT_BUTTON_UP: -// case NS_MOUSE_LEFT_BUTTON_DOWN: -// case NS_MOUSE_MIDDLE_CLICK: -// case NS_MOUSE_MIDDLE_DOUBLECLICK: -// case NS_MOUSE_MIDDLE_BUTTON_UP: -// case NS_MOUSE_MIDDLE_BUTTON_DOWN: -// case NS_MOUSE_RIGHT_CLICK: -// case NS_MOUSE_RIGHT_DOUBLECLICK: -// case NS_MOUSE_RIGHT_BUTTON_UP: -// case NS_MOUSE_RIGHT_BUTTON_DOWN: -// case NS_KEY_PRESS: -// case NS_KEY_UP: -// case NS_KEY_DOWN: - { - // Get the element that this label is for - nsAutoString elementId; - rv = GetHtmlFor(elementId); - if (NS_SUCCEEDED(rv) && !elementId.IsEmpty()) { // --- We have a FOR attr - nsCOMPtr iDoc; - rv = GetDocument(*getter_AddRefs(iDoc)); - if (NS_SUCCEEDED(rv)) { - nsCOMPtr domElement; - - nsCOMPtr domDoc(do_QueryInterface(iDoc)); - - if (domDoc) { - rv = domDoc->GetElementById(elementId, - getter_AddRefs(domElement)); - } - content = do_QueryInterface(domElement); - isFormElement = content && - content->IsContentOfType(nsIContent::eHTML_FORM_CONTROL); - } - } else { - // --- No FOR attribute, we are a label for our first child - // element - PRInt32 numNodes; - rv = ChildCount(numNodes); - if (NS_SUCCEEDED(rv)) { - PRInt32 i; - for (i = 0; NS_SUCCEEDED(rv) && !isFormElement && (i < numNodes); - i++) { - ChildAt(i, *getter_AddRefs(content)); - isFormElement = content && - content->IsContentOfType(nsIContent::eHTML_FORM_CONTROL); - } - } - } - } // Close should handle - } // Close switch - - // If we found an element, pass along the event to it. - if (NS_SUCCEEDED(rv) && content && isFormElement) { - rv = content->HandleDOMEvent(aPresContext, aEvent, aDOMEvent, aFlags, - aEventStatus); + // Focus the for content. + rv = content->SetFocus(aPresContext); + // This sends the event twice down parts of its path. Oh well. + // This is needed for: + // * Making radio buttons and checkboxes get checked. + // * Triggering user event handlers. (For compatibility with IE, + // we do only left click. If we wanted to interpret the HTML + // spec very narrowly, we would do nothing. If we wanted to + // do something sensible, we might send more events through + // like this.) See bug 7554, bug 49897, and bug 96813. + // XXX The event should probably have its target modified. See + // bug 146066. + rv = content->HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags, aEventStatus); + break; + case NS_FOCUS_CONTENT: + // Since we don't have '-moz-user-focus: normal', the only time + // the event type will be NS_FOCUS_CONTENT will be when the accesskey + // is activated. We've already redirected the |SetFocus| call in that + // case. + // Since focus doesn't bubble, this is basically the second part + // of redirecting |SetFocus|. + rv = content->HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags, aEventStatus); + break; } - } // Close trickery - + mHandlingEvent = PR_FALSE; + } return rv; } +NS_IMETHODIMP +nsHTMLLabelElement::SetFocus(nsIPresContext* aContext) +{ + // Since we don't have '-moz-user-focus: normal', the only time + // |SetFocus| will be called is when the accesskey is activated. + nsCOMPtr content = GetForContent(); + if (content) + return content->SetFocus(aContext); + + // Do nothing (yes, really)! + return NS_OK; +} + #ifdef DEBUG NS_IMETHODIMP nsHTMLLabelElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const @@ -422,3 +436,82 @@ nsHTMLLabelElement::SubmitNamesValues(nsIFormSubmission* aFormSubmission, { return NS_OK; } + +NS_IMETHODIMP +nsHTMLLabelElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, + const nsAString& aValue, PRBool aNotify) +{ + if (aName == nsHTMLAtoms::accesskey && kNameSpaceID_None == aNameSpaceID) { + RegUnRegAccessKey(PR_FALSE); + } + + nsresult rv = + nsGenericHTMLElement::SetAttr(aNameSpaceID, aName, aValue, aNotify); + + if (aName == nsHTMLAtoms::accesskey && kNameSpaceID_None == aNameSpaceID && + !aValue.IsEmpty()) { + RegUnRegAccessKey(PR_TRUE); + } + + return rv; +} + +NS_IMETHODIMP +nsHTMLLabelElement::SetAttr(nsINodeInfo* aNodeInfo, const nsAString& aValue, + PRBool aNotify) +{ + return nsGenericHTMLElement::SetAttr(aNodeInfo, aValue, aNotify); +} + +NS_IMETHODIMP +nsHTMLLabelElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, + PRBool aNotify) +{ + if (aAttribute == nsHTMLAtoms::accesskey && + kNameSpaceID_None == aNameSpaceID) { + RegUnRegAccessKey(PR_FALSE); + } + + return nsGenericHTMLElement::UnsetAttr(aNameSpaceID, aAttribute, aNotify); +} + +already_AddRefed +nsHTMLLabelElement::GetForContent() +{ + nsresult rv; + + // Get the element that this label is for + nsAutoString elementId; + rv = GetHtmlFor(elementId); + if (NS_SUCCEEDED(rv) && !elementId.IsEmpty()) { + // We have a FOR attribute. + nsCOMPtr domDoc; + GetOwnerDocument(getter_AddRefs(domDoc)); + if (domDoc) { + nsCOMPtr domElement; + domDoc->GetElementById(elementId, getter_AddRefs(domElement)); + nsIContent *result; + CallQueryInterface(domElement, &result); + if (result && !result->IsContentOfType(nsIContent::eHTML_FORM_CONTROL)) { + NS_RELEASE(result); // assigns null + } + return result; + } + } else { + // No FOR attribute, we are a label for our first child element. + PRInt32 numNodes; + rv = ChildCount(numNodes); + if (NS_SUCCEEDED(rv)) { + for (PRInt32 i = 0; i < numNodes; i++) { + nsIContent *result; + ChildAt(i, result); + if (result) { + if (result->IsContentOfType(nsIContent::eHTML_FORM_CONTROL)) + return result; + NS_RELEASE(result); + } + } + } + } + return nsnull; +} diff --git a/mozilla/content/xul/content/src/nsXULElement.cpp b/mozilla/content/xul/content/src/nsXULElement.cpp index eb07541d5f7..2a8dea46cb4 100644 --- a/mozilla/content/xul/content/src/nsXULElement.cpp +++ b/mozilla/content/xul/content/src/nsXULElement.cpp @@ -2556,7 +2556,7 @@ nsXULElement::UnregisterAccessKey(const nsAString& aOldValue) presContext->GetEventStateManager(getter_AddRefs(esm)); nsIContent* content = NS_STATIC_CAST(nsIContent*, this); - esm->UnregisterAccessKey(nsnull, content, aOldValue.First()); + esm->UnregisterAccessKey(content, aOldValue.First()); } } } diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index afd2452b46d..7464b35f1e9 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -4859,13 +4859,6 @@ nsCSSFrameConstructor::ConstructHTMLFrame(nsIPresShell* aPresShell, isReplaced = PR_TRUE; processChildren = PR_TRUE; } - else if (nsHTMLAtoms::label == aTag) { - if (!aState.mPseudoFrames.IsEmpty()) { // process pending pseudo frames - ProcessPseudoFrames(aPresContext, aState.mPseudoFrames, aFrameItems); - } - rv = NS_NewLabelFrame(aPresShell, &newFrame, isAbsolutelyPositioned ? NS_BLOCK_SPACE_MGR : 0); - processChildren = PR_TRUE; - } else if (nsHTMLAtoms::isindex == aTag) { if (!aState.mPseudoFrames.IsEmpty()) { // process pending pseudo frames ProcessPseudoFrames(aPresContext, aState.mPseudoFrames, aFrameItems); diff --git a/mozilla/layout/forms/nsFormControlFrame.cpp b/mozilla/layout/forms/nsFormControlFrame.cpp index 0fe3590d439..9c7546f2e2a 100644 --- a/mozilla/layout/forms/nsFormControlFrame.cpp +++ b/mozilla/layout/forms/nsFormControlFrame.cpp @@ -628,10 +628,12 @@ nsFormControlFrame::RegUnRegAccessKey(nsIPresContext* aPresContext, nsIFrame * a if (NS_CONTENT_ATTR_NOT_THERE != rv) { nsCOMPtr stateManager; if (NS_SUCCEEDED(aPresContext->GetEventStateManager(getter_AddRefs(stateManager)))) { + nsCOMPtr content; + aFrame->GetContent(getter_AddRefs(content)); if (aDoReg) { - return stateManager->RegisterAccessKey(aFrame, nsnull, (PRUint32)accessKey.First()); + return stateManager->RegisterAccessKey(content, (PRUint32)accessKey.First()); } else { - return stateManager->UnregisterAccessKey(aFrame, nsnull, (PRUint32)accessKey.First()); + return stateManager->UnregisterAccessKey(content, (PRUint32)accessKey.First()); } } } diff --git a/mozilla/layout/generic/nsAreaFrame.cpp b/mozilla/layout/generic/nsAreaFrame.cpp index b08bd474ff0..c62080d9497 100644 --- a/mozilla/layout/generic/nsAreaFrame.cpp +++ b/mozilla/layout/generic/nsAreaFrame.cpp @@ -127,9 +127,9 @@ nsAreaFrame::RegUnregAccessKey(nsIPresContext* aPresContext, if (esm) { PRUint32 key = accessKey.First(); if (aDoReg) - rv = esm->RegisterAccessKey(nsnull, mContent, key); + rv = esm->RegisterAccessKey(mContent, key); else - rv = esm->UnregisterAccessKey(nsnull, mContent, key); + rv = esm->UnregisterAccessKey(mContent, key); } return rv; diff --git a/mozilla/layout/generic/nsHTMLParts.h b/mozilla/layout/generic/nsHTMLParts.h index 5b4277dcd3c..4710c9ceee0 100644 --- a/mozilla/layout/generic/nsHTMLParts.h +++ b/mozilla/layout/generic/nsHTMLParts.h @@ -184,7 +184,6 @@ extern nsresult NS_NewGfxCheckboxControlFrame(nsIPresShell* aPresShell, nsIFrame extern nsresult NS_NewNativeCheckboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult); extern nsresult NS_NewFieldSetFrame(nsIPresShell* aPresShell, nsIFrame** aResult, PRUint32 aFlags); extern nsresult NS_NewFileControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult); -extern nsresult NS_NewLabelFrame(nsIPresShell* aPresShell, nsIFrame** aResult, PRUint32 aStateFlags); extern nsresult NS_NewLegendFrame(nsIPresShell* aPresShell, nsIFrame** aResult); extern nsresult NS_NewNativeTextControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); extern nsresult NS_NewGfxTextControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); diff --git a/mozilla/layout/html/base/src/nsAreaFrame.cpp b/mozilla/layout/html/base/src/nsAreaFrame.cpp index b08bd474ff0..c62080d9497 100644 --- a/mozilla/layout/html/base/src/nsAreaFrame.cpp +++ b/mozilla/layout/html/base/src/nsAreaFrame.cpp @@ -127,9 +127,9 @@ nsAreaFrame::RegUnregAccessKey(nsIPresContext* aPresContext, if (esm) { PRUint32 key = accessKey.First(); if (aDoReg) - rv = esm->RegisterAccessKey(nsnull, mContent, key); + rv = esm->RegisterAccessKey(mContent, key); else - rv = esm->UnregisterAccessKey(nsnull, mContent, key); + rv = esm->UnregisterAccessKey(mContent, key); } return rv; diff --git a/mozilla/layout/html/base/src/nsHTMLParts.h b/mozilla/layout/html/base/src/nsHTMLParts.h index 5b4277dcd3c..4710c9ceee0 100644 --- a/mozilla/layout/html/base/src/nsHTMLParts.h +++ b/mozilla/layout/html/base/src/nsHTMLParts.h @@ -184,7 +184,6 @@ extern nsresult NS_NewGfxCheckboxControlFrame(nsIPresShell* aPresShell, nsIFrame extern nsresult NS_NewNativeCheckboxControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult); extern nsresult NS_NewFieldSetFrame(nsIPresShell* aPresShell, nsIFrame** aResult, PRUint32 aFlags); extern nsresult NS_NewFileControlFrame(nsIPresShell* aPresShell, nsIFrame** aResult); -extern nsresult NS_NewLabelFrame(nsIPresShell* aPresShell, nsIFrame** aResult, PRUint32 aStateFlags); extern nsresult NS_NewLegendFrame(nsIPresShell* aPresShell, nsIFrame** aResult); extern nsresult NS_NewNativeTextControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); extern nsresult NS_NewGfxTextControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame); diff --git a/mozilla/layout/html/document/src/forms.css b/mozilla/layout/html/document/src/forms.css index afc67763104..7389c49770c 100644 --- a/mozilla/layout/html/document/src/forms.css +++ b/mozilla/layout/html/document/src/forms.css @@ -67,14 +67,6 @@ fieldset { border: 2px groove ThreeDFace; } -label { - /* our