Files
palemoon27/dom/base/Link.h
T
roytam1 2ddfe368e1 import changes from `dev' branch of rmottola/Arctic-Fox:
- bug 1215748 - use llvm-dsymutil for mac builds. r=mshal (a217006d89)
- warnings (31ea43d0d8)
- Bug 1175154 - Unit tests for IAC on 3.0. r=ferjm (12c424bab3)
- Bug 1219543 - Part 1: isRunningOnCompositor flag is now a member of AnimationProperty. r=bbirtles (85bc668501)
- Bug 1219543 - Part 2: Avoid the period that mIsRunningOnCompositor is false between restyling and building display list. r=bbirtles (597e46d479)
- Bug 1219543 - Part 3: MutationObserver should disconnect when the test is finished. r=bbirtles (70c26a266e)
- Bug 1214148 - patch 1 - propagation from the nested iframe back to the toplevel iframe, r=alwu (b42002f43a)
- Bug 1214148 - patch 2 - from toplevel iframe to the nested iframe, r=alwu (7b07fe5399)
- Bug 1214148 - patch 3 - correct window for nested iframes, r=alwu (27ee08caf1)
- Bug 1166910 - put referrer attribute behind pref in webidl, r=bz (93e421fa1b)
- Bug 1187357 - rename referrer attribute to referrerpolicy. r=hsivonen (70c67f5def)
- Bug 1187357 - Generated code for renaming referrer to referrerpolicy in html parser. r=hsivonen (738de3f278)
- Bug 1221341. Snap box shadow clip rect to device pixels. r=mstange (b63b783714)
- Bug 1228634 - Implement Element.getAttributeNames, r=peterv (4594d9c14c)
- Bug 1216193. Implement webkitMatchesSelector. r=khuey (39742b7e0b)
- Bug 1134648, handle dynamic changes to rel=dns-prefetch, r=bz (e27638080e)
- Bug 1229962 - use UniquePtr<T[]> instead of nsAutoArrayPtr<T> in parser/html/; r=hsivonen (75de6314f1)
- Bug 1226437 - Speculative CSP should set speculative referrer policy instead of actual referrer policy. r=sicking (f7dfd3fd18)
- Bug 1227554 - Default to NullPrincipal if doc is not available within expatdriver. r=bz (336a562965)
- Bug 1215781 - Use MOZ_UTF16 to generate sTagUnicodeTable. r=mrbkap (eca371a36b)
- Bug 1082598 - Part 5: Fix NPAPI for Skia update. r=jrmuizel (25c4d080ab)
- Bug 1183828 - Remove 'nsWindow::GetNativeData not implemented for this type' warning. r=roc (0a60404b57)
- Bug 1224445 - Add NS_NATIVE_OPENGL_CONTEXT handling to nsWindow::GetNativeData() r=mwu (ee35844be4)
- Bug 1179632 part.1 native IME context should not be stored in InputContext but should be able to retrieve with nsIWidget::GetNativeData() r=smaug (5f1804bb72)
- Bug 1179632 part.2 WidgetCompositionEvent should store NativeIMEContext which caused the event and PuppetWidget should store it for GetNativeIMEContext() r=smaug, sr=smaug (e00ca78e3f)
- Bug 1179632 part.3 TabParent::RecvEndIMEComposition() shouldn't return true with aNoCompositionEvent when there is no widget r=smaug (ee065ed491)
- Bug 1179632 part.4 Clean up the code to request IME to commit composition across process boundary r=smaug (9567c4dc57)
- Bug 1179632 part.5 WidgetCompositionEvent::mNativeIMEContext should be used at looking for a TextComposition instance for a WidgetCompositionEvent r=smaug (f4e27ec28c)
- Bug 1179632 part.6 KeyboardEvent.isComposing shouldn't expose IME state on different document r=smaug (ca8b8a6a02)
- Bug 1227544 - Scaling on 720p devices is broken. r=timdream (cb89af839f)
2023-06-13 15:52:32 +08:00

168 lines
4.4 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* This is the base class for all link classes.
*/
#ifndef mozilla_dom_Link_h__
#define mozilla_dom_Link_h__
#include "mozilla/IHistory.h"
#include "mozilla/MemoryReporting.h"
#include "nsIContent.h" // for nsLinkState
namespace mozilla {
class EventStates;
namespace dom {
class Element;
#define MOZILLA_DOM_LINK_IMPLEMENTATION_IID \
{ 0xb25edee6, 0xdd35, 0x4f8b, \
{ 0xab, 0x90, 0x66, 0xd0, 0xbd, 0x3c, 0x22, 0xd5 } }
class Link : public nsISupports
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_DOM_LINK_IMPLEMENTATION_IID)
/**
* aElement is the element pointer corresponding to this link.
*/
explicit Link(Element* aElement);
virtual void SetLinkState(nsLinkState aState);
/**
* @return NS_EVENT_STATE_VISITED if this link is visited,
* NS_EVENT_STATE_UNVISTED if this link is not visited, or 0 if this
* link is not actually a link.
*/
EventStates LinkState() const;
/**
* @return the URI this link is for, if available.
*/
nsIURI* GetURI() const;
virtual nsIURI* GetURIExternal() const {
return GetURI();
}
/**
* Helper methods for modifying and obtaining parts of the URI of the Link.
*/
void SetProtocol(const nsAString &aProtocol);
void SetUsername(const nsAString &aUsername);
void SetPassword(const nsAString &aPassword);
void SetHost(const nsAString &aHost);
void SetHostname(const nsAString &aHostname);
void SetPathname(const nsAString &aPathname);
void SetSearch(const nsAString &aSearch);
void SetPort(const nsAString &aPort);
void SetHash(const nsAString &aHash);
void GetOrigin(nsAString &aOrigin);
void GetProtocol(nsAString &_protocol);
void GetUsername(nsAString &aUsername);
void GetPassword(nsAString &aPassword);
void GetHost(nsAString &_host);
void GetHostname(nsAString &_hostname);
void GetPathname(nsAString &_pathname);
void GetSearch(nsAString &_search);
void GetPort(nsAString &_port);
void GetHash(nsAString &_hash);
/**
* Invalidates any link caching, and resets the state to the default.
*
* @param aNotify
* true if ResetLinkState should notify the owning document about style
* changes or false if it should not.
*/
void ResetLinkState(bool aNotify, bool aHasHref);
// This method nevers returns a null element.
Element* GetElement() const { return mElement; }
/**
* DNS prefetch has been deferred until later, e.g. page load complete.
*/
virtual void OnDNSPrefetchDeferred() { /*do nothing*/ }
/**
* DNS prefetch has been submitted to Host Resolver.
*/
virtual void OnDNSPrefetchRequested() { /*do nothing*/ }
/**
* Checks if DNS Prefetching is ok
*
* @returns boolean
* Defaults to true; should be overridden for specialised cases
*/
virtual bool HasDeferredDNSPrefetchRequest() { return true; }
virtual size_t
SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
bool ElementHasHref() const;
void TryDNSPrefetch();
void CancelDNSPrefetch(nsWrapperCache::FlagsType aDeferredFlag,
nsWrapperCache::FlagsType aRequestedFlag);
protected:
virtual ~Link();
/**
* Return true if the link has associated URI.
*/
bool HasURI() const
{
if (HasCachedURI()) {
return true;
}
return !!GetURI();
}
nsIURI* GetCachedURI() const { return mCachedURI; }
bool HasCachedURI() const { return !!mCachedURI; }
private:
/**
* Unregisters from History so this node no longer gets notifications about
* changes to visitedness.
*/
void UnregisterFromHistory();
already_AddRefed<nsIURI> GetURIToMutate();
void SetHrefAttribute(nsIURI *aURI);
mutable nsCOMPtr<nsIURI> mCachedURI;
Element * const mElement;
// Strong reference to History. The link has to unregister before History
// can disappear.
nsCOMPtr<IHistory> mHistory;
uint16_t mLinkState;
bool mNeedsRegistration;
bool mRegistered;
};
NS_DEFINE_STATIC_IID_ACCESSOR(Link, MOZILLA_DOM_LINK_IMPLEMENTATION_IID)
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_Link_h__