Bug 1448018, remove ContainerBoxObject which is only used to access the docshell, but bug 1448018 made the docshell accessible from the frameloader instead so the container box object is no longer being used. Change some editor tests which just access the docShell directly rather than through the box object, r=bz

This commit is contained in:
Neil Deakin 2018-03-29 10:44:52 -04:00
Родитель 40c8e34acf
Коммит 6a995d0462
17 изменённых файлов: 12 добавлений и 146 удалений

Просмотреть файл

@ -254,7 +254,6 @@
#include "mozilla/dom/DocGroup.h"
#include "mozilla/dom/TabGroup.h"
#ifdef MOZ_XUL
#include "mozilla/dom/ContainerBoxObject.h"
#include "mozilla/dom/ListBoxObject.h"
#include "mozilla/dom/MenuBoxObject.h"
#include "mozilla/dom/PopupBoxObject.h"
@ -6494,11 +6493,7 @@ nsIDocument::GetBoxObjectFor(Element* aElement, ErrorResult& aRv)
RefPtr<nsAtom> tag = BindingManager()->ResolveTag(aElement, &namespaceID);
#ifdef MOZ_XUL
if (namespaceID == kNameSpaceID_XUL) {
if (tag == nsGkAtoms::browser ||
tag == nsGkAtoms::editor ||
tag == nsGkAtoms::iframe) {
boxObject = new ContainerBoxObject();
} else if (tag == nsGkAtoms::menu) {
if (tag == nsGkAtoms::menu) {
boxObject = new MenuBoxObject();
} else if (tag == nsGkAtoms::popup ||
tag == nsGkAtoms::menupopup ||

Просмотреть файл

@ -1,12 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*/
[NoInterfaceObject]
interface ContainerBoxObject : BoxObject {
[ChromeOnly]
readonly attribute nsIDocShell? docShell;
};

Просмотреть файл

@ -64,9 +64,6 @@ with Files("ClipboardEvent.webidl"):
with Files("ConstantSourceNode.webidl"):
BUG_COMPONENT = ("Core", "Web Audio")
with Files("ContainerBoxObject.webidl"):
BUG_COMPONENT = ("Core", "DOM")
with Files("ConvolverNode.webidl"):
BUG_COMPONENT = ("Core", "Web Audio")
@ -423,7 +420,6 @@ WEBIDL_FILES = [
'CompositionEvent.webidl',
'Console.webidl',
'ConstantSourceNode.webidl',
'ContainerBoxObject.webidl',
'ConvolverNode.webidl',
'Coordinates.webidl',
'CreateOfferRequest.webidl',

Просмотреть файл

@ -99,7 +99,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=434998
function runTest() {
var newEditorElement = document.getElementById("editor");
newEditorElement.makeEditable("html", true);
var docShell = newEditorElement.boxObject.docShell;
var docShell = newEditorElement.docShell;
progress = docShell.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebProgress);
progressListener = new EditorContentListener(newEditorElement);
progress.addProgressListener(progressListener, Ci.nsIWebProgress.NOTIFY_ALL);

Просмотреть файл

@ -105,7 +105,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=607584
function runTest() {
var newEditorElement = document.getElementById("editor");
newEditorElement.makeEditable("html", true);
var docShell = newEditorElement.boxObject.docShell;
var docShell = newEditorElement.docShell;
progress = docShell.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebProgress);
progressListener = new EditorContentListener(newEditorElement);
progress.addProgressListener(progressListener, Ci.nsIWebProgress.NOTIFY_ALL);

Просмотреть файл

@ -94,7 +94,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=616590
function runTest() {
var editorElement = document.getElementById("editor");
editorElement.makeEditable("htmlmail", true);
var docShell = editorElement.boxObject.docShell;
var docShell = editorElement.docShell;
progress = docShell.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebProgress);
progressListener = new EditorContentListener(editorElement);
progress.addProgressListener(progressListener, Ci.nsIWebProgress.NOTIFY_ALL);

Просмотреть файл

@ -103,7 +103,7 @@ adapted from test_bug607584.xul by Kent James <kent@caspia.com>
function runTest() {
var newEditorElement = document.getElementById("editor");
newEditorElement.makeEditable("html", true);
var docShell = newEditorElement.boxObject.docShell;
var docShell = newEditorElement.docShell;
progress = docShell.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebProgress);
progressListener = new EditorContentListener(newEditorElement);
progress.addProgressListener(progressListener, Ci.nsIWebProgress.NOTIFY_ALL);

Просмотреть файл

@ -35,10 +35,6 @@
#define NS_POPUPBOXOBJECT_CID \
{ 0x6c392c62, 0x1ab1, 0x4de7, { 0xbf, 0xc6, 0xed, 0x4f, 0x9f, 0xc7, 0x74, 0x9a } }
// {dca9d7c3-7b6a-4490-ad6d-2699a8d683cd}
#define NS_CONTAINERBOXOBJECT_CID \
{ 0xdca9d7c3, 0x7b6a, 0x4490, { 0xad, 0x6d, 0x26, 0x99, 0xa8, 0xd6, 0x83, 0xcd } }
// {3B581FD4-3497-426c-8F61-3658B971CB80}
#define NS_TREEBOXOBJECT_CID \
{ 0x3b581fd4, 0x3497, 0x426c, { 0x8f, 0x61, 0x36, 0x58, 0xb9, 0x71, 0xcb, 0x80 } }

Просмотреть файл

@ -311,7 +311,6 @@ nsresult NS_NewListBoxObject(nsIBoxObject** aResult);
nsresult NS_NewScrollBoxObject(nsIBoxObject** aResult);
nsresult NS_NewMenuBoxObject(nsIBoxObject** aResult);
nsresult NS_NewPopupBoxObject(nsIBoxObject** aResult);
nsresult NS_NewContainerBoxObject(nsIBoxObject** aResult);
nsresult NS_NewTreeBoxObject(nsIBoxObject** aResult);
#endif
@ -376,7 +375,6 @@ MAKE_CTOR(CreateNewMenuBoxObject, nsIBoxObject, NS_NewMenuBoxObj
MAKE_CTOR(CreateNewPopupBoxObject, nsIBoxObject, NS_NewPopupBoxObject)
MAKE_CTOR(CreateNewScrollBoxObject, nsIBoxObject, NS_NewScrollBoxObject)
MAKE_CTOR(CreateNewTreeBoxObject, nsIBoxObject, NS_NewTreeBoxObject)
MAKE_CTOR(CreateNewContainerBoxObject, nsIBoxObject, NS_NewContainerBoxObject)
#endif // MOZ_XUL
#ifdef MOZ_XUL
@ -521,7 +519,6 @@ NS_DEFINE_NAMED_CID(NS_BOXOBJECT_CID);
NS_DEFINE_NAMED_CID(NS_LISTBOXOBJECT_CID);
NS_DEFINE_NAMED_CID(NS_MENUBOXOBJECT_CID);
NS_DEFINE_NAMED_CID(NS_POPUPBOXOBJECT_CID);
NS_DEFINE_NAMED_CID(NS_CONTAINERBOXOBJECT_CID);
NS_DEFINE_NAMED_CID(NS_SCROLLBOXOBJECT_CID);
NS_DEFINE_NAMED_CID(NS_TREEBOXOBJECT_CID);
#endif // MOZ_XUL
@ -768,7 +765,6 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
{ &kNS_LISTBOXOBJECT_CID, false, nullptr, CreateNewListBoxObject },
{ &kNS_MENUBOXOBJECT_CID, false, nullptr, CreateNewMenuBoxObject },
{ &kNS_POPUPBOXOBJECT_CID, false, nullptr, CreateNewPopupBoxObject },
{ &kNS_CONTAINERBOXOBJECT_CID, false, nullptr, CreateNewContainerBoxObject },
{ &kNS_SCROLLBOXOBJECT_CID, false, nullptr, CreateNewScrollBoxObject },
{ &kNS_TREEBOXOBJECT_CID, false, nullptr, CreateNewTreeBoxObject },
#endif // MOZ_XUL
@ -881,7 +877,6 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
{ "@mozilla.org/layout/xul-boxobject-listbox;1", &kNS_LISTBOXOBJECT_CID },
{ "@mozilla.org/layout/xul-boxobject-menu;1", &kNS_MENUBOXOBJECT_CID },
{ "@mozilla.org/layout/xul-boxobject-popup;1", &kNS_POPUPBOXOBJECT_CID },
{ "@mozilla.org/layout/xul-boxobject-container;1", &kNS_CONTAINERBOXOBJECT_CID },
{ "@mozilla.org/layout/xul-boxobject-scrollbox;1", &kNS_SCROLLBOXOBJECT_CID },
{ "@mozilla.org/layout/xul-boxobject-tree;1", &kNS_TREEBOXOBJECT_CID },
#endif // MOZ_XUL

Просмотреть файл

@ -1,74 +0,0 @@
/* -*- 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/. */
#include "mozilla/dom/ContainerBoxObject.h"
#include "mozilla/dom/ContainerBoxObjectBinding.h"
#include "nsCOMPtr.h"
#include "nsIDocShell.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIFrame.h"
#include "nsSubDocumentFrame.h"
namespace mozilla {
namespace dom {
ContainerBoxObject::ContainerBoxObject()
{
}
ContainerBoxObject::~ContainerBoxObject()
{
}
JSObject*
ContainerBoxObject::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
return ContainerBoxObjectBinding::Wrap(aCx, this, aGivenProto);
}
already_AddRefed<nsIDocShell>
ContainerBoxObject::GetDocShell()
{
nsSubDocumentFrame *subDocFrame = do_QueryFrame(GetFrame(false));
if (subDocFrame) {
// Ok, the frame for mContent is an nsSubDocumentFrame, it knows how
// to reach the docshell, so ask it...
return do_AddRef(subDocFrame->GetDocShell());
}
if (!mContent) {
return nullptr;
}
// No nsSubDocumentFrame available for mContent, try if there's a mapping
// between mContent's document to mContent's subdocument.
nsIDocument *doc = mContent->GetComposedDoc();
if (!doc) {
return nullptr;
}
nsIDocument *sub_doc = doc->GetSubDocumentFor(mContent);
if (!sub_doc) {
return nullptr;
}
nsCOMPtr<nsIDocShell> result = sub_doc->GetDocShell();
return result.forget();
}
} // namespace dom
} // namespace mozilla
nsresult
NS_NewContainerBoxObject(nsIBoxObject** aResult)
{
NS_ADDREF(*aResult = new mozilla::dom::ContainerBoxObject());
return NS_OK;
}

Просмотреть файл

@ -1,32 +0,0 @@
/* -*- 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/. */
#ifndef mozilla_dom_ContainerBoxObject_h
#define mozilla_dom_ContainerBoxObject_h
#include "mozilla/dom/BoxObject.h"
#include "nsIDocShell.h"
namespace mozilla {
namespace dom {
class ContainerBoxObject final : public BoxObject
{
public:
ContainerBoxObject();
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
already_AddRefed<nsIDocShell> GetDocShell();
private:
~ContainerBoxObject();
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_ContainerBoxObject_h

Просмотреть файл

@ -33,7 +33,6 @@ EXPORTS += [
EXPORTS.mozilla.dom += [
'BoxObject.h',
'ContainerBoxObject.h',
'ListBoxObject.h',
'MenuBoxObject.h',
'PopupBoxObject.h',
@ -61,7 +60,6 @@ UNIFIED_SOURCES += [
if CONFIG['MOZ_XUL']:
UNIFIED_SOURCES += [
'ContainerBoxObject.cpp',
'ListBoxObject.cpp',
'MenuBoxObject.cpp',
'nsDeckFrame.cpp',

Просмотреть файл

@ -7,6 +7,8 @@
#include "mozilla/Attributes.h"
#include "nsGridRowLeafFrame.h"
using namespace mozilla;
nsIFrame* NS_NewListItemFrame(nsIPresShell* aPresShell,
ComputedStyle* aStyle);

Просмотреть файл

@ -76,7 +76,7 @@ nsMenuBarListener::nsMenuBarListener(nsMenuBarFrame* aMenuBarFrame,
NS_LITERAL_STRING("MozDOMFullscreen:Entered"), this, false);
// Needs to listen to the deactivate event of the window.
RefPtr<EventTarget> topWindowEventTarget =
RefPtr<dom::EventTarget> topWindowEventTarget =
nsContentUtils::GetWindowRoot(aMenuBarContent->GetComposedDoc());
mTopWindowEventTarget = topWindowEventTarget.get();

Просмотреть файл

@ -96,7 +96,7 @@ public:
domEventToFire.AssignLiteral("DOMMenuItemInactive");
}
RefPtr<Event> event = NS_NewDOMEvent(mMenu, mPresContext, nullptr);
RefPtr<dom::Event> event = NS_NewDOMEvent(mMenu, mPresContext, nullptr);
event->InitEvent(domEventToFire, true, true);
event->SetTrusted(true);

Просмотреть файл

@ -541,7 +541,7 @@ nsResizerFrame::MouseClicked(WidgetMouseEvent* aEvent)
bool isControl = false;
bool isAlt = false;
bool isMeta = false;
uint16_t inputSource = MouseEventBinding::MOZ_SOURCE_UNKNOWN;
uint16_t inputSource = dom::MouseEventBinding::MOZ_SOURCE_UNKNOWN;
if(aEvent) {
isShift = aEvent->IsShift();

Просмотреть файл

@ -22,6 +22,8 @@
#include "nsStackLayout.h"
#include "nsDisplayList.h"
using namespace mozilla;
nsIFrame*
NS_NewStackFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle)
{