зеркало из https://github.com/mozilla/gecko-dev.git
Bug 461199 (Part 16) - Remove now unused style code testing for Link and HTML Links.
r=bz sr=dbaron
This commit is contained in:
Родитель
35bd533654
Коммит
c88f581583
|
@ -41,7 +41,6 @@
|
||||||
#include "nsStyleConsts.h"
|
#include "nsStyleConsts.h"
|
||||||
|
|
||||||
#include "nsGkAtoms.h"
|
#include "nsGkAtoms.h"
|
||||||
#include "nsILinkHandler.h"
|
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsINameSpaceManager.h"
|
#include "nsINameSpaceManager.h"
|
||||||
|
@ -402,96 +401,6 @@ nsStyleUtil::ConstrainFontWeight(PRInt32 aWeight)
|
||||||
return (base + ((negativeStep) ? -step : step));
|
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
|
// Compare two language strings
|
||||||
PRBool nsStyleUtil::DashMatchCompare(const nsAString& aAttributeValue,
|
PRBool nsStyleUtil::DashMatchCompare(const nsAString& aAttributeValue,
|
||||||
const nsAString& aSelectorValue,
|
const nsAString& aSelectorValue,
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
|
|
||||||
#include "nsCoord.h"
|
#include "nsCoord.h"
|
||||||
#include "nsPresContext.h"
|
#include "nsPresContext.h"
|
||||||
#include "nsILinkHandler.h" // for nsLinkState
|
|
||||||
#include "nsCSSProperty.h"
|
#include "nsCSSProperty.h"
|
||||||
|
|
||||||
struct nsStyleBackground;
|
struct nsStyleBackground;
|
||||||
|
@ -70,11 +69,6 @@ public:
|
||||||
|
|
||||||
static PRInt32 ConstrainFontWeight(PRInt32 aWeight);
|
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,
|
static PRBool DashMatchCompare(const nsAString& aAttributeValue,
|
||||||
const nsAString& aSelectorValue,
|
const nsAString& aSelectorValue,
|
||||||
const nsStringComparator& aComparator);
|
const nsStringComparator& aComparator);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче