mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 461199 (Part 13) - mozilla::dom::Link::SetLinkState should inform the document about changes to its state when it is called.
Make Link::SetLinkState notify the document about changes in state, plus a whole bunch of assertions for sanity checking. r=sicking r=bz
This commit is contained in:
parent
f284f552ef
commit
2d89f25390
@ -46,6 +46,7 @@
|
||||
#include "nsEscape.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsString.h"
|
||||
#include "mozAutoDocUpdate.h"
|
||||
|
||||
#include "mozilla/IHistory.h"
|
||||
|
||||
@ -78,10 +79,29 @@ Link::SetLinkState(nsLinkState aState)
|
||||
{
|
||||
NS_ASSERTION(mRegistered,
|
||||
"Setting the link state of an unregistered Link!");
|
||||
NS_ASSERTION(mLinkState != aState,
|
||||
"Setting state to the currently set state!");
|
||||
|
||||
// Remember our old link state for when we notify.
|
||||
PRInt32 oldLinkState = LinkState();
|
||||
|
||||
// Set our current state as appropriate.
|
||||
mLinkState = aState;
|
||||
|
||||
// Per IHistory interface documentation, we are no longer registered.
|
||||
mRegistered = false;
|
||||
|
||||
// Notify the document that our visited state has changed.
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(this));
|
||||
NS_ASSERTION(content, "Why isn't this an nsIContent node?!");
|
||||
nsIDocument *doc = content->GetCurrentDoc();
|
||||
NS_ASSERTION(doc, "Registered but we have no document?!");
|
||||
PRInt32 newLinkState = LinkState();
|
||||
NS_ASSERTION(newLinkState == NS_EVENT_STATE_VISITED ||
|
||||
newLinkState == NS_EVENT_STATE_UNVISITED,
|
||||
"Unexpected state obtained from LinkState()!");
|
||||
mozAutoDocUpdate update(doc, UPDATE_CONTENT_STATE, PR_TRUE);
|
||||
doc->ContentStatesChanged(content, nsnull, oldLinkState ^ newLinkState);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
|
Loading…
Reference in New Issue
Block a user