mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 510202 - simplify C++ code now that bug 461199 has landed. r=sdwilsh,sr=bzbarsky
This commit is contained in:
parent
451d06d8e3
commit
7f73b235c7
@ -50,8 +50,8 @@ namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
#define MOZILLA_DOM_LINK_IMPLEMENTATION_IID \
|
||||
{ 0x0c032581, 0x1c8a, 0x4fff, \
|
||||
{ 0xbe, 0x9a, 0xfb, 0x6e, 0x2e, 0xe4, 0x22, 0x2e } }
|
||||
{ 0x2be8af0, 0x32a5, 0x41dd, \
|
||||
{ 0xa7, 0x68, 0x12, 0x55, 0xc4, 0x9a, 0xd4, 0xc5 } }
|
||||
|
||||
class Link : public nsISupports
|
||||
{
|
||||
@ -74,6 +74,9 @@ public:
|
||||
* @return the URI this link is for, if available.
|
||||
*/
|
||||
already_AddRefed<nsIURI> GetURI() const;
|
||||
virtual already_AddRefed<nsIURI> GetURIExternal() const {
|
||||
return GetURI();
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper methods for modifying and obtaining parts of the URI of the Link.
|
||||
|
@ -55,6 +55,10 @@ EXPORTS = \
|
||||
nsCTooltipTextProvider.h \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/../../../content/base/src \
|
||||
$(NULL)
|
||||
|
||||
SDK_XPIDLSRCS = \
|
||||
nsIContextMenuListener.idl \
|
||||
nsIEmbeddingSiteWindow.idl \
|
||||
|
@ -68,11 +68,8 @@
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMDocumentType.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMHTMLAnchorElement.h"
|
||||
#include "nsIDOMHTMLAreaElement.h"
|
||||
#include "nsIDOMHTMLLinkElement.h"
|
||||
#include "Link.h"
|
||||
#ifdef MOZ_SVG
|
||||
#include "nsIDOMSVGAElement.h"
|
||||
#include "nsIDOMSVGElement.h"
|
||||
#include "nsIDOMSVGTitleElement.h"
|
||||
#include "nsIDOMSVGForeignObjectElem.h"
|
||||
@ -1048,24 +1045,14 @@ DefaultTooltipTextProvider::GetNodeText(nsIDOMNode *aNode, PRUnichar **aText,
|
||||
else {
|
||||
// ...ok, that didn't work, try it in the XLink namespace
|
||||
NS_NAMED_LITERAL_STRING(xlinkNS, "http://www.w3.org/1999/xlink");
|
||||
nsCOMPtr<nsIDOMHTMLAnchorElement> anchorContent(do_QueryInterface(currElement));
|
||||
nsCOMPtr<nsIDOMHTMLAreaElement> areaContent(do_QueryInterface(currElement));
|
||||
nsCOMPtr<nsIDOMHTMLLinkElement> linkContent(do_QueryInterface(currElement));
|
||||
PRBool hasHref;
|
||||
currElement->HasAttribute(NS_LITERAL_STRING("href"), &hasHref);
|
||||
#ifdef MOZ_SVG
|
||||
nsCOMPtr<nsIDOMSVGAElement> svgAnchorContent(do_QueryInterface(currElement));
|
||||
PRBool hasXlinkHref;
|
||||
currElement->HasAttributeNS(xlinkNS, NS_LITERAL_STRING("href"), &hasXlinkHref);
|
||||
|
||||
if (((anchorContent || areaContent || linkContent) && hasHref) ||
|
||||
(svgAnchorContent && hasXlinkHref)) {
|
||||
#else
|
||||
if ((anchorContent || areaContent || linkContent) && hasHref) {
|
||||
#endif
|
||||
currElement->GetAttributeNS(xlinkNS, NS_LITERAL_STRING("title"), outText);
|
||||
if ( outText.Length() )
|
||||
found = PR_TRUE;
|
||||
nsCOMPtr<mozilla::dom::Link> linkContent(do_QueryInterface(currElement));
|
||||
if (linkContent) {
|
||||
nsCOMPtr<nsIURI> uri(linkContent->GetURIExternal());
|
||||
if (uri) {
|
||||
currElement->GetAttributeNS(NS_LITERAL_STRING("http://www.w3.org/1999/xlink"), NS_LITERAL_STRING("title"), outText);
|
||||
if ( outText.Length() )
|
||||
found = PR_TRUE;
|
||||
}
|
||||
}
|
||||
#ifdef MOZ_SVG
|
||||
else {
|
||||
|
@ -117,6 +117,13 @@ Link::ResetLinkState(bool aNotify)
|
||||
NS_NOTREACHED("Unexpected call to Link::ResetLinkState");
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI>
|
||||
Link::GetURI() const
|
||||
{
|
||||
NS_NOTREACHED("Unexpected call to Link::GetURI");
|
||||
return nsnull; // suppress compiler warning
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user