зеркало из https://github.com/mozilla/pjs.git
Initial XBL landing.
This commit is contained in:
Родитель
c186b0fe92
Коммит
48e8fcfa21
|
@ -0,0 +1,38 @@
|
|||
#
|
||||
# The contents of this file are subject to the Netscape 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/NPL/
|
||||
#
|
||||
# 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 Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = layout
|
||||
|
||||
EXPORTS = \
|
||||
nsIXBLService.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
nsIXBLService.h
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape 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/NPL/
|
||||
#
|
||||
# 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 Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..\..\..
|
||||
|
||||
EXPORTS = \
|
||||
nsIXBLService.h \
|
||||
$(NULL)
|
||||
|
||||
MODULE=raptor
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
|
@ -0,0 +1,56 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape 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/NPL/
|
||||
*
|
||||
* 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 Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Private interface to the XBL service
|
||||
|
||||
*/
|
||||
|
||||
#ifndef nsIXBLService_h__
|
||||
#define nsIXBLService_h__
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsISupportsArray;
|
||||
|
||||
// {0E7903E1-C7BB-11d3-97FB-00400553EEF0}
|
||||
#define NS_IXBLSERVICE_IID \
|
||||
{ 0xe7903e1, 0xc7bb, 0x11d3, { 0x97, 0xfb, 0x0, 0x40, 0x5, 0x53, 0xee, 0xf0 } }
|
||||
|
||||
class nsIXBLService : public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IXBLSERVICE_IID; return iid; }
|
||||
|
||||
// This function loads a particular XBL file and installs all of the bindings
|
||||
// onto the element.
|
||||
NS_IMETHOD LoadBindings(nsIContent* aContent, const nsString& aURL);
|
||||
|
||||
// For a given element, returns a flat list of all the anonymous children that need
|
||||
// frames built.
|
||||
NS_IMETHOD GetContentList(nsIContent* aContent, nsISupportsArray** aResult);
|
||||
};
|
||||
|
||||
#endif // nsIXBLService_h__
|
|
@ -26,7 +26,7 @@ VPATH = @srcdir@
|
|||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = base html xml xul
|
||||
DIRS = base html xml xul xbl
|
||||
|
||||
ifdef MOZ_MATHML
|
||||
DIRS += mathml
|
||||
|
|
|
@ -79,6 +79,9 @@
|
|||
|
||||
#include "nsGfxTextControlFrame.h"
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIXBLService.h"
|
||||
|
||||
#undef NOISY_FIRST_LETTER
|
||||
|
||||
#ifdef MOZ_MATHML
|
||||
|
@ -3734,16 +3737,47 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell,
|
|||
nsIFrame* aNewFrame,
|
||||
nsFrameItems& aChildItems)
|
||||
{
|
||||
/*
|
||||
nsCOMPtr<nsIStyleContext> styleContext;
|
||||
aNewFrame->GetStyleContext(getter_AddRefs(styleContext));
|
||||
|
||||
const nsStyleUserInterface* ui= (const nsStyleUserInterface*)
|
||||
styleContext->GetStyleData(eStyleStruct_UserInterface);
|
||||
|
||||
if (ui->mBehavior != "")
|
||||
printf("The behavior is not the empty string!\n");
|
||||
*/
|
||||
if (ui->mBehavior != "") {
|
||||
// Get the XBL loader.
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIXBLService, xblService, "components://netscape/xbl", &rv);
|
||||
if (!xblService)
|
||||
return rv;
|
||||
|
||||
// Load the bindings.
|
||||
xblService->LoadBindings(aParent, ui->mBehavior);
|
||||
|
||||
// Retrieve the anonymous content that we should build.
|
||||
nsCOMPtr<nsISupportsArray> anonymousItems;
|
||||
xblService->GetContentList(aParent, getter_AddRefs(anonymousItems));
|
||||
|
||||
if (!anonymousItems)
|
||||
return NS_OK;
|
||||
|
||||
// Build the frames for the anonymous content.
|
||||
PRUint32 count = 0;
|
||||
anonymousItems->Count(&count);
|
||||
|
||||
for (PRUint32 i=0; i < count; i++)
|
||||
{
|
||||
// get our child's content and set its parent to our content
|
||||
nsCOMPtr<nsISupports> node;
|
||||
anonymousItems->GetElementAt(i,getter_AddRefs(node));
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
|
||||
|
||||
// create the frame and attach it to our frame
|
||||
ConstructFrame(aPresShell, aPresContext, aState, content, aNewFrame, aChildItems);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// only these tags types can have anonymous content. We do this check for performance
|
||||
// reasons. If we did a query interface on every tag it would be very inefficient.
|
||||
|
|
|
@ -79,6 +79,9 @@
|
|||
|
||||
#include "nsGfxTextControlFrame.h"
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIXBLService.h"
|
||||
|
||||
#undef NOISY_FIRST_LETTER
|
||||
|
||||
#ifdef MOZ_MATHML
|
||||
|
@ -3734,16 +3737,47 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell,
|
|||
nsIFrame* aNewFrame,
|
||||
nsFrameItems& aChildItems)
|
||||
{
|
||||
/*
|
||||
nsCOMPtr<nsIStyleContext> styleContext;
|
||||
aNewFrame->GetStyleContext(getter_AddRefs(styleContext));
|
||||
|
||||
const nsStyleUserInterface* ui= (const nsStyleUserInterface*)
|
||||
styleContext->GetStyleData(eStyleStruct_UserInterface);
|
||||
|
||||
if (ui->mBehavior != "")
|
||||
printf("The behavior is not the empty string!\n");
|
||||
*/
|
||||
if (ui->mBehavior != "") {
|
||||
// Get the XBL loader.
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIXBLService, xblService, "components://netscape/xbl", &rv);
|
||||
if (!xblService)
|
||||
return rv;
|
||||
|
||||
// Load the bindings.
|
||||
xblService->LoadBindings(aParent, ui->mBehavior);
|
||||
|
||||
// Retrieve the anonymous content that we should build.
|
||||
nsCOMPtr<nsISupportsArray> anonymousItems;
|
||||
xblService->GetContentList(aParent, getter_AddRefs(anonymousItems));
|
||||
|
||||
if (!anonymousItems)
|
||||
return NS_OK;
|
||||
|
||||
// Build the frames for the anonymous content.
|
||||
PRUint32 count = 0;
|
||||
anonymousItems->Count(&count);
|
||||
|
||||
for (PRUint32 i=0; i < count; i++)
|
||||
{
|
||||
// get our child's content and set its parent to our content
|
||||
nsCOMPtr<nsISupports> node;
|
||||
anonymousItems->GetElementAt(i,getter_AddRefs(node));
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
|
||||
|
||||
// create the frame and attach it to our frame
|
||||
ConstructFrame(aPresShell, aPresContext, aState, content, aNewFrame, aChildItems);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// only these tags types can have anonymous content. We do this check for performance
|
||||
// reasons. If we did a query interface on every tag it would be very inefficient.
|
||||
|
|
|
@ -26,6 +26,7 @@ DIRS= \
|
|||
html \
|
||||
xml \
|
||||
xul \
|
||||
xbl \
|
||||
!if defined(MOZ_XSL)
|
||||
xsl \
|
||||
!endif
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
#
|
||||
# The contents of this file are subject to the Netscape 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/NPL/
|
||||
#
|
||||
# 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 Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = layout
|
||||
|
||||
EXPORTS = \
|
||||
nsIXBLService.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
nsIXBLService.h
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape 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/NPL/
|
||||
#
|
||||
# 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 Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..\..\..
|
||||
|
||||
EXPORTS = \
|
||||
nsIXBLService.h \
|
||||
$(NULL)
|
||||
|
||||
MODULE=raptor
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
|
@ -0,0 +1,56 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape 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/NPL/
|
||||
*
|
||||
* 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 Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Private interface to the XBL service
|
||||
|
||||
*/
|
||||
|
||||
#ifndef nsIXBLService_h__
|
||||
#define nsIXBLService_h__
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsISupportsArray;
|
||||
|
||||
// {0E7903E1-C7BB-11d3-97FB-00400553EEF0}
|
||||
#define NS_IXBLSERVICE_IID \
|
||||
{ 0xe7903e1, 0xc7bb, 0x11d3, { 0x97, 0xfb, 0x0, 0x40, 0x5, 0x53, 0xee, 0xf0 } }
|
||||
|
||||
class nsIXBLService : public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IXBLSERVICE_IID; return iid; }
|
||||
|
||||
// This function loads a particular XBL file and installs all of the bindings
|
||||
// onto the element.
|
||||
NS_IMETHOD LoadBindings(nsIContent* aContent, const nsString& aURL);
|
||||
|
||||
// For a given element, returns a flat list of all the anonymous children that need
|
||||
// frames built.
|
||||
NS_IMETHOD GetContentList(nsIContent* aContent, nsISupportsArray** aResult);
|
||||
};
|
||||
|
||||
#endif // nsIXBLService_h__
|
Загрузка…
Ссылка в новой задаче