Bug 461199 (Part 16) - Remove now unused style code testing for Link and HTML Links.
authorShawn Wilsher <sdwilsh@shawnwilsher.com>
Tue, 15 Dec 2009 16:04:15 -0800
changeset 38475 d725b28f011684eef1037ade8e8c7d1d0a59d703
parent 38474 70b16597aaf65bda8111c9b7c7ad0fa58cc8c647
child 38476 4ae1f164e1f0aa5a222c530e890e3878181f3772
push idunknown
push userunknown
push dateunknown
bugs461199
milestone1.9.3a2pre
Bug 461199 (Part 16) - Remove now unused style code testing for Link and HTML Links. r=bz sr=dbaron
layout/style/nsStyleUtil.cpp
layout/style/nsStyleUtil.h
--- a/layout/style/nsStyleUtil.cpp
+++ b/layout/style/nsStyleUtil.cpp
@@ -36,17 +36,16 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include <math.h>
 #include "nsStyleUtil.h"
 #include "nsCRT.h"
 #include "nsStyleConsts.h"
 
 #include "nsGkAtoms.h"
-#include "nsILinkHandler.h"
 #include "nsIContent.h"
 #include "nsIDocument.h"
 #include "nsINameSpaceManager.h"
 #include "nsIURI.h"
 #include "nsNetUtil.h"
 #include "nsReadableUtils.h"
 #include "nsContentUtils.h"
 #include "nsTextFormatter.h"
@@ -397,106 +396,16 @@ nsStyleUtil::ConstrainFontWeight(PRInt32
     maxStep = ((900 - base) / 100);
   }
   if (maxStep < step) {
     step = maxStep;
   }
   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,
                                      const nsStringComparator& aComparator)
 {
   PRBool result;
   PRUint32 selectorLen = aSelectorValue.Length();
   PRUint32 attributeLen = aAttributeValue.Length();
--- a/layout/style/nsStyleUtil.h
+++ b/layout/style/nsStyleUtil.h
@@ -34,17 +34,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #ifndef nsStyleUtil_h___
 #define nsStyleUtil_h___
 
 #include "nsCoord.h"
 #include "nsPresContext.h"
-#include "nsILinkHandler.h" // for nsLinkState
 #include "nsCSSProperty.h"
 
 struct nsStyleBackground;
 
 enum nsFontSizeType {
   eFontSize_HTML = 1,
   eFontSize_CSS = 2
 };
@@ -65,21 +64,16 @@ public:
                                          nsFontSizeType aFontSizeType = eFontSize_HTML);
 
   static nscoord FindNextLargerFontSize(nscoord aFontSize, PRInt32 aBasePointSize, 
                                         float aScalingFactor, nsPresContext* aPresContext,
                                         nsFontSizeType aFontSizeType = eFontSize_HTML);
 
   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);
                                 
   // Append a quoted (with "") and escaped version of aString to aResult.
   static void AppendEscapedCSSString(const nsString& aString,
                                      nsAString& aResult);
   // Append the identifier given by |aIdent| to |aResult|, with