mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 562688 part 9. Eliminate eELEMENT users in dom/. r=jst
This commit is contained in:
parent
13aed1444a
commit
73d309e278
@ -469,6 +469,9 @@
|
||||
#include "nsIDOMNSMouseEvent.h"
|
||||
|
||||
#include "nsIEventListenerService.h"
|
||||
#include "Element.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
|
||||
|
||||
@ -7225,8 +7228,8 @@ nsNodeSH::PreCreate(nsISupports *nativeObj, JSContext *cx, JSObject *globalObj,
|
||||
nsISupports *native_parent;
|
||||
|
||||
PRBool slimWrappers = PR_TRUE;
|
||||
PRBool nodeIsElement = node->IsNodeOfType(nsINode::eELEMENT);
|
||||
if (nodeIsElement && static_cast<nsIContent*>(node)->IsXUL()) {
|
||||
PRBool nodeIsElement = node->IsElement();
|
||||
if (nodeIsElement && node->AsElement()->IsXUL()) {
|
||||
// For XUL elements, use the parent, if any.
|
||||
native_parent = node->GetParent();
|
||||
|
||||
@ -7645,14 +7648,14 @@ nsEventTargetSH::PreserveWrapper(nsISupports *aNative)
|
||||
// Element helper
|
||||
|
||||
static PRBool
|
||||
GetBindingURL(nsIContent *aContent, nsIDocument *aDocument,
|
||||
GetBindingURL(Element *aElement, nsIDocument *aDocument,
|
||||
nsCSSValue::URL **aResult)
|
||||
{
|
||||
// If we have a frame the frame has already loaded the binding. And
|
||||
// otherwise, don't do anything else here unless we're dealing with
|
||||
// XUL.
|
||||
nsIPresShell *shell = aDocument->GetPrimaryShell();
|
||||
if (!shell || aContent->GetPrimaryFrame() || !aContent->IsXUL()) {
|
||||
if (!shell || aElement->GetPrimaryFrame() || !aElement->IsXUL()) {
|
||||
*aResult = nsnull;
|
||||
|
||||
return PR_TRUE;
|
||||
@ -7662,7 +7665,7 @@ GetBindingURL(nsIContent *aContent, nsIDocument *aDocument,
|
||||
nsPresContext *pctx = shell->GetPresContext();
|
||||
NS_ENSURE_TRUE(pctx, PR_FALSE);
|
||||
|
||||
nsRefPtr<nsStyleContext> sc = pctx->StyleSet()->ResolveStyleFor(aContent,
|
||||
nsRefPtr<nsStyleContext> sc = pctx->StyleSet()->ResolveStyleFor(aElement,
|
||||
nsnull);
|
||||
NS_ENSURE_TRUE(sc, PR_FALSE);
|
||||
|
||||
@ -7678,7 +7681,7 @@ nsElementSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
nsresult rv = nsNodeSH::PreCreate(nativeObj, cx, globalObj, parentObj);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsIContent *content = static_cast<nsIContent*>(nativeObj);
|
||||
Element *element = static_cast<Element*>(nativeObj);
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
@ -7687,26 +7690,26 @@ nsElementSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
// If this assertion fires the QI implementation for the object in
|
||||
// question doesn't use the nsIContent pointer as the nsISupports
|
||||
// pointer. That must be fixed, or we'll crash...
|
||||
NS_ASSERTION(content_qi == content, "Uh, fix QI!");
|
||||
NS_ASSERTION(content_qi == element, "Uh, fix QI!");
|
||||
}
|
||||
#endif
|
||||
|
||||
nsIDocument *doc = content->HasFlag(NODE_FORCE_XBL_BINDINGS) ?
|
||||
content->GetOwnerDoc() :
|
||||
content->GetCurrentDoc();
|
||||
nsIDocument *doc = element->HasFlag(NODE_FORCE_XBL_BINDINGS) ?
|
||||
element->GetOwnerDoc() :
|
||||
element->GetCurrentDoc();
|
||||
|
||||
if (!doc) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (content->HasFlag(NODE_MAY_BE_IN_BINDING_MNGR) &&
|
||||
doc->BindingManager()->GetBinding(content)) {
|
||||
if (element->HasFlag(NODE_MAY_BE_IN_BINDING_MNGR) &&
|
||||
doc->BindingManager()->GetBinding(element)) {
|
||||
// Don't allow slim wrappers.
|
||||
return rv == NS_SUCCESS_ALLOW_SLIM_WRAPPERS ? NS_OK : rv;
|
||||
}
|
||||
|
||||
nsCSSValue::URL *bindingURL;
|
||||
PRBool ok = GetBindingURL(content, doc, &bindingURL);
|
||||
PRBool ok = GetBindingURL(element, doc, &bindingURL);
|
||||
NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
|
||||
|
||||
// Only allow slim wrappers if there's no binding.
|
||||
@ -7714,7 +7717,7 @@ nsElementSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
return rv;
|
||||
}
|
||||
|
||||
content->SetFlags(NODE_ATTACH_BINDING_ON_POSTCREATE);
|
||||
element->SetFlags(NODE_ATTACH_BINDING_ON_POSTCREATE);
|
||||
|
||||
return rv == NS_SUCCESS_ALLOW_SLIM_WRAPPERS ? NS_OK : rv;
|
||||
}
|
||||
@ -7723,7 +7726,7 @@ NS_IMETHODIMP
|
||||
nsElementSH::PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj)
|
||||
{
|
||||
nsIContent *content = static_cast<nsIContent*>(wrapper->Native());
|
||||
Element *element = static_cast<Element*>(wrapper->Native());
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
@ -7732,16 +7735,16 @@ nsElementSH::PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
// If this assertion fires the QI implementation for the object in
|
||||
// question doesn't use the nsIContent pointer as the nsISupports
|
||||
// pointer. That must be fixed, or we'll crash...
|
||||
NS_ASSERTION(content_qi == content, "Uh, fix QI!");
|
||||
NS_ASSERTION(content_qi == element, "Uh, fix QI!");
|
||||
}
|
||||
#endif
|
||||
|
||||
nsIDocument* doc;
|
||||
if (content->HasFlag(NODE_FORCE_XBL_BINDINGS)) {
|
||||
doc = content->GetOwnerDoc();
|
||||
if (element->HasFlag(NODE_FORCE_XBL_BINDINGS)) {
|
||||
doc = element->GetOwnerDoc();
|
||||
}
|
||||
else {
|
||||
doc = content->GetCurrentDoc();
|
||||
doc = element->GetCurrentDoc();
|
||||
}
|
||||
|
||||
if (!doc) {
|
||||
@ -7754,7 +7757,7 @@ nsElementSH::PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
// We must ensure that the XBL Binding is installed before we hand
|
||||
// back this object.
|
||||
|
||||
if (!content->HasFlag(NODE_ATTACH_BINDING_ON_POSTCREATE)) {
|
||||
if (!element->HasFlag(NODE_ATTACH_BINDING_ON_POSTCREATE)) {
|
||||
// There's already a binding for this element so nothing left to
|
||||
// be done here.
|
||||
|
||||
@ -7766,12 +7769,12 @@ nsElementSH::PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
content->UnsetFlags(NODE_ATTACH_BINDING_ON_POSTCREATE);
|
||||
element->UnsetFlags(NODE_ATTACH_BINDING_ON_POSTCREATE);
|
||||
|
||||
// Make sure the style context goes away _before_ we load the binding
|
||||
// since that can destroy the relevant presshell.
|
||||
nsCSSValue::URL *bindingURL;
|
||||
PRBool ok = GetBindingURL(content, doc, &bindingURL);
|
||||
PRBool ok = GetBindingURL(element, doc, &bindingURL);
|
||||
NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
|
||||
|
||||
if (!bindingURL) {
|
||||
@ -7789,7 +7792,7 @@ nsElementSH::PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
NS_ENSURE_TRUE(xblService, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
nsRefPtr<nsXBLBinding> binding;
|
||||
xblService->LoadBindings(content, uri, principal, PR_FALSE,
|
||||
xblService->LoadBindings(element, uri, principal, PR_FALSE,
|
||||
getter_AddRefs(binding), &dummy);
|
||||
|
||||
if (binding) {
|
||||
|
@ -2029,7 +2029,7 @@ nsFocusManager::GetSelectionLocation(nsIDocument* aDocument,
|
||||
nsIContent *childContent = nsnull;
|
||||
|
||||
startContent = do_QueryInterface(startNode);
|
||||
if (startContent && startContent->IsNodeOfType(nsINode::eELEMENT)) {
|
||||
if (startContent && startContent->IsElement()) {
|
||||
NS_ASSERTION(startOffset >= 0, "Start offset cannot be negative");
|
||||
childContent = startContent->GetChildAt(startOffset);
|
||||
if (childContent) {
|
||||
@ -2038,7 +2038,7 @@ nsFocusManager::GetSelectionLocation(nsIDocument* aDocument,
|
||||
}
|
||||
|
||||
endContent = do_QueryInterface(endNode);
|
||||
if (endContent && endContent->IsNodeOfType(nsINode::eELEMENT)) {
|
||||
if (endContent && endContent->IsElement()) {
|
||||
PRInt32 endOffset = 0;
|
||||
domRange->GetEndOffset(&endOffset);
|
||||
NS_ASSERTION(endOffset >= 0, "End offset cannot be negative");
|
||||
|
Loading…
Reference in New Issue
Block a user