зеркало из https://github.com/mozilla/gecko-dev.git
Straight revert of content/* dom/interfaces/canvas/* dom/ipc/* toolkit/content/tests/fennec-tile-testapp/* netwerk/* security/manager/ssl* to their mozilla-central state. This named branch will be used as a temporary area to merge just the plugin portion of electrolysis into mozilla-central.
--HG-- branch : electrolysis-plugins-only
This commit is contained in:
Родитель
e24dbe141e
Коммит
c23e173ce0
|
@ -41,9 +41,8 @@
|
|||
|
||||
interface nsIDocShell;
|
||||
interface nsIURI;
|
||||
interface nsIFrame;
|
||||
|
||||
[scriptable, uuid(8f94788d-ec69-4220-971c-0fd68d47b80f)]
|
||||
[scriptable, uuid(d675c531-6bdc-417c-b176-635060105f07)]
|
||||
interface nsIFrameLoader : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -75,35 +74,6 @@ interface nsIFrameLoader : nsISupports
|
|||
* or may not be allowed on the loader's docshell.
|
||||
*/
|
||||
readonly attribute boolean depthTooGreat;
|
||||
|
||||
/**
|
||||
* Updates the position and size of the subdocument loaded by this frameloader.
|
||||
*
|
||||
* @param aIFrame The nsIFrame for the content node that owns this frameloader
|
||||
*/
|
||||
[noscript] void updatePositionAndSize(in nsIFrame aIFrame);
|
||||
|
||||
/**
|
||||
* Activate remote frame.
|
||||
* Throws an exception with non-remote frames.
|
||||
*/
|
||||
void activateRemoteFrame();
|
||||
|
||||
/**
|
||||
* @see nsIDOMWindowUtils sendMouseEvent.
|
||||
*/
|
||||
void sendCrossProcessMouseEvent(in AString aType,
|
||||
in float aX,
|
||||
in float aY,
|
||||
in long aButton,
|
||||
in long aClickCount,
|
||||
in long aModifiers,
|
||||
[optional] in boolean aIgnoreRootScrollFrame);
|
||||
|
||||
/**
|
||||
* Activate event forwarding from client (remote frame) to parent.
|
||||
*/
|
||||
void activateFrameEvent(in AString aType, in boolean capture);
|
||||
};
|
||||
|
||||
native alreadyAddRefed_nsFrameLoader(already_AddRefed<nsFrameLoader>);
|
||||
|
|
|
@ -143,8 +143,6 @@ FORCE_STATIC_LIB = 1
|
|||
|
||||
EXTRA_COMPONENTS = $(srcdir)/nsBadCertHandler.js
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
INCLUDES += \
|
||||
|
@ -160,7 +158,6 @@ INCLUDES += \
|
|||
-I$(srcdir)/../../../dom/base \
|
||||
-I$(srcdir)/../../xml/document/src \
|
||||
-I$(topsrcdir)/xpcom/io \
|
||||
-I$(topsrcdir)/dom/ipc \
|
||||
$(NULL)
|
||||
|
||||
DEFINES += -D_IMPL_NS_LAYOUT
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
* Contributor(s):
|
||||
* Johnny Stenback <jst@netscape.com> (original author)
|
||||
* Boris Zbarsky <bzbarsky@mit.edu>
|
||||
* Frederic Plourde <frederic.plourde@polymtl.ca>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
|
@ -44,12 +43,6 @@
|
|||
* handling of loads in it, recursion-checking).
|
||||
*/
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
# include "base/basictypes.h"
|
||||
#endif
|
||||
|
||||
#include "prenv.h"
|
||||
|
||||
#include "nsIDOMHTMLIFrameElement.h"
|
||||
#include "nsIDOMHTMLFrameElement.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
|
@ -84,7 +77,7 @@
|
|||
#include "nsISHistory.h"
|
||||
#include "nsISHistoryInternal.h"
|
||||
#include "nsIDOMNSHTMLDocument.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsIView.h"
|
||||
|
||||
#include "nsIURI.h"
|
||||
#include "nsIURL.h"
|
||||
|
@ -94,22 +87,6 @@
|
|||
#include "nsINameSpaceManager.h"
|
||||
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsIView.h"
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#include "mozcontainer.h"
|
||||
|
||||
#include <gdk/gdkx.h>
|
||||
#include <gtk/gtk.h>
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
#include "ContentProcessParent.h"
|
||||
#include "TabParent.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
#endif
|
||||
|
||||
class nsAsyncDocShellDestroyer : public nsRunnable
|
||||
{
|
||||
|
@ -231,34 +208,11 @@ nsresult
|
|||
nsFrameLoader::ReallyStartLoading()
|
||||
{
|
||||
NS_ENSURE_STATE(mURIToLoad && mOwnerContent && mOwnerContent->IsInDoc());
|
||||
|
||||
nsresult rv = MaybeCreateDocShell();
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
if (mRemoteFrame) {
|
||||
if (!mChildProcess) {
|
||||
TryNewProcess();
|
||||
}
|
||||
|
||||
if (!mChildProcess) {
|
||||
NS_WARNING("Couldn't create child process for iframe.");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// FIXME get error codes from child
|
||||
mChildProcess->LoadURL(mURIToLoad);
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_ASSERTION(mDocShell,
|
||||
"MaybeCreateDocShell succeeded with a null mDocShell");
|
||||
|
||||
// Just to be safe, recheck uri.
|
||||
rv = CheckURILoad(mURIToLoad);
|
||||
nsresult rv = CheckURILoad(mURIToLoad);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = EnsureDocShell();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDocShellLoadInfo> loadInfo;
|
||||
|
@ -322,15 +276,6 @@ nsFrameLoader::CheckURILoad(nsIURI* aURI)
|
|||
}
|
||||
|
||||
// Bail out if this is an infinite recursion scenario
|
||||
rv = MaybeCreateDocShell();
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
#ifdef MOZ_IPC
|
||||
if (mRemoteFrame) {
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
return CheckForRecursiveLoad(aURI);
|
||||
}
|
||||
|
||||
|
@ -343,17 +288,8 @@ nsFrameLoader::GetDocShell(nsIDocShell **aDocShell)
|
|||
// that. If not, we're most likely in the middle of being torn down,
|
||||
// then we just return null.
|
||||
if (mOwnerContent) {
|
||||
nsresult rv = MaybeCreateDocShell();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
#ifdef MOZ_IPC
|
||||
if (mRemoteFrame) {
|
||||
NS_WARNING("No docshells for remote frames!");
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
#endif
|
||||
NS_ASSERTION(mDocShell,
|
||||
"MaybeCreateDocShell succeeded, but null mDocShell");
|
||||
nsresult rv = EnsureDocShell();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
*aDocShell = mDocShell;
|
||||
|
@ -540,64 +476,50 @@ nsFrameLoader::Show(PRInt32 marginWidth, PRInt32 marginHeight,
|
|||
{
|
||||
nsContentType contentType;
|
||||
|
||||
nsresult rv = MaybeCreateDocShell();
|
||||
nsresult rv = EnsureDocShell();
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
if (mRemoteFrame) {
|
||||
contentType = eContentTypeUI;
|
||||
if (!mDocShell)
|
||||
return false;
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
mDocShell->GetPresShell(getter_AddRefs(presShell));
|
||||
if (presShell)
|
||||
return true;
|
||||
|
||||
mDocShell->SetMarginWidth(marginWidth);
|
||||
mDocShell->SetMarginHeight(marginHeight);
|
||||
|
||||
nsCOMPtr<nsIScrollable> sc = do_QueryInterface(mDocShell);
|
||||
if (sc) {
|
||||
sc->SetDefaultScrollbarPreferences(nsIScrollable::ScrollOrientation_X,
|
||||
scrollbarPrefX);
|
||||
sc->SetDefaultScrollbarPreferences(nsIScrollable::ScrollOrientation_Y,
|
||||
scrollbarPrefY);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (!mDocShell)
|
||||
return false;
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
mDocShell->GetPresShell(getter_AddRefs(presShell));
|
||||
if (presShell)
|
||||
return true;
|
||||
|
||||
mDocShell->SetMarginWidth(marginWidth);
|
||||
mDocShell->SetMarginHeight(marginHeight);
|
||||
|
||||
nsCOMPtr<nsIScrollable> sc = do_QueryInterface(mDocShell);
|
||||
if (sc) {
|
||||
sc->SetDefaultScrollbarPreferences(nsIScrollable::ScrollOrientation_X,
|
||||
scrollbarPrefX);
|
||||
sc->SetDefaultScrollbarPreferences(nsIScrollable::ScrollOrientation_Y,
|
||||
scrollbarPrefY);
|
||||
}
|
||||
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem = do_QueryInterface(mDocShell);
|
||||
NS_ASSERTION(treeItem,
|
||||
"Found a nsIDocShell that isn't a nsIDocShellTreeItem.");
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem = do_QueryInterface(mDocShell);
|
||||
NS_ASSERTION(treeItem,
|
||||
"Found a nsIDocShell that isn't a nsIDocShellTreeItem.");
|
||||
|
||||
PRInt32 itemType;
|
||||
treeItem->GetItemType(&itemType);
|
||||
PRInt32 itemType;
|
||||
treeItem->GetItemType(&itemType);
|
||||
|
||||
if (itemType == nsIDocShellTreeItem::typeChrome)
|
||||
contentType = eContentTypeUI;
|
||||
else {
|
||||
nsCOMPtr<nsIDocShellTreeItem> sameTypeParent;
|
||||
treeItem->GetSameTypeParent(getter_AddRefs(sameTypeParent));
|
||||
contentType = sameTypeParent ? eContentTypeContentFrame : eContentTypeContent;
|
||||
}
|
||||
if (itemType == nsIDocShellTreeItem::typeChrome)
|
||||
contentType = eContentTypeUI;
|
||||
else {
|
||||
nsCOMPtr<nsIDocShellTreeItem> sameTypeParent;
|
||||
treeItem->GetSameTypeParent(getter_AddRefs(sameTypeParent));
|
||||
contentType = sameTypeParent ? eContentTypeContentFrame : eContentTypeContent;
|
||||
}
|
||||
|
||||
nsIView* view = frame->CreateViewAndWidget(contentType);
|
||||
if (!view)
|
||||
return false;
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
if (mRemoteFrame) {
|
||||
return ShowRemoteFrame(frame, view);
|
||||
}
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(mDocShell);
|
||||
NS_ASSERTION(baseWindow, "Found a nsIDocShell that isn't a nsIBaseWindow.");
|
||||
baseWindow->InitWindow(nsnull, view->GetWidget(), 0, 0, 10, 10);
|
||||
|
@ -611,7 +533,6 @@ nsFrameLoader::Show(PRInt32 marginWidth, PRInt32 marginHeight,
|
|||
// sub-document. This shouldn't be necessary, but given the way our
|
||||
// editor works, it is. See
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=284245
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
mDocShell->GetPresShell(getter_AddRefs(presShell));
|
||||
if (presShell) {
|
||||
nsCOMPtr<nsIDOMNSHTMLDocument> doc =
|
||||
|
@ -631,67 +552,6 @@ nsFrameLoader::Show(PRInt32 marginWidth, PRInt32 marginHeight,
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
bool
|
||||
nsFrameLoader::ShowRemoteFrame(nsIFrameFrame* frame, nsIView* view)
|
||||
{
|
||||
NS_ASSERTION(mRemoteFrame, "ShowRemote only makes sense on remote frames.");
|
||||
|
||||
TryNewProcess();
|
||||
if (!mChildProcess) {
|
||||
NS_ERROR("Couldn't create child process.");
|
||||
return false;
|
||||
}
|
||||
|
||||
nsIWidget* w = view->GetWidget();
|
||||
if (!w) {
|
||||
NS_ERROR("Our view doesn't have a widget. Totally stuffed!");
|
||||
return false;
|
||||
}
|
||||
|
||||
nsIntSize size = GetSubDocumentSize(frame->GetFrame());
|
||||
|
||||
#ifdef XP_WIN
|
||||
HWND parentwin =
|
||||
static_cast<HWND>(w->GetNativeData(NS_NATIVE_WINDOW));
|
||||
|
||||
mChildProcess->SendcreateWidget(parentwin);
|
||||
#elif defined(MOZ_WIDGET_GTK2)
|
||||
GdkWindow* parent_win =
|
||||
static_cast<GdkWindow*>(w->GetNativeData(NS_NATIVE_WINDOW));
|
||||
|
||||
gpointer user_data = nsnull;
|
||||
gdk_window_get_user_data(parent_win, &user_data);
|
||||
|
||||
MozContainer* parentMozContainer = MOZ_CONTAINER(user_data);
|
||||
GtkContainer* container = GTK_CONTAINER(parentMozContainer);
|
||||
|
||||
// create the socket for the child and add it to our view's widget
|
||||
mRemoteSocket = gtk_socket_new();
|
||||
gtk_widget_set_parent_window(mRemoteSocket, parent_win);
|
||||
gtk_container_add(container, mRemoteSocket);
|
||||
gtk_widget_realize(mRemoteSocket);
|
||||
|
||||
// set the child window's size and position
|
||||
GtkAllocation alloc = { 0, 0, size.width, size.height };
|
||||
gtk_widget_size_allocate(mRemoteSocket, &alloc);
|
||||
|
||||
gtk_widget_show(mRemoteSocket);
|
||||
GdkNativeWindow id = gtk_socket_get_id(GTK_SOCKET(mRemoteSocket));
|
||||
mChildProcess->SendcreateWidget(id);
|
||||
#elif defined(XP_MACOSX)
|
||||
# warning IMPLEMENT ME
|
||||
|
||||
#else
|
||||
#error TODO for this platform
|
||||
#endif
|
||||
|
||||
mChildProcess->Move(0, 0, size.width, size.height);
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
nsFrameLoader::Hide()
|
||||
{
|
||||
|
@ -995,13 +855,6 @@ nsFrameLoader::Destroy()
|
|||
|
||||
mOwnerContent = nsnull;
|
||||
}
|
||||
#ifdef MOZ_IPC
|
||||
if (mChildProcess) {
|
||||
mChildProcess->SetOwnerElement(nsnull);
|
||||
ContentProcessParent::GetSingleton()->SendPIFrameEmbeddingDestructor(mChildProcess);
|
||||
mChildProcess = nsnull;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Let the tree owner know we're gone.
|
||||
if (mIsTopLevelContent) {
|
||||
|
@ -1015,7 +868,7 @@ nsFrameLoader::Destroy()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Let our window know that we are gone
|
||||
nsCOMPtr<nsPIDOMWindow> win_private(do_GetInterface(mDocShell));
|
||||
if (win_private) {
|
||||
|
@ -1046,64 +899,14 @@ nsFrameLoader::GetDepthTooGreat(PRBool* aDepthTooGreat)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
bool
|
||||
nsFrameLoader::ShouldUseRemoteProcess()
|
||||
{
|
||||
// Check for *disabled* multi-process first: environment, prefs, attribute
|
||||
// Then check for *enabled* multi-process pref: attribute, prefs
|
||||
// Default is not-remote.
|
||||
|
||||
if (PR_GetEnv("MOZ_DISABLE_OOP_TABS")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PRBool remoteDisabled = nsContentUtils::GetBoolPref("dom.ipc.tabs.disabled",
|
||||
PR_FALSE);
|
||||
if (remoteDisabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static nsIAtom* const *const remoteValues[] = {
|
||||
&nsGkAtoms::_false,
|
||||
&nsGkAtoms::_true,
|
||||
nsnull
|
||||
};
|
||||
|
||||
switch (mOwnerContent->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::Remote,
|
||||
remoteValues, eCaseMatters)) {
|
||||
case 0:
|
||||
return false;
|
||||
case 1:
|
||||
return true;
|
||||
}
|
||||
|
||||
PRBool remoteEnabled = nsContentUtils::GetBoolPref("dom.ipc.tabs.enabled",
|
||||
PR_FALSE);
|
||||
return (bool) remoteEnabled;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
nsFrameLoader::MaybeCreateDocShell()
|
||||
nsFrameLoader::EnsureDocShell()
|
||||
{
|
||||
if (mDocShell) {
|
||||
return NS_OK;
|
||||
}
|
||||
#ifdef MOZ_IPC
|
||||
if (mRemoteFrame) {
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
NS_ENSURE_STATE(!mDestroyCalled);
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
if (ShouldUseRemoteProcess()) {
|
||||
mRemoteFrame = true;
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get our parent docshell off the document of mOwnerContent
|
||||
// XXXbz this is such a total hack.... We really need to have a
|
||||
// better setup for doing this.
|
||||
|
@ -1127,7 +930,6 @@ nsFrameLoader::MaybeCreateDocShell()
|
|||
// Get the frame name and tell the docshell about it.
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(mDocShell));
|
||||
NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);
|
||||
|
||||
nsAutoString frameName;
|
||||
|
||||
PRInt32 namespaceID = mOwnerContent->GetNameSpaceID();
|
||||
|
@ -1234,20 +1036,9 @@ nsFrameLoader::GetURL(nsString& aURI)
|
|||
nsresult
|
||||
nsFrameLoader::CheckForRecursiveLoad(nsIURI* aURI)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
mDepthTooGreat = PR_FALSE;
|
||||
rv = MaybeCreateDocShell();
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
#ifdef MOZ_IPC
|
||||
NS_ASSERTION(!mRemoteFrame,
|
||||
"Shouldn't call CheckForRecursiveLoad on remote frames.");
|
||||
#endif
|
||||
if (!mDocShell) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsresult rv = EnsureDocShell();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem = do_QueryInterface(mDocShell);
|
||||
NS_ASSERTION(treeItem, "docshell must be a treeitem!");
|
||||
|
@ -1332,179 +1123,3 @@ nsFrameLoader::CheckForRecursiveLoad(nsIURI* aURI)
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::UpdatePositionAndSize(nsIFrame *aIFrame)
|
||||
{
|
||||
#ifdef MOZ_IPC
|
||||
if (mRemoteFrame) {
|
||||
if (mChildProcess) {
|
||||
nsIntSize size = GetSubDocumentSize(aIFrame);
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
if (mRemoteSocket) {
|
||||
GtkAllocation alloc = {0, 0, size.width, size.height };
|
||||
gtk_widget_size_allocate(mRemoteSocket, &alloc);
|
||||
}
|
||||
#endif
|
||||
|
||||
mChildProcess->Move(0, 0, size.width, size.height);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
return UpdateBaseWindowPositionAndSize(aIFrame);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFrameLoader::UpdateBaseWindowPositionAndSize(nsIFrame *aIFrame)
|
||||
{
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
GetDocShell(getter_AddRefs(docShell));
|
||||
nsCOMPtr<nsIBaseWindow> baseWindow(do_QueryInterface(docShell));
|
||||
|
||||
// resize the sub document
|
||||
if (baseWindow) {
|
||||
PRInt32 x = 0;
|
||||
PRInt32 y = 0;
|
||||
|
||||
nsWeakFrame weakFrame(aIFrame);
|
||||
|
||||
baseWindow->GetPositionAndSize(&x, &y, nsnull, nsnull);
|
||||
|
||||
if (!weakFrame.IsAlive()) {
|
||||
// GetPositionAndSize() killed us
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIntSize size = GetSubDocumentSize(aIFrame);
|
||||
|
||||
baseWindow->SetPositionAndSize(x, y, size.width, size.height, PR_FALSE);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIntSize
|
||||
nsFrameLoader::GetSubDocumentSize(const nsIFrame *aIFrame)
|
||||
{
|
||||
nsAutoDisableGetUsedXAssertions disableAssert;
|
||||
nsSize docSizeAppUnits;
|
||||
nsPresContext* presContext = aIFrame->PresContext();
|
||||
nsCOMPtr<nsIDOMHTMLFrameElement> frameElem =
|
||||
do_QueryInterface(aIFrame->GetContent());
|
||||
if (frameElem) {
|
||||
docSizeAppUnits = aIFrame->GetSize();
|
||||
} else {
|
||||
docSizeAppUnits = aIFrame->GetContentRect().Size();
|
||||
}
|
||||
return nsIntSize(presContext->AppUnitsToDevPixels(docSizeAppUnits.width),
|
||||
presContext->AppUnitsToDevPixels(docSizeAppUnits.height));
|
||||
}
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
bool
|
||||
nsFrameLoader::TryNewProcess()
|
||||
{
|
||||
NS_ASSERTION(!mChildProcess, "TryNewProcess called with a process already?");
|
||||
|
||||
nsIDocument* doc = mOwnerContent->GetDocument();
|
||||
if (!doc) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (doc->GetDisplayDocument()) {
|
||||
// Don't allow subframe loads in external reference documents
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWebNavigation> parentAsWebNav =
|
||||
do_GetInterface(doc->GetScriptGlobalObject());
|
||||
|
||||
if (!parentAsWebNav) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> parentAsItem(do_QueryInterface(parentAsWebNav));
|
||||
|
||||
PRInt32 parentType;
|
||||
parentAsItem->GetItemType(&parentType);
|
||||
|
||||
if (parentType != nsIDocShellTreeItem::typeChrome) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mOwnerContent->IsXUL()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsAutoString value;
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::type, value);
|
||||
|
||||
if (!value.LowerCaseEqualsLiteral("content") &&
|
||||
!StringBeginsWith(value, NS_LITERAL_STRING("content-"),
|
||||
nsCaseInsensitiveStringComparator())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mChildProcess = ContentProcessParent::GetSingleton()->CreateTab();
|
||||
if (mChildProcess) {
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mOwnerContent);
|
||||
mChildProcess->SetOwnerElement(element);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
mozilla::dom::PIFrameEmbeddingParent*
|
||||
nsFrameLoader::GetChildProcess()
|
||||
{
|
||||
return mChildProcess;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::ActivateRemoteFrame() {
|
||||
#ifdef MOZ_IPC
|
||||
if (mChildProcess) {
|
||||
mChildProcess->Activate();
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::SendCrossProcessMouseEvent(const nsAString& aType,
|
||||
float aX,
|
||||
float aY,
|
||||
PRInt32 aButton,
|
||||
PRInt32 aClickCount,
|
||||
PRInt32 aModifiers,
|
||||
PRBool aIgnoreRootScrollFrame)
|
||||
{
|
||||
#ifdef MOZ_IPC
|
||||
if (mChildProcess) {
|
||||
mChildProcess->SendMouseEvent(aType, aX, aY, aButton,
|
||||
aClickCount, aModifiers,
|
||||
aIgnoreRootScrollFrame);
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::ActivateFrameEvent(const nsAString& aType,
|
||||
PRBool aCapture)
|
||||
{
|
||||
#ifdef MOZ_IPC
|
||||
if (mChildProcess) {
|
||||
mChildProcess->SendactivateFrameEvent(nsString(aType), aCapture);
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,27 +47,11 @@
|
|||
#include "nsIDocShell.h"
|
||||
#include "nsStringFwd.h"
|
||||
#include "nsIFrameLoader.h"
|
||||
#include "nsSize.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsIURI;
|
||||
class nsIFrameFrame;
|
||||
class nsIView;
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class TabParent;
|
||||
class PIFrameEmbeddingParent;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
typedef struct _GtkWidget GtkWidget;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
class nsFrameLoader : public nsIFrameLoader
|
||||
{
|
||||
|
@ -79,13 +63,6 @@ protected:
|
|||
mDestroyCalled(PR_FALSE),
|
||||
mNeedsAsyncDestroy(PR_FALSE),
|
||||
mInSwap(PR_FALSE)
|
||||
#ifdef MOZ_IPC
|
||||
, mRemoteFrame(false)
|
||||
, mChildProcess(nsnull)
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
, mRemoteSocket(nsnull)
|
||||
#endif
|
||||
#endif
|
||||
{}
|
||||
|
||||
public:
|
||||
|
@ -125,41 +102,12 @@ public:
|
|||
nsresult SwapWithOtherLoader(nsFrameLoader* aOther,
|
||||
nsRefPtr<nsFrameLoader>& aFirstToSwap,
|
||||
nsRefPtr<nsFrameLoader>& aSecondToSwap);
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
mozilla::dom::PIFrameEmbeddingParent* GetChildProcess();
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
bool ShouldUseRemoteProcess();
|
||||
#endif
|
||||
|
||||
/**
|
||||
* If we are an IPC frame, set mRemoteFrame. Otherwise, create and
|
||||
* initialize mDocShell.
|
||||
*/
|
||||
nsresult MaybeCreateDocShell();
|
||||
void GetURL(nsString& aURL);
|
||||
|
||||
// Properly retrieves documentSize of any subdocument type.
|
||||
NS_HIDDEN_(nsIntSize) GetSubDocumentSize(const nsIFrame *aIFrame);
|
||||
|
||||
// Updates the subdocument position and size. This gets called only
|
||||
// when we have our own in-process DocShell.
|
||||
NS_HIDDEN_(nsresult) UpdateBaseWindowPositionAndSize(nsIFrame *aIFrame);
|
||||
NS_HIDDEN_(nsresult) EnsureDocShell();
|
||||
NS_HIDDEN_(void) GetURL(nsString& aURL);
|
||||
nsresult CheckURILoad(nsIURI* aURI);
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
// True means new process started; nothing else to do
|
||||
bool TryNewProcess();
|
||||
|
||||
// Do the hookup necessary to actually show a remote frame once the view and
|
||||
// widget are available.
|
||||
bool ShowRemoteFrame(nsIFrameFrame* frame, nsIView* view);
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIDocShell> mDocShell;
|
||||
nsCOMPtr<nsIURI> mURIToLoad;
|
||||
nsIContent *mOwnerContent; // WEAK
|
||||
|
@ -168,16 +116,6 @@ private:
|
|||
PRPackedBool mDestroyCalled : 1;
|
||||
PRPackedBool mNeedsAsyncDestroy : 1;
|
||||
PRPackedBool mInSwap : 1;
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
bool mRemoteFrame;
|
||||
// XXX leaking
|
||||
mozilla::dom::TabParent* mChildProcess;
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
GtkWidget* mRemoteSocket;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1699,9 +1699,6 @@ GK_ATOM(TypingTxnName, "Typing")
|
|||
GK_ATOM(IMETxnName, "IME")
|
||||
GK_ATOM(DeleteTxnName, "Deleting")
|
||||
|
||||
// IPC stuff
|
||||
GK_ATOM(Remote, "remote")
|
||||
|
||||
// Names for system metrics
|
||||
GK_ATOM(scrollbar_start_backward, "scrollbar-start-backward")
|
||||
GK_ATOM(scrollbar_start_forward, "scrollbar-start-forward")
|
||||
|
|
|
@ -486,15 +486,6 @@ public:
|
|||
{
|
||||
return mInner->SetTrusted(aTrusted);
|
||||
}
|
||||
virtual void Serialize(IPC::Message* aMsg,
|
||||
PRBool aSerializeInterfaceType)
|
||||
{
|
||||
mInner->Serialize(aMsg, aSerializeInterfaceType);
|
||||
}
|
||||
virtual PRBool Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
{
|
||||
return mInner->Deserialize(aMsg, aIter);
|
||||
}
|
||||
|
||||
protected:
|
||||
// Use nsDOMProgressEvent so that we can forward
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Fennec Electrolysis.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef mozilla_dom_DocumentRendererChild
|
||||
#define mozilla_dom_DocumentRendererChild
|
||||
|
||||
#include "mozilla/ipc/PDocumentRendererChild.h"
|
||||
#include "nsICanvasRenderingContextInternal.h"
|
||||
#include "nsString.h"
|
||||
#include "gfxContext.h"
|
||||
|
||||
class nsIDOMWindow;
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
|
||||
class DocumentRendererChild : public PDocumentRendererChild
|
||||
{
|
||||
public:
|
||||
DocumentRendererChild();
|
||||
virtual ~DocumentRendererChild();
|
||||
|
||||
bool RenderDocument(nsIDOMWindow *window, const PRInt32& x, const PRInt32& y, const PRInt32& w, const PRInt32& h,
|
||||
const nsString& bgcolor, const PRUint32& flags, const PRBool& flush,
|
||||
PRUint32& _width, PRUint32& _height, nsCString& data);
|
||||
|
||||
private:
|
||||
|
||||
DISALLOW_EVIL_CONSTRUCTORS(DocumentRendererChild);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,70 +0,0 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Fennec Electrolysis.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef mozilla_dom_DocumentRendererParent
|
||||
#define mozilla_dom_DocumentRendererParent
|
||||
|
||||
#include "mozilla/ipc/PDocumentRendererParent.h"
|
||||
#include "nsICanvasRenderingContextInternal.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "gfxContext.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
|
||||
class DocumentRendererParent : public PDocumentRendererParent
|
||||
{
|
||||
public:
|
||||
DocumentRendererParent();
|
||||
virtual ~DocumentRendererParent();
|
||||
|
||||
void SetCanvasContext(nsICanvasRenderingContextInternal* aCanvas,
|
||||
gfxContext* ctx);
|
||||
void DrawToCanvas(PRUint32 aWidth, PRUint32 aHeight,
|
||||
const nsCString& aData);
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsICanvasRenderingContextInternal> mCanvas;
|
||||
nsRefPtr<gfxContext> mCanvasContext;
|
||||
|
||||
DISALLOW_EVIL_CONSTRUCTORS(DocumentRendererParent);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -45,19 +45,12 @@ include $(DEPTH)/config/autoconf.mk
|
|||
MODULE = content
|
||||
XPIDL_MODULE = content_canvas
|
||||
|
||||
EXPORTS_NAMESPACES = mozilla/ipc
|
||||
|
||||
EXPORTS = \
|
||||
nsICanvasRenderingContextInternal.h \
|
||||
nsICanvasElement.h \
|
||||
WebGLArray.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS_mozilla/ipc = \
|
||||
DocumentRendererChild.h \
|
||||
DocumentRendererParent.h \
|
||||
$(NULL)
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsICanvasGLPrivate.idl \
|
||||
$(NULL)
|
||||
|
|
|
@ -87,9 +87,6 @@ public:
|
|||
// dst alpha is always 1.0. If this is never called, the context
|
||||
// defaults to false (not opaque).
|
||||
NS_IMETHOD SetIsOpaque(PRBool isOpaque) = 0;
|
||||
|
||||
// Redraw the dirty rectangle of this canvas.
|
||||
NS_IMETHOD Redraw(const gfxRect &dirty) = 0;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsICanvasRenderingContextInternal,
|
||||
|
|
|
@ -1,147 +0,0 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Fennec Electrolysis.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "base/basictypes.h"
|
||||
|
||||
#include "gfxImageSurface.h"
|
||||
#include "gfxPattern.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDocShellTreeNode.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsICSSParser.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsColor.h"
|
||||
#include "gfxContext.h"
|
||||
#include "gfxImageSurface.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
|
||||
#include "mozilla/ipc/DocumentRendererChild.h"
|
||||
|
||||
using namespace mozilla::ipc;
|
||||
|
||||
DocumentRendererChild::DocumentRendererChild()
|
||||
{}
|
||||
|
||||
DocumentRendererChild::~DocumentRendererChild()
|
||||
{}
|
||||
|
||||
static void
|
||||
FlushLayoutForTree(nsIDOMWindow* aWindow)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> piWin = do_QueryInterface(aWindow);
|
||||
if (!piWin)
|
||||
return;
|
||||
|
||||
// Note that because FlushPendingNotifications flushes parents, this
|
||||
// is O(N^2) in docshell tree depth. However, the docshell tree is
|
||||
// usually pretty shallow.
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
aWindow->GetDocument(getter_AddRefs(domDoc));
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
|
||||
if (doc) {
|
||||
doc->FlushPendingNotifications(Flush_Layout);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeNode> node =
|
||||
do_QueryInterface(piWin->GetDocShell());
|
||||
if (node) {
|
||||
PRInt32 i = 0, i_end;
|
||||
node->GetChildCount(&i_end);
|
||||
for (; i < i_end; ++i) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> item;
|
||||
node->GetChildAt(i, getter_AddRefs(item));
|
||||
nsCOMPtr<nsIDOMWindow> win = do_GetInterface(item);
|
||||
if (win) {
|
||||
FlushLayoutForTree(win);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
DocumentRendererChild::RenderDocument(nsIDOMWindow *window, const PRInt32& x, const PRInt32& y, const PRInt32& w, const PRInt32& h,
|
||||
const nsString& aBGColor, const PRUint32& flags, const PRBool& flush,
|
||||
PRUint32& _width, PRUint32& _height, nsCString& data)
|
||||
{
|
||||
if (flush)
|
||||
FlushLayoutForTree(window);
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(window);
|
||||
if (win) {
|
||||
nsIDocShell* docshell = win->GetDocShell();
|
||||
if (docshell) {
|
||||
docshell->GetPresContext(getter_AddRefs(presContext));
|
||||
}
|
||||
}
|
||||
if (!presContext)
|
||||
return false;
|
||||
|
||||
nscolor bgColor;
|
||||
nsCOMPtr<nsICSSParser> parser = do_CreateInstance("@mozilla.org/content/css-parser;1");
|
||||
nsresult rv = parser->ParseColorString(PromiseFlatString(aBGColor),
|
||||
nsnull, 0, &bgColor);
|
||||
if (NS_FAILED(rv))
|
||||
return false;
|
||||
|
||||
nsIPresShell* presShell = presContext->PresShell();
|
||||
|
||||
nsRect r(x, y, w, h);
|
||||
|
||||
_width = nsPresContext::AppUnitsToIntCSSPixels(w);
|
||||
_height = nsPresContext::AppUnitsToIntCSSPixels(h);
|
||||
|
||||
// Draw directly into the output array.
|
||||
data.SetLength(_width * _height * 4);
|
||||
nsRefPtr<gfxImageSurface> surf = new gfxImageSurface(reinterpret_cast<PRUint8*>(const_cast<char*>(data.get())),
|
||||
gfxIntSize(_width, _height),
|
||||
4 * _width, gfxASurface::ImageFormatARGB32);
|
||||
nsRefPtr<gfxContext> ctx = new gfxContext(surf);
|
||||
|
||||
PRBool oldDisableValue = nsLayoutUtils::sDisableGetUsedXAssertions;
|
||||
nsLayoutUtils::sDisableGetUsedXAssertions = oldDisableValue || !flush;
|
||||
presShell->RenderDocument(r, flags, bgColor, ctx);
|
||||
nsLayoutUtils::sDisableGetUsedXAssertions = oldDisableValue;
|
||||
|
||||
return true;
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Fennec Electrolysis.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "mozilla/ipc/DocumentRendererParent.h"
|
||||
#include "gfxImageSurface.h"
|
||||
#include "gfxPattern.h"
|
||||
|
||||
using namespace mozilla::ipc;
|
||||
|
||||
DocumentRendererParent::DocumentRendererParent()
|
||||
{}
|
||||
|
||||
DocumentRendererParent::~DocumentRendererParent()
|
||||
{}
|
||||
|
||||
void DocumentRendererParent::SetCanvasContext(nsICanvasRenderingContextInternal* aCanvas,
|
||||
gfxContext* ctx)
|
||||
{
|
||||
mCanvas = aCanvas;
|
||||
mCanvasContext = ctx;
|
||||
}
|
||||
|
||||
void DocumentRendererParent::DrawToCanvas(PRUint32 aWidth, PRUint32 aHeight,
|
||||
const nsCString& aData)
|
||||
{
|
||||
if (!mCanvas || !mCanvasContext)
|
||||
return;
|
||||
|
||||
nsRefPtr<gfxImageSurface> surf = new gfxImageSurface(reinterpret_cast<PRUint8*>(const_cast<char*>(aData.Data())),
|
||||
gfxIntSize(aWidth, aHeight),
|
||||
aWidth * 4,
|
||||
gfxASurface::ImageFormatARGB32);
|
||||
nsRefPtr<gfxPattern> pat = new gfxPattern(surf);
|
||||
|
||||
mCanvasContext->NewPath();
|
||||
mCanvasContext->PixelSnappedRectangleAndSetPattern(gfxRect(0, 0, aWidth, aHeight), pat);
|
||||
mCanvasContext->Fill();
|
||||
|
||||
// get rid of the pattern surface ref, because aData is very likely to go away shortly
|
||||
mCanvasContext->SetColor(gfxRGBA(1,1,1,1));
|
||||
|
||||
gfxRect damageRect = mCanvasContext->UserToDevice(gfxRect(0, 0, aWidth, aHeight));
|
||||
mCanvas->Redraw(damageRect);
|
||||
}
|
|
@ -53,13 +53,6 @@ CPPSRCS = \
|
|||
nsCanvasRenderingContext2D.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_IPC
|
||||
CPPSRCS += \
|
||||
DocumentRendererParent.cpp \
|
||||
DocumentRendererChild.cpp \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
# Canvas 3D Pieces
|
||||
|
||||
ifdef MOZ_WEBGL
|
||||
|
@ -108,7 +101,6 @@ endif
|
|||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
||||
|
||||
CXXFLAGS += $(MOZ_CAIRO_CFLAGS) $(TK_CFLAGS)
|
||||
|
||||
|
|
|
@ -245,7 +245,6 @@ public:
|
|||
nsIInputStream **aStream);
|
||||
NS_IMETHOD GetThebesSurface(gfxASurface **surface);
|
||||
NS_IMETHOD SetIsOpaque(PRBool b) { return NS_OK; };
|
||||
NS_IMETHOD Redraw(const gfxRect&) { return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
protected:
|
||||
GLES20Wrap *gl;
|
||||
|
|
|
@ -37,12 +37,6 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
# include "base/basictypes.h"
|
||||
#endif
|
||||
|
||||
#include "nsIDOMXULElement.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define _USE_MATH_DEFINES
|
||||
#endif
|
||||
|
@ -109,20 +103,10 @@
|
|||
|
||||
#include "nsFrameManager.h"
|
||||
|
||||
#include "nsFrameLoader.h"
|
||||
|
||||
#include "nsBidiPresUtils.h"
|
||||
|
||||
#include "CanvasUtils.h"
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
# include "mozilla/ipc/PDocumentRendererParent.h"
|
||||
# include "mozilla/dom/PIFrameEmbeddingParent.h"
|
||||
# include "mozilla/ipc/DocumentRendererParent.h"
|
||||
// windows.h (included by chromium code) defines this, in its infinite wisdom
|
||||
# undef DrawText
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
#ifndef M_PI
|
||||
|
@ -327,6 +311,8 @@ public:
|
|||
virtual ~nsCanvasRenderingContext2D();
|
||||
|
||||
nsresult Redraw();
|
||||
// this rect is in CSS pixels
|
||||
nsresult Redraw(const gfxRect& r);
|
||||
|
||||
// nsICanvasRenderingContextInternal
|
||||
NS_IMETHOD SetCanvasElement(nsICanvasElement* aParentCanvas);
|
||||
|
@ -338,8 +324,6 @@ public:
|
|||
nsIInputStream **aStream);
|
||||
NS_IMETHOD GetThebesSurface(gfxASurface **surface);
|
||||
NS_IMETHOD SetIsOpaque(PRBool isOpaque);
|
||||
// this rect is in CSS pixels
|
||||
NS_IMETHOD Redraw(const gfxRect &r);
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
|
@ -864,7 +848,7 @@ nsCanvasRenderingContext2D::Redraw()
|
|||
return mCanvasElement->InvalidateFrame();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsCanvasRenderingContext2D::Redraw(const gfxRect& r)
|
||||
{
|
||||
if (!mCanvasElement)
|
||||
|
@ -3325,83 +3309,6 @@ nsCanvasRenderingContext2D::DrawWindow(nsIDOMWindow* aWindow, float aX, float aY
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::AsyncDrawXULElement(nsIDOMXULElement* aElem, float aX, float aY,
|
||||
float aW, float aH,
|
||||
const nsAString& aBGColor,
|
||||
PRUint32 flags)
|
||||
{
|
||||
NS_ENSURE_ARG(aElem != nsnull);
|
||||
|
||||
// We can't allow web apps to call this until we fix at least the
|
||||
// following potential security issues:
|
||||
// -- rendering cross-domain IFRAMEs and then extracting the results
|
||||
// -- rendering the user's theme and then extracting the results
|
||||
// -- rendering native anonymous content (e.g., file input paths;
|
||||
// scrollbars should be allowed)
|
||||
if (!nsContentUtils::IsCallerTrustedForRead()) {
|
||||
// not permitted to use DrawWindow
|
||||
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFrameLoaderOwner> loaderOwner = do_QueryInterface(aElem);
|
||||
if (!loaderOwner)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsFrameLoader> frameloader = loaderOwner->GetFrameLoader();
|
||||
if (!frameloader)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
mozilla::dom::PIFrameEmbeddingParent *child = frameloader->GetChildProcess();
|
||||
if (!child) {
|
||||
nsCOMPtr<nsIDOMWindow> window =
|
||||
do_GetInterface(frameloader->GetExistingDocShell());
|
||||
if (!window)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return DrawWindow(window, aX, aY, aW, aH, aBGColor, flags);
|
||||
}
|
||||
|
||||
// protect against too-large surfaces that will cause allocation
|
||||
// or overflow issues
|
||||
if (!gfxASurface::CheckSurfaceSize(gfxIntSize(aW, aH), 0xffff))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRBool flush =
|
||||
(flags & nsIDOMCanvasRenderingContext2D::DRAWWINDOW_DO_NOT_FLUSH) == 0;
|
||||
|
||||
PRUint32 renderDocFlags = nsIPresShell::RENDER_IGNORE_VIEWPORT_SCROLLING;
|
||||
if (flags & nsIDOMCanvasRenderingContext2D::DRAWWINDOW_DRAW_CARET) {
|
||||
renderDocFlags |= nsIPresShell::RENDER_CARET;
|
||||
}
|
||||
if (flags & nsIDOMCanvasRenderingContext2D::DRAWWINDOW_DRAW_VIEW) {
|
||||
renderDocFlags &= ~nsIPresShell::RENDER_IGNORE_VIEWPORT_SCROLLING;
|
||||
}
|
||||
|
||||
PRInt32 x = nsPresContext::CSSPixelsToAppUnits(aX),
|
||||
y = nsPresContext::CSSPixelsToAppUnits(aY),
|
||||
w = nsPresContext::CSSPixelsToAppUnits(aW),
|
||||
h = nsPresContext::CSSPixelsToAppUnits(aH);
|
||||
|
||||
mozilla::ipc::PDocumentRendererParent *pdocrender =
|
||||
child->SendPDocumentRendererConstructor(x, y, w, h, nsString(aBGColor), renderDocFlags, flush);
|
||||
mozilla::ipc::DocumentRendererParent *docrender = static_cast<mozilla::ipc::DocumentRendererParent *>(pdocrender);
|
||||
|
||||
docrender->SetCanvasContext(this, mThebes);
|
||||
|
||||
return NS_OK;
|
||||
#else
|
||||
nsCOMPtr<nsIDOMWindow> window =
|
||||
do_GetInterface(frameloader->GetExistingDocShell());
|
||||
if (!window)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return DrawWindow(window, aX, aY, aW, aH, aBGColor, flags);
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// device pixel getting/setting
|
||||
//
|
||||
|
|
|
@ -41,8 +41,8 @@
|
|||
#include "nsISupports.h"
|
||||
|
||||
#define NS_IPRIVATEDOMEVENT_IID \
|
||||
{ 0x26f5f0e9, 0x2960, 0x4405, \
|
||||
{ 0xa1, 0x7e, 0xd8, 0x9f, 0xb0, 0xd9, 0x4c, 0x71 } }
|
||||
{ 0x1da4c501, 0xe87e, 0x49b4, \
|
||||
{ 0xb0, 0x49, 0xdf, 0x9f, 0xc3, 0x6b, 0x56, 0xd4 } }
|
||||
|
||||
class nsIDOMEventTarget;
|
||||
class nsIDOMEvent;
|
||||
|
@ -50,9 +50,6 @@ class nsEvent;
|
|||
class nsCommandEvent;
|
||||
class nsPresContext;
|
||||
class nsInvalidateRequestList;
|
||||
namespace IPC {
|
||||
class Message;
|
||||
}
|
||||
|
||||
class nsIPrivateDOMEvent : public nsISupports
|
||||
{
|
||||
|
@ -64,9 +61,6 @@ public:
|
|||
NS_IMETHOD_(PRBool) IsDispatchStopped() = 0;
|
||||
NS_IMETHOD_(nsEvent*) GetInternalNSEvent() = 0;
|
||||
NS_IMETHOD SetTrusted(PRBool aTrusted) = 0;
|
||||
virtual void Serialize(IPC::Message* aMsg,
|
||||
PRBool aSerializeInterfaceType) = 0;
|
||||
virtual PRBool Deserialize(const IPC::Message* aMsg, void** aIter) = 0;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIPrivateDOMEvent, NS_IPRIVATEDOMEVENT_IID)
|
||||
|
|
|
@ -86,11 +86,9 @@ CPPSRCS = \
|
|||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
LOCAL_INCLUDES += \
|
||||
LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/../../base/src \
|
||||
-I$(srcdir)/../../html/base/src \
|
||||
-I$(srcdir)/../../xul/content/src \
|
||||
|
|
|
@ -37,10 +37,6 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
#include "base/basictypes.h"
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#endif
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsEventStateManager.h"
|
||||
|
@ -1537,61 +1533,6 @@ nsDOMEvent::GetPreventDefault(PRBool* aReturn)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMEvent::Serialize(IPC::Message* aMsg, PRBool aSerializeInterfaceType)
|
||||
{
|
||||
#ifdef MOZ_IPC
|
||||
if (aSerializeInterfaceType) {
|
||||
IPC::WriteParam(aMsg, NS_LITERAL_STRING("event"));
|
||||
}
|
||||
|
||||
nsString type;
|
||||
GetType(type);
|
||||
IPC::WriteParam(aMsg, type);
|
||||
|
||||
PRBool bubbles = PR_FALSE;
|
||||
GetBubbles(&bubbles);
|
||||
IPC::WriteParam(aMsg, bubbles);
|
||||
|
||||
PRBool cancelable = PR_FALSE;
|
||||
GetCancelable(&cancelable);
|
||||
IPC::WriteParam(aMsg, cancelable);
|
||||
|
||||
PRBool trusted = PR_FALSE;
|
||||
GetIsTrusted(&trusted);
|
||||
IPC::WriteParam(aMsg, trusted);
|
||||
|
||||
// No timestamp serialization for now!
|
||||
#endif
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsDOMEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
{
|
||||
#ifdef MOZ_IPC
|
||||
nsString type;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &type), PR_FALSE);
|
||||
|
||||
PRBool bubbles = PR_FALSE;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &bubbles), PR_FALSE);
|
||||
|
||||
PRBool cancelable = PR_FALSE;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &cancelable), PR_FALSE);
|
||||
|
||||
PRBool trusted = PR_FALSE;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &trusted), PR_FALSE);
|
||||
|
||||
nsresult rv = InitEvent(type, bubbles, cancelable);
|
||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
SetTrusted(trusted);
|
||||
|
||||
return PR_TRUE;
|
||||
#else
|
||||
return PR_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
nsresult NS_NewDOMEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsPresContext* aPresContext,
|
||||
nsEvent *aEvent)
|
||||
|
|
|
@ -193,9 +193,6 @@ public:
|
|||
NS_IMETHOD_(nsEvent*) GetInternalNSEvent();
|
||||
NS_IMETHOD SetTrusted(PRBool aTrusted);
|
||||
|
||||
virtual void Serialize(IPC::Message* aMsg, PRBool aSerializeInterfaceType);
|
||||
virtual PRBool Deserialize(const IPC::Message* aMsg, void** aIter);
|
||||
|
||||
static PopupControlState GetEventPopupControlState(nsEvent *aEvent);
|
||||
|
||||
static void PopupAllowedEventsChanged();
|
||||
|
|
|
@ -36,10 +36,6 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
#include "base/basictypes.h"
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#endif
|
||||
#include "nsDOMNotifyPaintEvent.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsClientRect.h"
|
||||
|
@ -146,50 +142,6 @@ nsDOMNotifyPaintEvent::GetPaintRequests(nsIDOMPaintRequestList** aResult)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
void
|
||||
nsDOMNotifyPaintEvent::Serialize(IPC::Message* aMsg,
|
||||
PRBool aSerializeInterfaceType)
|
||||
{
|
||||
if (aSerializeInterfaceType) {
|
||||
IPC::WriteParam(aMsg, NS_LITERAL_STRING("notifypaintevent"));
|
||||
}
|
||||
|
||||
nsDOMEvent::Serialize(aMsg, PR_FALSE);
|
||||
|
||||
PRUint32 length = mInvalidateRequests.Length();
|
||||
IPC::WriteParam(aMsg, length);
|
||||
for (PRUint32 i = 0; i < length; ++i) {
|
||||
IPC::WriteParam(aMsg, mInvalidateRequests[i].mRect.x);
|
||||
IPC::WriteParam(aMsg, mInvalidateRequests[i].mRect.y);
|
||||
IPC::WriteParam(aMsg, mInvalidateRequests[i].mRect.width);
|
||||
IPC::WriteParam(aMsg, mInvalidateRequests[i].mRect.height);
|
||||
IPC::WriteParam(aMsg, mInvalidateRequests[i].mFlags);
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsDOMNotifyPaintEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
{
|
||||
NS_ENSURE_TRUE(nsDOMEvent::Deserialize(aMsg, aIter), PR_FALSE);
|
||||
|
||||
PRUint32 length = 0;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &length), PR_FALSE);
|
||||
mInvalidateRequests.SetCapacity(length);
|
||||
for (PRUint32 i = 0; i < length; ++i) {
|
||||
nsInvalidateRequestList::Request req;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &req.mRect.x), PR_FALSE);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &req.mRect.y), PR_FALSE);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &req.mRect.width), PR_FALSE);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &req.mRect.height), PR_FALSE);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &req.mFlags), PR_FALSE);
|
||||
mInvalidateRequests.AppendElement(req);
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult NS_NewDOMNotifyPaintEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsPresContext* aPresContext,
|
||||
nsEvent *aEvent,
|
||||
|
|
|
@ -61,10 +61,6 @@ public:
|
|||
// Forward to base class
|
||||
NS_FORWARD_TO_NSDOMEVENT
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
virtual void Serialize(IPC::Message* aMsg, PRBool aSerializeInterfaceType);
|
||||
virtual PRBool Deserialize(const IPC::Message* aMsg, void** aIter);
|
||||
#endif
|
||||
private:
|
||||
nsRegion GetRegion();
|
||||
|
||||
|
|
|
@ -35,10 +35,6 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
#include "base/basictypes.h"
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#endif
|
||||
#include "nsDOMScrollAreaEvent.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsClientRect.h"
|
||||
|
@ -110,64 +106,6 @@ nsDOMScrollAreaEvent::InitScrollAreaEvent(const nsAString &aEventType,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
void
|
||||
nsDOMScrollAreaEvent::Serialize(IPC::Message* aMsg,
|
||||
PRBool aSerializeInterfaceType)
|
||||
{
|
||||
if (aSerializeInterfaceType) {
|
||||
IPC::WriteParam(aMsg, NS_LITERAL_STRING("scrollareaevent"));
|
||||
}
|
||||
|
||||
nsDOMUIEvent::Serialize(aMsg, PR_FALSE);
|
||||
|
||||
NS_ASSERTION(sizeof(PRInt32) == sizeof(float),
|
||||
"PRInt32 and float should be the same size!");
|
||||
|
||||
float x = 0.0f;
|
||||
GetX(&x);
|
||||
IPC::WriteParam(aMsg, reinterpret_cast<PRInt32&>(x));
|
||||
|
||||
float y = 0.0f;
|
||||
GetY(&y);
|
||||
IPC::WriteParam(aMsg, reinterpret_cast<PRInt32&>(y));
|
||||
|
||||
float width = 0.0f;
|
||||
GetWidth(&width);
|
||||
IPC::WriteParam(aMsg, reinterpret_cast<PRInt32&>(width));
|
||||
|
||||
float height = 0.0f;
|
||||
GetHeight(&height);
|
||||
IPC::WriteParam(aMsg, reinterpret_cast<PRInt32&>(height));
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsDOMScrollAreaEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
{
|
||||
NS_ENSURE_TRUE(nsDOMUIEvent::Deserialize(aMsg, aIter), PR_FALSE);
|
||||
|
||||
PRInt32 x_;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &x_), PR_FALSE);
|
||||
float x = reinterpret_cast<float&>(x_);
|
||||
|
||||
PRInt32 y_;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &y_), PR_FALSE);
|
||||
float y = reinterpret_cast<float&>(y_);
|
||||
|
||||
PRInt32 width_;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &width_), PR_FALSE);
|
||||
float width = reinterpret_cast<float&>(width_);
|
||||
|
||||
PRInt32 height_;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &height_), PR_FALSE);
|
||||
float height = reinterpret_cast<float&>(height_);
|
||||
|
||||
mClientArea.SetRect(x, y, width, height);
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
NS_NewDOMScrollAreaEvent(nsIDOMEvent **aInstancePtrResult,
|
||||
nsPresContext *aPresContext,
|
||||
|
|
|
@ -58,10 +58,6 @@ public:
|
|||
|
||||
NS_FORWARD_TO_NSDOMUIEVENT
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
virtual void Serialize(IPC::Message* aMsg, PRBool aSerializeInterfaceType);
|
||||
virtual PRBool Deserialize(const IPC::Message* aMsg, void** aIter);
|
||||
#endif
|
||||
protected:
|
||||
nsClientRect mClientArea;
|
||||
};
|
||||
|
|
|
@ -37,10 +37,6 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
#include "base/basictypes.h"
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#endif
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "nsIPresShell.h"
|
||||
|
@ -398,30 +394,6 @@ nsDOMUIEvent::DuplicatePrivateData()
|
|||
return rv;
|
||||
}
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
void
|
||||
nsDOMUIEvent::Serialize(IPC::Message* aMsg, PRBool aSerializeInterfaceType)
|
||||
{
|
||||
if (aSerializeInterfaceType) {
|
||||
IPC::WriteParam(aMsg, NS_LITERAL_STRING("uievent"));
|
||||
}
|
||||
|
||||
nsDOMEvent::Serialize(aMsg, PR_FALSE);
|
||||
|
||||
PRInt32 detail = 0;
|
||||
GetDetail(&detail);
|
||||
IPC::WriteParam(aMsg, detail);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsDOMUIEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
{
|
||||
NS_ENSURE_TRUE(nsDOMEvent::Deserialize(aMsg, aIter), PR_FALSE);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &mDetail), PR_FALSE);
|
||||
return PR_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsPresContext* aPresContext,
|
||||
nsGUIEvent *aEvent)
|
||||
|
|
|
@ -64,10 +64,7 @@ public:
|
|||
|
||||
// nsIPrivateDOMEvent interface
|
||||
NS_IMETHOD DuplicatePrivateData();
|
||||
#ifdef MOZ_IPC
|
||||
virtual void Serialize(IPC::Message* aMsg, PRBool aSerializeInterfaceType);
|
||||
virtual PRBool Deserialize(const IPC::Message* aMsg, void** aIter);
|
||||
#endif
|
||||
|
||||
// nsIPrivateCompositionEvent interface
|
||||
NS_IMETHOD GetCompositionReply(nsTextEventReply** aReply);
|
||||
|
||||
|
|
|
@ -1,159 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim: set sw=4 ts=8 et tw=80 : */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Content App.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "ContentProcessChild.h"
|
||||
#include "TabChild.h"
|
||||
|
||||
#include "mozilla/ipc/TestShellChild.h"
|
||||
#include "mozilla/net/NeckoChild.h"
|
||||
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
#include "base/message_loop.h"
|
||||
#include "base/task.h"
|
||||
|
||||
using namespace mozilla::ipc;
|
||||
using namespace mozilla::net;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
ContentProcessChild* ContentProcessChild::sSingleton;
|
||||
|
||||
ContentProcessChild::ContentProcessChild()
|
||||
: mQuit(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
ContentProcessChild::~ContentProcessChild()
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
ContentProcessChild::Init(MessageLoop* aIOLoop,
|
||||
base::ProcessHandle aParentHandle,
|
||||
IPC::Channel* aChannel)
|
||||
{
|
||||
NS_ASSERTION(!sSingleton, "only one ContentProcessChild per child");
|
||||
|
||||
Open(aChannel, aParentHandle, aIOLoop);
|
||||
sSingleton = this;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
PIFrameEmbeddingChild*
|
||||
ContentProcessChild::AllocPIFrameEmbedding()
|
||||
{
|
||||
nsRefPtr<TabChild> iframe = new TabChild();
|
||||
NS_ENSURE_TRUE(iframe && NS_SUCCEEDED(iframe->Init()) &&
|
||||
mIFrames.AppendElement(iframe),
|
||||
nsnull);
|
||||
return iframe.forget().get();
|
||||
}
|
||||
|
||||
bool
|
||||
ContentProcessChild::DeallocPIFrameEmbedding(PIFrameEmbeddingChild* iframe)
|
||||
{
|
||||
if (mIFrames.RemoveElement(iframe)) {
|
||||
TabChild* child = static_cast<TabChild*>(iframe);
|
||||
NS_RELEASE(child);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
PTestShellChild*
|
||||
ContentProcessChild::AllocPTestShell()
|
||||
{
|
||||
PTestShellChild* testshell = new TestShellChild();
|
||||
if (testshell && mTestShells.AppendElement(testshell)) {
|
||||
return testshell;
|
||||
}
|
||||
delete testshell;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentProcessChild::DeallocPTestShell(PTestShellChild* shell)
|
||||
{
|
||||
mTestShells.RemoveElement(shell);
|
||||
return true;
|
||||
}
|
||||
|
||||
PNeckoChild*
|
||||
ContentProcessChild::AllocPNecko()
|
||||
{
|
||||
return new NeckoChild();
|
||||
}
|
||||
|
||||
bool
|
||||
ContentProcessChild::DeallocPNecko(PNeckoChild* necko)
|
||||
{
|
||||
delete necko;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
ContentProcessChild::Quit()
|
||||
{
|
||||
NS_ASSERTION(mQuit, "Exiting uncleanly!");
|
||||
mIFrames.Clear();
|
||||
mTestShells.Clear();
|
||||
}
|
||||
|
||||
static void
|
||||
QuitIOLoop()
|
||||
{
|
||||
MessageLoop::current()->Quit();
|
||||
}
|
||||
|
||||
bool
|
||||
ContentProcessChild::RecvQuit()
|
||||
{
|
||||
mQuit = PR_TRUE;
|
||||
|
||||
Quit();
|
||||
|
||||
XRE_GetIOMessageLoop()->PostTask(FROM_HERE,
|
||||
NewRunnableFunction(&QuitIOLoop));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
|
@ -1,91 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim: set sw=4 ts=8 et tw=80 : */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Content App.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef mozilla_dom_ContentProcessChild_h
|
||||
#define mozilla_dom_ContentProcessChild_h
|
||||
|
||||
#include "mozilla/dom/PContentProcessChild.h"
|
||||
|
||||
#include "nsTArray.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class ContentProcessChild : public PContentProcessChild
|
||||
{
|
||||
public:
|
||||
ContentProcessChild();
|
||||
virtual ~ContentProcessChild();
|
||||
|
||||
bool Init(MessageLoop* aIOLoop,
|
||||
base::ProcessHandle aParentHandle,
|
||||
IPC::Channel* aChannel);
|
||||
|
||||
static ContentProcessChild* GetSingleton() {
|
||||
NS_ASSERTION(sSingleton, "not initialized");
|
||||
return sSingleton;
|
||||
}
|
||||
|
||||
virtual PIFrameEmbeddingChild* AllocPIFrameEmbedding();
|
||||
virtual bool DeallocPIFrameEmbedding(PIFrameEmbeddingChild*);
|
||||
|
||||
virtual PTestShellChild* AllocPTestShell();
|
||||
virtual bool DeallocPTestShell(PTestShellChild*);
|
||||
|
||||
virtual PNeckoChild* AllocPNecko();
|
||||
virtual bool DeallocPNecko(PNeckoChild*);
|
||||
|
||||
void Quit();
|
||||
virtual bool RecvQuit();
|
||||
|
||||
private:
|
||||
static ContentProcessChild* sSingleton;
|
||||
|
||||
nsTArray<PIFrameEmbeddingChild* > mIFrames;
|
||||
nsTArray<nsAutoPtr<PTestShellChild> > mTestShells;
|
||||
|
||||
PRBool mQuit;
|
||||
|
||||
DISALLOW_EVIL_CONSTRUCTORS(ContentProcessChild);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
|
@ -1,190 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim: set sw=4 ts=8 et tw=80 : */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Content App.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "ContentProcessParent.h"
|
||||
|
||||
#include "mozilla/ipc/GeckoThread.h"
|
||||
|
||||
#include "TabParent.h"
|
||||
#include "mozilla/ipc/TestShellParent.h"
|
||||
#include "mozilla/net/NeckoParent.h"
|
||||
|
||||
#include "nsIObserverService.h"
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
using namespace mozilla::ipc;
|
||||
using namespace mozilla::net;
|
||||
using mozilla::MonitorAutoEnter;
|
||||
|
||||
namespace {
|
||||
PRBool gSingletonDied = PR_FALSE;
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
ContentProcessParent* ContentProcessParent::gSingleton;
|
||||
|
||||
ContentProcessParent*
|
||||
ContentProcessParent::GetSingleton()
|
||||
{
|
||||
if (!gSingleton && !gSingletonDied) {
|
||||
nsRefPtr<ContentProcessParent> parent = new ContentProcessParent();
|
||||
if (parent) {
|
||||
nsCOMPtr<nsIObserverService> obs =
|
||||
do_GetService("@mozilla.org/observer-service;1");
|
||||
if (obs) {
|
||||
if (NS_SUCCEEDED(obs->AddObserver(parent, "xpcom-shutdown",
|
||||
PR_FALSE))) {
|
||||
gSingleton = parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return gSingleton;
|
||||
}
|
||||
|
||||
TabParent*
|
||||
ContentProcessParent::CreateTab()
|
||||
{
|
||||
return static_cast<TabParent*>(SendPIFrameEmbeddingConstructor());
|
||||
}
|
||||
|
||||
TestShellParent*
|
||||
ContentProcessParent::CreateTestShell()
|
||||
{
|
||||
return static_cast<TestShellParent*>(SendPTestShellConstructor());
|
||||
}
|
||||
|
||||
bool
|
||||
ContentProcessParent::DestroyTestShell(TestShellParent* aTestShell)
|
||||
{
|
||||
return SendPTestShellDestructor(aTestShell);
|
||||
}
|
||||
|
||||
ContentProcessParent::ContentProcessParent()
|
||||
: mMonitor("ContentProcessParent::mMonitor")
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
mSubprocess = new GeckoChildProcessHost(GeckoProcessType_Content, this);
|
||||
mSubprocess->AsyncLaunch();
|
||||
Open(mSubprocess->GetChannel(), mSubprocess->GetChildProcessHandle());
|
||||
}
|
||||
|
||||
ContentProcessParent::~ContentProcessParent()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
NS_ASSERTION(gSingleton == this, "More than one singleton?!");
|
||||
gSingletonDied = PR_TRUE;
|
||||
gSingleton = nsnull;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(ContentProcessParent, nsIObserver)
|
||||
|
||||
NS_IMETHODIMP
|
||||
ContentProcessParent::Observe(nsISupports* aSubject,
|
||||
const char* aTopic,
|
||||
const PRUnichar* aData)
|
||||
{
|
||||
if (!strcmp(aTopic, "xpcom-shutdown") && mSubprocess) {
|
||||
SendQuit();
|
||||
#ifdef OS_WIN
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
while (mSubprocess) {
|
||||
mon.Wait();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
ContentProcessParent::OnWaitableEventSignaled(base::WaitableEvent *event)
|
||||
{
|
||||
// The child process has died! Sadly we're on the wrong thread to do much.
|
||||
NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
|
||||
MonitorAutoEnter mon(mMonitor);
|
||||
mSubprocess = nsnull;
|
||||
mon.Notify();
|
||||
}
|
||||
|
||||
PIFrameEmbeddingParent*
|
||||
ContentProcessParent::AllocPIFrameEmbedding()
|
||||
{
|
||||
return new TabParent();
|
||||
}
|
||||
|
||||
bool
|
||||
ContentProcessParent::DeallocPIFrameEmbedding(PIFrameEmbeddingParent* frame)
|
||||
{
|
||||
delete frame;
|
||||
return true;
|
||||
}
|
||||
|
||||
PTestShellParent*
|
||||
ContentProcessParent::AllocPTestShell()
|
||||
{
|
||||
return new TestShellParent();
|
||||
}
|
||||
|
||||
bool
|
||||
ContentProcessParent::DeallocPTestShell(PTestShellParent* shell)
|
||||
{
|
||||
delete shell;
|
||||
return true;
|
||||
}
|
||||
|
||||
PNeckoParent*
|
||||
ContentProcessParent::AllocPNecko()
|
||||
{
|
||||
return new NeckoParent();
|
||||
}
|
||||
|
||||
bool
|
||||
ContentProcessParent::DeallocPNecko(PNeckoParent* necko)
|
||||
{
|
||||
delete necko;
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
|
@ -1,114 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim: set sw=4 ts=8 et tw=80 : */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Content App.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef mozilla_dom_ContentProcessParent_h
|
||||
#define mozilla_dom_ContentProcessParent_h
|
||||
|
||||
#include "base/waitable_event_watcher.h"
|
||||
|
||||
#include "mozilla/dom/PContentProcessParent.h"
|
||||
#include "mozilla/ipc/GeckoChildProcessHost.h"
|
||||
|
||||
#include "nsIObserver.h"
|
||||
#include "mozilla/Monitor.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace ipc {
|
||||
class TestShellParent;
|
||||
}
|
||||
|
||||
namespace dom {
|
||||
|
||||
class TabParent;
|
||||
|
||||
class ContentProcessParent : public PContentProcessParent,
|
||||
public base::WaitableEventWatcher::Delegate,
|
||||
public nsIObserver
|
||||
{
|
||||
private:
|
||||
typedef mozilla::ipc::GeckoChildProcessHost GeckoChildProcessHost;
|
||||
typedef mozilla::ipc::TestShellParent TestShellParent;
|
||||
|
||||
public:
|
||||
static ContentProcessParent* GetSingleton();
|
||||
|
||||
#if 0
|
||||
// TODO: implement this somewhere!
|
||||
static ContentProcessParent* FreeSingleton();
|
||||
#endif
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
virtual void OnWaitableEventSignaled(base::WaitableEvent *event);
|
||||
|
||||
TabParent* CreateTab();
|
||||
|
||||
TestShellParent* CreateTestShell();
|
||||
bool DestroyTestShell(TestShellParent* aTestShell);
|
||||
|
||||
private:
|
||||
static ContentProcessParent* gSingleton;
|
||||
|
||||
// Hide the raw constructor methods since we don't want client code
|
||||
// using them.
|
||||
using PContentProcessParent::SendPIFrameEmbeddingConstructor;
|
||||
using PContentProcessParent::SendPTestShellConstructor;
|
||||
|
||||
ContentProcessParent();
|
||||
virtual ~ContentProcessParent();
|
||||
|
||||
virtual PIFrameEmbeddingParent* AllocPIFrameEmbedding();
|
||||
virtual bool DeallocPIFrameEmbedding(PIFrameEmbeddingParent* frame);
|
||||
|
||||
virtual PTestShellParent* AllocPTestShell();
|
||||
virtual bool DeallocPTestShell(PTestShellParent* shell);
|
||||
|
||||
virtual PNeckoParent* AllocPNecko();
|
||||
virtual bool DeallocPNecko(PNeckoParent* necko);
|
||||
|
||||
mozilla::Monitor mMonitor;
|
||||
|
||||
GeckoChildProcessHost* mSubprocess;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
|
@ -1,82 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* vim: set sw=4 ts=8 et tw=80 :
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Plugin App.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ben Turner <bent.mozilla@gmail.com>.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Chris Jones <jones.chris.g@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "ContentProcessThread.h"
|
||||
|
||||
#include "prlink.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/string_util.h"
|
||||
#include "chrome/common/child_process.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
|
||||
using mozilla::ipc::GeckoThread;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
ContentProcessThread::ContentProcessThread(ProcessHandle mParentHandle) :
|
||||
GeckoThread(mParentHandle),
|
||||
mContentProcess()
|
||||
{
|
||||
}
|
||||
|
||||
ContentProcessThread::~ContentProcessThread()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ContentProcessThread::Init()
|
||||
{
|
||||
GeckoThread::Init();
|
||||
|
||||
// FIXME/cjones: set up channel stuff, etc.
|
||||
|
||||
// FIXME owner_loop() is bad here
|
||||
mContentProcess.Init(owner_loop(), GetParentProcessHandle(), channel());
|
||||
}
|
||||
|
||||
void
|
||||
ContentProcessThread::CleanUp()
|
||||
{
|
||||
GeckoThread::CleanUp();
|
||||
}
|
||||
|
||||
} // namespace tabs
|
||||
} // namespace mozilla
|
|
@ -1,79 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* vim: set sw=4 ts=8 et tw=80 :
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Plugin App.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ben Turner <bent.mozilla@gmail.com>.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Chris Jones <jones.chris.g@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef dom_tabs_ContentProcessThread_h
|
||||
#define dom_tabs_ContentProcessThread_h 1
|
||||
|
||||
#include "chrome/common/child_thread.h"
|
||||
#include "base/file_path.h"
|
||||
|
||||
#include "mozilla/ipc/GeckoThread.h"
|
||||
#include "ContentProcessChild.h"
|
||||
|
||||
#undef _MOZ_LOG
|
||||
#define _MOZ_LOG(s) printf("[ContentProcessThread] %s", s)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
/**
|
||||
* ContentProcessThread is a singleton on the content process which represents
|
||||
* a background thread where tab instances live.
|
||||
*/
|
||||
class ContentProcessThread : public mozilla::ipc::GeckoThread
|
||||
{
|
||||
public:
|
||||
ContentProcessThread(ProcessHandle mParentHandle);
|
||||
~ContentProcessThread();
|
||||
|
||||
private:
|
||||
// Thread implementation:
|
||||
virtual void Init();
|
||||
virtual void CleanUp();
|
||||
|
||||
ContentProcessChild mContentProcess;
|
||||
IPC::Channel* mChannel;
|
||||
|
||||
DISALLOW_EVIL_CONSTRUCTORS(ContentProcessThread);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // ifndef dom_tabs_ContentProcessThread_h
|
|
@ -1,77 +0,0 @@
|
|||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Mozilla Firefox.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# The Mozilla Foundation <http://www.mozilla.org/>.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2009
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = dom
|
||||
LIBRARY_NAME = domipc_s
|
||||
LIBXUL_LIBRARY = 1
|
||||
FORCE_STATIC_LIB = 1
|
||||
EXPORT_LIBRARY = 1
|
||||
|
||||
EXPORTS = TabMessageUtils.h
|
||||
|
||||
EXPORTS_NAMESPACES = mozilla mozilla/dom
|
||||
|
||||
EXPORTS_mozilla = \
|
||||
TabTypes.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS_mozilla/dom = \
|
||||
ContentProcessChild.h \
|
||||
ContentProcessParent.h \
|
||||
ContentProcessThread.h \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
ContentProcessThread.cpp \
|
||||
ContentProcessParent.cpp \
|
||||
ContentProcessChild.cpp \
|
||||
TabParent.cpp \
|
||||
TabChild.cpp \
|
||||
TabMessageUtils.cpp \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
DEFINES += -DBIN_SUFFIX='"$(BIN_SUFFIX)"'
|
|
@ -1,69 +0,0 @@
|
|||
/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8 -*- */
|
||||
/* vim: set sw=4 ts=8 et tw=80 ft=cpp : */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Content App.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
include protocol "PIFrameEmbedding.ipdl";
|
||||
include protocol "PTestShell.ipdl";
|
||||
include protocol "PNecko.ipdl";
|
||||
|
||||
include "mozilla/TabTypes.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
sync protocol PContentProcess
|
||||
{
|
||||
manages PIFrameEmbedding;
|
||||
manages PTestShell;
|
||||
manages PNecko;
|
||||
|
||||
child:
|
||||
PIFrameEmbedding();
|
||||
~PIFrameEmbedding();
|
||||
|
||||
PTestShell();
|
||||
~PTestShell();
|
||||
|
||||
Quit();
|
||||
|
||||
parent:
|
||||
PNecko();
|
||||
~PNecko();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Fenntrolysis.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
include protocol "PIFrameEmbedding.ipdl";
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
|
||||
protocol PDocumentRenderer
|
||||
{
|
||||
manager PIFrameEmbedding;
|
||||
};
|
||||
|
||||
} // namespace ipc
|
||||
} // namespace mozilla
|
|
@ -1,106 +0,0 @@
|
|||
/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8 -*- */
|
||||
/* vim: set sw=4 ts=8 et tw=80 ft=cpp : */
|
||||
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Content App.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
include protocol "PContentProcess.ipdl";
|
||||
include protocol "PDocumentRenderer.ipdl";
|
||||
|
||||
include "mozilla/TabTypes.h";
|
||||
include "TabMessageUtils.h";
|
||||
|
||||
using PRUint32;
|
||||
using PRInt32;
|
||||
using MagicWindowHandle;
|
||||
using RemoteDOMEvent;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
async protocol PIFrameEmbedding
|
||||
{
|
||||
manager PContentProcess;
|
||||
manages PDocumentRenderer;
|
||||
|
||||
parent:
|
||||
/**
|
||||
* When child sends this message, parent should move focus to
|
||||
* the next or previous focusable element.
|
||||
*/
|
||||
moveFocus(bool forward);
|
||||
|
||||
sendEvent(RemoteDOMEvent aEvent);
|
||||
child:
|
||||
createWidget(MagicWindowHandle parentWidget);
|
||||
|
||||
loadURL(nsCString uri);
|
||||
|
||||
move(PRUint32 x,
|
||||
PRUint32 y,
|
||||
PRUint32 width,
|
||||
PRUint32 height);
|
||||
|
||||
/**
|
||||
* Sending an activate message moves focus to the child.
|
||||
*/
|
||||
activate();
|
||||
|
||||
/**
|
||||
* @see nsIDOMWindowUtils sendMouseEvent.
|
||||
*/
|
||||
sendMouseEvent(nsString aType,
|
||||
PRInt32 aX, //XXX should be float, but ipdl doesn't seem to support that.
|
||||
PRInt32 aY, //XXX - " -
|
||||
PRInt32 aButton,
|
||||
PRInt32 aClickCount,
|
||||
PRInt32 aModifiers,
|
||||
bool aIgnoreRootScrollFrame);
|
||||
|
||||
/**
|
||||
* Activate event forwarding from client to parent.
|
||||
*/
|
||||
activateFrameEvent(nsString aType, bool capture);
|
||||
|
||||
PDocumentRenderer(PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h, nsString bgcolor, PRUint32 flags, bool flush);
|
||||
|
||||
parent:
|
||||
|
||||
~PDocumentRenderer(PRUint32 w, PRUint32 h, nsCString data);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
|
@ -1,420 +0,0 @@
|
|||
/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8; -*- */
|
||||
/* vim: set sw=4 ts=8 et tw=80 : */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Content App.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "TabChild.h"
|
||||
|
||||
#include "nsIWebBrowser.h"
|
||||
#include "nsEmbedCID.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "mozilla/ipc/DocumentRendererChild.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMWindowUtils.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsIWebBrowserFocus.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#include <gdk/gdkx.h>
|
||||
#include <gtk/gtk.h>
|
||||
#endif
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
NS_IMPL_ISUPPORTS1(ContentListener, nsIDOMEventListener)
|
||||
|
||||
NS_IMETHODIMP
|
||||
ContentListener::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
RemoteDOMEvent remoteEvent;
|
||||
remoteEvent.mEvent = do_QueryInterface(aEvent);
|
||||
NS_ENSURE_STATE(remoteEvent.mEvent);
|
||||
mTabChild->SendsendEvent(remoteEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
TabChild::TabChild()
|
||||
{
|
||||
printf("creating %d!\n", NS_IsMainThread());
|
||||
}
|
||||
|
||||
nsresult
|
||||
TabChild::Init()
|
||||
{
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
gtk_init(NULL, NULL);
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIWebBrowser> webBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID);
|
||||
if (!webBrowser) {
|
||||
NS_ERROR("Couldn't create a nsWebBrowser?");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
webBrowser->SetContainerWindow(this);
|
||||
|
||||
mWebNav = do_QueryInterface(webBrowser);
|
||||
NS_ASSERTION(mWebNav, "nsWebBrowser doesn't implement nsIWebNavigation?");
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellItem(do_QueryInterface(mWebNav));
|
||||
docShellItem->SetItemType(nsIDocShellTreeItem::typeContentWrapper);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS5(TabChild, nsIWebBrowserChrome, nsIWebBrowserChrome2,
|
||||
nsIEmbeddingSiteWindow, nsIEmbeddingSiteWindow2,
|
||||
nsIWebBrowserChromeFocus)
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::SetStatus(PRUint32 aStatusType, const PRUnichar* aStatus)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::GetWebBrowser(nsIWebBrowser** aWebBrowser)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::SetWebBrowser(nsIWebBrowser* aWebBrowser)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::GetChromeFlags(PRUint32* aChromeFlags)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::SetChromeFlags(PRUint32 aChromeFlags)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::DestroyBrowserWindow()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::SizeBrowserTo(PRInt32 aCX, PRInt32 aCY)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::ShowAsModal()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::IsWindowModal(PRBool* aRetVal)
|
||||
{
|
||||
*aRetVal = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::ExitModalEventLoop(nsresult aStatus)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::SetStatusWithContext(PRUint32 aStatusType,
|
||||
const nsAString& aStatusText,
|
||||
nsISupports* aStatusContext)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::SetDimensions(PRUint32 aFlags, PRInt32 aX, PRInt32 aY,
|
||||
PRInt32 aCx, PRInt32 aCy)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::GetDimensions(PRUint32 aFlags, PRInt32* aX,
|
||||
PRInt32* aY, PRInt32* aCx, PRInt32* aCy)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::SetFocus()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::GetVisibility(PRBool* aVisibility)
|
||||
{
|
||||
*aVisibility = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::SetVisibility(PRBool aVisibility)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::GetTitle(PRUnichar** aTitle)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::SetTitle(const PRUnichar* aTitle)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::GetSiteWindow(void** aSiteWindow)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::Blur()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::FocusNextElement()
|
||||
{
|
||||
SendmoveFocus(PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::FocusPrevElement()
|
||||
{
|
||||
SendmoveFocus(PR_FALSE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvcreateWidget(const MagicWindowHandle& parentWidget)
|
||||
{
|
||||
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(mWebNav);
|
||||
if (!baseWindow) {
|
||||
NS_ERROR("mWebNav doesn't QI to nsIBaseWindow");
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
GtkWidget* win = gtk_plug_new((GdkNativeWindow)parentWidget);
|
||||
gtk_widget_show(win);
|
||||
#elif defined(XP_WIN)
|
||||
HWND win = parentWidget;
|
||||
#elif defined(XP_MACOSX)
|
||||
# warning IMPLEMENT ME
|
||||
#else
|
||||
#error You lose!
|
||||
#endif
|
||||
|
||||
#if !defined(XP_MACOSX)
|
||||
baseWindow->InitWindow(win, 0, 0, 0, 0, 0);
|
||||
baseWindow->Create();
|
||||
baseWindow->SetVisibility(PR_TRUE);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::destroyWidget()
|
||||
{
|
||||
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(mWebNav);
|
||||
if (baseWindow)
|
||||
baseWindow->Destroy();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
TabChild::~TabChild()
|
||||
{
|
||||
destroyWidget();
|
||||
nsCOMPtr<nsIWebBrowser> webBrowser = do_QueryInterface(mWebNav);
|
||||
if (webBrowser) {
|
||||
webBrowser->SetContainerWindow(nsnull);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvloadURL(const nsCString& uri)
|
||||
{
|
||||
printf("loading %s, %d\n", uri.get(), NS_IsMainThread());
|
||||
|
||||
nsresult rv = mWebNav->LoadURI(NS_ConvertUTF8toUTF16(uri).get(),
|
||||
nsIWebNavigation::LOAD_FLAGS_NONE,
|
||||
NULL, NULL, NULL);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("mWebNav->LoadURI failed. Eating exception, what else can I do?");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::Recvmove(const PRUint32& x,
|
||||
const PRUint32& y,
|
||||
const PRUint32& width,
|
||||
const PRUint32& height)
|
||||
{
|
||||
printf("[TabChild] MOVE to (x,y)=(%ud, %ud), (w,h)= (%ud, %ud)\n",
|
||||
x, y, width, height);
|
||||
|
||||
nsCOMPtr<nsIBaseWindow> baseWin = do_QueryInterface(mWebNav);
|
||||
baseWin->SetPositionAndSize(x, y, width, height, PR_TRUE);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::Recvactivate()
|
||||
{
|
||||
nsCOMPtr<nsIWebBrowserFocus> browser = do_QueryInterface(mWebNav);
|
||||
browser->Activate();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvsendMouseEvent(const nsString& aType,
|
||||
const PRInt32& aX,
|
||||
const PRInt32& aY,
|
||||
const PRInt32& aButton,
|
||||
const PRInt32& aClickCount,
|
||||
const PRInt32& aModifiers,
|
||||
const bool& aIgnoreRootScrollFrame)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_GetInterface(mWebNav);
|
||||
nsCOMPtr<nsIDOMWindowUtils> utils = do_GetInterface(window);
|
||||
NS_ENSURE_TRUE(utils, true);
|
||||
utils->SendMouseEvent(aType, aX, aY, aButton, aClickCount, aModifiers,
|
||||
aIgnoreRootScrollFrame);
|
||||
return true;
|
||||
}
|
||||
|
||||
mozilla::ipc::PDocumentRendererChild*
|
||||
TabChild::AllocPDocumentRenderer(
|
||||
const PRInt32& x,
|
||||
const PRInt32& y,
|
||||
const PRInt32& w,
|
||||
const PRInt32& h,
|
||||
const nsString& bgcolor,
|
||||
const PRUint32& flags,
|
||||
const bool& flush)
|
||||
{
|
||||
return new mozilla::ipc::DocumentRendererChild();
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::DeallocPDocumentRenderer(
|
||||
mozilla::ipc::PDocumentRendererChild* __a,
|
||||
const PRUint32& w,
|
||||
const PRUint32& h,
|
||||
const nsCString& data)
|
||||
{
|
||||
delete __a;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvPDocumentRendererConstructor(
|
||||
mozilla::ipc::PDocumentRendererChild *__a,
|
||||
const PRInt32& aX,
|
||||
const PRInt32& aY,
|
||||
const PRInt32& aW,
|
||||
const PRInt32& aH,
|
||||
const nsString& bgcolor,
|
||||
const PRUint32& flags,
|
||||
const bool& flush)
|
||||
{
|
||||
mozilla::ipc::DocumentRendererChild *render =
|
||||
static_cast<mozilla::ipc::DocumentRendererChild *>(__a);
|
||||
|
||||
nsCOMPtr<nsIWebBrowser> browser = do_QueryInterface(mWebNav);
|
||||
if (!browser)
|
||||
return true; // silently ignore
|
||||
nsCOMPtr<nsIDOMWindow> window;
|
||||
if (NS_FAILED(browser->GetContentDOMWindow(getter_AddRefs(window))) ||
|
||||
!window)
|
||||
{
|
||||
return true; // silently ignore
|
||||
}
|
||||
|
||||
PRUint32 width, height;
|
||||
nsCString data;
|
||||
bool ret = render->RenderDocument(window, aX, aY, aW, aH, bgcolor, flags, flush,
|
||||
width, height, data);
|
||||
if (!ret)
|
||||
return true; // silently ignore
|
||||
|
||||
return SendPDocumentRendererDestructor(__a, width, height, data);
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvactivateFrameEvent(const nsString& aType, const bool& capture)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_GetInterface(mWebNav);
|
||||
NS_ENSURE_TRUE(window, true);
|
||||
nsCOMPtr<nsIDOMEventTarget> chromeHandler =
|
||||
do_QueryInterface(window->GetChromeEventHandler());
|
||||
NS_ENSURE_TRUE(chromeHandler, true);
|
||||
nsRefPtr<ContentListener> listener = new ContentListener(this);
|
||||
NS_ENSURE_TRUE(listener, true);
|
||||
chromeHandler->AddEventListener(aType, listener, capture);
|
||||
return true;
|
||||
}
|
|
@ -1,132 +0,0 @@
|
|||
/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8; -*- */
|
||||
/* vim: set sw=4 ts=8 et tw=80 : */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Content App.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef mozilla_tabs_TabChild_h
|
||||
#define mozilla_tabs_TabChild_h
|
||||
|
||||
#include "mozilla/dom/PIFrameEmbeddingChild.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIWebBrowserChrome2.h"
|
||||
#include "nsIEmbeddingSiteWindow2.h"
|
||||
#include "nsIWebBrowserChromeFocus.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class TabChild;
|
||||
|
||||
class ContentListener : public nsIDOMEventListener
|
||||
{
|
||||
public:
|
||||
ContentListener(TabChild* aTabChild) : mTabChild(aTabChild) {}
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDOMEVENTLISTENER
|
||||
protected:
|
||||
TabChild* mTabChild;
|
||||
};
|
||||
|
||||
class TabChild : public PIFrameEmbeddingChild,
|
||||
public nsIWebBrowserChrome2,
|
||||
public nsIEmbeddingSiteWindow2,
|
||||
public nsIWebBrowserChromeFocus
|
||||
{
|
||||
public:
|
||||
TabChild();
|
||||
virtual ~TabChild();
|
||||
bool destroyWidget();
|
||||
nsresult Init();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIWEBBROWSERCHROME
|
||||
NS_DECL_NSIWEBBROWSERCHROME2
|
||||
NS_DECL_NSIEMBEDDINGSITEWINDOW
|
||||
NS_DECL_NSIEMBEDDINGSITEWINDOW2
|
||||
NS_DECL_NSIWEBBROWSERCHROMEFOCUS
|
||||
|
||||
virtual bool RecvcreateWidget(const MagicWindowHandle& parentWidget);
|
||||
virtual bool RecvloadURL(const nsCString& uri);
|
||||
virtual bool Recvmove(const PRUint32& x,
|
||||
const PRUint32& y,
|
||||
const PRUint32& width,
|
||||
const PRUint32& height);
|
||||
virtual bool Recvactivate();
|
||||
virtual bool RecvsendMouseEvent(const nsString& aType,
|
||||
const PRInt32& aX,
|
||||
const PRInt32& aY,
|
||||
const PRInt32& aButton,
|
||||
const PRInt32& aClickCount,
|
||||
const PRInt32& aModifiers,
|
||||
const bool& aIgnoreRootScrollFrame);
|
||||
virtual bool RecvactivateFrameEvent(const nsString& aType, const bool& capture);
|
||||
virtual mozilla::ipc::PDocumentRendererChild* AllocPDocumentRenderer(
|
||||
const PRInt32& x,
|
||||
const PRInt32& y,
|
||||
const PRInt32& w,
|
||||
const PRInt32& h,
|
||||
const nsString& bgcolor,
|
||||
const PRUint32& flags,
|
||||
const bool& flush);
|
||||
virtual bool DeallocPDocumentRenderer(
|
||||
mozilla::ipc::PDocumentRendererChild* __a,
|
||||
const PRUint32& w,
|
||||
const PRUint32& h,
|
||||
const nsCString& data);
|
||||
virtual bool RecvPDocumentRendererConstructor(
|
||||
mozilla::ipc::PDocumentRendererChild *__a,
|
||||
const PRInt32& x,
|
||||
const PRInt32& y,
|
||||
const PRInt32& w,
|
||||
const PRInt32& h,
|
||||
const nsString& bgcolor,
|
||||
const PRUint32& flags,
|
||||
const bool& flush);
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIWebNavigation> mWebNav;
|
||||
|
||||
DISALLOW_EVIL_CONSTRUCTORS(TabChild);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // mozilla_tabs_TabChild_h
|
|
@ -1,69 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Corporation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Olli Pettay <Olli.Pettay@helsinki.fi>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "TabMessageUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
|
||||
#ifdef CreateEvent
|
||||
#undef CreateEvent
|
||||
#endif
|
||||
|
||||
#include "nsEventDispatcher.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
bool
|
||||
ReadRemoteEvent(const IPC::Message* aMsg, void** aIter,
|
||||
RemoteDOMEvent* aResult)
|
||||
{
|
||||
aResult->mEvent = nsnull;
|
||||
nsString type;
|
||||
NS_ENSURE_TRUE(ReadParam(aMsg, aIter, &type), false);
|
||||
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
nsEventDispatcher::CreateEvent(nsnull, nsnull, type, getter_AddRefs(event));
|
||||
aResult->mEvent = do_QueryInterface(event);
|
||||
NS_ENSURE_TRUE(aResult->mEvent, false);
|
||||
|
||||
return aResult->mEvent->Deserialize(aMsg, aIter);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Corporation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Olli Pettay <Olli.Pettay@helsinki.fi>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef TABMESSAGE_UTILS_H
|
||||
#define TABMESSAGE_UTILS_H
|
||||
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
struct RemoteDOMEvent
|
||||
{
|
||||
nsCOMPtr<nsIPrivateDOMEvent> mEvent;
|
||||
};
|
||||
|
||||
bool ReadRemoteEvent(const IPC::Message* aMsg, void** aIter,
|
||||
mozilla::dom::RemoteDOMEvent* aResult);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
namespace IPC {
|
||||
|
||||
template<>
|
||||
struct ParamTraits<mozilla::dom::RemoteDOMEvent>
|
||||
{
|
||||
typedef mozilla::dom::RemoteDOMEvent paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
aParam.mEvent->Serialize(aMsg, PR_TRUE);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
return mozilla::dom::ReadRemoteEvent(aMsg, aIter, aResult);
|
||||
}
|
||||
|
||||
static void Log(const paramType& aParam, std::wstring* aLog)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -1,155 +0,0 @@
|
|||
/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8; -*- */
|
||||
/* vim: set sw=4 ts=8 et tw=80 : */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Content App.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "TabParent.h"
|
||||
|
||||
#include "mozilla/ipc/GeckoThread.h"
|
||||
#include "mozilla/ipc/DocumentRendererParent.h"
|
||||
|
||||
#include "nsIURI.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
|
||||
using mozilla::ipc::BrowserProcessSubThread;
|
||||
using mozilla::ipc::DocumentRendererParent;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
TabParent::TabParent()
|
||||
{
|
||||
}
|
||||
|
||||
TabParent::~TabParent()
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::RecvmoveFocus(const bool& aForward)
|
||||
{
|
||||
nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
|
||||
if (fm) {
|
||||
nsCOMPtr<nsIDOMElement> dummy;
|
||||
PRUint32 type = aForward ? nsIFocusManager::MOVEFOCUS_FORWARD
|
||||
: nsIFocusManager::MOVEFOCUS_BACKWARD;
|
||||
fm->MoveFocus(nsnull, mFrameElement, type, nsIFocusManager::FLAG_BYKEY,
|
||||
getter_AddRefs(dummy));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::RecvsendEvent(const RemoteDOMEvent& aEvent)
|
||||
{
|
||||
nsCOMPtr<nsIDOMEvent> event = do_QueryInterface(aEvent.mEvent);
|
||||
NS_ENSURE_TRUE(event, true);
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(mFrameElement);
|
||||
NS_ENSURE_TRUE(target, true);
|
||||
|
||||
PRBool dummy;
|
||||
target->DispatchEvent(event, &dummy);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
TabParent::LoadURL(nsIURI* aURI)
|
||||
{
|
||||
nsCString spec;
|
||||
aURI->GetSpec(spec);
|
||||
|
||||
SendloadURL(spec);
|
||||
}
|
||||
|
||||
void
|
||||
TabParent::Move(PRUint32 x, PRUint32 y, PRUint32 width, PRUint32 height)
|
||||
{
|
||||
Sendmove(x, y, width, height);
|
||||
}
|
||||
|
||||
void
|
||||
TabParent::Activate()
|
||||
{
|
||||
Sendactivate();
|
||||
}
|
||||
|
||||
mozilla::ipc::PDocumentRendererParent*
|
||||
TabParent::AllocPDocumentRenderer(const PRInt32& x,
|
||||
const PRInt32& y, const PRInt32& w, const PRInt32& h, const nsString& bgcolor,
|
||||
const PRUint32& flags, const bool& flush)
|
||||
{
|
||||
return new DocumentRendererParent();
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::DeallocPDocumentRenderer(mozilla::ipc::PDocumentRendererParent* __a,
|
||||
const PRUint32& w, const PRUint32& h, const nsCString& data)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(__a);
|
||||
delete __a;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::RecvPDocumentRendererDestructor(PDocumentRendererParent* __a,
|
||||
const PRUint32& w, const PRUint32& h, const nsCString& data)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(__a);
|
||||
DocumentRendererParent *renderer = static_cast<DocumentRendererParent *>(__a);
|
||||
renderer->DrawToCanvas(w, h, data);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
TabParent::SendMouseEvent(const nsAString& aType, float aX, float aY,
|
||||
PRInt32 aButton, PRInt32 aClickCount,
|
||||
PRInt32 aModifiers, PRBool aIgnoreRootScrollFrame)
|
||||
{
|
||||
SendsendMouseEvent(nsString(aType), aX, aY, aButton, aClickCount,
|
||||
aModifiers, aIgnoreRootScrollFrame);
|
||||
}
|
||||
|
||||
} // namespace tabs
|
||||
} // namespace mozilla
|
|
@ -1,94 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim: set sw=4 ts=8 et tw=80 : */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Content App.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef mozilla_tabs_TabParent_h
|
||||
#define mozilla_tabs_TabParent_h
|
||||
|
||||
#include "mozilla/dom/PIFrameEmbeddingParent.h"
|
||||
|
||||
#include "mozilla/ipc/GeckoChildProcessHost.h"
|
||||
|
||||
class nsIURI;
|
||||
class nsIDOMElement;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class TabParent : public PIFrameEmbeddingParent
|
||||
{
|
||||
public:
|
||||
TabParent();
|
||||
virtual ~TabParent();
|
||||
void SetOwnerElement(nsIDOMElement* aElement) { mFrameElement = aElement; }
|
||||
|
||||
virtual bool RecvmoveFocus(const bool& aForward);
|
||||
virtual bool RecvsendEvent(const RemoteDOMEvent& aEvent);
|
||||
|
||||
void LoadURL(nsIURI* aURI);
|
||||
void Move(PRUint32 x, PRUint32 y, PRUint32 width, PRUint32 height);
|
||||
void Activate();
|
||||
void SendMouseEvent(const nsAString& aType, float aX, float aY,
|
||||
PRInt32 aButton, PRInt32 aClickCount,
|
||||
PRInt32 aModifiers, PRBool aIgnoreRootScrollFrame);
|
||||
|
||||
virtual mozilla::ipc::PDocumentRendererParent* AllocPDocumentRenderer(
|
||||
const PRInt32& x,
|
||||
const PRInt32& y,
|
||||
const PRInt32& w,
|
||||
const PRInt32& h,
|
||||
const nsString& bgcolor,
|
||||
const PRUint32& flags,
|
||||
const bool& flush);
|
||||
virtual bool DeallocPDocumentRenderer(
|
||||
mozilla::ipc::PDocumentRendererParent* __a,
|
||||
const PRUint32& w,
|
||||
const PRUint32& h,
|
||||
const nsCString& data);
|
||||
virtual bool RecvPDocumentRendererDestructor(
|
||||
mozilla::ipc::PDocumentRendererParent* __a,
|
||||
const PRUint32& w,
|
||||
const PRUint32& h,
|
||||
const nsCString& data);
|
||||
protected:
|
||||
nsIDOMElement* mFrameElement;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
|
@ -1,26 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim: set sw=4 ts=8 et tw=80 : */
|
||||
|
||||
#ifndef mozilla_tabs_TabTypes_h
|
||||
#define mozilla_tabs_TabTypes_h
|
||||
|
||||
#include "base/basictypes.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
#include <windows.h>
|
||||
|
||||
typedef HWND MagicWindowHandle;
|
||||
#elif defined(MOZ_WIDGET_GTK2)
|
||||
#include <X11/X.h>
|
||||
|
||||
typedef XID MagicWindowHandle;
|
||||
|
||||
#elif defined(XP_MACOSX)
|
||||
# warning This is a placeholder
|
||||
typedef long MagicWindowHandle;
|
||||
|
||||
#else
|
||||
#error Not implemented, stooge
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,41 +0,0 @@
|
|||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Mozilla Content App.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# The Mozilla Foundation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2009
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
IPDLSRCS = \
|
||||
PContentProcess.ipdl \
|
||||
PIFrameEmbedding.ipdl \
|
||||
PDocumentRenderer.ipdl \
|
||||
$(NULL)
|
|
@ -1,2 +0,0 @@
|
|||
toolkit.jar:
|
||||
content/global/test-ipc.xul (test.xul)
|
|
@ -1,94 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
width="800" height="800" orient="vertical">
|
||||
<script>
|
||||
|
||||
function dumpClientRect(r) {
|
||||
dump(r.left + "," + r.top + "," + r.right + "," +
|
||||
r.bottom + "," + r.width + "," + r.height + "\n");
|
||||
}
|
||||
|
||||
function handleMozAfterPaint(e) {
|
||||
return;
|
||||
dump(e.type + "\n")
|
||||
var rects = e.clientRects;
|
||||
var i;
|
||||
dump("\tclientRects:\n");
|
||||
for (i = 0; i < rects.length; ++i) {
|
||||
var r = rects.item(i);
|
||||
dump("\t\t");
|
||||
dumpClientRect(rects.item(i));
|
||||
}
|
||||
|
||||
dump("\tboundingClientRect\n\t\t");
|
||||
dumpClientRect(e.boundingClientRect);
|
||||
|
||||
var paintRequests = e.paintRequests;
|
||||
dump("\tpaintRequests\n");
|
||||
for (i = 0; i < paintRequests.length; ++i) {
|
||||
var pr = paintRequests.item(i);
|
||||
dump("\t\t");
|
||||
dumpClientRect(pr.clientRect);
|
||||
if (pr.reason)
|
||||
dump("\t\t" + pr.reason + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
function handleMozScrolledAreaChanged(e) {
|
||||
return;
|
||||
dump(e.type + "\n");
|
||||
dump("\t" + e.x + "," + e.y + "," + e.width + "," + e.height + "\n");
|
||||
}
|
||||
|
||||
function restart() {
|
||||
var y = document.getElementById('page');
|
||||
var p = y.parentNode;
|
||||
p.removeChild(y);
|
||||
p.appendChild(y);
|
||||
|
||||
var fl = y.QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader;
|
||||
fl.activateFrameEvent("MozAfterPaint", true);
|
||||
fl.activateFrameEvent("MozScrolledAreaChanged", true);
|
||||
y.addEventListener("MozAfterPaint", handleMozAfterPaint, true);
|
||||
y.addEventListener("MozScrolledAreaChanged", handleMozScrolledAreaChanged, true);
|
||||
}
|
||||
|
||||
function loadURL(url) {
|
||||
document.getElementById('page').setAttribute('src', url);
|
||||
}
|
||||
|
||||
function randomClick() {
|
||||
// First focus the remote frame, then dispatch click. This way remote frame gets focus before
|
||||
// mouse event.
|
||||
document.getElementById('page').QueryInterface(Components.interfaces.nsIFrameLoaderOwner)
|
||||
.frameLoader.activateRemoteFrame();
|
||||
var frameLoader = document.getElementById('page').QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader;
|
||||
var x = parseInt(Math.random() * 100);
|
||||
var y = parseInt(Math.random() * 100);
|
||||
frameLoader.sendCrossProcessMouseEvent("mousedown", x, y, 0, 1, 0, false);
|
||||
frameLoader.sendCrossProcessMouseEvent("mouseup", x, y, 0, 1, 0, false);
|
||||
}
|
||||
|
||||
function openWindow() {
|
||||
window.open('chrome://global/content/test-ipc.xul', '_blank', 'chrome,resizable,width=800,height=800');
|
||||
}
|
||||
|
||||
function closeWindow() {
|
||||
window.close();
|
||||
}
|
||||
</script>
|
||||
|
||||
<toolbar id="controls">
|
||||
<toolbarbutton label="Back"/>
|
||||
<toolbarbutton label="Forward"/>
|
||||
<textbox onchange="loadURL(this.value)" flex="1" id="URL"/>
|
||||
<toolbarbutton onclick="restart()" label="Recover"/>
|
||||
<toolbarbutton onclick="randomClick()" label="random click"/>
|
||||
<toolbarbutton onclick="openWindow()" label="open new window"/>
|
||||
<toolbarbutton onclick="closeWindow()" label="close this window"/>
|
||||
</toolbar>
|
||||
|
||||
<browser type="content" src="http://www.google.com/" flex="1" id="page" remote="true"
|
||||
onfocus="this.QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader.activateRemoteFrame();"/>
|
||||
</window>
|
|
@ -56,12 +56,6 @@ DIRS = \
|
|||
system \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_IPC
|
||||
DIRS += \
|
||||
ipc \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifdef NECKO_WIFI
|
||||
DIRS += wifi
|
||||
endif
|
||||
|
|
|
@ -45,7 +45,10 @@ ifndef tier_xpcom_dirs
|
|||
include $(topsrcdir)/xpcom/build.mk
|
||||
endif
|
||||
|
||||
TIERS += zlib
|
||||
TIERS += zlib \
|
||||
necko \
|
||||
$(NULL)
|
||||
|
||||
|
||||
ifndef MOZ_NATIVE_ZLIB
|
||||
tier_zlib_dirs += modules/zlib
|
||||
|
|
|
@ -63,13 +63,6 @@ SHARED_LIBRARY_LIBS = \
|
|||
../mime/src/$(LIB_PREFIX)nkmime_s.$(LIB_SUFFIX) \
|
||||
../cache/src/$(LIB_PREFIX)nkcache_s.$(LIB_SUFFIX) \
|
||||
../protocol/about/src/$(LIB_PREFIX)nkabout_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_IPC
|
||||
SHARED_LIBRARY_LIBS += ../ipc/$(LIB_PREFIX)neckoipc_s.$(LIB_SUFFIX)
|
||||
endif
|
||||
|
||||
SHARED_LIBRARY_LIBS += \
|
||||
$(foreach d,$(filter-out about,$(NECKO_PROTOCOLS)), \
|
||||
../protocol/$(d)/src/$(LIB_PREFIX)nk$(d)_s.$(LIB_SUFFIX)) \
|
||||
$(NULL)
|
||||
|
@ -161,8 +154,6 @@ ifeq ($(OS_ARCH),AIX)
|
|||
EXTRA_DSO_LDOPTS += -lodm -lcfg
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
|
|
|
@ -37,10 +37,6 @@
|
|||
|
||||
#include "necko-config.h"
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
#include "base/basictypes.h"
|
||||
#endif
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIModule.h"
|
||||
#include "nsIClassInfoImpl.h"
|
||||
|
|
|
@ -92,7 +92,6 @@ typedef struct idn_nameprep *idn_nameprep_t;
|
|||
*/
|
||||
#define IDN_NAMEPREP_CURRENT "nameprep-11"
|
||||
|
||||
#undef assert
|
||||
#define assert(a)
|
||||
#define TRACE(a)
|
||||
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Mozilla Firefox.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# The Mozilla Foundation <http://www.mozilla.org/>.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2009
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Jason Duell
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = necko
|
||||
|
||||
LIBRARY_NAME = neckoipc_s
|
||||
LIBXUL_LIBRARY = 1
|
||||
FORCE_STATIC_LIB = 1
|
||||
EXPORT_LIBRARY = 1
|
||||
|
||||
EXPORTS_NAMESPACES = mozilla/net
|
||||
|
||||
EXPORTS_mozilla/net = \
|
||||
NeckoParent.h \
|
||||
NeckoChild.h \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
NeckoChild.cpp \
|
||||
NeckoParent.cpp \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
|
@ -1,84 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 ts=8 et tw=80 : */
|
||||
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jason Duell <jduell.mcbugs@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "mozilla/net/NeckoChild.h"
|
||||
#include "mozilla/dom/ContentProcessChild.h"
|
||||
#include "mozilla/net/HttpChannelChild.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
PNeckoChild *gNeckoChild = nsnull;
|
||||
|
||||
// C++ file contents
|
||||
NeckoChild::NeckoChild()
|
||||
{
|
||||
}
|
||||
|
||||
NeckoChild::~NeckoChild()
|
||||
{
|
||||
}
|
||||
|
||||
void NeckoChild::InitNeckoChild()
|
||||
{
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Content) {
|
||||
mozilla::dom::ContentProcessChild * cpc =
|
||||
mozilla::dom::ContentProcessChild::GetSingleton();
|
||||
NS_ASSERTION(cpc, "Content Protocol is NULL!");
|
||||
gNeckoChild = cpc->SendPNeckoConstructor();
|
||||
NS_ASSERTION(gNeckoChild, "PNecko Protocol init failed!");
|
||||
}
|
||||
}
|
||||
|
||||
PHttpChannelChild*
|
||||
NeckoChild::AllocPHttpChannel()
|
||||
{
|
||||
return new HttpChannelChild();
|
||||
}
|
||||
|
||||
bool
|
||||
NeckoChild::DeallocPHttpChannel(PHttpChannelChild* channel)
|
||||
{
|
||||
delete channel;
|
||||
return true;
|
||||
}
|
||||
|
||||
}} // mozilla::net
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 ts=8 et tw=80 : */
|
||||
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jason Duell <jduell.mcbugs@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef mozilla_net_NeckoChild_h
|
||||
#define mozilla_net_NeckoChild_h
|
||||
|
||||
#include "mozilla/net/PNeckoChild.h"
|
||||
#include "mozilla/net/HttpChannelChild.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
// Header file contents
|
||||
class NeckoChild :
|
||||
public PNeckoChild
|
||||
{
|
||||
public:
|
||||
NeckoChild();
|
||||
virtual ~NeckoChild();
|
||||
|
||||
static void InitNeckoChild();
|
||||
|
||||
virtual PHttpChannelChild* AllocPHttpChannel();
|
||||
virtual bool DeallocPHttpChannel(PHttpChannelChild*);
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
/**
|
||||
* Reference to the PNecko Child protocol.
|
||||
* Null if this is not a content process.
|
||||
*/
|
||||
extern PNeckoChild *gNeckoChild;
|
||||
|
||||
static inline PRBool
|
||||
IsNeckoChild()
|
||||
{
|
||||
return XRE_GetProcessType() == GeckoProcessType_Content;
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_net_NeckoChild_h
|
|
@ -1,71 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 ts=8 et tw=80 : */
|
||||
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jason Duell <jduell.mcbugs@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "mozilla/net/NeckoParent.h"
|
||||
#include "mozilla/net/HttpChannelParent.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
// C++ file contents
|
||||
NeckoParent::NeckoParent()
|
||||
{
|
||||
}
|
||||
|
||||
NeckoParent::~NeckoParent()
|
||||
{
|
||||
}
|
||||
|
||||
PHttpChannelParent*
|
||||
NeckoParent::AllocPHttpChannel()
|
||||
{
|
||||
return new HttpChannelParent();
|
||||
}
|
||||
|
||||
bool
|
||||
NeckoParent::DeallocPHttpChannel(PHttpChannelParent* channel)
|
||||
{
|
||||
delete channel;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}} // mozilla::net
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 ts=8 et tw=80 : */
|
||||
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jason Duell <jduell.mcbugs@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "mozilla/net/PNeckoParent.h"
|
||||
#include "mozilla/net/HttpChannelChild.h"
|
||||
|
||||
#ifndef mozilla_net_NeckoParent_h
|
||||
#define mozilla_net_NeckoParent_h
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
// Header file contents
|
||||
class NeckoParent :
|
||||
public PNeckoParent
|
||||
{
|
||||
public:
|
||||
NeckoParent();
|
||||
virtual ~NeckoParent();
|
||||
|
||||
protected:
|
||||
virtual PHttpChannelParent* AllocPHttpChannel();
|
||||
virtual bool DeallocPHttpChannel(PHttpChannelParent*);
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_net_NeckoParent_h
|
|
@ -1,61 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 ts=8 et tw=80 ft=cpp : */
|
||||
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jason Duell <jduell.mcbugs@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
include protocol "PContentProcess.ipdl";
|
||||
include protocol "PHttpChannel.ipdl";
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
protocol PNecko
|
||||
{
|
||||
manager PContentProcess;
|
||||
manages PHttpChannel;
|
||||
|
||||
parent:
|
||||
PHttpChannel();
|
||||
~PHttpChannel();
|
||||
};
|
||||
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
|
@ -1,40 +0,0 @@
|
|||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Mozilla Firefox.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# The Mozilla Foundation <http://www.mozilla.org/>.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2009
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Jason Duell
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
IPDLSRCS = \
|
||||
PNecko.ipdl \
|
||||
$(NULL)
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 ts=8 et tw=80 : */
|
||||
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jason Duell <jduell.mcbugs@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "mozilla/net/HttpChannelChild.h"
|
||||
#include "mozilla/dom/ContentProcessChild.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
// C++ file contents
|
||||
HttpChannelChild::HttpChannelChild()
|
||||
{
|
||||
}
|
||||
|
||||
HttpChannelChild::~HttpChannelChild()
|
||||
{
|
||||
}
|
||||
|
||||
}} // mozilla::net
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 ts=8 et tw=80 : */
|
||||
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jason Duell <jduell.mcbugs@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef mozilla_net_HttpChannelChild_h
|
||||
#define mozilla_net_HttpChannelChild_h
|
||||
|
||||
#include "mozilla/net/PHttpChannelChild.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
// Header file contents
|
||||
class HttpChannelChild :
|
||||
public PHttpChannelChild
|
||||
{
|
||||
public:
|
||||
HttpChannelChild();
|
||||
virtual ~HttpChannelChild();
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_net_HttpChannelChild_h
|
|
@ -1,64 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 ts=8 et tw=80 : */
|
||||
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jason Duell <jduell.mcbugs@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "mozilla/net/HttpChannelParent.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
// C++ file contents
|
||||
HttpChannelParent::HttpChannelParent()
|
||||
{
|
||||
}
|
||||
|
||||
HttpChannelParent::~HttpChannelParent()
|
||||
{
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
bool HttpChannelParent::RecvasyncOpen(const nsCString& uri)
|
||||
{
|
||||
puts("[HttpChannelParent] got asyncOpen msg");
|
||||
return true;
|
||||
}
|
||||
|
||||
}} // mozilla::net
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 ts=8 et tw=80 : */
|
||||
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jason Duell <jduell.mcbugs@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef mozilla_net_HttpChannelParent_h
|
||||
#define mozilla_net_HttpChannelParent_h
|
||||
|
||||
#include "mozilla/net/PHttpChannelParent.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
// Header file contents
|
||||
class HttpChannelParent :
|
||||
public PHttpChannelParent
|
||||
{
|
||||
public:
|
||||
HttpChannelParent();
|
||||
virtual ~HttpChannelParent();
|
||||
|
||||
protected:
|
||||
virtual bool RecvasyncOpen(const nsCString& uri);
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_net_HttpChannelParent_h
|
|
@ -46,14 +46,6 @@ MODULE = necko
|
|||
LIBRARY_NAME = nkhttp_s
|
||||
LIBXUL_LIBRARY = 1
|
||||
|
||||
ifdef MOZ_IPC
|
||||
EXPORTS_NAMESPACES = mozilla/net
|
||||
|
||||
EXPORTS_mozilla/net = \
|
||||
HttpChannelParent.h \
|
||||
HttpChannelChild.h \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
CPPSRCS = \
|
||||
nsHttp.cpp \
|
||||
|
@ -76,21 +68,12 @@ CPPSRCS = \
|
|||
nsHttpActivityDistributor.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_IPC
|
||||
CPPSRCS += \
|
||||
HttpChannelParent.cpp \
|
||||
HttpChannelChild.cpp \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
LOCAL_INCLUDES=-I$(srcdir)/../../../base/src -I$(topsrcdir)/xpcom/ds
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a
|
||||
# static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
DEFINES += -DIMPL_NS_NET
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 ts=8 et tw=80 ft=cpp : */
|
||||
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Mozilla Foundation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jason Duell <jduell.mcbugs@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
include protocol "PNecko.ipdl";
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
protocol PHttpChannel
|
||||
{
|
||||
manager PNecko;
|
||||
|
||||
parent:
|
||||
asyncOpen(nsCString uri);
|
||||
};
|
||||
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Mozilla Firefox.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# The Mozilla Foundation <http://www.mozilla.org/>.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2009
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Jason Duell
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
IPDLSRCS = \
|
||||
PHttpChannel.ipdl \
|
||||
$(NULL)
|
||||
|
|
@ -44,10 +44,6 @@
|
|||
#define FORCE_PR_LOG
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
#include "mozilla/net/NeckoChild.h"
|
||||
#endif
|
||||
|
||||
#include "plstr.h"
|
||||
#include "prlog.h"
|
||||
#include "prtime.h"
|
||||
|
@ -71,7 +67,6 @@
|
|||
extern PRLogModuleInfo *gHttpLog;
|
||||
#endif
|
||||
|
||||
#undef LOG
|
||||
// http logging
|
||||
#define LOG1(args) PR_LOG(gHttpLog, 1, args)
|
||||
#define LOG2(args) PR_LOG(gHttpLog, 2, args)
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#ifndef nsHttpChunkedDecoder_h__
|
||||
#define nsHttpChunkedDecoder_h__
|
||||
|
||||
#include "nsHttp.h"
|
||||
#include "nsError.h"
|
||||
#include "nsString.h"
|
||||
#include "nsHttpHeaderArray.h"
|
||||
|
|
|
@ -94,11 +94,6 @@
|
|||
#include <os2.h>
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifdef MOZ_IPC
|
||||
using namespace mozilla::net;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
// defined by the socket transport service while active
|
||||
extern PRThread *gSocketThread;
|
||||
|
@ -230,11 +225,6 @@ nsHttpHandler::Init()
|
|||
return rv;
|
||||
}
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
if (IsNeckoChild() && !gNeckoChild)
|
||||
NeckoChild::InitNeckoChild();
|
||||
#endif // MOZ_IPC
|
||||
|
||||
InitUserAgentComponents();
|
||||
|
||||
// monitor some preference changes
|
||||
|
|
|
@ -39,12 +39,12 @@
|
|||
#ifndef nsHttpHeaderArray_h__
|
||||
#define nsHttpHeaderArray_h__
|
||||
|
||||
#include "nsHttp.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "nsIHttpHeaderVisitor.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsHttp.h"
|
||||
|
||||
class nsHttpHeaderArray
|
||||
{
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
#ifndef nsHttpRequestHead_h__
|
||||
#define nsHttpRequestHead_h__
|
||||
|
||||
#include "nsHttp.h"
|
||||
#include "nsHttpHeaderArray.h"
|
||||
#include "nsHttp.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
|
|
|
@ -128,20 +128,6 @@ NS_IMETHODIMP nsSmartCardEvent::SetTrusted(PRBool aResult)
|
|||
return mPrivate->SetTrusted(aResult);
|
||||
}
|
||||
|
||||
void
|
||||
nsSmartCardEvent::Serialize(IPC::Message* aMsg,
|
||||
PRBool aSerializeInterfaceType)
|
||||
{
|
||||
NS_ASSERTION(mPrivate, "SmartCardEvent called without Init");
|
||||
mPrivate->Serialize(aMsg, aSerializeInterfaceType);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsSmartCardEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
{
|
||||
NS_ASSERTION(mPrivate, "SmartCardEvent called without Init");
|
||||
return mPrivate->Deserialize(aMsg, aIter);
|
||||
}
|
||||
|
||||
// IDOMNSEvent maps
|
||||
NS_IMETHODIMP nsSmartCardEvent::GetOriginalTarget(nsIDOMEventTarget * *aOriginalTarget)
|
||||
|
|
|
@ -66,9 +66,6 @@ public:
|
|||
NS_IMETHOD_(nsEvent*) GetInternalNSEvent();
|
||||
NS_IMETHOD_(PRBool ) IsDispatchStopped();
|
||||
NS_IMETHOD SetTrusted(PRBool aResult);
|
||||
virtual void Serialize(IPC::Message* aMsg,
|
||||
PRBool aSerializeInterfaceType);
|
||||
virtual PRBool Deserialize(const IPC::Message* aMsg, void** aIter);
|
||||
|
||||
NS_DECL_NSIDOMEVENT
|
||||
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
[App]
|
||||
Vendor=venderr
|
||||
Name=tile
|
||||
Version=1.0
|
||||
BuildID=20060101
|
||||
Copyright=Copyright (c) 2006 Mark Finkle
|
||||
ID=xulapp@starkravingfinkle.org
|
||||
|
||||
[Gecko]
|
||||
MinVersion=1.8
|
||||
MaxVersion=2.0
|
|
@ -1 +0,0 @@
|
|||
content tile file:content/
|
|
@ -1,728 +0,0 @@
|
|||
// -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*-
|
||||
/*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Mobile Browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2008
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Roy Frostig <rfrostig@mozilla.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
let Ci = Components.interfaces;
|
||||
|
||||
// --- REMOVE ---
|
||||
let noop = function() {};
|
||||
let endl = '\n';
|
||||
// --------------
|
||||
|
||||
function BrowserView(container, visibleRect) {
|
||||
bindAll(this);
|
||||
this.init(container, visibleRect);
|
||||
}
|
||||
|
||||
/**
|
||||
* A BrowserView maintains state of the viewport (browser, zoom level,
|
||||
* dimensions) and the visible rectangle into the viewport, for every
|
||||
* browser it is given (cf setBrowser()). In updates to the viewport state,
|
||||
* a BrowserView (using its TileManager) renders parts of the page quasi-
|
||||
* intelligently, with guarantees of having rendered and appended all of the
|
||||
* visible browser content (aka the "critical rectangle").
|
||||
*
|
||||
* State is characterized in large part by two rectangles (and an implicit third):
|
||||
* - Viewport: Always rooted at the origin, ie with (left, top) at (0, 0). The
|
||||
* width and height (right and bottom) of this rectangle are that of the
|
||||
* current viewport, which corresponds more or less to the transformed
|
||||
* browser content (scaled by zoom level).
|
||||
* - Visible: Corresponds to the client's viewing rectangle in viewport
|
||||
* coordinates. Has (top, left) corresponding to position, and width & height
|
||||
* corresponding to the clients viewing dimensions. Take note that the top
|
||||
* and left of the visible rect are per-browser state, but that the width
|
||||
* and height persist across setBrowser() calls. This is best explained by
|
||||
* a simple example: user views browser A, pans to position (x0, y0), switches
|
||||
* to browser B, where she finds herself at position (x1, y1), tilts her
|
||||
* device so that visible rectangle's width and height change, and switches
|
||||
* back to browser A. She expects to come back to position (x0, y0), but her
|
||||
* device remains tilted.
|
||||
* - Critical (the implicit one): The critical rectangle is the (possibly null)
|
||||
* intersection of the visible and viewport rectangles. That is, it is that
|
||||
* region of the viewport which is visible to the user. We care about this
|
||||
* because it tells us which region must be rendered as soon as it is dirtied.
|
||||
* The critical rectangle is mostly state that we do not keep in BrowserView
|
||||
* but that our TileManager maintains.
|
||||
*
|
||||
* Example rectangle state configurations:
|
||||
*
|
||||
*
|
||||
* +-------------------------------+
|
||||
* |A |
|
||||
* | |
|
||||
* | |
|
||||
* | |
|
||||
* | +----------------+ |
|
||||
* | |B,C | |
|
||||
* | | | |
|
||||
* | | | |
|
||||
* | | | |
|
||||
* | +----------------+ |
|
||||
* | |
|
||||
* | |
|
||||
* | |
|
||||
* | |
|
||||
* | |
|
||||
* +-------------------------------+
|
||||
*
|
||||
*
|
||||
* A = viewport ; at (0, 0)
|
||||
* B = visible ; at (x, y) where x > 0, y > 0
|
||||
* C = critical ; at (x, y)
|
||||
*
|
||||
*
|
||||
*
|
||||
* +-------------------------------+
|
||||
* |A |
|
||||
* | |
|
||||
* | |
|
||||
* | |
|
||||
* +----+-----------+ |
|
||||
* |B .C | |
|
||||
* | . | |
|
||||
* | . | |
|
||||
* | . | |
|
||||
* +----+-----------+ |
|
||||
* | |
|
||||
* | |
|
||||
* | |
|
||||
* | |
|
||||
* | |
|
||||
* +-------------------------------+
|
||||
*
|
||||
*
|
||||
* A = viewport ; at (0, 0)
|
||||
* B = visible ; at (x, y) where x < 0, y > 0
|
||||
* C = critical ; at (0, y)
|
||||
*
|
||||
*
|
||||
* Maintaining per-browser state is a little bit of a hack involving attaching
|
||||
* an object as the obfuscated dynamic JS property of the browser object, that
|
||||
* hopefully no one but us will touch. See getViewportStateFromBrowser() for
|
||||
* the property name.
|
||||
*/
|
||||
BrowserView.prototype = (
|
||||
function() {
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// Privates
|
||||
//
|
||||
|
||||
const kZoomLevelMin = 0.2;
|
||||
const kZoomLevelMax = 4.0;
|
||||
const kZoomLevelPrecision = 10000;
|
||||
|
||||
function visibleRectToCriticalRect(visibleRect, browserViewportState) {
|
||||
return visibleRect.intersect(browserViewportState.viewportRect);
|
||||
}
|
||||
|
||||
function clampZoomLevel(zl) {
|
||||
let bounded = Math.min(Math.max(kZoomLevelMin, zl), kZoomLevelMax);
|
||||
return Math.round(bounded * kZoomLevelPrecision) / kZoomLevelPrecision;
|
||||
}
|
||||
|
||||
function pageZoomLevel(visibleRect, browserW, browserH) {
|
||||
return clampZoomLevel(visibleRect.width / browserW);
|
||||
}
|
||||
|
||||
function seenBrowser(browser) {
|
||||
return !!(browser.__BrowserView__vps);
|
||||
}
|
||||
|
||||
function initBrowserState(browser, visibleRect) {
|
||||
let [browserW, browserH] = getBrowserDimensions(browser);
|
||||
|
||||
let zoomLevel = pageZoomLevel(visibleRect, browserW, browserH);
|
||||
let viewportRect = (new wsRect(0, 0, browserW, browserH)).scale(zoomLevel, zoomLevel);
|
||||
|
||||
dump('--- initing browser to ---' + endl);
|
||||
browser.__BrowserView__vps = new BrowserView.BrowserViewportState(viewportRect,
|
||||
visibleRect.x,
|
||||
visibleRect.y,
|
||||
zoomLevel);
|
||||
dump(browser.__BrowserView__vps.toString() + endl);
|
||||
dump('--------------------------' + endl);
|
||||
}
|
||||
|
||||
function getViewportStateFromBrowser(browser) {
|
||||
return browser.__BrowserView__vps;
|
||||
}
|
||||
|
||||
function getBrowserDimensions(browser) {
|
||||
return [browser.scrollWidth, browser.scrollHeight];
|
||||
}
|
||||
|
||||
function getContentScrollValues(browser) {
|
||||
let cwu = getBrowserDOMWindowUtils(browser);
|
||||
let scrollX = {};
|
||||
let scrollY = {};
|
||||
cwu.getScrollXY(false, scrollX, scrollY);
|
||||
|
||||
return [scrollX.value, scrollY.value];
|
||||
}
|
||||
|
||||
function getBrowserDOMWindowUtils(browser) {
|
||||
return browser.contentWindow
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
}
|
||||
|
||||
function getNewBatchOperationState() {
|
||||
return {
|
||||
viewportSizeChanged: false,
|
||||
dirtyAll: false
|
||||
};
|
||||
}
|
||||
|
||||
function clampViewportWH(width, height, visibleRect) {
|
||||
let minW = visibleRect.width;
|
||||
let minH = visibleRect.height;
|
||||
return [Math.max(width, minW), Math.max(height, minH)];
|
||||
}
|
||||
|
||||
function initContainer(container, visibleRect) {
|
||||
container.style.width = visibleRect.width + 'px';
|
||||
container.style.height = visibleRect.height + 'px';
|
||||
container.style.overflow = '-moz-hidden-unscrollable';
|
||||
}
|
||||
|
||||
function resizeContainerToViewport(container, viewportRect) {
|
||||
container.style.width = viewportRect.width + 'px';
|
||||
container.style.height = viewportRect.height + 'px';
|
||||
}
|
||||
|
||||
// !!! --- RESIZE HACK BEGIN -----
|
||||
function simulateMozAfterSizeChange(browser, width, height) {
|
||||
let ev = document.createElement("MouseEvents");
|
||||
ev.initEvent("FakeMozAfterSizeChange", false, false, window, 0, width, height);
|
||||
browser.dispatchEvent(ev);
|
||||
}
|
||||
// !!! --- RESIZE HACK END -------
|
||||
|
||||
// --- Change of coordinates functions --- //
|
||||
|
||||
|
||||
// The following returned object becomes BrowserView.prototype
|
||||
return {
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// Public instance methods
|
||||
//
|
||||
|
||||
init: function init(container, visibleRect) {
|
||||
this._batchOps = [];
|
||||
this._container = container;
|
||||
this._browserViewportState = null;
|
||||
this._renderMode = 0;
|
||||
this._tileManager = new TileManager(this._appendTile, this._removeTile, this);
|
||||
this.setVisibleRect(visibleRect);
|
||||
|
||||
// !!! --- RESIZE HACK BEGIN -----
|
||||
// remove this eventually
|
||||
this._resizeHack = {
|
||||
maxSeenW: 0,
|
||||
maxSeenH: 0
|
||||
};
|
||||
// !!! --- RESIZE HACK END -------
|
||||
},
|
||||
|
||||
setVisibleRect: function setVisibleRect(r) {
|
||||
let bvs = this._browserViewportState;
|
||||
let vr = this._visibleRect;
|
||||
|
||||
if (!vr)
|
||||
this._visibleRect = vr = r.clone();
|
||||
else
|
||||
vr.copyFrom(r);
|
||||
|
||||
if (bvs) {
|
||||
bvs.visibleX = vr.left;
|
||||
bvs.visibleY = vr.top;
|
||||
|
||||
// reclamp minimally to the new visible rect
|
||||
//this.setViewportDimensions(bvs.viewportRect.right, bvs.viewportRect.bottom);
|
||||
} else
|
||||
this._viewportChanged(false, false);
|
||||
},
|
||||
|
||||
getVisibleRect: function getVisibleRect() {
|
||||
return this._visibleRect.clone();
|
||||
},
|
||||
|
||||
getVisibleRectX: function getVisibleRectX() { return this._visibleRect.x; },
|
||||
getVisibleRectY: function getVisibleRectY() { return this._visibleRect.y; },
|
||||
getVisibleRectWidth: function getVisibleRectWidth() { return this._visibleRect.width; },
|
||||
getVisibleRectHeight: function getVisibleRectHeight() { return this._visibleRect.height; },
|
||||
|
||||
setViewportDimensions: function setViewportDimensions(width, height, causedByZoom) {
|
||||
let bvs = this._browserViewportState;
|
||||
let vis = this._visibleRect;
|
||||
|
||||
if (!bvs)
|
||||
return;
|
||||
|
||||
//[width, height] = clampViewportWH(width, height, vis);
|
||||
bvs.viewportRect.right = width;
|
||||
bvs.viewportRect.bottom = height;
|
||||
|
||||
// XXX we might not want the user's page to disappear from under them
|
||||
// at this point, which could happen if the container gets resized such
|
||||
// that visible rect becomes entirely outside of viewport rect. might
|
||||
// be wise to define what UX should be in this case, like a move occurs.
|
||||
// then again, we could also argue this is the responsibility of the
|
||||
// caller who would do such a thing...
|
||||
|
||||
this._viewportChanged(true, !!causedByZoom);
|
||||
},
|
||||
|
||||
setZoomLevel: function setZoomLevel(zl) {
|
||||
let bvs = this._browserViewportState;
|
||||
|
||||
if (!bvs)
|
||||
return;
|
||||
|
||||
let newZL = clampZoomLevel(zl);
|
||||
|
||||
if (newZL != bvs.zoomLevel) {
|
||||
let browserW = this.viewportToBrowser(bvs.viewportRect.right);
|
||||
let browserH = this.viewportToBrowser(bvs.viewportRect.bottom);
|
||||
bvs.zoomLevel = newZL; // side-effect: now scale factor in transformations is newZL
|
||||
this.setViewportDimensions(this.browserToViewport(browserW),
|
||||
this.browserToViewport(browserH));
|
||||
}
|
||||
},
|
||||
|
||||
getZoomLevel: function getZoomLevel() {
|
||||
let bvs = this._browserViewportState;
|
||||
if (!bvs)
|
||||
return undefined;
|
||||
|
||||
return bvs.zoomLevel;
|
||||
},
|
||||
|
||||
beginBatchOperation: function beginBatchOperation() {
|
||||
this._batchOps.push(getNewBatchOperationState());
|
||||
this.pauseRendering();
|
||||
},
|
||||
|
||||
commitBatchOperation: function commitBatchOperation() {
|
||||
let bops = this._batchOps;
|
||||
|
||||
if (bops.length == 0)
|
||||
return;
|
||||
|
||||
let opState = bops.pop();
|
||||
this._viewportChanged(opState.viewportSizeChanged, opState.dirtyAll);
|
||||
this.resumeRendering();
|
||||
},
|
||||
|
||||
discardBatchOperation: function discardBatchOperation() {
|
||||
let bops = this._batchOps;
|
||||
bops.pop();
|
||||
this.resumeRendering();
|
||||
},
|
||||
|
||||
discardAllBatchOperations: function discardAllBatchOperations() {
|
||||
let bops = this._batchOps;
|
||||
while (bops.length > 0)
|
||||
this.discardBatchOperation();
|
||||
},
|
||||
|
||||
moveVisibleBy: function moveVisibleBy(dx, dy) {
|
||||
let vr = this._visibleRect;
|
||||
let vs = this._browserViewportState;
|
||||
|
||||
this.onBeforeVisibleMove(dx, dy);
|
||||
this.onAfterVisibleMove(dx, dy);
|
||||
},
|
||||
|
||||
moveVisibleTo: function moveVisibleTo(x, y) {
|
||||
let visibleRect = this._visibleRect;
|
||||
let dx = x - visibleRect.x;
|
||||
let dy = y - visibleRect.y;
|
||||
this.moveBy(dx, dy);
|
||||
},
|
||||
|
||||
/**
|
||||
* Calls to this function need to be one-to-one with calls to
|
||||
* resumeRendering()
|
||||
*/
|
||||
pauseRendering: function pauseRendering() {
|
||||
this._renderMode++;
|
||||
},
|
||||
|
||||
/**
|
||||
* Calls to this function need to be one-to-one with calls to
|
||||
* pauseRendering()
|
||||
*/
|
||||
resumeRendering: function resumeRendering(renderNow) {
|
||||
if (this._renderMode > 0)
|
||||
this._renderMode--;
|
||||
|
||||
if (renderNow || this._renderMode == 0)
|
||||
this._tileManager.criticalRectPaint();
|
||||
},
|
||||
|
||||
isRendering: function isRendering() {
|
||||
return (this._renderMode == 0);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param dx Guess delta to destination x coordinate
|
||||
* @param dy Guess delta to destination y coordinate
|
||||
*/
|
||||
onBeforeVisibleMove: function onBeforeVisibleMove(dx, dy) {
|
||||
let vs = this._browserViewportState;
|
||||
let vr = this._visibleRect;
|
||||
|
||||
let destCR = visibleRectToCriticalRect(vr.clone().translate(dx, dy), vs);
|
||||
|
||||
this._tileManager.beginCriticalMove(destCR);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param dx Actual delta to destination x coordinate
|
||||
* @param dy Actual delta to destination y coordinate
|
||||
*/
|
||||
onAfterVisibleMove: function onAfterVisibleMove(dx, dy) {
|
||||
let vs = this._browserViewportState;
|
||||
let vr = this._visibleRect;
|
||||
|
||||
vr.translate(dx, dy);
|
||||
vs.visibleX = vr.left;
|
||||
vs.visibleY = vr.top;
|
||||
|
||||
let cr = visibleRectToCriticalRect(vr, vs);
|
||||
|
||||
this._tileManager.endCriticalMove(cr, this.isRendering());
|
||||
},
|
||||
|
||||
setBrowser: function setBrowser(browser, skipZoom) {
|
||||
let currentBrowser = this._browser;
|
||||
|
||||
let browserChanged = (currentBrowser !== browser);
|
||||
|
||||
if (currentBrowser) {
|
||||
currentBrowser.removeEventListener("MozAfterPaint", this.handleMozAfterPaint, false);
|
||||
|
||||
// !!! --- RESIZE HACK BEGIN -----
|
||||
// change to the real event type and perhaps refactor the handler function name
|
||||
currentBrowser.removeEventListener("FakeMozAfterSizeChange", this.handleMozAfterSizeChange, false);
|
||||
// !!! --- RESIZE HACK END -------
|
||||
|
||||
this.discardAllBatchOperations();
|
||||
|
||||
currentBrowser.setAttribute("type", "content");
|
||||
currentBrowser.docShell.isOffScreenBrowser = false;
|
||||
}
|
||||
|
||||
this._restoreBrowser(browser);
|
||||
|
||||
browser.setAttribute("type", "content-primary");
|
||||
|
||||
this.beginBatchOperation();
|
||||
|
||||
browser.addEventListener("MozAfterPaint", this.handleMozAfterPaint, false);
|
||||
|
||||
// !!! --- RESIZE HACK BEGIN -----
|
||||
// change to the real event type and perhaps refactor the handler function name
|
||||
browser.addEventListener("FakeMozAfterSizeChange", this.handleMozAfterSizeChange, false);
|
||||
// !!! --- RESIZE HACK END -------
|
||||
|
||||
if (!skipZoom) {
|
||||
browser.docShell.isOffScreenBrowser = true;
|
||||
this.zoomToPage();
|
||||
}
|
||||
|
||||
this._viewportChanged(browserChanged, browserChanged);
|
||||
|
||||
this.commitBatchOperation();
|
||||
},
|
||||
|
||||
handleMozAfterPaint: function handleMozAfterPaint(ev) {
|
||||
let browser = this._browser;
|
||||
let tm = this._tileManager;
|
||||
let vs = this._browserViewportState;
|
||||
|
||||
let [scrollX, scrollY] = getContentScrollValues(browser);
|
||||
let clientRects = ev.clientRects;
|
||||
|
||||
// !!! --- RESIZE HACK BEGIN -----
|
||||
// remove this, cf explanation in loop below
|
||||
let hack = this._resizeHack;
|
||||
let hackSizeChanged = false;
|
||||
// !!! --- RESIZE HACK END -------
|
||||
|
||||
let rects = [];
|
||||
// loop backwards to avoid xpconnect penalty for .length
|
||||
for (let i = clientRects.length - 1; i >= 0; --i) {
|
||||
let e = clientRects.item(i);
|
||||
let r = new wsRect(e.left + scrollX,
|
||||
e.top + scrollY,
|
||||
e.width, e.height);
|
||||
|
||||
this.browserToViewportRect(r);
|
||||
r.round();
|
||||
|
||||
if (r.right < 0 || r.bottom < 0)
|
||||
continue;
|
||||
|
||||
// !!! --- RESIZE HACK BEGIN -----
|
||||
// remove this. this is where we make 'lazy' calculations
|
||||
// that hint at a browser size change and fake the size change
|
||||
// event dispach
|
||||
if (r.right > hack.maxW) {
|
||||
hack.maxW = rect.right;
|
||||
hackSizeChanged = true;
|
||||
}
|
||||
if (r.bottom > hack.maxH) {
|
||||
hack.maxH = rect.bottom;
|
||||
hackSizeChanged = true;
|
||||
}
|
||||
// !!! --- RESIZE HACK END -------
|
||||
|
||||
r.restrictTo(vs.viewportRect);
|
||||
rects.push(r);
|
||||
}
|
||||
|
||||
// !!! --- RESIZE HACK BEGIN -----
|
||||
// remove this, cf explanation in loop above
|
||||
if (hackSizeChanged)
|
||||
simulateMozAfterSizeChange(browser, hack.maxW, hack.maxH);
|
||||
// !!! --- RESIZE HACK END -------
|
||||
|
||||
tm.dirtyRects(rects, this.isRendering());
|
||||
},
|
||||
|
||||
handleMozAfterSizeChange: function handleMozAfterPaint(ev) {
|
||||
// !!! --- RESIZE HACK BEGIN -----
|
||||
// get the correct properties off of the event, these are wrong because
|
||||
// we're using a MouseEvent since it has an X and Y prop of some sort and
|
||||
// we piggyback on that.
|
||||
let w = ev.screenX;
|
||||
let h = ev.screenY;
|
||||
// !!! --- RESIZE HACK END -------
|
||||
|
||||
this.setViewportDimensions(w, h);
|
||||
},
|
||||
|
||||
zoomToPage: function zoomToPage() {
|
||||
let browser = this._browser;
|
||||
|
||||
if (!browser)
|
||||
return;
|
||||
|
||||
let [w, h] = getBrowserDimensions(browser);
|
||||
this.setZoomLevel(pageZoomLevel(this._visibleRect, w, h));
|
||||
},
|
||||
|
||||
zoom: function zoom(aDirection) {
|
||||
if (aDirection == 0)
|
||||
return;
|
||||
|
||||
var zoomDelta = 0.05; // 1/20
|
||||
if (aDirection >= 0)
|
||||
zoomDelta *= -1;
|
||||
|
||||
this.zoomLevel = this._zoomLevel + zoomDelta;
|
||||
},
|
||||
|
||||
viewportToBrowser: function viewportToBrowser(x) {
|
||||
let bvs = this._browserViewportState;
|
||||
|
||||
if (!bvs)
|
||||
throw "No browser is set";
|
||||
|
||||
return x / bvs.zoomLevel;
|
||||
},
|
||||
|
||||
browserToViewport: function browserToViewport(x) {
|
||||
let bvs = this._browserViewportState;
|
||||
|
||||
if (!bvs)
|
||||
throw "No browser is set";
|
||||
|
||||
return x * bvs.zoomLevel;
|
||||
},
|
||||
|
||||
viewportToBrowserRect: function viewportToBrowserRect(rect) {
|
||||
let f = this.viewportToBrowser(1.0);
|
||||
return rect.scale(f, f);
|
||||
},
|
||||
|
||||
browserToViewportRect: function browserToViewportRect(rect) {
|
||||
let f = this.browserToViewport(1.0);
|
||||
return rect.scale(f, f);
|
||||
},
|
||||
|
||||
browserToViewportCanvasContext: function browserToViewportCanvasContext(ctx) {
|
||||
let f = this.browserToViewport(1.0);
|
||||
ctx.scale(f, f);
|
||||
},
|
||||
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// Private instance methods
|
||||
//
|
||||
|
||||
_restoreBrowser: function _restoreBrowser(browser) {
|
||||
let vr = this._visibleRect;
|
||||
|
||||
if (!seenBrowser(browser))
|
||||
initBrowserState(browser, vr);
|
||||
|
||||
let bvs = getViewportStateFromBrowser(browser);
|
||||
|
||||
this._contentWindow = browser.contentWindow;
|
||||
this._browser = browser;
|
||||
this._browserViewportState = bvs;
|
||||
vr.left = bvs.visibleX;
|
||||
vr.top = bvs.visibleY;
|
||||
this._tileManager.setBrowser(browser);
|
||||
},
|
||||
|
||||
_viewportChanged: function _viewportChanged(viewportSizeChanged, dirtyAll) {
|
||||
let bops = this._batchOps;
|
||||
|
||||
if (bops.length > 0) {
|
||||
let opState = bops[bops.length - 1];
|
||||
|
||||
if (viewportSizeChanged)
|
||||
opState.viewportSizeChanged = viewportSizeChanged;
|
||||
|
||||
if (dirtyAll)
|
||||
opState.dirtyAll = dirtyAll;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let bvs = this._browserViewportState;
|
||||
let vis = this._visibleRect;
|
||||
|
||||
// !!! --- RESIZE HACK BEGIN -----
|
||||
// We want to uncomment this for perf, but we can't with the hack in place
|
||||
// because the mozAfterPaint gives us rects that we use to create the
|
||||
// fake mozAfterResize event, so we can't just clear things.
|
||||
/*
|
||||
if (dirtyAll) {
|
||||
// We're about to mark the entire viewport dirty, so we can clear any
|
||||
// queued afterPaint events that will cause redundant draws
|
||||
getBrowserDOMWindowUtils(this._browser).clearMozAfterPaintEvents();
|
||||
}
|
||||
*/
|
||||
// !!! --- RESIZE HACK END -------
|
||||
|
||||
if (bvs) {
|
||||
resizeContainerToViewport(this._container, bvs.viewportRect);
|
||||
|
||||
this._tileManager.viewportChangeHandler(bvs.viewportRect,
|
||||
visibleRectToCriticalRect(vis, bvs),
|
||||
viewportSizeChanged,
|
||||
dirtyAll);
|
||||
}
|
||||
},
|
||||
|
||||
_appendTile: function _appendTile(tile) {
|
||||
let canvas = tile.getContentImage();
|
||||
|
||||
/*
|
||||
canvas.style.position = "absolute";
|
||||
canvas.style.left = tile.x + "px";
|
||||
canvas.style.top = tile.y + "px";
|
||||
*/
|
||||
|
||||
canvas.setAttribute("style", "position: absolute; left: " + tile.boundRect.left + "px; " + "top: " + tile.boundRect.top + "px;");
|
||||
|
||||
this._container.appendChild(canvas);
|
||||
|
||||
//dump('++ ' + tile.toString(true) + endl);
|
||||
},
|
||||
|
||||
_removeTile: function _removeTile(tile) {
|
||||
let canvas = tile.getContentImage();
|
||||
|
||||
this._container.removeChild(canvas);
|
||||
|
||||
//dump('-- ' + tile.toString(true) + endl);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
)();
|
||||
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// Helper structures
|
||||
//
|
||||
|
||||
BrowserView.BrowserViewportState = function(viewportRect,
|
||||
visibleX,
|
||||
visibleY,
|
||||
zoomLevel) {
|
||||
|
||||
this.init(viewportRect, visibleX, visibleY, zoomLevel);
|
||||
};
|
||||
|
||||
BrowserView.BrowserViewportState.prototype = {
|
||||
|
||||
init: function init(viewportRect, visibleX, visibleY, zoomLevel) {
|
||||
this.viewportRect = viewportRect;
|
||||
this.visibleX = visibleX;
|
||||
this.visibleY = visibleY;
|
||||
this.zoomLevel = zoomLevel;
|
||||
},
|
||||
|
||||
clone: function clone() {
|
||||
return new BrowserView.BrowserViewportState(this.viewportRect,
|
||||
this.visibleX,
|
||||
this.visibleY,
|
||||
this.zoomLevel);
|
||||
},
|
||||
|
||||
toString: function toString() {
|
||||
let props = ['\tviewportRect=' + this.viewportRect.toString(),
|
||||
'\tvisibleX=' + this.visibleX,
|
||||
'\tvisibleY=' + this.visibleY,
|
||||
'\tzoomLevel=' + this.zoomLevel];
|
||||
|
||||
return '[BrowserViewportState] {\n' + props.join(',\n') + '\n}';
|
||||
}
|
||||
|
||||
};
|
||||
|
|
@ -1,359 +0,0 @@
|
|||
let noop = function() {};
|
||||
Browser = {
|
||||
updateViewportSize: noop
|
||||
/*************************************************************
|
||||
function
|
||||
let browser = document.getElementById("googlenews");
|
||||
let cdoc = browser.contentDocument;
|
||||
|
||||
// These might not exist yet depending on page load state
|
||||
var body = cdoc.body || {};
|
||||
var html = cdoc.documentElement || {};
|
||||
|
||||
var w = Math.max(body.scrollWidth || 0, html.scrollWidth);
|
||||
var h = Math.max(body.scrollHeight || 0, html.scrollHeight);
|
||||
|
||||
window.tileManager.viewportHandler(new wsRect(0, 0, w, h),
|
||||
window.innerWidth,
|
||||
new wsRect(0, 0, window.innerWidth, window.innerHeight),
|
||||
false);
|
||||
*************************************************************/
|
||||
};
|
||||
let ws = {
|
||||
beginUpdateBatch: noop,
|
||||
panTo: noop,
|
||||
endUpdateBatch: noop
|
||||
};
|
||||
let Ci = Components.interfaces;
|
||||
let bv = null;
|
||||
let endl = "\n";
|
||||
|
||||
|
||||
function BrowserView() {
|
||||
this.init();
|
||||
bindAll(this);
|
||||
}
|
||||
|
||||
BrowserView.prototype = {
|
||||
|
||||
// --- PROPERTIES ---
|
||||
// public:
|
||||
// init()
|
||||
// getViewportInnerBoundsRect(dx, dy)
|
||||
// tileManager
|
||||
// scrollbox
|
||||
//
|
||||
// private:
|
||||
// _scrollbox
|
||||
// _leftbar
|
||||
// _rightbar
|
||||
// _topbar
|
||||
// _browser
|
||||
// _tileManager
|
||||
// _viewportRect
|
||||
// _viewportInnerBoundsRect
|
||||
//
|
||||
|
||||
get tileManager() { return this._tileManager; },
|
||||
get scrollbox() { return this._scrollbox; },
|
||||
|
||||
init: function init() {
|
||||
let scrollbox = document.getElementById("scrollbox")
|
||||
.boxObject
|
||||
.QueryInterface(Components.interfaces.nsIScrollBoxObject);
|
||||
this._scrollbox = scrollbox;
|
||||
|
||||
let leftbar = document.getElementById("left_sidebar");
|
||||
let rightbar = document.getElementById("right_sidebar");
|
||||
let topbar = document.getElementById("top_urlbar");
|
||||
this._leftbar = leftbar;
|
||||
this._rightbar = rightbar;
|
||||
this._topbar = topbar;
|
||||
|
||||
scrollbox.scrollTo(Math.round(leftbar.getBoundingClientRect().right), 0);
|
||||
|
||||
let tileContainer = document.getElementById("tile_container");
|
||||
tileContainer.addEventListener("mousedown", onMouseDown, true);
|
||||
tileContainer.addEventListener("mouseup", onMouseUp, true);
|
||||
tileContainer.addEventListener("mousemove", onMouseMove, true);
|
||||
this._tileContainer = tileContainer;
|
||||
|
||||
let tileManager = new TileManager(this.appendTile, this.removeTile, window.innerWidth);
|
||||
this._tileManager = tileManager;
|
||||
|
||||
let browser = document.getElementById("googlenews");
|
||||
this.setCurrentBrowser(browser, false); // sets this._browser
|
||||
|
||||
let cdoc = browser.contentDocument;
|
||||
|
||||
// These might not exist yet depending on page load state
|
||||
let body = cdoc.body || {};
|
||||
let html = cdoc.documentElement || {};
|
||||
|
||||
let w = Math.max(body.scrollWidth || 0, html.scrollWidth);
|
||||
let h = Math.max(body.scrollHeight || 0, html.scrollHeight);
|
||||
|
||||
let viewportRect = new wsRect(0, 0, w, h);
|
||||
this._viewportRect = viewportRect;
|
||||
|
||||
let viewportInnerBoundsRect = this.getViewportInnerBoundsRect();
|
||||
this._viewportInnerBoundsRect = viewportInnerBoundsRect;
|
||||
|
||||
tileManager.viewportHandler(viewportRect,
|
||||
window.innerWidth,
|
||||
viewportInnerBoundsRect,
|
||||
true);
|
||||
},
|
||||
|
||||
resizeTileContainer: function resizeTileContainer() {
|
||||
|
||||
},
|
||||
|
||||
scrollboxToViewportRect: function scrollboxToViewportRect(rect, clip) {
|
||||
let leftbar = this._leftbar.getBoundingClientRect();
|
||||
let rightbar = this._rightbar.getBoundingClientRect();
|
||||
let topbar = this._topbar.getBoundingClientRect();
|
||||
|
||||
let xtrans = -leftbar.width;
|
||||
let ytrans = -topbar.height;
|
||||
let x = rect.x + xtrans;
|
||||
let y = rect.y + ytrans;
|
||||
|
||||
// XXX we're cheating --- this is not really a clip, but its the only
|
||||
// way this function is used
|
||||
rect.x = (clip) ? Math.max(x, 0) : x;
|
||||
rect.y = (clip) ? Math.max(y, 0) : y;
|
||||
|
||||
return rect;
|
||||
},
|
||||
|
||||
getScrollboxPosition: function getScrollboxPosition() {
|
||||
let x = {};
|
||||
let y = {};
|
||||
this._scrollbox.getPosition(x, y);
|
||||
return [x.value, y.value];
|
||||
},
|
||||
|
||||
getViewportInnerBoundsRect: function getViewportInnerBoundsRect(dx, dy) {
|
||||
if (!dx) dx = 0;
|
||||
if (!dy) dy = 0;
|
||||
|
||||
let w = window.innerWidth;
|
||||
let h = window.innerHeight;
|
||||
|
||||
let leftbar = this._leftbar.getBoundingClientRect();
|
||||
let rightbar = this._rightbar.getBoundingClientRect();
|
||||
let topbar = this._topbar.getBoundingClientRect();
|
||||
|
||||
let leftinner = Math.max(leftbar.right - dx, 0);
|
||||
let rightinner = Math.min(rightbar.left - dx, w);
|
||||
let topinner = Math.max(topbar.bottom - dy, 0);
|
||||
|
||||
let [x, y] = this.getScrollboxPosition();
|
||||
|
||||
return this.scrollboxToViewportRect(new wsRect(x + dx, y + dy, rightinner - leftinner, h - topinner),
|
||||
true);
|
||||
},
|
||||
|
||||
appendTile: function appendTile(tile) {
|
||||
let canvas = tile.contentImage;
|
||||
|
||||
canvas.style.position = "absolute";
|
||||
canvas.style.left = tile.x + "px";
|
||||
canvas.style.top = tile.y + "px";
|
||||
|
||||
let tileContainer = document.getElementById("tile_container");
|
||||
tileContainer.appendChild(canvas);
|
||||
|
||||
dump('++ ' + tile.toString() + endl);
|
||||
},
|
||||
|
||||
removeTile: function removeTile(tile) {
|
||||
let canvas = tile.contentImage;
|
||||
|
||||
let tileContainer = document.getElementById("tile_container");
|
||||
tileContainer.removeChild(canvas);
|
||||
|
||||
dump('-- ' + tile.toString() + endl);
|
||||
},
|
||||
|
||||
scrollBy: function scrollBy(dx, dy) {
|
||||
// TODO
|
||||
this.onBeforeScroll();
|
||||
this.onAfterScroll();
|
||||
},
|
||||
|
||||
// x: current x
|
||||
// y: current y
|
||||
// dx: delta to get to x from current x
|
||||
// dy: delta to get to y from current y
|
||||
onBeforeScroll: function onBeforeScroll(x, y, dx, dy) {
|
||||
this.tileManager.onBeforeScroll(this.getViewportInnerBoundsRect(dx, dy));
|
||||
|
||||
// shouldn't update margin if it doesn't need to be changed
|
||||
let sidebars = document.getElementsByClassName("sidebar");
|
||||
for (let i = 0; i < sidebars.length; i++) {
|
||||
let sidebar = sidebars[i];
|
||||
sidebar.style.margin = (y + dy) + "px 0px 0px 0px";
|
||||
}
|
||||
|
||||
let urlbar = document.getElementById("top_urlbar");
|
||||
urlbar.style.margin = "0px 0px 0px " + (x + dx) + "px";
|
||||
},
|
||||
|
||||
onAfterScroll: function onAfterScroll(x, y, dx, dy) {
|
||||
this.tileManager.onAfterScroll(this.getViewportInnerBoundsRect());
|
||||
},
|
||||
|
||||
setCurrentBrowser: function setCurrentBrowser(browser, skipZoom) {
|
||||
let currentBrowser = this._browser;
|
||||
if (currentBrowser) {
|
||||
// backup state
|
||||
currentBrowser.mZoomLevel = this.zoomLevel;
|
||||
currentBrowser.mPanX = ws._viewingRect.x;
|
||||
currentBrowser.mPanY = ws._viewingRect.y;
|
||||
|
||||
// stop monitor paint events for this browser
|
||||
currentBrowser.removeEventListener("MozAfterPaint", this.handleMozAfterPaint, false);
|
||||
currentBrowser.setAttribute("type", "content");
|
||||
currentBrowser.docShell.isOffScreenBrowser = false;
|
||||
}
|
||||
|
||||
browser.setAttribute("type", "content-primary");
|
||||
if (!skipZoom)
|
||||
browser.docShell.isOffScreenBrowser = true;
|
||||
|
||||
// start monitoring paint events for this browser
|
||||
browser.addEventListener("MozAfterPaint", this.handleMozAfterPaint, false);
|
||||
|
||||
this._browser = browser;
|
||||
|
||||
// endLoading(and startLoading in most cases) calls zoom anyway
|
||||
if (!skipZoom) {
|
||||
this.zoomToPage();
|
||||
}
|
||||
|
||||
if ("mZoomLevel" in browser) {
|
||||
// restore last state
|
||||
ws.beginUpdateBatch();
|
||||
ws.panTo(browser.mPanX, browser.mPanY);
|
||||
this.zoomLevel = browser.mZoomLevel;
|
||||
ws.endUpdateBatch(true);
|
||||
|
||||
// drop the cache
|
||||
delete browser.mZoomLevel;
|
||||
delete browser.mPanX;
|
||||
delete browser.mPanY;
|
||||
}
|
||||
|
||||
this.tileManager.browser = browser;
|
||||
},
|
||||
|
||||
handleMozAfterPaint: function handleMozAfterPaint(ev) {
|
||||
this.tileManager.handleMozAfterPaint(ev);
|
||||
},
|
||||
|
||||
zoomToPage: function zoomToPage() {
|
||||
/********************************************************
|
||||
let needToPanToTop = this._needToPanToTop;
|
||||
// Ensure pages are panned at the top before zooming/painting
|
||||
// combine the initial pan + zoom into a transaction
|
||||
if (needToPanToTop) {
|
||||
ws.beginUpdateBatch();
|
||||
this._needToPanToTop = false;
|
||||
ws.panTo(0, -BrowserUI.toolbarH);
|
||||
}
|
||||
// Adjust the zoomLevel to fit the page contents in our window width
|
||||
let [contentW, ] = this._contentAreaDimensions;
|
||||
let fakeW = this._fakeWidth;
|
||||
|
||||
if (contentW > fakeW)
|
||||
this.zoomLevel = fakeW / contentW;
|
||||
|
||||
if (needToPanToTop)
|
||||
ws.endUpdateBatch();
|
||||
********************************************************/
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
function onResize(e) {
|
||||
let browser = document.getElementById("googlenews");
|
||||
let cdoc = browser.contentDocument;
|
||||
|
||||
// These might not exist yet depending on page load state
|
||||
var body = cdoc.body || {};
|
||||
var html = cdoc.documentElement || {};
|
||||
|
||||
var w = Math.max(body.scrollWidth || 0, html.scrollWidth);
|
||||
var h = Math.max(body.scrollHeight || 0, html.scrollHeight);
|
||||
|
||||
if (bv)
|
||||
bv.tileManager.viewportHandler(new wsRect(0, 0, w, h),
|
||||
window.innerWidth,
|
||||
bv.getViewportInnerBoundsRect(),
|
||||
true);
|
||||
}
|
||||
|
||||
function onMouseDown(e) {
|
||||
window._isDragging = true;
|
||||
window._dragStart = {x: e.clientX, y: e.clientY};
|
||||
|
||||
bv.tileManager.startPanning();
|
||||
}
|
||||
|
||||
function onMouseUp() {
|
||||
window._isDragging = false;
|
||||
|
||||
bv.tileManager.endPanning();
|
||||
}
|
||||
|
||||
function onMouseMove(e) {
|
||||
if (window._isDragging) {
|
||||
let scrollbox = bv.scrollbox;
|
||||
|
||||
let x = {};
|
||||
let y = {};
|
||||
let w = {};
|
||||
let h = {};
|
||||
scrollbox.getPosition(x, y);
|
||||
scrollbox.getScrolledSize(w, h);
|
||||
|
||||
let dx = window._dragStart.x - e.clientX;
|
||||
let dy = window._dragStart.y - e.clientY;
|
||||
|
||||
// XXX if max(x, 0) > scrollwidth we shouldn't do anything (same for y/height)
|
||||
let newX = Math.max(x.value + dx, 0);
|
||||
let newY = Math.max(y.value + dy, 0);
|
||||
|
||||
if (newX < w.value || newY < h.value) {
|
||||
// clip dx and dy to prevent us from going below 0
|
||||
dx = Math.max(dx, -x.value);
|
||||
dy = Math.max(dy, -y.value);
|
||||
|
||||
bv.onBeforeScroll(x.value, y.value, dx, dy);
|
||||
|
||||
/*dump("==========scroll==========" + endl);
|
||||
dump("delta: " + dx + "," + dy + endl);
|
||||
let xx = {};
|
||||
let yy = {};
|
||||
scrollbox.getPosition(xx, yy);
|
||||
dump(xx.value + "," + yy.value + endl);*/
|
||||
|
||||
scrollbox.scrollBy(dx, dy);
|
||||
|
||||
/*scrollbox.getPosition(xx, yy);
|
||||
dump(xx.value + "," + yy.value + endl);
|
||||
dump("==========================" + endl);*/
|
||||
|
||||
bv.onAfterScroll();
|
||||
}
|
||||
}
|
||||
|
||||
window._dragStart = {x: e.clientX, y: e.clientY};
|
||||
}
|
||||
|
||||
function onLoad() {
|
||||
bv = new BrowserView();
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml-stylesheet href="chrome://tile/skin/overlay.css" type="text/css"?>
|
||||
<!DOCTYPE overlay SYSTEM "chrome://tile/locale/tile.dtd">
|
||||
<overlay id="tile-overlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script src="overlay.js"/>
|
||||
<stringbundleset id="stringbundleset">
|
||||
<stringbundle id="tile-strings" src="chrome://tile/locale/tile.properties"/>
|
||||
</stringbundleset>
|
||||
|
||||
<menupopup id="menu_ToolsPopup">
|
||||
<menuitem id="tile-hello" label="&tile.label;"
|
||||
oncommand="tile.onMenuItemCommand(event);"/>
|
||||
</menupopup>
|
||||
</overlay>
|
|
@ -1,469 +0,0 @@
|
|||
<window
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
onload="onAlmostLoad();"
|
||||
style="background-color:white;"
|
||||
width="800"
|
||||
height="480"
|
||||
onresize="onResize();"
|
||||
onkeypress="onKeyPress(event);">
|
||||
|
||||
<script type="application/javascript" src="WidgetStack.js"/>
|
||||
<script type="application/javascript" src="TileManager.js"/>
|
||||
<script type="application/javascript" src="BrowserView.js"/>
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
// We do not endorse the use of globals, but this is just a closed lab
|
||||
// environment. What could possibly go wrong? ...
|
||||
let bv = null;
|
||||
let scrollbox = null;
|
||||
let leftbar = null;
|
||||
let rightbar = null;
|
||||
let topbar = null;
|
||||
|
||||
function debug() {
|
||||
let w = {};
|
||||
let h = {};
|
||||
scrollbox.getScrolledSize(w, h);
|
||||
let container = document.getElementById("tile_container");
|
||||
let [x, y] = getScrollboxPosition();
|
||||
let [w, h] = [w.value, h.value];
|
||||
if (bv) {
|
||||
dump('----------------------DEBUG!-------------------------\n');
|
||||
dump(bv._browserViewportState.toString() + endl);
|
||||
|
||||
dump(endl);
|
||||
|
||||
let cr = bv._tileManager._criticalRect;
|
||||
dump('criticalRect from BV: ' + (cr ? cr.toString() : null) + endl);
|
||||
dump('visibleRect from BV : ' + bv._visibleRect.toString() + endl);
|
||||
dump('visibleRect from foo: ' + scrollboxToViewportRect(getVisibleRect()) + endl);
|
||||
|
||||
dump(endl);
|
||||
|
||||
dump('container width,height from BV: ' + bv._container.style.width + ', '
|
||||
+ bv._container.style.height + endl);
|
||||
dump('container width,height via DOM: ' + container.style.width + ', '
|
||||
+ container.style.height + endl);
|
||||
|
||||
dump(endl);
|
||||
|
||||
dump('scrollbox position : ' + x + ', ' + y + endl);
|
||||
dump('scrollbox scrolledsize: ' + w + ', ' + h + endl);
|
||||
|
||||
dump(endl);
|
||||
|
||||
dump('tilecache capacity: ' + bv._tileManager._tileCache.getCapacity() + endl);
|
||||
dump('tilecache size : ' + bv._tileManager._tileCache.size + endl);
|
||||
dump('tilecache numFree : ' + bv._tileManager._tileCache.numFree + endl);
|
||||
dump('tilecache iBound : ' + bv._tileManager._tileCache.iBound + endl);
|
||||
dump('tilecache jBound : ' + bv._tileManager._tileCache.jBound + endl);
|
||||
dump('tilecache _lru : ' + bv._tileManager._tileCache._lru + endl);
|
||||
|
||||
dump('-----------------------------------------------------\n');
|
||||
}
|
||||
}
|
||||
|
||||
function debugTile(i, j) {
|
||||
let tc = bv._tileManager._tileCache;
|
||||
let t = tc.getTile(i, j);
|
||||
|
||||
dump('------ DEBUGGING TILE (' + i + ',' + j + ') --------\n');
|
||||
|
||||
dump('in bounds: ' + tc.inBounds(i, j) + endl);
|
||||
dump('occupied : ' + tc._isOccupied(i, j) + endl);
|
||||
if (t)
|
||||
{
|
||||
dump('toString : ' + t.toString(true) + endl);
|
||||
dump('free : ' + t.free + endl);
|
||||
dump('dirtyRect: ' + t._dirtyTileCanvasRect + endl);
|
||||
|
||||
let len = tc._tilePool.length;
|
||||
for (let k = 0; k < len; ++k)
|
||||
if (tc._tilePool[k] === t)
|
||||
dump('found in tilePool at index ' + k + endl);
|
||||
}
|
||||
|
||||
dump('------------------------------------\n');
|
||||
}
|
||||
|
||||
function onKeyPress(e) {
|
||||
const a = 97; // debug all critical tiles
|
||||
const c = 99; // set tilecache capacity
|
||||
const d = 100; // debug dump
|
||||
const f = 102; // run noop() through forEachIntersectingRect (for timing)
|
||||
const i = 105; // toggle info click mode
|
||||
const l = 108; // restart lazy crawl
|
||||
const m = 109; // fix mouseout
|
||||
const t = 116; // debug given list of tiles separated by space
|
||||
|
||||
switch (e.charCode) {
|
||||
case d:
|
||||
debug();
|
||||
|
||||
break;
|
||||
case l:
|
||||
bv._tileManager.restartLazyCrawl(bv._tileManager._criticalRect);
|
||||
|
||||
break;
|
||||
case c:
|
||||
let cap = parseInt(window.prompt('new capacity'));
|
||||
bv._tileManager._tileCache.setCapacity(cap);
|
||||
|
||||
break;
|
||||
case f:
|
||||
let noop = function noop() { for (let i = 0; i < 10; ++i); };
|
||||
bv._tileManager._tileCache.forEachIntersectingRect(bv._tileManager._criticalRect,
|
||||
false, noop, window);
|
||||
|
||||
break;
|
||||
case t:
|
||||
let ijstrs = window.prompt('row,col plz').split(' ');
|
||||
for each (let ijstr in ijstrs) {
|
||||
let [i, j] = ijstr.split(',').map(function (x) parseInt(x));
|
||||
debugTile(i, j);
|
||||
}
|
||||
|
||||
break;
|
||||
case a:
|
||||
let cr = bv._tileManager._criticalRect;
|
||||
dump('>>>>>> critical rect is ' + (cr ? cr.toString() : cr) + endl);
|
||||
if (cr) {
|
||||
let starti = cr.left >> kTileExponentWidth;
|
||||
let endi = cr.right >> kTileExponentWidth;
|
||||
|
||||
let startj = cr.top >> kTileExponentHeight;
|
||||
let endj = cr.bottom >> kTileExponentHeight;
|
||||
|
||||
for (var jj = startj; jj <= endj; ++jj)
|
||||
for (var ii = starti; ii <= endi; ++ii)
|
||||
debugTile(ii, jj);
|
||||
}
|
||||
|
||||
break;
|
||||
case i:
|
||||
window.infoMode = !window.infoMode;
|
||||
break;
|
||||
case m:
|
||||
onMouseUp();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function onResize(e) {
|
||||
if (bv) {
|
||||
bv.beginBatchOperation();
|
||||
bv.setVisibleRect(scrollboxToViewportRect(getVisibleRect()));
|
||||
bv.zoomToPage();
|
||||
bv.commitBatchOperation();
|
||||
}
|
||||
}
|
||||
|
||||
function onMouseDown(e) {
|
||||
if (window.infoMode) {
|
||||
let [basex, basey] = getScrollboxPosition();
|
||||
let [x, y] = scrollboxToViewportXY(basex + e.clientX, basey + e.clientY);
|
||||
let i = x >> kTileExponentWidth;
|
||||
let j = y >> kTileExponentHeight;
|
||||
|
||||
debugTile(i, j);
|
||||
}
|
||||
|
||||
window._isDragging = true;
|
||||
window._dragStart = {x: e.clientX, y: e.clientY};
|
||||
|
||||
bv.pauseRendering();
|
||||
}
|
||||
|
||||
function onMouseUp() {
|
||||
window._isDragging = false;
|
||||
bv.resumeRendering();
|
||||
}
|
||||
|
||||
function onMouseMove(e) {
|
||||
if (window._isDragging) {
|
||||
let x = {};
|
||||
let y = {};
|
||||
let w = {};
|
||||
let h = {};
|
||||
scrollbox.getPosition(x, y);
|
||||
scrollbox.getScrolledSize(w, h);
|
||||
|
||||
let dx = window._dragStart.x - e.clientX;
|
||||
let dy = window._dragStart.y - e.clientY;
|
||||
|
||||
// XXX if max(x, 0) > scrollwidth we shouldn't do anything (same for y/height)
|
||||
let newX = Math.max(x.value + dx, 0);
|
||||
let newY = Math.max(y.value + dy, 0);
|
||||
|
||||
if (newX < w.value || newY < h.value) {
|
||||
// clip dx and dy to prevent us from going below 0
|
||||
dx = Math.max(dx, -x.value);
|
||||
dy = Math.max(dy, -y.value);
|
||||
|
||||
let oldx = x.value;
|
||||
let oldy = y.value;
|
||||
|
||||
bv.onBeforeVisibleMove(dx, dy);
|
||||
|
||||
updateBars(oldx, oldy, dx, dy);
|
||||
scrollbox.scrollBy(dx, dy);
|
||||
|
||||
let [newx, newy] = getScrollboxPosition();
|
||||
let realdx = newx - oldx;
|
||||
let realdy = newy - oldy;
|
||||
|
||||
updateBars(oldx, oldy, realdx, realdy);
|
||||
bv.onAfterVisibleMove(realdx, realdy);
|
||||
}
|
||||
window._dragStart = {x: e.clientX, y: e.clientY};
|
||||
}
|
||||
}
|
||||
|
||||
function onAlmostLoad() {
|
||||
window._isDragging = false;
|
||||
window.infoMode = false;
|
||||
window.setTimeout(onLoad, 1500);
|
||||
}
|
||||
|
||||
function onLoad() {
|
||||
// ----------------------------------------------------
|
||||
scrollbox = document.getElementById("scrollbox")
|
||||
.boxObject
|
||||
.QueryInterface(Components.interfaces.nsIScrollBoxObject);
|
||||
leftbar = document.getElementById("left_sidebar");
|
||||
rightbar = document.getElementById("right_sidebar");
|
||||
topbar = document.getElementById("top_urlbar");
|
||||
// ----------------------------------------------------
|
||||
|
||||
let initX = Math.round(leftbar.getBoundingClientRect().right);
|
||||
dump('scrolling to ' + initX + endl);
|
||||
scrollbox.scrollTo(initX, 0);
|
||||
let [x, y] = getScrollboxPosition();
|
||||
dump(' scrolled to ' + x + ',' + y + endl);
|
||||
|
||||
let container = document.getElementById("tile_container");
|
||||
container.addEventListener("mousedown", onMouseDown, true);
|
||||
container.addEventListener("mouseup", onMouseUp, true);
|
||||
container.addEventListener("mousemove", onMouseMove, true);
|
||||
|
||||
bv = new BrowserView(container, scrollboxToViewportRect(getVisibleRect()));
|
||||
|
||||
let browser = document.getElementById("googlenews");
|
||||
bv.setBrowser(browser, false);
|
||||
}
|
||||
|
||||
function updateBars(x, y, dx, dy) {
|
||||
return;
|
||||
// shouldn't update margin if it doesn't need to be changed
|
||||
let sidebars = document.getElementsByClassName("sidebar");
|
||||
for (let i = 0; i < sidebars.length; i++) {
|
||||
let sidebar = sidebars[i];
|
||||
sidebar.style.margin = (y + dy) + "px 0px 0px 0px";
|
||||
}
|
||||
|
||||
let urlbar = document.getElementById("top_urlbar");
|
||||
urlbar.style.margin = "0px 0px 0px " + (x + dx) + "px";
|
||||
}
|
||||
|
||||
function viewportToScrollboxXY(x, y) {
|
||||
return scrollboxToViewportXY(x, y, -1);
|
||||
}
|
||||
|
||||
function scrollboxToViewportXY(x, y) {
|
||||
if (!x) x = 0;
|
||||
if (!y) y = 0;
|
||||
|
||||
// shield your eyes!
|
||||
let direction = (arguments.length >= 3) ? arguments[2] : 1;
|
||||
|
||||
let leftbarcr = leftbar.getBoundingClientRect();
|
||||
let rightbarcr = rightbar.getBoundingClientRect();
|
||||
let topbarcr = topbar.getBoundingClientRect();
|
||||
|
||||
let xtrans = direction * (-leftbarcr.width);
|
||||
let ytrans = direction * (-topbarcr.height);
|
||||
x += xtrans;
|
||||
y += ytrans;
|
||||
|
||||
return [x, y];
|
||||
}
|
||||
|
||||
function scrollboxToBrowserXY(browserView, x, y) {
|
||||
[x, y] = scrollboxToViewportXY(x, y);
|
||||
return [browserView.viewportToBrowser(x),
|
||||
browserView.viewportToBrowser(y)];
|
||||
}
|
||||
|
||||
function scrollboxToViewportRect(rect) {
|
||||
let leftbarcr = leftbar.getBoundingClientRect();
|
||||
let topbarcr = topbar.getBoundingClientRect();
|
||||
|
||||
let xtrans = -leftbarcr.width;
|
||||
let ytrans = -topbarcr.height;
|
||||
|
||||
rect.translate(xtrans, ytrans);
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
function getScrollboxPosition() {
|
||||
let x = {};
|
||||
let y = {};
|
||||
scrollbox.getPosition(x, y);
|
||||
return [x.value, y.value];
|
||||
}
|
||||
|
||||
function getContentScrollValues(browser) {
|
||||
let cwu = getBrowserDOMWindowUtils(browser);
|
||||
let scrollX = {};
|
||||
let scrollY = {};
|
||||
cwu.getScrollXY(false, scrollX, scrollY);
|
||||
|
||||
return [scrollX.value, scrollY.value];
|
||||
}
|
||||
|
||||
function getBrowserDOMWindowUtils(browser) {
|
||||
return browser.contentWindow
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
}
|
||||
|
||||
function getBrowserClientRect(browser, el) {
|
||||
let [scrollX, scrollY] = getContentScrollValues(browser);
|
||||
let r = el.getBoundingClientRect();
|
||||
|
||||
return new wsRect(r.left + scrollX,
|
||||
r.top + scrollY,
|
||||
r.width, r.height);
|
||||
}
|
||||
|
||||
function scrollToElement(browser, el) {
|
||||
var elRect = getPagePosition(browser, el);
|
||||
bv.browserToViewportRect(elRect);
|
||||
elRect.round();
|
||||
this.scrollTo(elRect.x, elRect.y);
|
||||
}
|
||||
|
||||
function zoomToElement(aElement) {
|
||||
const margin = 15;
|
||||
|
||||
let elRect = getBrowserClientRect(browser, aElement);
|
||||
let elWidth = elRect.width;
|
||||
let vrWidth = bv.visibleRect.width;
|
||||
/* Try to set zoom-level such that once zoomed element is as wide
|
||||
* as the visible rect */
|
||||
let zoomLevel = vrtWidth / (elWidth + (2 * margin));
|
||||
|
||||
bv.beginBatchOperation();
|
||||
|
||||
bv.setZoomLevel(zoomLevel);
|
||||
|
||||
/* If zoomLevel ends up clamped to less than asked for, calculate
|
||||
* how many more screen pixels will fit horizontally in addition to
|
||||
* element's width. This ensures that more of the webpage is
|
||||
* showing instead of the navbar. Bug 480595. */
|
||||
let xpadding = Math.max(margin, vrWidth - bv.browserToViewport(elWidth));
|
||||
|
||||
// XXX TODO these arguments are wrong, we still have to transform the coordinates
|
||||
// from viewport to scrollbox before sending them to scrollTo
|
||||
this.scrollTo(Math.floor(Math.max(bv.browserToViewport(elRect.x) - xpadding, 0)),
|
||||
Math.floor(Math.max(bv.browserToViewport(elRect.y) - margin, 0)));
|
||||
|
||||
bv.commitBatchOperation();
|
||||
}
|
||||
|
||||
function zoomFromElement(browser, aElement) {
|
||||
let elRect = getBrowserClientRect(browser, aElement);
|
||||
|
||||
bv.beginBatchOperation();
|
||||
|
||||
// pan to the element
|
||||
// don't bother with x since we're zooming all the way out
|
||||
bv.zoomToPage();
|
||||
|
||||
// XXX have this center the element on the page
|
||||
// XXX TODO these arguments are wrong, we still have to transform the coordinates
|
||||
// from viewport to scrollbox before sending them to scrollTo
|
||||
this.scrollTo(0, Math.floor(Math.max(0, bv.browserToViewport(elRect.y))));
|
||||
|
||||
bv.commitBatchOperation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the content element for a given point in client coordinates
|
||||
* (relative to the top left corner of the chrome window).
|
||||
*/
|
||||
function elementFromPoint(browser, browserView, x, y) {
|
||||
[x, y] = scrollboxToBrowserXY(browserView, x, y);
|
||||
let cwu = getBrowserDOMWindowUtils(browser);
|
||||
return cwu.elementFromPoint(x, y,
|
||||
true, /* ignore root scroll frame*/
|
||||
false); /* don't flush layout */
|
||||
}
|
||||
|
||||
/* ensures that a given content element is visible */
|
||||
function ensureElementIsVisible(browser, aElement) {
|
||||
let elRect = getBrowserClientRect(browser, aElement);
|
||||
|
||||
bv.browserToViewportRect(elRect);
|
||||
|
||||
let curRect = bv.visibleRect;
|
||||
let newx = curRect.x;
|
||||
let newy = curRect.y;
|
||||
|
||||
if (elRect.x < curRect.x || elRect.width > curRect.width) {
|
||||
newx = elRect.x;
|
||||
} else if (elRect.x + elRect.width > curRect.x + curRect.width) {
|
||||
newx = elRect.x - curRect.width + elRect.width;
|
||||
}
|
||||
|
||||
if (elRect.y < curRect.y || elRect.height > curRect.height) {
|
||||
newy = elRect.y;
|
||||
} else if (elRect.y + elRect.height > curRect.y + curRect.height) {
|
||||
newy = elRect.y - curRect.height + elRect.height;
|
||||
}
|
||||
|
||||
// XXX TODO these arguments are wrong, we still have to transform the coordinates
|
||||
// from viewport to scrollbox before sending them to scrollTo
|
||||
this.scrollTo(newx, newy);
|
||||
}
|
||||
|
||||
// this is a mehful way of getting the visible rect in scrollbox coordinates
|
||||
// that we use in this here lab environment and hopefully nowhere in real fennec
|
||||
function getVisibleRect() {
|
||||
let w = window.innerWidth;
|
||||
let h = window.innerHeight;
|
||||
|
||||
let [x, y] = getScrollboxPosition();
|
||||
|
||||
return new wsRect(x, y, w, h);
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<scrollbox id="scrollbox" style="-moz-box-orient: vertical; overflow: scroll;" flex="1">
|
||||
<hbox id="top_urlbar" style="background-color: pink"><textbox flex="1"/></hbox>
|
||||
<hbox style="position: relative">
|
||||
<vbox id="left_sidebar" class="sidebar" style="background-color: red"><button label="left sidebar"/></vbox>
|
||||
<box>
|
||||
<html:div id="tile_container" style="position: relative; width: 800px; height: 480px; overflow: -moz-hidden-unscrollable;"/>
|
||||
</box>
|
||||
<vbox id="right_sidebar" class="sidebar" style="background-color: blue"><button label="right sidebar"/></vbox>
|
||||
</hbox>
|
||||
</scrollbox>
|
||||
|
||||
<box>
|
||||
<html:div style="position: relative; overflow: hidden; max-width: 0px; max-height: 0px; visibility: hidden;">
|
||||
<html:div id="browsers" style="position: absolute;">
|
||||
<!-- <browser id="googlenews" src="http://www.webhamster.com/" type="content" style="width: 1024px; height: 614px"/> -->
|
||||
<iframe id="googlenews" src="http://news.google.com/" type="content" style="width: 1024px; height: 614px"/>
|
||||
</html:div>
|
||||
</html:div>
|
||||
</box>
|
||||
|
||||
</window>
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
|
||||
<window id="main" title="My App" width="300" height="300"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<caption label="Hello World"/>
|
||||
</window>
|
|
@ -1,15 +0,0 @@
|
|||
var tile = {
|
||||
onLoad: function() {
|
||||
// initialization code
|
||||
this.initialized = true;
|
||||
this.strings = document.getElementById("tile-strings");
|
||||
},
|
||||
onMenuItemCommand: function(e) {
|
||||
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
promptService.alert(window, this.strings.getString("helloMessageTitle"),
|
||||
this.strings.getString("helloMessage"));
|
||||
},
|
||||
|
||||
};
|
||||
window.addEventListener("load", function(e) { tile.onLoad(e); }, false);
|
|
@ -1 +0,0 @@
|
|||
<!ENTITY tile.label "Your localized menuitem">
|
|
@ -1,3 +0,0 @@
|
|||
helloMessage=Hello World!
|
||||
helloMessageTitle=Hello
|
||||
prefMessage=Int Pref Value: %d
|
|
@ -1,5 +0,0 @@
|
|||
/* This is just an example. You shouldn't do this. */
|
||||
#tile-hello
|
||||
{
|
||||
color: red ! important;
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
pref("toolkit.defaultChromeURI", "chrome://tile/content/foo.xul");
|
||||
pref("javascript.options.jit.chrome", true);
|
||||
pref("javascript.options.jit.content", false);
|
||||
pref("browser.dom.window.dump.enabled", true);
|
||||
pref("dom.ipc.tabs.enabled", true);
|
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>tile@roy</em:id>
|
||||
<em:name>tile</em:name>
|
||||
<em:version>1.0</em:version>
|
||||
<em:creator>Roy</em:creator>
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <!-- firefox -->
|
||||
<em:minVersion>1.5</em:minVersion>
|
||||
<em:maxVersion>3.5.*</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
</Description>
|
||||
</RDF>
|
|
@ -1,104 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
import re, sys
|
||||
|
||||
interesting_re = re.compile("(js_Execute|CallHook) ([^ ]+) ([^ ]+ )?([^ ]+ms)")
|
||||
class Entry:
|
||||
def __init__(self, kind, depth, file, linenum, func, timetaken):
|
||||
self.kind = kind
|
||||
self.depth = depth
|
||||
self.file = file
|
||||
self.linenum = linenum
|
||||
self.func = func
|
||||
self.timetaken = timetaken
|
||||
self.calls = 0
|
||||
self.duration = 0
|
||||
|
||||
def __str__(self):
|
||||
return " ".join(map(str,[self.kind, self.depth, self.file, self.linenum, self.func, self.timetaken]))
|
||||
|
||||
def id(self):
|
||||
if self.kind == "js_Execute":
|
||||
return self.file
|
||||
else:
|
||||
if self.file and self.linenum:
|
||||
strout = "%s:%d" % (self.file, self.linenum)
|
||||
if self.func:
|
||||
strout = "%s %s" % (self.func, strout)
|
||||
return strout
|
||||
elif self.func:
|
||||
return self.func
|
||||
else:
|
||||
print("No clue what my id is:"+self)
|
||||
|
||||
def call(self, timetaken):
|
||||
self.calls += 1
|
||||
self.duration += timetaken
|
||||
|
||||
def parse_line(line):
|
||||
m = interesting_re.search(line)
|
||||
if not m:
|
||||
return None
|
||||
|
||||
ms_index = line.find("ms")
|
||||
depth = m.start() - ms_index - 3
|
||||
kind = m.group(1)
|
||||
func = None
|
||||
file = None
|
||||
linenum = None
|
||||
if kind == "CallHook":
|
||||
func = m.group(2)
|
||||
file = m.group(3)
|
||||
colpos = file.rfind(":")
|
||||
(file,linenum) = file[:colpos], file[colpos+1:-1]
|
||||
if linenum == "0":
|
||||
linenum = None
|
||||
else:
|
||||
linenum = int(linenum)
|
||||
offset = 1
|
||||
else:
|
||||
file = m.group(3)
|
||||
|
||||
timetaken = None
|
||||
try:
|
||||
timetaken = float(m.group(4)[:-2])
|
||||
except:
|
||||
return None
|
||||
return Entry(kind, depth, file, linenum, func, timetaken)
|
||||
|
||||
def compare(x,y):
|
||||
diff = x[1].calls - y[1].calls
|
||||
if diff == 0:
|
||||
return int(x[1].duration - y[1].duration)
|
||||
elif diff > 0:
|
||||
return 1
|
||||
elif diff < 0:
|
||||
return -1
|
||||
|
||||
def frequency(ls):
|
||||
dict = {}
|
||||
for item in ls:
|
||||
id = item.id()
|
||||
stat = None
|
||||
if not id in dict:
|
||||
stat = dict[id] = item
|
||||
else:
|
||||
stat = dict[id]
|
||||
stat.call(item.timetaken)
|
||||
|
||||
ls = dict.items()
|
||||
ls.sort(compare)
|
||||
ls = filter(lambda (_,item): item.duration > 20, ls)
|
||||
# ls = filter(lambda (_,item): item.file and item.file.find("browser.js") != -1 and item.linenum <= 1223 and item.linenum >1067, ls)
|
||||
for key, item in ls:
|
||||
print(item.calls,key, str(item.duration)+"ms")
|
||||
|
||||
def go():
|
||||
file = sys.argv[1]
|
||||
|
||||
ls = filter(lambda x: x != None, map(parse_line, open(file).readlines()))
|
||||
|
||||
frequency(ls)
|
||||
print ls[0]
|
||||
|
||||
go()
|
||||
|
Загрузка…
Ссылка в новой задаче