mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 776515 - Move InternalIsSupported to nsContentUtils; r=khuey
This commit is contained in:
parent
fdc6b5d2e7
commit
7aba8dbea5
@ -262,19 +262,6 @@ public:
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
/**
|
||||
* Check whether a spec feature/version is supported.
|
||||
* @param aObject the object, which should support the feature,
|
||||
* for example nsIDOMNode or nsIDOMDOMImplementation
|
||||
* @param aFeature the feature ("Views", "Core", "HTML", "Range" ...)
|
||||
* @param aVersion the version ("1.0", "2.0", ...)
|
||||
* @param aReturn whether the feature is supported or not [OUT]
|
||||
*/
|
||||
static nsresult InternalIsSupported(nsISupports* aObject,
|
||||
const nsAString& aFeature,
|
||||
const nsAString& aVersion,
|
||||
bool* aReturn);
|
||||
|
||||
/**
|
||||
* If there are listeners for DOMNodeInserted event, fires the event on all
|
||||
* aNodes
|
||||
|
@ -2126,6 +2126,18 @@ public:
|
||||
static bool GetSVGGlyphExtents(Element *aElement, const gfxMatrix& aSVGToAppSpace,
|
||||
gfxRect *aResult);
|
||||
|
||||
/**
|
||||
* Check whether a spec feature/version is supported.
|
||||
* @param aObject the object, which should support the feature,
|
||||
* for example nsIDOMNode or nsIDOMDOMImplementation
|
||||
* @param aFeature the feature ("Views", "Core", "HTML", "Range" ...)
|
||||
* @param aVersion the version ("1.0", "2.0", ...)
|
||||
* @return whether the feature is supported or not
|
||||
*/
|
||||
static bool InternalIsSupported(nsISupports* aObject,
|
||||
const nsAString& aFeature,
|
||||
const nsAString& aVersion);
|
||||
|
||||
private:
|
||||
static bool InitializeEventTable();
|
||||
|
||||
|
@ -113,7 +113,6 @@
|
||||
|
||||
#include "prprf.h"
|
||||
#include "nsDOMMutationObserver.h"
|
||||
#include "nsSVGFeatures.h"
|
||||
#include "nsWrapperCacheInlines.h"
|
||||
#include "nsCycleCollector.h"
|
||||
#include "xpcpublic.h"
|
||||
@ -690,76 +689,13 @@ FragmentOrElement::GetPrefix(nsAString& aPrefix)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
FragmentOrElement::InternalIsSupported(nsISupports* aObject,
|
||||
const nsAString& aFeature,
|
||||
const nsAString& aVersion,
|
||||
bool* aReturn)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aReturn);
|
||||
*aReturn = false;
|
||||
|
||||
// Convert the incoming UTF16 strings to raw char*'s to save us some
|
||||
// code when doing all those string compares.
|
||||
NS_ConvertUTF16toUTF8 feature(aFeature);
|
||||
NS_ConvertUTF16toUTF8 version(aVersion);
|
||||
|
||||
const char *f = feature.get();
|
||||
const char *v = version.get();
|
||||
|
||||
if (PL_strcasecmp(f, "XML") == 0 ||
|
||||
PL_strcasecmp(f, "HTML") == 0) {
|
||||
if (aVersion.IsEmpty() ||
|
||||
PL_strcmp(v, "1.0") == 0 ||
|
||||
PL_strcmp(v, "2.0") == 0) {
|
||||
*aReturn = true;
|
||||
}
|
||||
} else if (PL_strcasecmp(f, "Views") == 0 ||
|
||||
PL_strcasecmp(f, "StyleSheets") == 0 ||
|
||||
PL_strcasecmp(f, "Core") == 0 ||
|
||||
PL_strcasecmp(f, "CSS") == 0 ||
|
||||
PL_strcasecmp(f, "CSS2") == 0 ||
|
||||
PL_strcasecmp(f, "Events") == 0 ||
|
||||
PL_strcasecmp(f, "UIEvents") == 0 ||
|
||||
PL_strcasecmp(f, "MouseEvents") == 0 ||
|
||||
// Non-standard!
|
||||
PL_strcasecmp(f, "MouseScrollEvents") == 0 ||
|
||||
PL_strcasecmp(f, "HTMLEvents") == 0 ||
|
||||
PL_strcasecmp(f, "Range") == 0 ||
|
||||
PL_strcasecmp(f, "XHTML") == 0) {
|
||||
if (aVersion.IsEmpty() ||
|
||||
PL_strcmp(v, "2.0") == 0) {
|
||||
*aReturn = true;
|
||||
}
|
||||
} else if (PL_strcasecmp(f, "XPath") == 0) {
|
||||
if (aVersion.IsEmpty() ||
|
||||
PL_strcmp(v, "3.0") == 0) {
|
||||
*aReturn = true;
|
||||
}
|
||||
} else if (PL_strcasecmp(f, "SVGEvents") == 0 ||
|
||||
PL_strcasecmp(f, "SVGZoomEvents") == 0 ||
|
||||
nsSVGFeatures::HasFeature(aObject, aFeature)) {
|
||||
if (aVersion.IsEmpty() ||
|
||||
PL_strcmp(v, "1.0") == 0 ||
|
||||
PL_strcmp(v, "1.1") == 0) {
|
||||
*aReturn = true;
|
||||
}
|
||||
}
|
||||
else if (NS_SMILEnabled() && PL_strcasecmp(f, "TimeControl") == 0) {
|
||||
if (aVersion.IsEmpty() || PL_strcmp(v, "1.0") == 0) {
|
||||
*aReturn = true;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FragmentOrElement::IsSupported(const nsAString& aFeature,
|
||||
const nsAString& aVersion,
|
||||
bool* aReturn)
|
||||
{
|
||||
return InternalIsSupported(this, aFeature, aVersion, aReturn);
|
||||
*aReturn = nsContentUtils::InternalIsSupported(this, aFeature, aVersion);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -171,6 +171,7 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
|
||||
#include "nsIParserService.h"
|
||||
#include "nsIDOMScriptObjectFactory.h"
|
||||
#include "nsSandboxFlags.h"
|
||||
#include "nsSVGFeatures.h"
|
||||
|
||||
#include "nsWrapperCacheInlines.h"
|
||||
|
||||
@ -7125,3 +7126,63 @@ nsContentUtils::GetHTMLEditor(nsPresContext* aPresContext)
|
||||
editorDocShell->GetEditor(getter_AddRefs(editor));
|
||||
return editor;
|
||||
}
|
||||
|
||||
bool
|
||||
nsContentUtils::InternalIsSupported(nsISupports* aObject,
|
||||
const nsAString& aFeature,
|
||||
const nsAString& aVersion)
|
||||
{
|
||||
// Convert the incoming UTF16 strings to raw char*'s to save us some
|
||||
// code when doing all those string compares.
|
||||
NS_ConvertUTF16toUTF8 feature(aFeature);
|
||||
NS_ConvertUTF16toUTF8 version(aVersion);
|
||||
|
||||
const char *f = feature.get();
|
||||
const char *v = version.get();
|
||||
|
||||
if (PL_strcasecmp(f, "XML") == 0 ||
|
||||
PL_strcasecmp(f, "HTML") == 0) {
|
||||
if (aVersion.IsEmpty() ||
|
||||
PL_strcmp(v, "1.0") == 0 ||
|
||||
PL_strcmp(v, "2.0") == 0) {
|
||||
return true;
|
||||
}
|
||||
} else if (PL_strcasecmp(f, "Views") == 0 ||
|
||||
PL_strcasecmp(f, "StyleSheets") == 0 ||
|
||||
PL_strcasecmp(f, "Core") == 0 ||
|
||||
PL_strcasecmp(f, "CSS") == 0 ||
|
||||
PL_strcasecmp(f, "CSS2") == 0 ||
|
||||
PL_strcasecmp(f, "Events") == 0 ||
|
||||
PL_strcasecmp(f, "UIEvents") == 0 ||
|
||||
PL_strcasecmp(f, "MouseEvents") == 0 ||
|
||||
// Non-standard!
|
||||
PL_strcasecmp(f, "MouseScrollEvents") == 0 ||
|
||||
PL_strcasecmp(f, "HTMLEvents") == 0 ||
|
||||
PL_strcasecmp(f, "Range") == 0 ||
|
||||
PL_strcasecmp(f, "XHTML") == 0) {
|
||||
if (aVersion.IsEmpty() ||
|
||||
PL_strcmp(v, "2.0") == 0) {
|
||||
return true;
|
||||
}
|
||||
} else if (PL_strcasecmp(f, "XPath") == 0) {
|
||||
if (aVersion.IsEmpty() ||
|
||||
PL_strcmp(v, "3.0") == 0) {
|
||||
return true;
|
||||
}
|
||||
} else if (PL_strcasecmp(f, "SVGEvents") == 0 ||
|
||||
PL_strcasecmp(f, "SVGZoomEvents") == 0 ||
|
||||
nsSVGFeatures::HasFeature(aObject, aFeature)) {
|
||||
if (aVersion.IsEmpty() ||
|
||||
PL_strcmp(v, "1.0") == 0 ||
|
||||
PL_strcmp(v, "1.1") == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (NS_SMILEnabled() && PL_strcasecmp(f, "TimeControl") == 0) {
|
||||
if (aVersion.IsEmpty() || PL_strcmp(v, "1.0") == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -446,8 +446,9 @@ nsDOMAttribute::IsSupported(const nsAString& aFeature,
|
||||
{
|
||||
OwnerDoc()->WarnOnceAbout(nsIDocument::eIsSupported);
|
||||
|
||||
return nsGenericElement::InternalIsSupported(static_cast<nsIDOMAttr*>(this),
|
||||
aFeature, aVersion, aReturn);
|
||||
*aReturn = nsContentUtils::InternalIsSupported(static_cast<nsIDOMAttr*>(this),
|
||||
aFeature, aVersion);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI>
|
||||
|
@ -1337,9 +1337,10 @@ nsDOMImplementation::HasFeature(const nsAString& aFeature,
|
||||
const nsAString& aVersion,
|
||||
bool* aReturn)
|
||||
{
|
||||
return nsGenericElement::InternalIsSupported(
|
||||
*aReturn = nsContentUtils::InternalIsSupported(
|
||||
static_cast<nsIDOMDOMImplementation*>(this),
|
||||
aFeature, aVersion, aReturn);
|
||||
aFeature, aVersion);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -5969,8 +5970,9 @@ NS_IMETHODIMP
|
||||
nsDocument::IsSupported(const nsAString& aFeature, const nsAString& aVersion,
|
||||
bool* aReturn)
|
||||
{
|
||||
return nsGenericElement::InternalIsSupported(static_cast<nsIDOMDocument*>(this),
|
||||
aFeature, aVersion, aReturn);
|
||||
*aReturn = nsContentUtils::InternalIsSupported(static_cast<nsIDOMDocument*>(this),
|
||||
aFeature, aVersion);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -148,8 +148,9 @@ nsGenericDOMDataNode::IsSupported(const nsAString& aFeature,
|
||||
const nsAString& aVersion,
|
||||
bool* aReturn)
|
||||
{
|
||||
return nsGenericElement::InternalIsSupported(static_cast<nsIContent*>(this),
|
||||
aFeature, aVersion, aReturn);
|
||||
*aReturn = nsContentUtils::InternalIsSupported(static_cast<nsIContent*>(this),
|
||||
aFeature, aVersion);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user