mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
Bug 461199 (Part 16) - Remove now unused style code testing for Link and HTML Links.
r=bz sr=dbaron
This commit is contained in:
parent
5a72540281
commit
456e4f62d4
@ -41,7 +41,6 @@
|
||||
#include "nsStyleConsts.h"
|
||||
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
@ -402,96 +401,6 @@ nsStyleUtil::ConstrainFontWeight(PRInt32 aWeight)
|
||||
return (base + ((negativeStep) ? -step : step));
|
||||
}
|
||||
|
||||
static nsLinkState
|
||||
GetLinkStateFromURI(nsIURI* aURI, nsIContent* aContent,
|
||||
nsILinkHandler* aLinkHandler)
|
||||
{
|
||||
NS_PRECONDITION(aURI, "Must have URI");
|
||||
nsLinkState state;
|
||||
if (NS_LIKELY(aLinkHandler)) {
|
||||
aLinkHandler->GetLinkState(aURI, state);
|
||||
}
|
||||
else {
|
||||
// no link handler? Try to get one off the content
|
||||
NS_ASSERTION(aContent->GetOwnerDoc(), "Shouldn't happen");
|
||||
nsCOMPtr<nsISupports> supp =
|
||||
aContent->GetOwnerDoc()->GetContainer();
|
||||
nsCOMPtr<nsILinkHandler> handler = do_QueryInterface(supp);
|
||||
if (handler) {
|
||||
handler->GetLinkState(aURI, state);
|
||||
} else {
|
||||
// no link handler? then all links are unvisited
|
||||
state = eLinkState_Unvisited;
|
||||
}
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
/*static*/
|
||||
PRBool nsStyleUtil::IsHTMLLink(nsIContent *aContent,
|
||||
nsILinkHandler *aLinkHandler,
|
||||
nsLinkState *aState)
|
||||
{
|
||||
NS_ASSERTION(aContent->IsHTML(),
|
||||
"Only use this function with HTML elements");
|
||||
NS_ASSERTION(aState, "null arg in IsHTMLLink");
|
||||
|
||||
nsLinkState linkState = aContent->GetLinkState();
|
||||
if (linkState == eLinkState_Unknown) {
|
||||
// if it is an anchor, area or link then check the href attribute
|
||||
// make sure this anchor has a link even if we are not testing state
|
||||
// if there is no link, then this anchor is not really a linkpseudo.
|
||||
// bug=23209
|
||||
|
||||
nsCOMPtr<nsIURI> hrefURI = aContent->GetHrefURI();
|
||||
|
||||
if (hrefURI) {
|
||||
linkState = GetLinkStateFromURI(hrefURI, aContent, aLinkHandler);
|
||||
} else {
|
||||
linkState = eLinkState_NotLink;
|
||||
}
|
||||
if (linkState != eLinkState_NotLink && aContent->IsInDoc()) {
|
||||
aContent->GetCurrentDoc()->AddStyleRelevantLink(aContent, hrefURI);
|
||||
}
|
||||
aContent->SetLinkState(linkState);
|
||||
}
|
||||
if (linkState == eLinkState_NotLink) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
*aState = linkState;
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/*static*/
|
||||
PRBool nsStyleUtil::IsLink(nsIContent *aContent,
|
||||
nsILinkHandler *aLinkHandler,
|
||||
nsLinkState *aState)
|
||||
{
|
||||
// XXX PERF This function will cause serious performance problems on
|
||||
// pages with lots of XLinks. We should be caching the visited
|
||||
// state of the XLinks. Where???
|
||||
|
||||
NS_ASSERTION(aContent && aState, "invalid call to IsLink with null content");
|
||||
|
||||
PRBool rv = PR_FALSE;
|
||||
|
||||
if (aContent && aState) {
|
||||
nsCOMPtr<nsIURI> absURI;
|
||||
if (aContent->IsLink(getter_AddRefs(absURI))) {
|
||||
*aState = GetLinkStateFromURI(absURI, aContent, aLinkHandler);
|
||||
if (aContent->IsInDoc()) {
|
||||
aContent->GetCurrentDoc()->AddStyleRelevantLink(aContent, absURI);
|
||||
}
|
||||
|
||||
rv = PR_TRUE;
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Compare two language strings
|
||||
PRBool nsStyleUtil::DashMatchCompare(const nsAString& aAttributeValue,
|
||||
const nsAString& aSelectorValue,
|
||||
|
@ -39,7 +39,6 @@
|
||||
|
||||
#include "nsCoord.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsILinkHandler.h" // for nsLinkState
|
||||
#include "nsCSSProperty.h"
|
||||
|
||||
struct nsStyleBackground;
|
||||
@ -70,11 +69,6 @@ public:
|
||||
|
||||
static PRInt32 ConstrainFontWeight(PRInt32 aWeight);
|
||||
|
||||
static PRBool IsHTMLLink(nsIContent *aContent, nsILinkHandler *aLinkHandler,
|
||||
nsLinkState *aState);
|
||||
static PRBool IsLink(nsIContent *aContent, nsILinkHandler *aLinkHandler,
|
||||
nsLinkState *aState);
|
||||
|
||||
static PRBool DashMatchCompare(const nsAString& aAttributeValue,
|
||||
const nsAString& aSelectorValue,
|
||||
const nsStringComparator& aComparator);
|
||||
|
Loading…
Reference in New Issue
Block a user