added link state api

This commit is contained in:
peterl 1998-05-19 00:08:57 +00:00
parent f589d457b0
commit 0e56caa97a
3 changed files with 42 additions and 0 deletions

View File

@ -29,6 +29,14 @@ struct nsGUIEvent;
{ 0x52bd1e30, 0xce3f, 0x11d1, \
{0x93, 0x28, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
enum nsLinkState {
eLinkState_Unvisited = 0,
eLinkState_Visited = 1,
eLinkState_OutOfDate = 2, // visited, but the cache is stale
eLinkState_Active = 3, // mouse is down on link
eLinkState_Hover = 4 // mouse is hovering over link
};
/**
* Interface used for handling clicks on links
*/
@ -46,6 +54,11 @@ public:
*/
NS_IMETHOD OnLinkClick(nsIFrame* aFrame, const nsString& aURLSpec,
const nsString& aTargetSpec) = 0;
/**
* Get the state of a link to a given absolute URL
*/
NS_IMETHOD GetLinkState(const nsString& aURLSpec, nsLinkState& aState) = 0;
};
// Standard link handler that does what you would expect (XXX doc...)

View File

@ -42,6 +42,7 @@ public:
NS_IMETHOD GetWebWidget(nsIWebWidget** aResult);
NS_IMETHOD OnLinkClick(nsIFrame* aFrame, const nsString& aURLSpec,
const nsString& aTargetSpec);
NS_IMETHOD GetLinkState(const nsString& aURLSpec, nsLinkState& aState);
void HandleLinkClickEvent(const nsString& aURLSpec,
const nsString& aTargetSpec);
@ -153,6 +154,28 @@ NS_IMETHODIMP LinkHandlerImpl::OnLinkClick(nsIFrame* aFrame,
return NS_OK;
}
NS_IMETHODIMP LinkHandlerImpl::GetLinkState(const nsString& aURLSpec, nsLinkState& aState)
{
// XXX not yet implemented
aState = eLinkState_Unvisited;
#ifdef NS_DEBUG
if (aURLSpec.Equals("http://visited/")) {
aState = eLinkState_Visited;
}
else if (aURLSpec.Equals("http://out-of-date/")) {
aState = eLinkState_OutOfDate;
}
else if (aURLSpec.Equals("http://active/")) {
aState = eLinkState_Active;
}
else if (aURLSpec.Equals("http://hover/")) {
aState = eLinkState_Hover;
}
#endif
return NS_OK;
}
void LinkHandlerImpl::HandleLinkClickEvent(const nsString& aURLSpec,
const nsString& aTargetSpec)
{

View File

@ -58,6 +58,12 @@ H4 { color: yellow;
<p><br></p>
<p>Here is an example of <b>bold</b>, <i>italic</i> and <b><i>bold-italic</i></b></p>
<p><br></p>
<p>Some links to test pseudo-classes</p>
<p><a href="http://link">link</a></p>
<p><a href="http://visited">visited</a></p>
<p><a href="http://out-of-date">outofdate</a></p>
<p><a href="http://active">active</a></p>
<p><a href="http://hover">hover</a></p>
<h2>Bulleted List </h2>
<ul>
<li>One</li>