Move implementation of HTML label element entirely into the content model so that it can have any display type: implement the event-munging and accesskey support in nsHTMLLabelElement. For the latter, share some code with nsHTMLAnchorElement and remove extra parameter from nsIEventStateManager access key methods. b=96813 r=jkeiser sr=jst

This commit is contained in:
dbaron%fas.harvard.edu 2002-05-22 00:14:51 +00:00
Родитель 1e548ad046
Коммит 4ae6c30b20
24 изменённых файлов: 257 добавлений и 261 удалений

Просмотреть файл

@ -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;

Просмотреть файл

@ -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<nsIContent> 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<nsIContent> 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<nsIContent> 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<nsIContent> 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);

Просмотреть файл

@ -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);

Просмотреть файл

@ -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<nsIPresContext> presContext;
GetPresContext(this, getter_AddRefs(presContext));
NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
nsCOMPtr<nsIEventStateManager> 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,

Просмотреть файл

@ -509,6 +509,7 @@ public:
nsAString& aHash);
protected:
nsresult SetElementFocus(PRBool aDoFocus);
nsresult RegUnRegAccessKey(PRBool aDoReg);
PRBool IsEventName(nsIAtom* aName);
};

Просмотреть файл

@ -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<nsIPresContext> presContext;
GetPresContext(this, getter_AddRefs(presContext));
// With a valid PresContext we can get the EVM
// and register the access key
if (presContext) {
nsCOMPtr<nsIEventStateManager> 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);
}

Просмотреть файл

@ -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<nsIContent> 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<nsIContent> 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<nsIContent> 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<nsIDocument> iDoc;
rv = GetDocument(*getter_AddRefs(iDoc));
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIDOMElement> domElement;
nsCOMPtr<nsIDOMDocument> 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<nsIContent> 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<nsIContent>
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<nsIDOMDocument> domDoc;
GetOwnerDocument(getter_AddRefs(domDoc));
if (domDoc) {
nsCOMPtr<nsIDOMElement> 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;
}

Просмотреть файл

@ -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());
}
}
}

Просмотреть файл

@ -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);

Просмотреть файл

@ -628,10 +628,12 @@ nsFormControlFrame::RegUnRegAccessKey(nsIPresContext* aPresContext, nsIFrame * a
if (NS_CONTENT_ATTR_NOT_THERE != rv) {
nsCOMPtr<nsIEventStateManager> stateManager;
if (NS_SUCCEEDED(aPresContext->GetEventStateManager(getter_AddRefs(stateManager)))) {
nsCOMPtr<nsIContent> 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());
}
}
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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);

Просмотреть файл

@ -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;

Просмотреть файл

@ -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);

Просмотреть файл

@ -67,14 +67,6 @@ fieldset {
border: 2px groove ThreeDFace;
}
label {
/* our <label> support is badly broken.
does not support display types other than inline(b=100801)
*/
display: inline !important;
}
/* default inputs, text inputs, and selects */
input {
padding: 1px 0 1px 0;

Просмотреть файл

@ -69,7 +69,6 @@ CPPSRCS = \
nsGfxTextControlFrame2.cpp \
nsHTMLButtonControlFrame.cpp \
nsImageControlFrame.cpp \
nsLabelFrame.cpp \
nsLegendFrame.cpp \
nsListControlFrame.cpp \
nsIsIndexFrame.cpp \

Просмотреть файл

@ -62,7 +62,6 @@ CPP_OBJS= \
.\$(OBJDIR)\nsFieldSetFrame.obj \
.\$(OBJDIR)\nsLegendFrame.obj \
.\$(OBJDIR)\nsHTMLButtonControlFrame.obj \
.\$(OBJDIR)\nsLabelFrame.obj \
.\$(OBJDIR)\nsButtonFrameRenderer.obj \
.\$(OBJDIR)\nsImageControlFrame.obj \
.\$(OBJDIR)\nsGfxButtonControlFrame.obj \

Просмотреть файл

@ -628,10 +628,12 @@ nsFormControlFrame::RegUnRegAccessKey(nsIPresContext* aPresContext, nsIFrame * a
if (NS_CONTENT_ATTR_NOT_THERE != rv) {
nsCOMPtr<nsIEventStateManager> stateManager;
if (NS_SUCCEEDED(aPresContext->GetEventStateManager(getter_AddRefs(stateManager)))) {
nsCOMPtr<nsIContent> 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());
}
}
}

Просмотреть файл

Просмотреть файл

@ -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);

Просмотреть файл

@ -1221,13 +1221,6 @@
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsLabelFrame.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsSimplePageSequence.cpp</PATH>
@ -2363,11 +2356,6 @@
<PATH>nsTextTransformer.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsLabelFrame.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsSimplePageSequence.cpp</PATH>
@ -4168,13 +4156,6 @@
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsLabelFrame.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsSimplePageSequence.cpp</PATH>
@ -5330,11 +5311,6 @@
<PATH>nsTextTransformer.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsLabelFrame.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsSimplePageSequence.cpp</PATH>
@ -6446,12 +6422,6 @@
<PATH>nsImageControlFrame.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>layout.shlb</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsLabelFrame.cpp</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>layout.shlb</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>

Просмотреть файл

@ -67,14 +67,6 @@ fieldset {
border: 2px groove ThreeDFace;
}
label {
/* our <label> support is badly broken.
does not support display types other than inline(b=100801)
*/
display: inline !important;
}
/* default inputs, text inputs, and selects */
input {
padding: 1px 0 1px 0;

Просмотреть файл

@ -2859,9 +2859,9 @@ nsBoxFrame::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;

Просмотреть файл

@ -937,9 +937,9 @@ nsTextBoxFrame::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;