Compare commits
8 Commits
NETSCAPE_7
...
XULDOMJS_1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dec4c9d945 | ||
|
|
ccb9edab60 | ||
|
|
d798be075c | ||
|
|
5fe368c501 | ||
|
|
d8526e1053 | ||
|
|
7dedd77121 | ||
|
|
7da3b87c4a | ||
|
|
93b4e5ec43 |
@@ -1,80 +0,0 @@
|
||||
#!perl
|
||||
|
||||
#
|
||||
# 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):
|
||||
# Simon Fraser <sfraser@netscape.com>
|
||||
#
|
||||
|
||||
require 5.004;
|
||||
|
||||
use strict;
|
||||
|
||||
use Cwd;
|
||||
use Moz::BuildUtils;
|
||||
use Moz::BuildCore;
|
||||
|
||||
#-------------------------------------------------------------
|
||||
# Where have the build options gone?
|
||||
#
|
||||
# The various build flags have been centralized into one place.
|
||||
# The master list of options is in MozBuildFlags.txt. However,
|
||||
# you should never need to edit that file, or this one.
|
||||
#
|
||||
# To customize what gets built, or where to start the build,
|
||||
# edit the $prefs_file_name file in
|
||||
# System Folder:Preferences:Mozilla build prefs:
|
||||
# Documentation is provided in that file.
|
||||
#-------------------------------------------------------------
|
||||
|
||||
my($prefs_file_name) = "Mozilla opt build prefs";
|
||||
my($config_header_file_name) = ":mozilla:config:mac:DefinesOptions.h";
|
||||
|
||||
#-------------------------------------------------------------
|
||||
# hashes to hold build options
|
||||
#-------------------------------------------------------------
|
||||
my(%build);
|
||||
my(%options);
|
||||
my(%filepaths);
|
||||
my(%optiondefines);
|
||||
|
||||
# Hash of input files for this build. Eventually, there will be
|
||||
# input files for manifests, and projects too.
|
||||
my(%inputfiles) = (
|
||||
"buildflags", "MozillaBuildFlags.txt",
|
||||
"checkoutdata", "MozillaCheckoutList.txt",
|
||||
"buildprogress", "¥ Mozilla opt progress",
|
||||
"buildmodule", "MozillaBuildList.pm",
|
||||
"checkouttime", "Mozilla last checkout"
|
||||
);
|
||||
#-------------------------------------------------------------
|
||||
# end build hashes
|
||||
#-------------------------------------------------------------
|
||||
|
||||
# set the build root directory, which is the the dir above mozilla
|
||||
SetupBuildRootDir(":mozilla:build:mac:build_scripts");
|
||||
|
||||
# Set up all the flags on $main::, like DEBUG, CARBON etc.
|
||||
# Override the defaults using the preferences files.
|
||||
SetupDefaultBuildOptions(0, ":mozilla:dist:viewer:", $config_header_file_name);
|
||||
|
||||
my($do_checkout) = 0;
|
||||
my($do_build) = 1;
|
||||
|
||||
RunBuild($do_checkout, $do_build, \%inputfiles, $prefs_file_name);
|
||||
@@ -1,80 +0,0 @@
|
||||
#!perl
|
||||
|
||||
#
|
||||
# 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):
|
||||
# Simon Fraser <sfraser@netscape.com>
|
||||
#
|
||||
|
||||
require 5.004;
|
||||
|
||||
use strict;
|
||||
|
||||
use Cwd;
|
||||
use Moz::BuildUtils;
|
||||
use Moz::BuildCore;
|
||||
|
||||
#-------------------------------------------------------------
|
||||
# Where have the build options gone?
|
||||
#
|
||||
# The various build flags have been centralized into one place.
|
||||
# The master list of options is in MozBuildFlags.txt. However,
|
||||
# you should never need to edit that file, or this one.
|
||||
#
|
||||
# To customize what gets built, or where to start the build,
|
||||
# edit the $prefs_file_name file in
|
||||
# System Folder:Preferences:Mozilla build prefs:
|
||||
# Documentation is provided in that file.
|
||||
#-------------------------------------------------------------
|
||||
|
||||
my($prefs_file_name) = "Mozilla debug build prefs";
|
||||
my($config_header_file_name) = ":mozilla:config:mac:DefinesOptionsDebug.h";
|
||||
|
||||
#-------------------------------------------------------------
|
||||
# hashes to hold build options
|
||||
#-------------------------------------------------------------
|
||||
my(%build);
|
||||
my(%options);
|
||||
my(%filepaths);
|
||||
my(%optiondefines);
|
||||
|
||||
# Hash of input files for this build. Eventually, there will be
|
||||
# input files for manifests, and projects too.
|
||||
my(%inputfiles) = (
|
||||
"buildflags", "MozillaBuildFlags.txt",
|
||||
"checkoutdata", "MozillaCheckoutList.txt",
|
||||
"buildprogress", "¥ Mozilla debug progress",
|
||||
"buildmodule", "MozillaBuildList.pm",
|
||||
"checkouttime", "Mozilla last checkout"
|
||||
);
|
||||
#-------------------------------------------------------------
|
||||
# end build hashes
|
||||
#-------------------------------------------------------------
|
||||
|
||||
# set the build root directory, which is the the dir above mozilla
|
||||
SetupBuildRootDir(":mozilla:build:mac:build_scripts");
|
||||
|
||||
# Set up all the flags on $main::, like DEBUG, CARBON etc.
|
||||
# Override the defaults using the preferences files.
|
||||
SetupDefaultBuildOptions(1, ":mozilla:dist:viewer_debug:", $config_header_file_name);
|
||||
|
||||
my($do_pull) = 0; # overridden by flags and prefs
|
||||
my($do_build) = 1;
|
||||
|
||||
RunBuild($do_pull, $do_build, \%inputfiles, $prefs_file_name);
|
||||
@@ -1,595 +0,0 @@
|
||||
#!perl -w
|
||||
package Moz::BuildCore;
|
||||
|
||||
require 5.004;
|
||||
require Exporter;
|
||||
|
||||
use strict;
|
||||
use vars qw( @ISA @EXPORT );
|
||||
|
||||
# perl includes
|
||||
use Cwd;
|
||||
use POSIX;
|
||||
use Time::Local;
|
||||
use File::Basename;
|
||||
use LWP::Simple;
|
||||
|
||||
# homegrown
|
||||
use Moz::Moz;
|
||||
use Moz::Jar;
|
||||
use Moz::BuildFlags;
|
||||
use Moz::BuildUtils;
|
||||
use Moz::CodeWarriorLib;
|
||||
|
||||
# use MozillaBuildList; # eventually, this should go away, and be replaced by data input
|
||||
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(
|
||||
RunBuild
|
||||
);
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// DoPrebuildCheck
|
||||
#//
|
||||
#// Check the build tools etc before running the build.
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub DoPrebuildCheck()
|
||||
{
|
||||
SanityCheckBuildOptions();
|
||||
|
||||
# launch codewarrior and persist its location. Have to call this before first
|
||||
# call to getCodeWarriorPath().
|
||||
my($ide_path_file) = $main::filepaths{"idepath"};
|
||||
$ide_path_file = full_path_to($ide_path_file);
|
||||
LaunchCodeWarrior($ide_path_file);
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// SanityCheckBuildOptions
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub SanityCheckBuildOptions()
|
||||
{
|
||||
my($bad_options) = 0;
|
||||
|
||||
# Jar options
|
||||
if (!$main::options{chrome_jars} && !$main::options{chrome_files})
|
||||
{
|
||||
print "Warning: Both \$options{chrome_jars} and \$options{chrome_files} are off. You won't get any chrome.\n";
|
||||
$bad_options = 1;
|
||||
}
|
||||
|
||||
if (!$main::options{chrome_jars} && $main::options{use_jars})
|
||||
{
|
||||
print "Warning: \$options{chrome_jars} is off but \$options{use_jars} is on. Your build won't run (expects jars, got files).\n";
|
||||
$bad_options = 1;
|
||||
}
|
||||
|
||||
if (!$main::options{chrome_files} && !$main::options{use_jars})
|
||||
{
|
||||
print "Warning: \$options{chrome_jars} is off but \$options{chrome_files} is on. Your build won't run (expects files, got jars).\n";
|
||||
$bad_options = 1;
|
||||
}
|
||||
|
||||
if ($main::options{ldap_experimental} && !$main::options{ldap})
|
||||
{
|
||||
print "Warning: \$options{ldap_experimental} is on but \$options{ldap} is off. LDAP experimental features will not be built.\n";
|
||||
$bad_options = 1;
|
||||
}
|
||||
|
||||
if ($main::options{wsp} && !$main::options{xmlextras})
|
||||
{
|
||||
print "Warning: \$options{wsp} is on but \$options{xmlextras} is off. wsp will not be built.\n";
|
||||
$bad_options = 1;
|
||||
}
|
||||
|
||||
if ($bad_options) {
|
||||
print "Build will start in 5 seconds. Press command-. to stop\n";
|
||||
|
||||
DelayFor(5);
|
||||
}
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// GenBuildSystemInfo
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub GenBuildSystemInfo()
|
||||
{
|
||||
# always rebuild the configuration program.
|
||||
BuildProjectClean(":mozilla:build:mac:tools:BuildSystemInfo:BuildSystemInfo.mcp", "BuildSystemInfo");
|
||||
|
||||
# delete the configuration file.
|
||||
unlink(":mozilla:build:mac:BuildSystemInfo.pm");
|
||||
|
||||
# run the program.
|
||||
system(":mozilla:build:mac:BuildSystemInfo");
|
||||
|
||||
# wait for the file to be created.
|
||||
while (!(-e ":mozilla:build:mac:BuildSystemInfo.pm")) { WaitNextEvent(); }
|
||||
|
||||
# wait for BuildSystemInfo to finish, so that we see correct results.
|
||||
while (IsProcessRunning("BuildSystemInfo")) { WaitNextEvent(); }
|
||||
|
||||
# now, evaluate the contents of the file.
|
||||
open(F, ":mozilla:build:mac:BuildSystemInfo.pm");
|
||||
while (<F>) { eval; }
|
||||
close(F);
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Make library aliases
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub MakeLibAliases()
|
||||
{
|
||||
my($dist_dir) = GetBinDirectory();
|
||||
|
||||
#// ProfilerLib
|
||||
if ($main::PROFILE)
|
||||
{
|
||||
my($profilerlibpath) = Moz::CodeWarriorLib::getCodeWarriorPath("MacOS Support:Profiler:Profiler Common:ProfilerLib");
|
||||
MakeAlias("$profilerlibpath", "$dist_dir"."Essential Files:");
|
||||
}
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// ConfigureBuildSystem
|
||||
#//
|
||||
#// defines some build-system configuration variables.
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub ConfigureBuildSystem()
|
||||
{
|
||||
#// In the future, we may want to do configurations based on the actual build system itself.
|
||||
#// GenBuildSystemInfo();
|
||||
|
||||
#// For now, if we discover a newer header file than existed in Universal Interfaces 3.2,
|
||||
#// we'll assume that 3.3 or later is in use.
|
||||
my($universal_interfaces) = Moz::CodeWarriorLib::getCodeWarriorPath("MacOS Support:Universal:Interfaces:CIncludes:");
|
||||
if (-e ($universal_interfaces . "ControlDefinitions.h")) {
|
||||
$main::UNIVERSAL_INTERFACES_VERSION = 0x0330;
|
||||
}
|
||||
|
||||
#// Rename IC SDK folder in the Mac OS Support folder
|
||||
my($ic_sdk_folder) = Moz::CodeWarriorLib::getCodeWarriorPath("MacOS Support:ICProgKit2.0.2");
|
||||
if( -e $ic_sdk_folder)
|
||||
{
|
||||
my($new_ic_folder_name) = Moz::CodeWarriorLib::getCodeWarriorPath("MacOS Support:(ICProgKit2.0.2)");
|
||||
rename ($ic_sdk_folder, $new_ic_folder_name);
|
||||
# note that CodeWarrior doesn't descend into folders with () the name
|
||||
print "Mozilla no longer needs the Internet Config SDK to build:\n Renaming the 'ICProgKit2.0.2' folder to '(ICProgKit2.0.2)'\n";
|
||||
}
|
||||
|
||||
printf("UNIVERSAL_INTERFACES_VERSION = 0x%04X\n", $main::UNIVERSAL_INTERFACES_VERSION);
|
||||
|
||||
# alias required CodeWarrior libs into the Essential Files folder (only the Profiler lib now)
|
||||
MakeLibAliases();
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// CheckOutModule. Takes variable number of args; first two are required
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub CheckOutModule($$$$)
|
||||
{
|
||||
my($session, $module, $revision, $date) = @_;
|
||||
|
||||
my($result) = $session->checkout($module, $revision, $date);
|
||||
|
||||
# result of 1 is success
|
||||
if ($result) { return; }
|
||||
|
||||
my($checkout_err) = $session->getLastError();
|
||||
if ($checkout_err == 708) {
|
||||
die "Error: Checkout was cancelled.\n";
|
||||
} elsif ($checkout_err == 911) {
|
||||
die "Error: CVS session settings are incorrect. Check your password, and the CVS root settings.\n";
|
||||
} elsif ($checkout_err == 703) {
|
||||
die "Error: CVS checkout failed. Unknown module, unknown tag, bad username, or other CVS error.\n";
|
||||
} elsif ($checkout_err == 711) {
|
||||
print "Checkout of '$module' failed.\n";
|
||||
}
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// getScriptFolder
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub getScriptFolder()
|
||||
{
|
||||
return dirname($0);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// getScriptFolder
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub get_url_contents($)
|
||||
{
|
||||
my($url) = @_;
|
||||
|
||||
my($url_contents) = LWP::Simple::get($url);
|
||||
$url_contents =~ s/\r\n/\n/g; # normalize linebreaks
|
||||
$url_contents =~ s/\r/\n/g; # normalize linebreaks
|
||||
return $url_contents;
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// get_files_from_content
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub uniq
|
||||
{
|
||||
my $lastval;
|
||||
grep(($_ ne $lastval, $lastval = $_)[$[], @_);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// get_files_from_content
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub get_files_from_content($)
|
||||
{
|
||||
my($content) = @_;
|
||||
|
||||
my(@jscalls) = grep (/return js_file_menu[^{]*/, split(/\n/, $content));
|
||||
my $i;
|
||||
|
||||
for ($i = 0; $i < @jscalls ; $i++)
|
||||
{
|
||||
$jscalls[$i] =~ s/.*\(|\).*//g;
|
||||
my(@callparams) = split(/,/, $jscalls[$i]);
|
||||
my ($repos, $dir, $file, $rev) = grep(s/['\s]//g, @callparams);
|
||||
$jscalls[$i] = "$dir/$file";
|
||||
}
|
||||
|
||||
&uniq(sort(@jscalls));
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// getLastUpdateTime
|
||||
#//
|
||||
#// Get the last time we updated. Return 0 on failure
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub getLastUpdateTime($)
|
||||
{
|
||||
my($timestamp_file) = @_;
|
||||
|
||||
my($time_string);
|
||||
|
||||
local(*TIMESTAMP_FILE);
|
||||
unless (open(TIMESTAMP_FILE, "< $timestamp_file")) { return 0; }
|
||||
|
||||
while (<TIMESTAMP_FILE>)
|
||||
{
|
||||
my($line) = $_;
|
||||
chomp($line);
|
||||
|
||||
# ignore comments and empty lines
|
||||
if ($line =~ /^\#/ || $line =~ /^\s*$/) {
|
||||
next;
|
||||
}
|
||||
|
||||
$time_string = $line;
|
||||
}
|
||||
|
||||
# get the epoch seconds
|
||||
my($last_update_secs) = $time_string;
|
||||
$last_update_secs =~ s/\s#.+$//;
|
||||
|
||||
print "FAST_UPDATE found that you last updated at ".localtime($last_update_secs)."\n";
|
||||
|
||||
# how long ago was this, in hours?
|
||||
my($gm_now) = time();
|
||||
my($update_hours) = 1 + ceil(($gm_now - $last_update_secs) / (60 * 60));
|
||||
|
||||
return $update_hours;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// saveCheckoutTimestamp
|
||||
#//
|
||||
#// Create a file on disk containing the current time. Param is time(), which is an Epoch seconds
|
||||
#// (and therefore in GMT).
|
||||
#//
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub saveCheckoutTimestamp($$)
|
||||
{
|
||||
my($gm_secs, $timestamp_file) = @_;
|
||||
|
||||
local(*TIMESTAMP_FILE);
|
||||
open(TIMESTAMP_FILE, ">$timestamp_file") || die "Failed to open $timestamp_file\n";
|
||||
print(TIMESTAMP_FILE "# time of last checkout or update, in GMT. Used by FAST_UPDATE\n");
|
||||
print(TIMESTAMP_FILE "$gm_secs \# around ".localtime()." local time\n");
|
||||
close(TIMESTAMP_FILE);
|
||||
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// FastUpdate
|
||||
#//
|
||||
#// Use Bonsai url data to update only those dirs which have new files
|
||||
#//
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub FastUpdate($$)
|
||||
{
|
||||
my($modules, $timestamp_file) = @_; # list of modules to check out
|
||||
|
||||
my($num_hours) = getLastUpdateTime($timestamp_file);
|
||||
if ($num_hours == 0 || $num_hours > 170) {
|
||||
print "Can't fast_update; last update was too long ago, or never. Doing normal checkout.\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
print "Doing fast update, pulling files changed in the last $num_hours hours\n";
|
||||
|
||||
my($cvsfile) = AskAndPersistFile($main::filepaths{"sessionpath"});
|
||||
my($session) = Moz::MacCVS->new( $cvsfile );
|
||||
unless (defined($session)) { die "Error: Checkout aborted. Cannot create session file: $session" }
|
||||
|
||||
# activate MacCVS
|
||||
ActivateApplication('Mcvs');
|
||||
|
||||
my($checkout_start_time) = time();
|
||||
|
||||
#print "Time now is $checkout_start_time ($checkout_start_time + 0)\n";
|
||||
|
||||
my($this_co);
|
||||
foreach $this_co (@$modules)
|
||||
{
|
||||
my($module, $revision, $date) = ($this_co->[0], $this_co->[1], $this_co->[2]);
|
||||
|
||||
# assume that things pulled by date wont change
|
||||
if ($date ne "") {
|
||||
print "$module is pulled by date, so ignoring in FastUpdate.\n";
|
||||
next;
|
||||
}
|
||||
|
||||
my($search_type) = "hours";
|
||||
my($min_date) = "";
|
||||
my($max_date) = "";
|
||||
my($url) = "http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=${module}&branch=${revision}&branchtype=match&dir=&file=&filetype=match&who=&whotype=match&sortby=Date&hours=${num_hours}&date=${search_type}&mindate=${min_date}&maxdate=${max_date}&cvsroot=%2Fcvsroot";
|
||||
|
||||
if ($revision eq "") {
|
||||
print "Getting list of checkins to $module from Bonsai...\n";
|
||||
} else {
|
||||
print "Getting list of checkins to $module on branch $revision from Bonsai...\n";
|
||||
}
|
||||
my(@files) = &get_files_from_content(&get_url_contents($url));
|
||||
|
||||
if ($#files > 0)
|
||||
{
|
||||
my(@cvs_co_list);
|
||||
|
||||
my($co_file);
|
||||
foreach $co_file (@files)
|
||||
{
|
||||
print "Updating $co_file\n";
|
||||
push(@cvs_co_list, $co_file);
|
||||
}
|
||||
|
||||
my($result) = $session->update($revision, \@cvs_co_list);
|
||||
# result of 1 is success
|
||||
if (!$result) { die "Error: Fast update failed\n"; }
|
||||
} else {
|
||||
print "No files in this module changed\n";
|
||||
}
|
||||
}
|
||||
|
||||
saveCheckoutTimestamp($checkout_start_time, $timestamp_file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Checkout
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub CheckoutModules($$$)
|
||||
{
|
||||
my($modules, $pull_date, $timestamp_file) = @_; # list of modules to check out
|
||||
|
||||
my($start_time) = TimeStart();
|
||||
|
||||
# assertRightDirectory();
|
||||
my($cvsfile) = AskAndPersistFile($main::filepaths{"sessionpath"});
|
||||
my($session) = Moz::MacCVS->new( $cvsfile );
|
||||
unless (defined($session)) { die "Error: Checkout aborted. Cannot create session file: $session" }
|
||||
|
||||
my($checkout_start_time) = time();
|
||||
|
||||
# activate MacCVS
|
||||
ActivateApplication('Mcvs');
|
||||
|
||||
my($this_co);
|
||||
foreach $this_co (@$modules)
|
||||
{
|
||||
my($module, $revision, $date) = ($this_co->[0], $this_co->[1], $this_co->[2]);
|
||||
if ($date eq "") {
|
||||
$date = $pull_date;
|
||||
}
|
||||
CheckOutModule($session, $module, $revision, $date);
|
||||
# print "Checking out $module with ref $revision, date $date\n";
|
||||
}
|
||||
|
||||
saveCheckoutTimestamp($checkout_start_time, $timestamp_file);
|
||||
TimeEnd($start_time, "Checkout");
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// ReadCheckoutModulesFile
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub ReadCheckoutModulesFile($$)
|
||||
{
|
||||
my($modules_file, $co_list) = @_;
|
||||
|
||||
my($checkout_file) = getScriptFolder().":".$modules_file;
|
||||
local(*CHECKOUT_FILE);
|
||||
open(CHECKOUT_FILE, "< $checkout_file") || die "Error: failed to open checkout list $checkout_file\n";
|
||||
while (<CHECKOUT_FILE>)
|
||||
{
|
||||
my($line) = $_;
|
||||
chomp($line);
|
||||
|
||||
# ignore comments and empty lines
|
||||
if ($line =~ /^\#/ || $line =~ /^\s*$/) {
|
||||
next;
|
||||
}
|
||||
|
||||
my(@cvs_co) = ["", "", ""];
|
||||
|
||||
my($module, $revision, $date) = (0, 1, 2);
|
||||
|
||||
if ($line =~ /\s*([^#,\s]+)\s*\,\s*([^#,\s]+)\s*\,\s*([^#]+)/)
|
||||
{
|
||||
@cvs_co[$module] = $1;
|
||||
@cvs_co[$revision] = $2;
|
||||
@cvs_co[$date] = $3;
|
||||
}
|
||||
elsif ($line =~ /\s*([^#,\s]+)\s*\,\s*([^#,\s]+)\s*(#.+)?/)
|
||||
{
|
||||
@cvs_co[$module] = $1;
|
||||
@cvs_co[$revision] = $2;
|
||||
}
|
||||
elsif ($line =~ /\s*([^#,\s]+)\s*\,\s*,\s*([^#,]+)/)
|
||||
{
|
||||
@cvs_co[$module] = $1;
|
||||
@cvs_co[$date] = $2;
|
||||
}
|
||||
elsif ($line =~ /\s*([^#,\s]+)/)
|
||||
{
|
||||
@cvs_co[$module] = $1;
|
||||
}
|
||||
else
|
||||
{
|
||||
die "Error: unrecognized line '$line' in $modules_file\n";
|
||||
}
|
||||
|
||||
# strip surrounding space from date
|
||||
@cvs_co[$date] =~ s/^\s*|\s*$//g;
|
||||
|
||||
# print "Going to check out '@cvs_co[$module]', '@cvs_co[$revision]', '@cvs_co[$date]'\n";
|
||||
push(@$co_list, \@cvs_co);
|
||||
}
|
||||
|
||||
close(CHECKOUT_FILE);
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// PullFromCVS
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub PullFromCVS($$)
|
||||
{
|
||||
unless ( $main::build{pull} ) { return; }
|
||||
|
||||
my($modules_file, $timestamp_file) = @_;
|
||||
|
||||
StartBuildModule("pull");
|
||||
|
||||
my(@cvs_co_list);
|
||||
ReadCheckoutModulesFile($modules_file, \@cvs_co_list);
|
||||
|
||||
if ($main::FAST_UPDATE && $main::options{pull_by_date})
|
||||
{
|
||||
die "Error: you can't use FAST_UPDATE if you are pulling by date.\n";
|
||||
}
|
||||
|
||||
my($did_fast_update) = $main::FAST_UPDATE && FastUpdate(\@cvs_co_list, $timestamp_file);
|
||||
if (!$did_fast_update)
|
||||
{
|
||||
my($pull_date) = "";
|
||||
if ($main::options{pull_by_date})
|
||||
{
|
||||
# acceptable CVS date formats are (in local time):
|
||||
# ISO8601 (e.g. "1972-09-24 20:05") and Internet (e.g. "24 Sep 1972 20:05").
|
||||
# Perl's localtime() string format also seems to work.
|
||||
$pull_date = localtime().""; # force string interp.
|
||||
print "Pulling by date $pull_date\n";
|
||||
}
|
||||
|
||||
CheckoutModules(\@cvs_co_list, $pull_date, $timestamp_file);
|
||||
}
|
||||
|
||||
EndBuildModule("pull");
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// RunBuild
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub RunBuild($$$$)
|
||||
{
|
||||
my($do_pull, $do_build, $input_files, $build_prefs) = @_;
|
||||
|
||||
InitBuildProgress($input_files->{"buildprogress"});
|
||||
|
||||
# if we are pulling, we probably want to do a full build, so clear the build progress
|
||||
if ($do_pull) {
|
||||
ClearBuildProgress();
|
||||
}
|
||||
|
||||
# read local prefs, and the build progress file, and set flags to say what to build
|
||||
SetupBuildParams(\%main::build,
|
||||
\%main::options,
|
||||
\%main::optiondefines,
|
||||
\%main::filepaths,
|
||||
$input_files->{"buildflags"},
|
||||
$build_prefs);
|
||||
|
||||
# If we were told to pull, make sure we do, overriding prefs etc.
|
||||
if ($do_pull)
|
||||
{
|
||||
$main::build{"pull"} = 1;
|
||||
}
|
||||
|
||||
# transfer this flag
|
||||
$CodeWarriorLib::CLOSE_PROJECTS_FIRST = $main::CLOSE_PROJECTS_FIRST;
|
||||
|
||||
# setup the build log
|
||||
SetupBuildLog($main::filepaths{"buildlogfilepath"}, $main::USE_TIMESTAMPED_LOGS);
|
||||
StopForErrors();
|
||||
|
||||
if ($main::LOG_TO_FILE) {
|
||||
RedirectOutputToFile($main::filepaths{"scriptlogfilepath"});
|
||||
}
|
||||
|
||||
# run a pre-build check to see that the tools etc are in order
|
||||
DoPrebuildCheck();
|
||||
|
||||
# do the pull
|
||||
PullFromCVS($input_files->{"checkoutdata"}, $input_files->{"checkouttime"});
|
||||
|
||||
unless ($do_build) { return; }
|
||||
|
||||
my($build_start) = TimeStart();
|
||||
|
||||
# check the build environment
|
||||
ConfigureBuildSystem();
|
||||
|
||||
# here we load and call methods in the build module indirectly.
|
||||
# we have to use indirection because the build module can be named
|
||||
# differently for different builds.
|
||||
chdir(dirname($0)); # change to the script dir
|
||||
my($build_module) = $input_files->{"buildmodule"};
|
||||
# load the build module
|
||||
require $build_module;
|
||||
{ # scope for no strict 'refs'
|
||||
no strict 'refs';
|
||||
|
||||
my($package_name) = $build_module;
|
||||
$package_name =~ s/\.pm$//;
|
||||
|
||||
chdir($main::MOZ_SRC);
|
||||
&{$package_name."::BuildDist"}();
|
||||
|
||||
chdir($main::MOZ_SRC);
|
||||
&{$package_name."::BuildProjects"}();
|
||||
}
|
||||
|
||||
# the build finished, so clear the build progress state
|
||||
ClearBuildProgress();
|
||||
|
||||
TimeEnd($build_start, "Build");
|
||||
print "Build complete\n";
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -1,425 +0,0 @@
|
||||
#!perl -w
|
||||
package Moz::BuildFlags;
|
||||
|
||||
require 5.004;
|
||||
require Exporter;
|
||||
|
||||
# Package that attempts to read a file from the Preferences folder,
|
||||
# and get build settings out of it
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
use Moz::Moz;
|
||||
use Moz::Prefs;
|
||||
|
||||
use vars qw(@ISA @EXPORT);
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(
|
||||
SetupBuildParams
|
||||
InitBuildProgress
|
||||
WriteBuildProgress
|
||||
ClearBuildProgress
|
||||
ReadBuildProgress
|
||||
);
|
||||
|
||||
|
||||
my(@build_flags);
|
||||
my(@options_flags);
|
||||
my(@filepath_flags);
|
||||
|
||||
my(%arrays_list) = (
|
||||
"build_flags", \@build_flags,
|
||||
"options_flags", \@options_flags,
|
||||
"filepath_flags", \@filepath_flags
|
||||
);
|
||||
|
||||
my($progress_file) = "¥ÊBuild progress";
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# appendArrayFlag
|
||||
#
|
||||
# Set a flag in the array
|
||||
#-------------------------------------------------------------------------------
|
||||
sub appendArrayFlag(@)
|
||||
{
|
||||
my($array_name) = shift;
|
||||
my($setting) = shift;
|
||||
my($value) = shift;
|
||||
|
||||
my(@optional_values);
|
||||
foreach (@_) {
|
||||
push(@optional_values, $_);
|
||||
}
|
||||
|
||||
my(@this_flag) = [$setting, $value, @optional_values];
|
||||
my($flags_array) = $arrays_list{$array_name};
|
||||
if ($flags_array)
|
||||
{
|
||||
push(@{$flags_array}, @this_flag) || die "Failed to append\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
die "Error: unknown build flags array $array_name\n";
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# readFlagsFile
|
||||
#
|
||||
# Read the file of build flags from disk. File path is relative to the
|
||||
# script directory.
|
||||
#-------------------------------------------------------------------------------
|
||||
sub readFlagsFile($)
|
||||
{
|
||||
my($flags_file) = @_;
|
||||
|
||||
my($file_path) = $0;
|
||||
$file_path =~ s/[^:]+$/$flags_file/;
|
||||
|
||||
print "Reading build flags from '$file_path'\n";
|
||||
|
||||
local(*FLAGS_FILE);
|
||||
open(FLAGS_FILE, "< $file_path") || die "Error: failed to open flags file $file_path\n";
|
||||
|
||||
my($cur_array) = "";
|
||||
|
||||
while(<FLAGS_FILE>)
|
||||
{
|
||||
my($line) = $_;
|
||||
chomp($line);
|
||||
|
||||
# ignore comments and empty lines
|
||||
if ($line =~ /^\#/ || $line =~ /^\s*$/) {
|
||||
next;
|
||||
}
|
||||
|
||||
# 1-word line, probably array name
|
||||
if ($line =~ /^([^#\s]+)\s*$/)
|
||||
{
|
||||
$cur_array = $1;
|
||||
next;
|
||||
}
|
||||
elsif ($line =~ /^([^#\s]+)\s+\"(.+)\"(\s+#.+)?$/) # quoted option, possible comment
|
||||
{
|
||||
my($flag) = $1;
|
||||
my($setting) = $2;
|
||||
|
||||
appendArrayFlag($cur_array, $flag, $setting);
|
||||
}
|
||||
elsif ($line =~ /^([^#\s]+)((\s+[^#\s]+)+)(\s+#.+)?$/) # multiple word line, possible comment
|
||||
{
|
||||
my($flag) = $1;
|
||||
|
||||
appendArrayFlag($cur_array, $flag, split(' ', $2));
|
||||
}
|
||||
else
|
||||
{
|
||||
die "Error: unknown build flag at '$line'\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
close(FLAGS_FILE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# flagsArrayToHash
|
||||
#
|
||||
# Utility routine to migrate flag from a 2D array to a hash, where
|
||||
# item[n][0] is the hash entry name, and item[n][1] is the hash entry value.
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub flagsArrayToHash($$)
|
||||
{
|
||||
my($src_array, $dest_hash) = @_;
|
||||
|
||||
my($item);
|
||||
foreach $item (@$src_array)
|
||||
{
|
||||
$dest_hash->{$item->[0]} = $item->[1];
|
||||
}
|
||||
}
|
||||
|
||||
#-----------------------------------------------
|
||||
# printHash
|
||||
#
|
||||
# Utility routine to print a hash
|
||||
#-----------------------------------------------
|
||||
sub printHash($)
|
||||
{
|
||||
my($hash_ref) = @_;
|
||||
|
||||
print "Printing hash:\n";
|
||||
|
||||
my($key, $value);
|
||||
|
||||
while (($key, $value) = each (%$hash_ref))
|
||||
{
|
||||
print " $key $value\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-----------------------------------------------
|
||||
# printBuildArray
|
||||
#
|
||||
# Utility routine to print a 2D array
|
||||
#-----------------------------------------------
|
||||
sub printBuildArray($)
|
||||
{
|
||||
my($build_array) = @_;
|
||||
|
||||
my($entry);
|
||||
foreach $entry (@$build_array)
|
||||
{
|
||||
print "$entry->[0] = $entry->[1]\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# SetBuildFlags
|
||||
#-------------------------------------------------------------------------------
|
||||
sub SetBuildFlags($)
|
||||
{
|
||||
my($build) = @_;
|
||||
|
||||
flagsArrayToHash(\@build_flags, $build);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# SetBuildOptions
|
||||
#-------------------------------------------------------------------------------
|
||||
sub SetBuildOptions($)
|
||||
{
|
||||
my($options) = @_;
|
||||
|
||||
flagsArrayToHash(\@options_flags, $options);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# SetFilepathFlags
|
||||
#-------------------------------------------------------------------------------
|
||||
sub SetFilepathFlags($)
|
||||
{
|
||||
my($filepath) = @_;
|
||||
|
||||
flagsArrayToHash(\@filepath_flags, $filepath);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# SetOptionDefines
|
||||
#-------------------------------------------------------------------------------
|
||||
sub SetOptionDefines($)
|
||||
{
|
||||
my($optiondefines) = @_;
|
||||
|
||||
foreach my $entry (@options_flags)
|
||||
{
|
||||
if (defined($entry->[2])) {
|
||||
$optiondefines->{$entry->[0]}{$entry->[2]} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# PropagateAllFlags
|
||||
#-------------------------------------------------------------------------------
|
||||
sub PropagateAllFlags($)
|
||||
{
|
||||
my($build_array) = @_;
|
||||
|
||||
# if "all" is set, set all the flags to 1
|
||||
unless ($build_array->[0][0] eq "all") { die "Error: 'all' must come first in the flags array\n"; }
|
||||
|
||||
if ($build_array->[0][1] == 1)
|
||||
{
|
||||
my($index);
|
||||
foreach $index (@$build_array)
|
||||
{
|
||||
$index->[1] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// _getBuildProgressFile
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub _getBuildProgressFile()
|
||||
{
|
||||
return $progress_file;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// setBuildProgressStart
|
||||
#//
|
||||
#// This automagically sets $build{"all"} to 0
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub setBuildProgressStart($$)
|
||||
{
|
||||
my($build_array, $name) = @_;
|
||||
|
||||
my($index);
|
||||
foreach $index (@$build_array)
|
||||
{
|
||||
$index->[1] = 0;
|
||||
if ($index->[0] eq $name) {
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
print "Building from module after $name, as specified by build progress\n";
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// InitBuildProgress
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub InitBuildProgress($)
|
||||
{
|
||||
my($prog_file) = @_;
|
||||
if ($prog_file ne "") {
|
||||
$progress_file = full_path_to($prog_file);
|
||||
print "Writing build progress to $progress_file\n";
|
||||
}
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// WriteBuildProgress
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub WriteBuildProgress($)
|
||||
{
|
||||
my($module_built) = @_;
|
||||
|
||||
my($progress_file) = _getBuildProgressFile();
|
||||
|
||||
if ($progress_file ne "")
|
||||
{
|
||||
open(PROGRESS_FILE, ">>$progress_file") || die "Failed to open $progress_file\n";
|
||||
print(PROGRESS_FILE "$module_built\n");
|
||||
close(PROGRESS_FILE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// ClearBuildProgress
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub ClearBuildProgress()
|
||||
{
|
||||
my($progress_file) = _getBuildProgressFile();
|
||||
if ($progress_file ne "") {
|
||||
unlink $progress_file;
|
||||
}
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// WipeBuildProgress
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub WipeBuildProgress()
|
||||
{
|
||||
print "Ignoring build progress\n";
|
||||
ClearBuildProgress();
|
||||
$progress_file = "";
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// ReadBuildProgress
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub ReadBuildProgress($)
|
||||
{
|
||||
my($build_array) = @_;
|
||||
my($progress_file) = _getBuildProgressFile();
|
||||
|
||||
my($last_module);
|
||||
|
||||
if (open(PROGRESS_FILE, "< $progress_file"))
|
||||
{
|
||||
print "Getting build progress from $progress_file\n";
|
||||
|
||||
while (<PROGRESS_FILE>)
|
||||
{
|
||||
my($line) = $_;
|
||||
chomp($line);
|
||||
$last_module = $line;
|
||||
}
|
||||
|
||||
close(PROGRESS_FILE);
|
||||
}
|
||||
|
||||
if ($last_module)
|
||||
{
|
||||
setBuildProgressStart($build_array, $last_module);
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# clearOldBuildSettings
|
||||
#-------------------------------------------------------------------------------
|
||||
sub clearOldBuildSettings($$$$)
|
||||
{
|
||||
my($build, $options, $optiondefines, $filepaths) = @_;
|
||||
|
||||
# empty the arrays in case we're being called twice
|
||||
@build_flags = ();
|
||||
@options_flags = ();
|
||||
@filepath_flags = ();
|
||||
|
||||
# and empty the hashes
|
||||
%$build = ();
|
||||
%$options = ();
|
||||
%$optiondefines = ();
|
||||
%$filepaths = ();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# SetupBuildParams
|
||||
#-------------------------------------------------------------------------------
|
||||
sub SetupBuildParams($$$$$$)
|
||||
{
|
||||
my($build, $options, $optiondefines, $filepaths, $flags_file, $prefs_file) = @_;
|
||||
|
||||
# Empty the hashes and arrays, to wipe out any stale data.
|
||||
# Needed because these structures persist across two build scripts
|
||||
# called using 'do' from a parent script.
|
||||
clearOldBuildSettings($build, $options, $optiondefines, $filepaths);
|
||||
|
||||
# Read from the flags file, which sets up the various arrays
|
||||
readFlagsFile($flags_file);
|
||||
|
||||
# If 'all' is set in the build array, propagate that to all entries
|
||||
PropagateAllFlags(\@build_flags);
|
||||
|
||||
# read the user pref file, that can change values in the array
|
||||
ReadMozUserPrefs($prefs_file, \@build_flags, \@options_flags, \@filepath_flags);
|
||||
|
||||
# If build progress exists, this clears flags in the array up to a certain point
|
||||
if ($main::USE_BUILD_PROGRESS) {
|
||||
ReadBuildProgress(\@build_flags);
|
||||
} else {
|
||||
WipeBuildProgress();
|
||||
}
|
||||
|
||||
# printBuildArray(\@build_flags);
|
||||
# printBuildArray(\@options_flags);
|
||||
|
||||
SetBuildFlags($build);
|
||||
SetBuildOptions($options);
|
||||
SetOptionDefines($optiondefines);
|
||||
SetFilepathFlags($filepaths);
|
||||
|
||||
# printHash($build);
|
||||
# printHash($options);
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
@@ -1,786 +0,0 @@
|
||||
|
||||
package Moz::BuildUtils;
|
||||
|
||||
require 5.004;
|
||||
require Exporter;
|
||||
|
||||
# Package that contains build util functions specific to the Mozilla build
|
||||
# process.
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
|
||||
use Cwd;
|
||||
use File::Path;
|
||||
use File::Basename;
|
||||
|
||||
use Mac::Events;
|
||||
use Mac::StandardFile;
|
||||
|
||||
use Moz::Moz;
|
||||
use Moz::BuildFlags;
|
||||
use Moz::MacCVS;
|
||||
#use Moz::ProjectXML; #optional; required for static build only
|
||||
|
||||
use vars qw(@ISA @EXPORT);
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(
|
||||
SetupDefaultBuildOptions
|
||||
SetupBuildRootDir
|
||||
StartBuildModule
|
||||
EndBuildModule
|
||||
GetBinDirectory
|
||||
BuildOneProjectWithOutput
|
||||
BuildOneProject
|
||||
BuildProject
|
||||
BuildProjectClean
|
||||
BuildIDLProject
|
||||
BuildFolderResourceAliases
|
||||
AskAndPersistFile
|
||||
DelayFor
|
||||
TimeStart
|
||||
TimeEnd
|
||||
EmptyTree
|
||||
SetupBuildLog
|
||||
SetBuildNumber
|
||||
SetTimeBomb
|
||||
UpdateConfigHeader
|
||||
);
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// SetupDefaultBuildOptions
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub SetupDefaultBuildOptions($$$)
|
||||
{
|
||||
my($debug, $bin_dir, $config_header_file_name) = @_;
|
||||
|
||||
# Here we set up defaults for the various build flags.
|
||||
# If you want to override any of these, it's best to do
|
||||
# so via the relevant preferences file, which lives in
|
||||
# System Folder:Preferences:Mozilla build prefs:{build prefs file}.
|
||||
# For the name of the prefs file, see the .pl script that you
|
||||
# run to start this build. The prefs files are created when
|
||||
# you run the build, and contain some documentation.
|
||||
|
||||
#-------------------------------------------------------------
|
||||
# configuration variables that globally affect what is built
|
||||
#-------------------------------------------------------------
|
||||
$main::DEBUG = $debug;
|
||||
$main::PROFILE = 0;
|
||||
$main::RUNTIME = 0; # turn on to just build runtime support and NSPR projects
|
||||
$main::GC_LEAK_DETECTOR = 0; # turn on to use GC leak detection
|
||||
$main::MOZILLA_OFFICIAL = 0; # generate build number
|
||||
$main::LOG_TO_FILE = 0; # write perl output to a file
|
||||
|
||||
#-------------------------------------------------------------
|
||||
# configuration variables that affect the manner of building,
|
||||
# but possibly affecting the outcome.
|
||||
#-------------------------------------------------------------
|
||||
$main::ALIAS_SYM_FILES = $main::DEBUG;
|
||||
$main::CLOBBER_LIBS = 1; # turn on to clobber existing libs and .xSYM files before
|
||||
# building each project
|
||||
# The following two options will delete all dist files (if you have $main::build{dist} turned on),
|
||||
# but leave the directory structure intact.
|
||||
$main::CLOBBER_DIST_ALL = 1; # turn on to clobber all aliases/files inside dist (headers/xsym/libs)
|
||||
$main::CLOBBER_DIST_LIBS = 0; # turn on to clobber only aliases/files for libraries/sym files in dist
|
||||
$main::CLOBBER_IDL_PROJECTS = 0; # turn on to clobber all IDL projects.
|
||||
$main::CLOBBER_PROJECTS = 0; # turn on to remove object code from each project before building it
|
||||
|
||||
$main::UNIVERSAL_INTERFACES_VERSION = 0x0320;
|
||||
|
||||
#-------------------------------------------------------------
|
||||
# configuration variables that are preferences for the build,
|
||||
# style and do not affect what is built.
|
||||
#-------------------------------------------------------------
|
||||
$main::CLOSE_PROJECTS_FIRST = 0;
|
||||
# 1 = close then make (for development),
|
||||
# 0 = make then close (for tinderbox).
|
||||
$main::USE_TIMESTAMPED_LOGS = 0;
|
||||
$main::USE_BUILD_PROGRESS = 1; # track build progress for restartable builds
|
||||
#-------------------------------------------------------------
|
||||
# END OF CONFIG SWITCHES
|
||||
#-------------------------------------------------------------
|
||||
|
||||
$main::BIN_DIRECTORY = $bin_dir;
|
||||
$main::DEFINESOPTIONS_FILE = $config_header_file_name;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// SetupBuildRootDir
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub SetupBuildRootDir($)
|
||||
{
|
||||
my($rel_path_to_script) = @_;
|
||||
|
||||
my($cur_dir) = cwd();
|
||||
$cur_dir =~ s/$rel_path_to_script$//;
|
||||
chdir($cur_dir) || die "Error: failed to set build root directory to '$cur_dir'.\nYou probably need to put 'mozilla' one level down (in a folder).\n";
|
||||
$main::MOZ_SRC = cwd();
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// StartBuildModule
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub StartBuildModule($)
|
||||
{
|
||||
my($module) = @_;
|
||||
|
||||
print("---- Start of $module ----\n");
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// EndBuildModule
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub EndBuildModule($)
|
||||
{
|
||||
my($module) = @_;
|
||||
WriteBuildProgress($module);
|
||||
print("---- End of $module ----\n");
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
# GetBinDirectory
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
sub GetBinDirectory()
|
||||
{
|
||||
if ($main::BIN_DIRECTORY eq "") { die "Dist directory not set\n"; }
|
||||
return $main::BIN_DIRECTORY;
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
# AskAndPersistFile stores the information about the user pick inside
|
||||
# the file $session_storage
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
sub AskAndPersistFile($)
|
||||
{
|
||||
my ($sessionStorage) = @_;
|
||||
my $cvsfile;
|
||||
|
||||
if (( -e $sessionStorage) &&
|
||||
open( SESSIONFILE, $sessionStorage ))
|
||||
{
|
||||
# Read in the path if available
|
||||
$cvsfile = <SESSIONFILE>;
|
||||
chomp $cvsfile;
|
||||
close SESSIONFILE;
|
||||
if ( ! -e $cvsfile )
|
||||
{
|
||||
print STDERR "$cvsfile has disappeared\n";
|
||||
undef $cvsfile;
|
||||
}
|
||||
}
|
||||
unless (defined ($cvsfile))
|
||||
{
|
||||
# make sure that MacPerl is a front process
|
||||
ActivateApplication('McPL');
|
||||
MacPerl::Answer("Could not find your MacCVS session file. Please choose one", "OK");
|
||||
|
||||
# prompt user for the file name, and store it
|
||||
my $macFile = StandardGetFile( 0, "McvD");
|
||||
if ( $macFile->sfGood() )
|
||||
{
|
||||
$cvsfile = $macFile->sfFile();
|
||||
# save the choice if we can
|
||||
if ( open (SESSIONFILE, ">" . $sessionStorage))
|
||||
{
|
||||
printf SESSIONFILE $cvsfile, "\n";
|
||||
close SESSIONFILE;
|
||||
}
|
||||
else
|
||||
{
|
||||
print STDERR "Could not open storage file $sessionStorage for saving $cvsfile\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
return $cvsfile;
|
||||
}
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
# BuildIDLProject
|
||||
#
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub BuildIDLProject($$)
|
||||
{
|
||||
my ($project_path, $module_name) = @_;
|
||||
|
||||
if ($main::CLOBBER_IDL_PROJECTS)
|
||||
{
|
||||
my (@suffix_list) = (".mcp", ".xml");
|
||||
my ($project_name, $project_dir, $suffix) = fileparse($project_path, @suffix_list);
|
||||
if ($suffix eq "") { die "Error: Project, $project_path must end in .xml or .mcp\n"; }
|
||||
|
||||
my($datafolder_path);
|
||||
if ($suffix eq ".xml")
|
||||
{
|
||||
$datafolder_path = $project_dir . "_" . $project_name . " Data:";
|
||||
}
|
||||
else {
|
||||
$datafolder_path = $project_dir . $project_name . " Data:";
|
||||
}
|
||||
|
||||
print STDERR "Deleting IDL data folder: $datafolder_path\n";
|
||||
EmptyTree($datafolder_path);
|
||||
}
|
||||
|
||||
BuildOneProject($project_path, "headers", 0, 0, 0);
|
||||
BuildOneProject($project_path, $module_name.".xpt", 1, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
# CreateStaticLibTargets
|
||||
#
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
sub CreateXMLStaticLibTargets($)
|
||||
{
|
||||
my($xml_path) = @_;
|
||||
|
||||
my (@suffix_list) = (".xml");
|
||||
my ($project_name, $project_dir, $suffix) = fileparse($xml_path, @suffix_list);
|
||||
if ($suffix eq "") { die "XML munging: $xml_path must end in .xml\n"; }
|
||||
|
||||
#sniff the file to see if we need to fix up broken Pro5-exported XML
|
||||
print "Parsing $xml_path\n";
|
||||
|
||||
my $ide_version = Moz::ProjectXML::SniffProjectXMLIDEVersion($xml_path);
|
||||
if ($ide_version eq "4.0")
|
||||
{
|
||||
my $new_file = $project_dir.$project_name."2.xml";
|
||||
|
||||
print "Cleaning up Pro 5 xml to $new_file\n";
|
||||
|
||||
Moz::ProjectXML::CleanupPro5XML($xml_path, $new_file);
|
||||
|
||||
unlink $xml_path;
|
||||
rename ($new_file, $xml_path);
|
||||
}
|
||||
|
||||
my $doc = Moz::ProjectXML::ParseXMLDocument($xml_path);
|
||||
my @target_list = Moz::ProjectXML::GetTargetsList($doc);
|
||||
my $target;
|
||||
|
||||
my %target_hash; # for easy lookups below
|
||||
foreach $target (@target_list) { $target_hash{$target} = 1; }
|
||||
|
||||
foreach $target (@target_list)
|
||||
{
|
||||
if ($target =~ /(.+).shlb$/) # if this is a shared lib target
|
||||
{
|
||||
my $target_base = $1;
|
||||
my $static_target = $target_base.".o";
|
||||
|
||||
# ensure that this does not exist already
|
||||
if ($target_hash{$static_target}) {
|
||||
print "Static target $static_target already exists in project. Not making\n";
|
||||
next;
|
||||
}
|
||||
|
||||
print "Making static target '$static_target' from target '$target'\n";
|
||||
|
||||
Moz::ProjectXML::CloneTarget($doc, $target, $static_target);
|
||||
Moz::ProjectXML::SetAsStaticLibraryTarget($doc, $static_target, $static_target);
|
||||
}
|
||||
}
|
||||
|
||||
print "Writing XML file to $xml_path\n";
|
||||
my $temp_path = $project_dir."_".$project_name.".xml";
|
||||
Moz::ProjectXML::WriteXMLDocument($doc, $temp_path, $ide_version);
|
||||
Moz::ProjectXML::DisposeXMLDocument($doc);
|
||||
|
||||
if (-e $temp_path)
|
||||
{
|
||||
unlink $xml_path;
|
||||
rename ($temp_path, $xml_path);
|
||||
}
|
||||
else
|
||||
{
|
||||
die "Error: Failed to add new targets to XML project\n";
|
||||
}
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// ProcessProjectXML
|
||||
#//
|
||||
#// Helper routine to allow for XML pre-processing. This should read in the XML, process it,
|
||||
#// and replace the original file with the processed version.
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub ProcessProjectXML($)
|
||||
{
|
||||
my($xml_path) = @_;
|
||||
|
||||
# we need to manually load Moz::ProjectXML, becaues not everyone will have the
|
||||
# required perl modules in their distro.
|
||||
my($cur_dir) = cwd();
|
||||
|
||||
chdir(dirname($0)); # change to the script dir
|
||||
eval "require Moz::ProjectXML";
|
||||
if ($@) { die "Error: could not do Project XML munging because you do not have the correct XML modules installed. Error is:\n################\n $@################"; }
|
||||
|
||||
chdir($cur_dir);
|
||||
|
||||
CreateXMLStaticLibTargets($xml_path);
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Build one project, and make the alias. Parameters are project path, target name, shared library
|
||||
#// name, make shlb alias (boolean), make xSYM alias (boolean), and is component (boolean).
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub BuildOneProjectWithOutput($$$$$$)
|
||||
{
|
||||
my ($project_path, $target_name, $output_name, $alias_lib, $alias_xSYM, $component) = @_;
|
||||
|
||||
unless ($project_path =~ m/^$main::BUILD_ROOT.+/) { return; }
|
||||
|
||||
my (@suffix_list) = (".mcp", ".xml");
|
||||
my ($project_name, $project_dir, $suffix) = fileparse($project_path, @suffix_list);
|
||||
if ($suffix eq "") { die "Error: Project, $project_path must end in .xml or .mcp\n"; }
|
||||
|
||||
my($dist_dir) = GetBinDirectory();
|
||||
|
||||
# Put libraries in "Essential Files" folder, Components in "Components" folder
|
||||
my($output_dir) = $component ? "Components:" : "Essential Files:";
|
||||
my($output_path) = $dist_dir.$output_dir;
|
||||
|
||||
if ($main::options{static_build})
|
||||
{
|
||||
if ($output_name =~ /\.o$/ || $output_name =~ /\.[Ll]ib$/)
|
||||
{
|
||||
$alias_xSYM = 0;
|
||||
$alias_lib = 1;
|
||||
$output_path = $main::DEBUG ? ":mozilla:dist:static_libs_debug:" : ":mozilla:dist:static_libs:";
|
||||
}
|
||||
}
|
||||
|
||||
# if the flag is on to export projects to XML, export and munge them
|
||||
if ($main::EXPORT_PROJECTS && !($project_path =~ /IDL\.mcp$/))
|
||||
{
|
||||
my $xml_out_path = $project_path;
|
||||
|
||||
$xml_out_path =~ s/\.mcp$/\.xml/;
|
||||
|
||||
# only do this if project is newer?
|
||||
if (! -e $xml_out_path)
|
||||
{
|
||||
ExportProjectToXML(full_path_to($project_path), full_path_to($xml_out_path));
|
||||
ProcessProjectXML($xml_out_path);
|
||||
}
|
||||
}
|
||||
|
||||
# if the flag is set to use XML projects, default to XML if the file
|
||||
# is present.
|
||||
if ($main::USE_XML_PROJECTS && !($project_path =~ /IDL\.mcp$/))
|
||||
{
|
||||
my $xml_project_path = $project_dir.$project_name.".xml";
|
||||
if (-e $xml_project_path)
|
||||
{
|
||||
$project_path = $xml_project_path;
|
||||
$suffix = ".xml";
|
||||
}
|
||||
}
|
||||
|
||||
if ($suffix eq ".xml")
|
||||
{
|
||||
my($xml_path) = $project_path;
|
||||
# Prepend an "_" onto the name of the generated project file so it doesn't conflict
|
||||
$project_path = $project_dir . "_" . $project_name . ".mcp";
|
||||
my($project_modtime) = (-e $project_path ? GetFileModDate($project_path) : 0);
|
||||
my($xml_modtime) = (-e $xml_path ? GetFileModDate($xml_path) : 0);
|
||||
|
||||
if ($xml_modtime > $project_modtime)
|
||||
{
|
||||
print("Importing $project_path from $project_name.xml.\n");
|
||||
unlink($project_path);
|
||||
# Might want to delete the "xxx.mcp Data" dir ???
|
||||
ImportXMLProject(full_path_to($xml_path), full_path_to($project_path));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($main::CLOBBER_LIBS)
|
||||
{
|
||||
unlink "$project_dir$output_name"; # it's OK if these fail
|
||||
unlink "$project_dir$output_name.xSYM";
|
||||
}
|
||||
|
||||
DoBuildProject($project_path, $target_name, $main::CLOBBER_PROJECTS);
|
||||
|
||||
$alias_lib ? MakeAlias("$project_dir$output_name", "$output_path") : 0;
|
||||
$alias_xSYM ? MakeAlias("$project_dir$output_name.xSYM", "$output_path") : 0;
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// For compatiblity with existing scripts, BuildOneProject now just calls
|
||||
#// BuildOneProjectWithOutput, with the output name and target name identical.
|
||||
#// Note that this routine assumes that the target name and the shared libary name
|
||||
#// are the same.
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub BuildOneProject($$$$$)
|
||||
{
|
||||
my ($project_path, $target_name, $alias_lib, $alias_xSYM, $component) = @_;
|
||||
|
||||
BuildOneProjectWithOutput($project_path, $target_name, $target_name,
|
||||
$alias_lib, $alias_xSYM, $component);
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// For compatiblity with existing scripts, BuildProject now just calls
|
||||
#// BuildOneProjectWithOutput, with the output name and target name identical.
|
||||
#// Note that this routine assumes that the target name and the shared libary name
|
||||
#// are the same. No aliases of the output are made.
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub BuildProject($$)
|
||||
{
|
||||
my ($project_path, $target_name) = @_;
|
||||
|
||||
BuildOneProjectWithOutput($project_path, $target_name, $target_name, 0, 0, 0);
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Identical to BuildProject but clobbers the project before building it.
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub BuildProjectClean($$)
|
||||
{
|
||||
my ($project_path, $target_name) = @_;
|
||||
my ($save_clobber_flag) = $main::CLOBBER_PROJECTS;
|
||||
$main::CLOBBER_PROJECTS = 1;
|
||||
BuildOneProjectWithOutput($project_path, $target_name, $target_name, 0, 0, 0);
|
||||
$main::CLOBBER_PROJECTS = $save_clobber_flag;
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Make resource aliases for one directory
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub BuildFolderResourceAliases($$)
|
||||
{
|
||||
my($src_dir, $dest_dir) = @_;
|
||||
|
||||
# get a list of all the resource files
|
||||
opendir(SRCDIR, $src_dir) || die("can't open $src_dir");
|
||||
my(@resource_files) = readdir(SRCDIR);
|
||||
closedir(SRCDIR);
|
||||
|
||||
# make aliases for each one into the dest directory
|
||||
print("Placing aliases to all files from $src_dir in $dest_dir\n");
|
||||
for ( @resource_files )
|
||||
{
|
||||
next if $_ eq "CVS";
|
||||
#print(" Doing $_\n");
|
||||
if (-l $src_dir.$_)
|
||||
{
|
||||
print(" $_ is an alias\n");
|
||||
next;
|
||||
}
|
||||
my($file_name) = $src_dir . $_;
|
||||
MakeAlias($file_name, $dest_dir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// DelayFor
|
||||
#//
|
||||
#// Delay for the given number of seconds, allowing the script to be cancelled
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub DelayFor($)
|
||||
{
|
||||
my($delay_secs) = @_;
|
||||
|
||||
STDOUT->autoflush(1);
|
||||
|
||||
my($end_time) = time() + $delay_secs;
|
||||
|
||||
my($last_time) = 0;
|
||||
my($cur_time) = time();
|
||||
|
||||
while ($cur_time < $end_time)
|
||||
{
|
||||
$cur_time = time();
|
||||
if ($cur_time > $last_time)
|
||||
{
|
||||
print ".";
|
||||
$last_time = $cur_time;
|
||||
}
|
||||
|
||||
WaitNextEvent();
|
||||
}
|
||||
|
||||
print "\n";
|
||||
STDOUT->autoflush(0);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// TimeStart
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub TimeStart()
|
||||
{
|
||||
return time();
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// TimeEnd
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub TimeEnd($$)
|
||||
{
|
||||
use integer;
|
||||
|
||||
my($start_time, $operation_name) = @_;
|
||||
my($end_time) = time();
|
||||
|
||||
my($tot_sec) = $end_time - $start_time;
|
||||
|
||||
my($seconds) = $tot_sec;
|
||||
|
||||
my($hours) = $seconds / (60 * 60);
|
||||
$seconds -= $hours * (60 * 60);
|
||||
|
||||
my($minutes) = $seconds / 60;
|
||||
$seconds -= $minutes * 60;
|
||||
|
||||
print "$operation_name took $hours hours $minutes minutes and $seconds seconds\n";
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Remove all files from a tree, leaving directories intact (except "CVS").
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub EmptyTree($)
|
||||
{
|
||||
my ($root) = @_;
|
||||
#print "EmptyTree($root)\n";
|
||||
opendir(DIR, $root);
|
||||
my $sub;
|
||||
foreach $sub (readdir(DIR))
|
||||
{
|
||||
my $fullpathname = $root.$sub; # -f, -d only work on full paths
|
||||
|
||||
# Don't call empty tree for the alias of a directory.
|
||||
# -d returns true for the alias of a directory, false for a broken alias)
|
||||
|
||||
if (-d $fullpathname)
|
||||
{
|
||||
if (-l $fullpathname) # delete aliases
|
||||
{
|
||||
unlink $fullpathname;
|
||||
next;
|
||||
}
|
||||
EmptyTree($fullpathname.":");
|
||||
if ($sub eq "CVS")
|
||||
{
|
||||
#print "rmdir $fullpathname\n";
|
||||
rmdir $fullpathname;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
unless (unlink $fullpathname) { die "Failed to delete $fullpathname\n"; }
|
||||
}
|
||||
}
|
||||
closedir(DIR);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Recurse through a directory hierarchy, looking for MANIFEST files.
|
||||
#// Currently unused.
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub ScanForManifestFiles($$$$)
|
||||
{
|
||||
my($dir, $theme_root, $theme_name, $dist_dir) = @_;
|
||||
|
||||
opendir(DIR, $dir) or die "Cannot open dir $dir\n";
|
||||
my @files = readdir(DIR);
|
||||
closedir DIR;
|
||||
|
||||
my $file;
|
||||
|
||||
foreach $file (@files)
|
||||
{
|
||||
my $filepath = $dir.":".$file;
|
||||
|
||||
if (-d $filepath)
|
||||
{
|
||||
# print "Looking for MANIFEST files in $filepath\n";
|
||||
ScanForManifestFiles($filepath, $theme_root, $theme_name, $dist_dir);
|
||||
}
|
||||
elsif ($file eq "MANIFEST")
|
||||
{
|
||||
# print "Doing manifest file $filepath\n";
|
||||
|
||||
# Get the dest path from the first line of the file
|
||||
|
||||
open(MANIFEST, $filepath) || die "Could not open file $file";
|
||||
# Read in the path if available
|
||||
my($dest_line) = <MANIFEST>;
|
||||
chomp $dest_line;
|
||||
close MANIFEST;
|
||||
|
||||
$dest_line =~ s|^#!dest[\t ]+|| || die "No destination line found in $filepath\n";
|
||||
|
||||
my($dest_path) = $dist_dir."chrome:skins:$theme_name:$dest_line";
|
||||
# print " Destination is $dest_path\n";
|
||||
|
||||
InstallResources($filepath, "$dest_path", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-----------------------------------------------
|
||||
# SetupBuildLog
|
||||
#-----------------------------------------------
|
||||
sub SetupBuildLog($$)
|
||||
{
|
||||
my($logfile_path, $timestamped_log) = @_;
|
||||
|
||||
my($logdir) = "";
|
||||
my($logfile) = $logfile_path;
|
||||
|
||||
if ($logfile_path =~ /(.+?:)([^:]+)$/) # ? for non-greedy match
|
||||
{
|
||||
$logdir = $1;
|
||||
$logfile = $2;
|
||||
|
||||
mkpath($logdir);
|
||||
}
|
||||
|
||||
if ($timestamped_log)
|
||||
{
|
||||
#Use time-stamped names so that you don't clobber your previous log file!
|
||||
my $now = localtime();
|
||||
while ($now =~ s@:@.@) {} # replace all colons by periods
|
||||
OpenErrorLog("${logdir}${now}");
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenErrorLog("${logdir}${logfile}");
|
||||
}
|
||||
}
|
||||
|
||||
#-----------------------------------------------
|
||||
# SetBuildNumber
|
||||
#-----------------------------------------------
|
||||
sub SetBuildNumber($$)
|
||||
{
|
||||
my($build_num_file, $files_to_touch) = @_;
|
||||
|
||||
# Make sure we add the config dir to search, to pick up mozBDate.pm
|
||||
# Need to do this dynamically, because this module can be used before
|
||||
# mozilla/config has been checked out.
|
||||
|
||||
my ($inc_path) = $0; # $0 is the path to the parent script
|
||||
$inc_path =~ s/:build:mac:build_scripts:.+$/:config/;
|
||||
push(@INC, $inc_path);
|
||||
|
||||
require mozBDate;
|
||||
|
||||
mozBDate::UpdateBuildNumber($build_num_file, $main::MOZILLA_OFFICIAL);
|
||||
|
||||
my($file);
|
||||
foreach $file (@$files_to_touch)
|
||||
{
|
||||
print "Writing build number to $file from ${file}.in\n";
|
||||
mozBDate::SubstituteBuildNumber($file, $build_num_file, "${file}.in");
|
||||
}
|
||||
}
|
||||
|
||||
#-----------------------------------------------
|
||||
# SetTimeBomb
|
||||
#-----------------------------------------------
|
||||
sub SetTimeBomb($$)
|
||||
{
|
||||
my ($warn_days, $bomb_days) = @_;
|
||||
|
||||
system("perl :mozilla:config:mac-set-timebomb.pl $warn_days $bomb_days");
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Regenerate a configuration header file if necessary
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub UpdateConfigHeader($)
|
||||
{
|
||||
my($config_path) = @_;
|
||||
|
||||
my($config, $oldconfig) = ("", "");
|
||||
my($define, $definevalue, $defines);
|
||||
my($k, $l,);
|
||||
|
||||
foreach $k (keys(%main::options))
|
||||
{
|
||||
if ($main::options{$k})
|
||||
{
|
||||
foreach $l (keys(%{$main::optiondefines{$k}}))
|
||||
{
|
||||
$my::defines{$l} = $main::optiondefines{$k}{$l};
|
||||
print "Setting up my::defines{$l}\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my $config_headerfile = current_directory().$config_path;
|
||||
if (-e $config_headerfile)
|
||||
{
|
||||
open(CONFIG_HEADER, "< $config_headerfile") || die "$config_headerfile: $!\n";
|
||||
my($line);
|
||||
while ($line = <CONFIG_HEADER>)
|
||||
{
|
||||
if ($line =~ m/#define\s+([^\s]*)\s+([^\s]*)\s*\n/)
|
||||
{
|
||||
$define = $1;
|
||||
$definevalue = $2;
|
||||
|
||||
#canonicalize so that whitespace changes are not significant
|
||||
my $canon_value = "#define " . $define . " " . $definevalue . "\n";
|
||||
$oldconfig .= $canon_value;
|
||||
|
||||
if (exists ($my::defines{$define}) and ($my::defines{$define} == $definevalue))
|
||||
{
|
||||
delete $my::defines{$define};
|
||||
$config .= $canon_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
close(CONFIG_HEADER);
|
||||
}
|
||||
|
||||
if (%my::defines)
|
||||
{
|
||||
foreach $k (keys(%my::defines))
|
||||
{
|
||||
$config .= "#define " . $k . " " . $my::defines{$k} . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
my $file_name = basename($config_headerfile);
|
||||
if (($config ne $oldconfig) || (!-e $config_headerfile))
|
||||
{
|
||||
printf("Writing new configuration header $file_name\n");
|
||||
open(CONFIG_HEADER, "> $config_headerfile") || die "$config_headerfile: $!\n";
|
||||
print(CONFIG_HEADER "/* This file is auto-generated based on build options. Do not edit. */\n");
|
||||
print CONFIG_HEADER ($config);
|
||||
close(CONFIG_HEADER);
|
||||
|
||||
MacPerl::SetFileInfo("CWIE", "TEXT", $config_headerfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Configuration header $file_name is up-to-date\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
@@ -1,660 +0,0 @@
|
||||
#!perl
|
||||
package Moz::CodeWarriorLib;
|
||||
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
CodeWarriorLib - supply interface to CodeWarrior
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
#!perl
|
||||
use CodeWarriorLib;
|
||||
CodeWarriorLib::activate();
|
||||
$had_errors = CodeWarriorLib::build_project(
|
||||
$project_path, $target_name, $recent_errors_file, $clean_build
|
||||
);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Replaces the AppleScript library I<CodeWarriorLib>.
|
||||
|
||||
=over 4
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
use Mac::Types;
|
||||
use Mac::Events;
|
||||
use Mac::AppleEvents;
|
||||
use Mac::AppleEvents::Simple;
|
||||
use Mac::Processes;
|
||||
use Mac::MoreFiles;
|
||||
use Mac::StandardFile;
|
||||
|
||||
|
||||
use vars qw($VERSION);
|
||||
$VERSION = '1.02';
|
||||
|
||||
my($app) = 'CWIE';
|
||||
my($scriptDir) = cwd(); # could use $0 for this
|
||||
my($ide_loc_file) = "";
|
||||
|
||||
# 0 == don't switch CWIE to front app in do_event(), 1 == do switch
|
||||
# note: activate() still switches when called
|
||||
$Mac::AppleEvents::Simple::SWITCH = 0;
|
||||
# $Mac::AppleEvents::Simple::WARN = 1;
|
||||
|
||||
# supply your own path to the source here
|
||||
#_test('PowerPudgeIV:mozilla:mozilla:');
|
||||
|
||||
# If you want to understand the gobbldeygook that's used to build Apple Events,
|
||||
# you should start by reading the AEGizmos documentation.
|
||||
|
||||
=pod
|
||||
|
||||
=item _get_project($full_path)
|
||||
|
||||
A private routine returning a reference to the open project with the given name,
|
||||
or else the empty string (when that project is not open)
|
||||
|
||||
full_path is a string identifying the project to be built and is of the form,
|
||||
e.g., "HD:ProjectFolder:MyProject.mcp". It must be supplied.
|
||||
|
||||
=cut
|
||||
|
||||
sub _get_project ($) {
|
||||
my(
|
||||
$full_path, $candidate_projects
|
||||
) = @_;
|
||||
$candidate_projects = _doc_named(basename($full_path, '*'));
|
||||
if ($candidate_projects) {
|
||||
my($cps) = _get_dobj($candidate_projects);
|
||||
my($num) = AECountItems($cps);
|
||||
if ($num) { # is a list
|
||||
foreach (1 .. AECountItems($cps)) {
|
||||
my($cp) = AEGetNthDesc($cps, $_);
|
||||
if (lc $full_path eq lc _full_path($cp)) {
|
||||
return($cp);
|
||||
}
|
||||
}
|
||||
} else { # is only one, not a list
|
||||
if (lc $full_path eq lc _full_path($cps)) {
|
||||
return($cps);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
=pod
|
||||
|
||||
=item build_project
|
||||
|
||||
Build a selected target of a project, saving any errors to a file, if supplied.
|
||||
|
||||
full_path is a string identifying the project to be built and is of the form,
|
||||
e.g., "HD:ProjectFolder:MyProject.mcp". It must be supplied.
|
||||
|
||||
If target_name is the empty string, the current target of the selected project
|
||||
will be built, else, target_name should be a string matching a target name in
|
||||
the selected project.
|
||||
|
||||
If error_path is the empty string, errors will not be saved to a file,
|
||||
else, error_path should be the full path of a file to save error messages into.
|
||||
|
||||
=cut
|
||||
|
||||
$CodeWarriorLib::CLOSE_PROJECTS_FIRST = 0; # If true we close then make. If false, make then close.
|
||||
my $last_project_built = "";
|
||||
my $last_project_was_closed = 0;
|
||||
|
||||
sub build_project ($;$$$) {
|
||||
my(
|
||||
$full_path, $target_name, $error_path,
|
||||
$remove_object, $p, $project_was_closed, $had_errors
|
||||
) = @_;
|
||||
_close_errors_window();
|
||||
|
||||
if ($CodeWarriorLib::CLOSE_PROJECTS_FIRST && ($last_project_built ne $full_path))
|
||||
{
|
||||
# If we're in "close first" mode, we don't close if the current project
|
||||
# is the same as the previous one.
|
||||
if ($last_project_was_closed) {
|
||||
$p = _get_project($last_project_built);
|
||||
_close($p);
|
||||
}
|
||||
$last_project_built = $full_path;
|
||||
$last_project_was_closed = 0; # now refers to the new project
|
||||
}
|
||||
$project_was_closed = 0;
|
||||
while (1) {
|
||||
$p = _get_project($full_path);
|
||||
if (!$p) {
|
||||
if ($project_was_closed) {
|
||||
print "### Error - request for project document failed after opening\n";
|
||||
die "### possibly CW Pro 4 bug: be sure to close your Find window\n";
|
||||
}
|
||||
$project_was_closed = 1;
|
||||
$last_project_was_closed = 1;
|
||||
_open_file($full_path);
|
||||
} else {
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
$had_errors = 0;
|
||||
if ($target_name eq '') {
|
||||
if ($remove_object) {_remove_object($p)}
|
||||
_build($p);
|
||||
} else {
|
||||
if ($remove_object) {_remove_object($p, $target_name)}
|
||||
_build($p, $target_name);
|
||||
}
|
||||
|
||||
if ($error_path ne '') {
|
||||
_save_errors_window($error_path);
|
||||
}
|
||||
$had_errors = _close_errors_window();
|
||||
|
||||
if (!$CodeWarriorLib::CLOSE_PROJECTS_FIRST)
|
||||
{
|
||||
if ($project_was_closed) {
|
||||
$p = _get_project($full_path);
|
||||
_close($p);
|
||||
}
|
||||
}
|
||||
|
||||
return($had_errors);
|
||||
}
|
||||
|
||||
=pod
|
||||
|
||||
=item appIsRunning()
|
||||
|
||||
=cut
|
||||
sub _appIsRunning($)
|
||||
{
|
||||
my ($appSignature) = @_;
|
||||
my ($psi);
|
||||
my ($found) = 0;
|
||||
my ($appPSN);
|
||||
|
||||
foreach $psi (values(%Process))
|
||||
{
|
||||
if ($psi->processSignature() eq $appSignature)
|
||||
{
|
||||
$appPSN = $psi->processNumber();
|
||||
$found = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
return $found;
|
||||
}
|
||||
|
||||
=pod
|
||||
|
||||
=item appIsFrontmost()
|
||||
|
||||
=cut
|
||||
sub _appIsFrontmost($)
|
||||
{
|
||||
my ($appSignature) = @_;
|
||||
my ($psi);
|
||||
my ($found) = 0;
|
||||
my ($appPSN);
|
||||
|
||||
foreach $psi (values(%Process))
|
||||
{
|
||||
if ($psi->processSignature() eq $appSignature)
|
||||
{
|
||||
$appPSN = $psi->processNumber();
|
||||
$found = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
return (GetFrontProcess() == $appPSN);
|
||||
}
|
||||
|
||||
|
||||
=pod
|
||||
|
||||
=item activate()
|
||||
|
||||
Launches CodeWarrior and brings it to the front.
|
||||
|
||||
Once found, path will be saved in $idepath_file for future reference.
|
||||
Edit or delete this file to change the location of the IDE. If app is
|
||||
moved, C<activate()> will prompt for a new location.
|
||||
|
||||
First looks for an open CodeWarrior app. Second, tries to open previously
|
||||
saved location in ':idepath.txt'. Third, tries to find it and allow user
|
||||
to choose it with Navigation Services (if present). Fourth, uses good old
|
||||
GUSI routines built-in to MacPerl for a Choose Directory dialog box.
|
||||
|
||||
=cut
|
||||
|
||||
sub activate ($) {
|
||||
|
||||
$ide_loc_file = $_[0]; # save in global
|
||||
|
||||
my($filepath, $appath, $psi) = ($ide_loc_file);
|
||||
|
||||
foreach $psi (values(%Process)) {
|
||||
if ($psi->processSignature() eq $app) {
|
||||
$appath = $psi->processAppSpec();
|
||||
_save_appath($filepath, $appath);
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$appath || !-x $appath) {
|
||||
$appath = _read_appath($filepath);
|
||||
}
|
||||
|
||||
if (!$appath || ! -x $appath)
|
||||
{
|
||||
# make sure that MacPerl is a front process
|
||||
#ActivateApplication('McPL');
|
||||
MacPerl::Answer("Please locate the CodeWarrior application.", "OK");
|
||||
|
||||
# prompt user for the file name, and store it
|
||||
my $macFile = StandardGetFile( 0, "APPL");
|
||||
if ( $macFile->sfGood() )
|
||||
{
|
||||
$appath = $macFile->sfFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
die "Operation canceled\n";
|
||||
}
|
||||
|
||||
# if (eval {require Mac::Navigation}) {
|
||||
# my($options, $nav);
|
||||
# Mac::Navigation->import();
|
||||
# $options = NavGetDefaultDialogOptions();
|
||||
# $options->message('Where is CodeWarrior IDE?');
|
||||
# $options->windowTitle('Find CodeWarrior IDE');
|
||||
# $nav = NavChooseObject($Application{$app}, $options);
|
||||
# die "CodeWarrior IDE not found.\n" if (!$nav || !$nav->file(1));
|
||||
# $appath = $nav->file(1);
|
||||
# } else {
|
||||
# local(*D);
|
||||
# my $cwd = `pwd`;
|
||||
# $appath = _get_folder(
|
||||
# 'Where is the CW IDE folder?',
|
||||
# dirname($Application{$app})
|
||||
# );
|
||||
# die "CodeWarrior IDE not found.\n" if !$appath;
|
||||
# opendir(D, $appath) or die $!;
|
||||
# chdir($appath);
|
||||
# foreach my $file (sort readdir (D)) {
|
||||
# my(@app) = MacPerl::GetFileInfo($file);
|
||||
# if ($app[0] && $app[1] &&
|
||||
# $app[1] eq 'APPL' && $app[0] eq $app
|
||||
# ) {
|
||||
# $appath .= $file;
|
||||
# last;
|
||||
# }
|
||||
# }
|
||||
# chomp($cwd);
|
||||
# chdir($cwd);
|
||||
# }
|
||||
_save_appath($filepath, $appath);
|
||||
}
|
||||
|
||||
my($lp) = LaunchParam->new(
|
||||
launchAppSpec => $appath,
|
||||
launchControlFlags => launchContinue() + launchNoFileFlags()
|
||||
);
|
||||
|
||||
unless (LaunchApplication($lp)) {
|
||||
unlink($filepath);
|
||||
die $^E;
|
||||
}
|
||||
|
||||
# wait for CodeWarrior to show up in the list of processes
|
||||
while (!_appIsRunning('CWIE'))
|
||||
{
|
||||
WaitNextEvent();
|
||||
}
|
||||
|
||||
# wait for CodeWarrior to come to the front
|
||||
while (!_appIsFrontmost('CWIE'))
|
||||
{
|
||||
WaitNextEvent();
|
||||
}
|
||||
}
|
||||
|
||||
=pod
|
||||
|
||||
=item getCodeWarriorPath()
|
||||
|
||||
Returns a file path relative to the CodeWarrior folder
|
||||
|
||||
=cut
|
||||
|
||||
sub getCodeWarriorPath($)
|
||||
{
|
||||
my($subfolder)=@_;
|
||||
|
||||
my($app_path) = _read_appath($ide_loc_file);
|
||||
if ($app_path eq "") { die "Error: Failed to get CodeWarrior IDE path\n"; }
|
||||
|
||||
my($codewarrior_root) = $app_path;
|
||||
$codewarrior_root =~ s/[^:]*$//;
|
||||
return ($codewarrior_root . $subfolder);
|
||||
}
|
||||
|
||||
|
||||
=pod
|
||||
|
||||
=item getCodeWarriorIDEName()
|
||||
|
||||
Returns the name of the CodeWarrior application
|
||||
|
||||
=cut
|
||||
|
||||
sub getCodeWarriorIDEName()
|
||||
{
|
||||
my($subfolder)=@_;
|
||||
|
||||
my($app_path) = _read_appath($ide_loc_file);
|
||||
if ($app_path eq "") { die "Error: Failed to get CodeWarrior IDE path\n"; }
|
||||
|
||||
my(@codewarrior_path) = split(/:/, $app_path);
|
||||
return pop(@codewarrior_path);
|
||||
}
|
||||
|
||||
|
||||
=pod
|
||||
|
||||
=item quit()
|
||||
|
||||
Quits CodeWarrior.
|
||||
|
||||
=cut
|
||||
|
||||
sub quit() {
|
||||
|
||||
$last_project_built = "";
|
||||
$last_project_was_closed = 0;
|
||||
|
||||
my($evt) = do_event(qw/aevt quit/, $app);
|
||||
}
|
||||
|
||||
|
||||
sub _build ($;$) {
|
||||
my($evt);
|
||||
if ($_[1]) {
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(TRGT), seld:TEXT(@), from:" .
|
||||
AEPrint($_[0]) . '}';
|
||||
$evt = do_event(qw/CWIE MAKE/, $app, $prm, $_[1]);
|
||||
} else {
|
||||
my($prm) = q"'----':" . AEPrint($_[0]);
|
||||
$evt = do_event(qw/CWIE MAKE/, $app, $prm);
|
||||
}
|
||||
}
|
||||
|
||||
sub _remove_object ($;$) {
|
||||
my($evt);
|
||||
if ($_[1]) {
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(TRGT), seld:TEXT(@), from:" .
|
||||
AEPrint($_[0]) . '}';
|
||||
$evt = do_event(qw/CWIE RMOB/, $app, $prm, $_[1]);
|
||||
} else {
|
||||
my($prm) = q"'----':" . AEPrint($_[0]);
|
||||
$evt = do_event(qw/CWIE RMOB/, $app, $prm);
|
||||
}
|
||||
}
|
||||
|
||||
sub _open_file ($) {
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(alis), " .
|
||||
q"seld:TEXT(@), from:'null'()}";
|
||||
|
||||
do_event(qw/aevt odoc/, $app, $prm, $_[0]);
|
||||
}
|
||||
|
||||
sub import_project ($$) {
|
||||
my($xml_file, $project_path) = @_;
|
||||
|
||||
my($prm) = "kocl:type(PRJD), rtyp:TEXT(@), data:TEXT(@), &subj:'null'()";
|
||||
|
||||
my($evt) = do_event(qw/core crel/, $app, $prm, $project_path, $xml_file);
|
||||
my($result) = _get_event_result($evt);
|
||||
|
||||
if ($result eq "") {
|
||||
_close(_get_project($project_path));
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
sub export_project ($$) {
|
||||
my($project_path, $xml_out_path) = @_;
|
||||
my($p, $project_was_closed);
|
||||
|
||||
$project_was_closed = 0;
|
||||
while (1) {
|
||||
$p = _get_project($project_path);
|
||||
if (!$p) {
|
||||
if ($project_was_closed) {
|
||||
print "### Error - request for project document failed after opening\n";
|
||||
die "### possibly CW bug: be sure to close your Find window\n";
|
||||
}
|
||||
$project_was_closed = 1;
|
||||
_open_file($project_path);
|
||||
} else {
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
# avoid problems with the Project Messages window
|
||||
_close_named_window("Project Messages");
|
||||
|
||||
my($prm) =
|
||||
q"'----':obj {form:indx, want:type(PRJD), " .
|
||||
q"seld:1, from:'null'()}, kfil:TEXT(@)";
|
||||
|
||||
my($evt) = do_event(qw/CWIE EXPT/, $app, $prm, $xml_out_path);
|
||||
|
||||
if ($project_was_closed) {
|
||||
$p = _get_project($project_path);
|
||||
_close($p);
|
||||
}
|
||||
|
||||
return _get_event_result($evt);
|
||||
}
|
||||
|
||||
sub _doc_named ($) {
|
||||
my($prm) =
|
||||
q"'----':obj {form:test, want:type(docu), from:'null'(), " .
|
||||
q"seld:cmpd{relo:'= ', 'obj1':obj {form:prop, want:type" .
|
||||
q"(prop), seld:type(pnam), from:'exmn'()}, 'obj2':TEXT(@)}}";
|
||||
|
||||
my($evt) = do_event(qw/core getd/, $app, $prm, $_[0]);
|
||||
return($evt->{REPLY} eq 'aevt\ansr{}' ? undef : $evt);
|
||||
}
|
||||
|
||||
sub _full_path ($) {
|
||||
my($obj) = $_[0];
|
||||
my($prm) =
|
||||
q"'----':obj {form:prop, want:type(prop), seld:type(FILE), " .
|
||||
q"from:" . AEPrint($_[0]) . q"}, rtyp:type(TEXT)";
|
||||
my($evt) = do_event(qw/core getd/, $app, $prm);
|
||||
|
||||
return MacPerl::MakePath(
|
||||
MacUnpack('fss ', (
|
||||
AEGetParamDesc($evt->{REP}, keyDirectObject()))->data()->get()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
sub _save_errors_window ($) {
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(alis), seld:TEXT(@), from:'null'()}";
|
||||
do_event(qw/MMPR SvMs/, $app, $prm, $_[0]);
|
||||
}
|
||||
|
||||
|
||||
sub _close_errors_window () {
|
||||
return _close_named_window('Errors & Warnings');
|
||||
}
|
||||
|
||||
|
||||
sub _close_named_window ($) {
|
||||
my($window_name) = @_;
|
||||
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(cwin), " .
|
||||
q"seld:TEXT(@), from:'null'()}";
|
||||
|
||||
my($evt) = do_event(qw/core clos/, $app, $prm, $window_name);
|
||||
return($evt->{REPLY} eq 'aevt\ansr{}' ? 1 : 0);
|
||||
}
|
||||
|
||||
sub _close () {
|
||||
my($prm) = q"'----':" . AEPrint($_[0]);
|
||||
do_event(qw/core clos/, $app, $prm);
|
||||
}
|
||||
|
||||
sub _get_dobj ($) {
|
||||
return(AEGetParamDesc($_[0]->{REP}, keyDirectObject()));
|
||||
}
|
||||
|
||||
sub _get_folder ($$) {
|
||||
require 'GUSI.ph';
|
||||
my($prompt, $default) = @_;
|
||||
MacPerl::Choose(
|
||||
GUSI::AF_FILE(), 0, $prompt, '',
|
||||
GUSI::CHOOSE_DIR() + ($default ? &GUSI::CHOOSE_DEFAULT : 0),
|
||||
$default
|
||||
);
|
||||
}
|
||||
|
||||
sub _get_event_result ($)
|
||||
{
|
||||
my($evt) = @_;
|
||||
|
||||
my($result) = $evt->{ERROR};
|
||||
|
||||
if ( $result eq "" && $evt->{ERRNO} != 0 )
|
||||
{
|
||||
$result = "unknown error (".$evt->{ERRNO}.")";
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
sub _save_appath ($$) {
|
||||
|
||||
my($cwd) = cwd(); # remember the current working dir
|
||||
chdir($scriptDir); # change dir to the script dir
|
||||
|
||||
local(*F);
|
||||
open(F, '>' . $_[0]) or die $!;
|
||||
print F $_[1];
|
||||
close(F);
|
||||
|
||||
chdir($cwd); # restore the cwd
|
||||
}
|
||||
|
||||
sub _read_appath ($) {
|
||||
|
||||
my($filepath) = @_;
|
||||
|
||||
my($cwd) = cwd(); # remember the current working dir
|
||||
chdir($scriptDir); # change dir to the script dir
|
||||
|
||||
if (! -e $filepath) {
|
||||
return "";
|
||||
}
|
||||
|
||||
local(*F);
|
||||
open(F, $filepath);
|
||||
my($appath) = <F>;
|
||||
close(F);
|
||||
|
||||
chdir($cwd); # restore the cwd
|
||||
return($appath);
|
||||
}
|
||||
|
||||
|
||||
sub _test ($) {
|
||||
activate($ide_loc_file);
|
||||
my($path) = $_[0];
|
||||
build_project(
|
||||
"${path}modules:xml:macbuild:XML.mcp", '',
|
||||
"${path}build:mac:Mozilla.BuildLog.part"
|
||||
);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
=pod
|
||||
|
||||
=back
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
=over 4
|
||||
|
||||
=item v1.02, September 23, 1998
|
||||
|
||||
Made fixes in finding and saving location of CodeWarrior IDE.
|
||||
|
||||
=item v1.01, June 1, 1998
|
||||
|
||||
Made fixes to C<chdir()> in C<activate()>, made C<activate()> more robust
|
||||
in finding CodeWarrior IDE, added global variable to NOT switch to IDE
|
||||
for each sent event, a few other fixes.
|
||||
|
||||
=item v1.00, May 30, 1998
|
||||
|
||||
First shot
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Chris Nandor F<E<lt>pudge@pobox.comE<gt>>, and the author of the
|
||||
original I<CodeWarriorLib>, Scott Collins F<E<lt>scc@netscape.comE<gt>>.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
BuildProject L<Moz>.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
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, released
|
||||
March 31, 1998.
|
||||
|
||||
The Initial Developer of the Original Code is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
||||
=cut
|
||||
@@ -1,573 +0,0 @@
|
||||
#!perl -w
|
||||
package Moz::Jar;
|
||||
|
||||
#
|
||||
# Module for creating jar files, either using a jar manifest, or
|
||||
# simply jarring up folders on disk.
|
||||
#
|
||||
|
||||
require 5.004;
|
||||
require Exporter;
|
||||
|
||||
use strict;
|
||||
use Archive::Zip;
|
||||
use File::Path;
|
||||
|
||||
use Mac::Files;
|
||||
|
||||
use Moz::Moz;
|
||||
|
||||
use vars qw( @ISA @EXPORT );
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(
|
||||
CreateJarFileFromDirectory
|
||||
CreateJarFromManifest
|
||||
WriteOutJarFiles
|
||||
SanityCheckJarOptions
|
||||
);
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Add the contents of a directory to the zip file
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
sub _addDirToJar($$$$)
|
||||
{
|
||||
my($dir, $jar_root, $zip, $compress) = @_;
|
||||
|
||||
opendir(DIR, $dir) or die "Error: Cannot open dir $dir\n";
|
||||
my @files = readdir(DIR);
|
||||
closedir DIR;
|
||||
|
||||
my $unix_jar_root = $jar_root;
|
||||
$unix_jar_root =~ s|:|/|g; # colon to slash conversion
|
||||
|
||||
my $file;
|
||||
|
||||
foreach $file (@files)
|
||||
{
|
||||
my $filepath = $dir.":".$file;
|
||||
|
||||
if (-d $filepath)
|
||||
{
|
||||
print "Adding files to jar from $filepath\n";
|
||||
_addDirToJar($filepath, $jar_root, $zip, $compress);
|
||||
}
|
||||
else
|
||||
{
|
||||
my $member = Archive::Zip::Member->newFromFile($filepath);
|
||||
die "Error: Failed to create zip file member $filepath\n" unless $member;
|
||||
|
||||
my $unixName = $filepath;
|
||||
$unixName =~ s|:|/|g; # colon to slash conversion
|
||||
$unixName =~ s|^$unix_jar_root||; # relativise
|
||||
|
||||
$member->fileName($unixName);
|
||||
|
||||
# print "Adding $file as $unixName\n";
|
||||
|
||||
if ($compress) {
|
||||
$member->desiredCompressionMethod(Archive::Zip::COMPRESSION_DEFLATED);
|
||||
} else {
|
||||
$member->desiredCompressionMethod(Archive::Zip::COMPRESSION_STORED);
|
||||
}
|
||||
|
||||
$zip->addMember($member);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Add the contents of a directory to the zip file
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub CreateJarFileFromDirectory($$$)
|
||||
{
|
||||
my($srcdir, $jarpath, $compress) = @_;
|
||||
|
||||
my $zip = Archive::Zip->new();
|
||||
|
||||
_addDirToJar($srcdir, $srcdir, $zip, $compress);
|
||||
|
||||
print "Saving zip file...\n";
|
||||
my $status = $zip->writeToFileNamed($jarpath);
|
||||
if ($status == 0) {
|
||||
print "Zipping completed successfully\n";
|
||||
} else {
|
||||
print "Error saving zip file\n";
|
||||
}
|
||||
|
||||
# set the file type/creator to something reasonable
|
||||
MacPerl::SetFileInfo("ZIP ", "ZIP ", $jarpath);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# printZipContents
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
sub printZipContents($)
|
||||
{
|
||||
my($zip) = @_;
|
||||
|
||||
my(@members) = $zip->memberNames();
|
||||
|
||||
print "Zip contains:\n";
|
||||
|
||||
my($member);
|
||||
foreach $member (@members)
|
||||
{
|
||||
print " $member\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# safeSaveJarFile
|
||||
#
|
||||
# Archive::Zip has a problem where you cannot save a zip file on top of
|
||||
# an existing zip file that it has open, because it holds references
|
||||
# into that zip. So we have to save to a temp file, then do a swap.
|
||||
#
|
||||
# Note that the zip will become invalid after this operation.
|
||||
# If you want to do further operations on it, you'll have to reread it.
|
||||
#-------------------------------------------------------------------------------
|
||||
sub safeSaveJarFile($$)
|
||||
{
|
||||
my($zip, $full_dest_path) = @_;
|
||||
|
||||
my($temp_file_name) = $full_dest_path."_temp";
|
||||
|
||||
($zip->writeToFileNamed($temp_file_name) == Archive::Zip::AZ_OK) || die "Error: died writing jar to temp file $temp_file_name\n";
|
||||
|
||||
unlink $full_dest_path;
|
||||
|
||||
(rename $temp_file_name, $full_dest_path) || die "Error: Failed to rename $temp_file_name\n";
|
||||
|
||||
MacPerl::SetFileInfo("ZIP ", "ZIP ", $full_dest_path);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# addToJarFile
|
||||
#
|
||||
# Add a file to a jar file
|
||||
#
|
||||
# Parameters:
|
||||
# 1. Jar ID. Unix path of jar file inside chrome.
|
||||
# 2. Abs path to jar.mn file (i.e. source) (mac breaks)
|
||||
# 3. File source, relative to jar.mn path (mac breaks)
|
||||
# 4. Abs path to the resulting .jar file (mac breaks)
|
||||
# 5. Relative file path within the jar (unix breaks)
|
||||
# 6. Reference to hash of jar files
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub addToJarFile($$$$$$$)
|
||||
{
|
||||
my($jar_id, $jar_man_dir, $file_src, $jar_path, $file_jar_path, $override, $jars) = @_;
|
||||
|
||||
# print "addToJarFile with:\n $jar_man_dir\n $file_src\n $jar_path\n $file_jar_path\n";
|
||||
|
||||
unless ($jar_path =~ m/(.+:)([^:]+)$/) { die "Error: Bad jar path $jar_path\n"; }
|
||||
|
||||
my($target_dir) = $1;
|
||||
my($jar_name) = $2;
|
||||
|
||||
$target_dir =~ s/[^:]+$//;
|
||||
|
||||
# print "¥ $target_dir $jar_name\n";
|
||||
|
||||
# find the source file
|
||||
my($src) = $jar_man_dir.":".$file_src;
|
||||
if ((!-e $src) && ($file_src =~ m/.+:([^:]+)$/)) # src does not exist. Fall back to looking for src in jar.mn dir
|
||||
{
|
||||
$file_src = $1;
|
||||
$src = $jar_man_dir.":".$file_src;
|
||||
|
||||
if (!-e $src) {
|
||||
die "Error: Can't find chrome file $src\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ($main::options{chrome_jars})
|
||||
{
|
||||
my($zip) = $jars->{$jar_id};
|
||||
unless ($zip) { die "Error: Can't find Zip entry for $jar_id\n"; }
|
||||
|
||||
# print "Adding $file_src to jar file $jar_path at $file_jar_path\n";
|
||||
my($member) = Archive::Zip::Member->newFromFile($src);
|
||||
unless ($member) { die "Error: Failed to create zip file member $src\n"; }
|
||||
|
||||
$member->fileName($file_jar_path);
|
||||
|
||||
my($compress) = 1;
|
||||
if ($compress) {
|
||||
$member->desiredCompressionMethod(Archive::Zip::COMPRESSION_DEFLATED);
|
||||
$member->desiredCompressionLevel(Archive::Zip::COMPRESSION_LEVEL_DEFAULT); # defaults to 6
|
||||
} else {
|
||||
$member->desiredCompressionMethod(Archive::Zip::COMPRESSION_STORED);
|
||||
}
|
||||
|
||||
my($old_member) = $zip->memberNamed($file_jar_path);
|
||||
|
||||
if ($override)
|
||||
{
|
||||
if ($old_member)
|
||||
{
|
||||
# print "Overriding $file_jar_path in jar file $jar_id\n";
|
||||
# need to compare mod dates or use the + here
|
||||
$zip->removeMember($old_member);
|
||||
}
|
||||
|
||||
$zip->addMember($member);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($old_member)
|
||||
{
|
||||
#compare dates here
|
||||
my($member_moddate) = $old_member->lastModTime();
|
||||
my($file_moddate) = GetFileModDate($src);
|
||||
|
||||
if ($file_moddate > $member_moddate)
|
||||
{
|
||||
print "Updating older file $file_jar_path in $jar_id\n";
|
||||
$zip->removeMember($old_member);
|
||||
$zip->addMember($member);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "File $file_jar_path in $jar_id is more recent. Not updating.\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$zip->addMember($member);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($main::options{chrome_files}) # we install raw files too
|
||||
{
|
||||
my($rel_path) = $file_jar_path;
|
||||
$rel_path =~ s|/|:|g; # slash to colons
|
||||
|
||||
my($dir_name) = $jar_name;
|
||||
$dir_name =~ s/\.jar$//;
|
||||
|
||||
my($dst) = $target_dir.$dir_name.":".$rel_path;
|
||||
|
||||
# print "Aliassing $src\n to\n$dst\n";
|
||||
if ($override)
|
||||
{
|
||||
unlink $dst;
|
||||
MakeAlias($src, $dst); # don't check errors, otherwise we fail on replacement
|
||||
}
|
||||
else
|
||||
{
|
||||
if (-e $dst)
|
||||
{
|
||||
#compare dates here
|
||||
my($dst_moddate) = GetFileModDate($dst);
|
||||
my($file_moddate) = GetFileModDate($src);
|
||||
|
||||
if ($file_moddate > $dst_moddate)
|
||||
{
|
||||
print "Updating older file $rel_path in $dir_name\n";
|
||||
unlink $dst;
|
||||
MakeAlias($src, $dst);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "File $file_jar_path in $jar_id is more recent. Not updating.\n";
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
MakeAlias($src, $dst);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# setupJarFile
|
||||
#
|
||||
# setup a zip for writing
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub setupJarFile($$$)
|
||||
{
|
||||
my($jar_id, $dest_path, $jar_hash) = @_;
|
||||
|
||||
# print "Creating jar file $jar_id at $jar_path\n";
|
||||
|
||||
my($jar_file) = $jar_id;
|
||||
$jar_file =~ s|/|:|g; # slash to colons
|
||||
my($full_jar_path) = full_path_to($dest_path.":".$jar_file);
|
||||
|
||||
if ($main::options{chrome_jars})
|
||||
{
|
||||
my($zip) = $jar_hash->{$jar_id};
|
||||
if (!$zip) # if we haven't made it already, do so
|
||||
{
|
||||
my($zip) = Archive::Zip->new();
|
||||
$jar_hash->{$jar_id} = $zip;
|
||||
|
||||
# does the jar file exist already? If so, read it in
|
||||
if (-e $full_jar_path)
|
||||
{
|
||||
print "Reading in jar file $jar_id\n";
|
||||
if ($zip->read($full_jar_path) != Archive::Zip::AZ_OK) { die "Error: Failed to re-read $full_jar_path\n"; }
|
||||
|
||||
# printZipContents($zip);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# installing files.
|
||||
# nothing to do. MakeAlias creates dirs as needed.
|
||||
|
||||
# add this jar to the list
|
||||
$jar_hash->{$jar_id} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# closeJarFile
|
||||
#
|
||||
# We're done with this jar file _for this jar.mn_. We may add more entries
|
||||
# to it later, so keep it open in the hash.
|
||||
#-------------------------------------------------------------------------------
|
||||
sub closeJarFile($$)
|
||||
{
|
||||
my($jar_path, $jar_hash) = @_;
|
||||
|
||||
# print "Closing jar file $jar_path\n";
|
||||
|
||||
if ($main::options{chrome_jars})
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
# installing files.
|
||||
# nothing to do
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# WriteOutJarFiles
|
||||
#
|
||||
# Now we dump out the jars
|
||||
#-------------------------------------------------------------------------------
|
||||
sub WriteOutJarFiles($$)
|
||||
{
|
||||
my($chrome_dir, $jars) = @_;
|
||||
|
||||
unless ($main::options{chrome_jars}) { return; }
|
||||
|
||||
my($full_chrome_path) = full_path_to($chrome_dir);
|
||||
|
||||
my($key);
|
||||
foreach $key (keys %$jars)
|
||||
{
|
||||
my($zip) = $jars->{$key};
|
||||
|
||||
my($rel_path) = $key;
|
||||
$rel_path =~ s/\//:/g;
|
||||
|
||||
my($output_path) = $full_chrome_path.":".$rel_path;
|
||||
|
||||
print "Writing zip file $key to $output_path\n";
|
||||
|
||||
# ensure the target dirs exist
|
||||
my($path) = $output_path;
|
||||
$path =~ s/[^:]+$//;
|
||||
mkpath($path);
|
||||
|
||||
# unlink $output_path; # remove any existing jar
|
||||
safeSaveJarFile($zip, $output_path);
|
||||
# $zip is invalid after this operation, so nuke it here
|
||||
$jars->{$key} = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# registerChromePackage
|
||||
#
|
||||
# Enter a chrome package into the installed-chrome.txt file
|
||||
#-------------------------------------------------------------------------------
|
||||
sub registerChromePackage($$$$$$)
|
||||
{
|
||||
my($jar_file, $file_path, $chrome_dir, $jar_hash, $chrome_type, $pkg_name) = @_;
|
||||
|
||||
my($manifest_subdir) = $jar_file;
|
||||
$manifest_subdir =~ s/:/\//g;
|
||||
|
||||
my($chrome_entry);
|
||||
|
||||
if ($main::options{use_jars}) {
|
||||
$chrome_entry = "$chrome_type,install,url,jar:resource:/chrome/$manifest_subdir!/$chrome_type/$pkg_name";
|
||||
} else {
|
||||
$manifest_subdir =~ s/\.jar$//;
|
||||
$chrome_entry = "$chrome_type,install,url,resource:/chrome/$manifest_subdir/$chrome_type/$pkg_name";
|
||||
}
|
||||
|
||||
# print "Entering $chrome_entry in installed-chrome.txt\n";
|
||||
|
||||
# ensure chrome_dir exists
|
||||
mkpath($chrome_dir);
|
||||
|
||||
my($inst_chrome) = ${chrome_dir}.":installed-chrome.txt";
|
||||
|
||||
if (open(CHROMEFILE, "<$inst_chrome")) {
|
||||
while (<CHROMEFILE>) {
|
||||
chomp;
|
||||
if ($_ eq $chrome_entry) {
|
||||
# $chrome_entry already appears in installed-chrome.txt file
|
||||
# just update the mod date
|
||||
my $now = time;
|
||||
utime($now, $now, $inst_chrome) || die "Error: Couldn't touch $inst_chrome";
|
||||
print "+++ updating chrome $inst_chrome\n+++\t\t$chrome_entry\n";
|
||||
close(CHROMEFILE) || die "Error: can't close $inst_chrome: $!";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
close(CHROMEFILE) || die "Error: can't close $inst_chrome: $!";
|
||||
}
|
||||
open(CHROMEFILE, ">>${inst_chrome}") || die "Error: Failed to open $inst_chrome\n";
|
||||
print(CHROMEFILE "${chrome_entry}\n");
|
||||
close(CHROMEFILE) || die "Error: Failed to close $inst_chrome\n";
|
||||
print "+++ adding chrome $inst_chrome\n+++\t\t$chrome_entry\n";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Create or add to a jar file from a jar.mn file.
|
||||
# Both arguments are relative to the mozilla root dir.
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
sub CreateJarFromManifest($$$)
|
||||
{
|
||||
my($jar_man_path, $dest_path, $jars) = @_;
|
||||
|
||||
if ($main::options{chrome_jars}) {
|
||||
print "Jarring from $jar_man_path\n";
|
||||
}
|
||||
if ($main::options{chrome_files}) {
|
||||
print "Installing files from $jar_man_path\n";
|
||||
}
|
||||
|
||||
$jar_man_path = full_path_to($jar_man_path);
|
||||
$dest_path = full_path_to($dest_path);
|
||||
|
||||
# if the jars hash is empty, nuke installed-chrome.txt
|
||||
if (! scalar(%$jars))
|
||||
{
|
||||
print "Nuking installed-chrome.txt\n";
|
||||
my($installed_chrome) = $dest_path.":installed-chrome.txt";
|
||||
# unlink $installed_chrome;
|
||||
}
|
||||
|
||||
my $jar_man_dir = "";
|
||||
my $jar_man_file = "";
|
||||
|
||||
if ($jar_man_path =~ /(.+):([^:]+)$/)
|
||||
{
|
||||
$jar_man_dir = $1; # no trailing :
|
||||
$jar_man_file = $2;
|
||||
}
|
||||
|
||||
# Keep a hash of jar files, keyed on relative jar path (e.g. "packages/core.jar")
|
||||
# Entries are open Archive::Zips (if zipping), and installed-chrome entries.
|
||||
|
||||
my($jar_id) = ""; # Current foo/bar.jar from jar.mn file
|
||||
my($jar_file) = ""; # relative path to jar file (from $dest_path), with mac separators
|
||||
my($full_jar_path);
|
||||
|
||||
open(FILE, "<$jar_man_path") || die "Error: could not open \"$jar_man_path\": $!";
|
||||
while (<FILE>)
|
||||
{
|
||||
my($line) = $_;
|
||||
chomp($line);
|
||||
|
||||
# print "$line\n";
|
||||
|
||||
if ($line =~ /^\s*\#.*$/) { # skip comments
|
||||
next;
|
||||
}
|
||||
|
||||
if ($line =~/^([\w\d.\-\_\\\/]+)\:\s*$/) # line start jar file entries
|
||||
{
|
||||
$jar_id = $1;
|
||||
$jar_file = $jar_id;
|
||||
$jar_file =~ s|/|:|g; # slash to colons
|
||||
$full_jar_path = $dest_path.":".$jar_file;
|
||||
|
||||
setupJarFile($jar_id, $dest_path, $jars);
|
||||
|
||||
}
|
||||
elsif ($line =~ /^(\+?)\s+([\w\d.\-\_\\\/]+)\s*(\([\w\d.\-\_\\\/]+\))?$\s*/) # jar file entry
|
||||
{
|
||||
my($override) = ($1 eq "+");
|
||||
my($file_dest) = $2;
|
||||
my($file_src) = $3;
|
||||
|
||||
if ($file_src) {
|
||||
$file_src = substr($file_src, 1, -1); #strip the ()
|
||||
} else {
|
||||
$file_src = $file_dest;
|
||||
}
|
||||
|
||||
$file_src =~ s|/|:|g;
|
||||
|
||||
if ($jar_file ne "") # if jar is open, add to jar
|
||||
{
|
||||
if ($file_dest =~ /([\w\d.\-\_]+)\/([\w\d.\-\_\\\/]+)contents.rdf/)
|
||||
{
|
||||
my $chrome_type = $1;
|
||||
my $pkg_name = $2;
|
||||
registerChromePackage($jar_file, $file_dest, $dest_path, $jars, $chrome_type, $pkg_name);
|
||||
}
|
||||
|
||||
addToJarFile($jar_id, $jar_man_dir, $file_src, $full_jar_path, $file_dest, $override, $jars);
|
||||
}
|
||||
else
|
||||
{
|
||||
die "Error: bad jar.mn format at $line\n";
|
||||
}
|
||||
}
|
||||
elsif ($line =~ /^\s*$/ ) # blank line
|
||||
{
|
||||
if ($jar_file ne "") #if a jar file is open, close it
|
||||
{
|
||||
closeJarFile($full_jar_path, $jars);
|
||||
|
||||
$jar_file = "";
|
||||
$full_jar_path = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
close(FILE);
|
||||
|
||||
if ($jar_file ne "") #if a jar file is open, close it
|
||||
{
|
||||
closeJarFile($full_jar_path, $jars);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -1,228 +0,0 @@
|
||||
#!perl -w
|
||||
package Moz::MacCVS;
|
||||
|
||||
# package Mac::Apps::MacCVS; this should really be the name of the package
|
||||
# but due to our directory hierarchy in mozilla, I am not doing it
|
||||
|
||||
require 5.004;
|
||||
require Exporter;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
|
||||
use vars qw($VERSION @ISA @EXPORT);
|
||||
|
||||
use Cwd;
|
||||
|
||||
use File::Basename;
|
||||
|
||||
use Mac::StandardFile;
|
||||
use Mac::AppleEvents;
|
||||
use Mac::AppleEvents::Simple;
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(new describe checkout update);
|
||||
$VERSION = "1.00";
|
||||
|
||||
# If you want to understand the gobbldeygook that's used to build Apple Events,
|
||||
# you should start by reading the AEGizmos documentation.
|
||||
|
||||
|
||||
# Architecture:
|
||||
# cvs session object:
|
||||
# name - session name
|
||||
# session_file - session file
|
||||
#
|
||||
#
|
||||
|
||||
my($last_error) = 0;
|
||||
my($gAppSig) = 'Mcvs'; # MacCVS Pro
|
||||
|
||||
#
|
||||
# utility routines
|
||||
#
|
||||
|
||||
|
||||
sub _checkForEventError($)
|
||||
{
|
||||
my($evt) = @_;
|
||||
|
||||
if ($evt->{ERRNO} != 0)
|
||||
{
|
||||
print STDERR "Error. Script returned '$evt->{ERROR} (error $evt->{ERRNO})\n";
|
||||
$last_error = $evt->{ERRNO};
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1; # success
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Session object methods
|
||||
#
|
||||
|
||||
sub new
|
||||
{
|
||||
my ( $proto, $session_file) = @_;
|
||||
my $class = ref($proto) || $proto;
|
||||
my $self = {};
|
||||
|
||||
if ( defined($session_file) && ( -e $session_file) )
|
||||
{
|
||||
$self->{"name"} = basename( $session_file );
|
||||
$self->{"session_file"} = $session_file;
|
||||
bless $self, $class;
|
||||
return $self;
|
||||
}
|
||||
else
|
||||
{
|
||||
print STDERR "MacCVS->new cvs file < $session_file > does not exist\n";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
# makes sure that the session is open
|
||||
# assertSessionOpen()
|
||||
# returns 1 on success
|
||||
sub assertSessionOpen()
|
||||
{
|
||||
my ($self) = shift;
|
||||
|
||||
$last_error = 0;
|
||||
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(alis), seld:TEXT(@), from:'null'()}";
|
||||
|
||||
my($evt) = do_event(qw/aevt odoc/, $gAppSig, $prm, $self->{session_file});
|
||||
return _checkForEventError($evt);
|
||||
}
|
||||
|
||||
# prints the cvs object, used mostly for debugging
|
||||
sub describe
|
||||
{
|
||||
my($self) = shift;
|
||||
$last_error = 0;
|
||||
print "MacCVS:: name: ", $self->{name}, " session file: ", $self->{session_file}, "\n";
|
||||
}
|
||||
|
||||
# checkout( self, module, revision, date)
|
||||
# MacCVS checkout command
|
||||
# returns 1 on success.
|
||||
sub checkout()
|
||||
{
|
||||
my($self, $module, $revision, $date ) = @_;
|
||||
unless( defined ($module) ) { $module = ""; } # get rid of the pesky undefined warnings
|
||||
unless( defined ($revision) ) { $revision = ""; }
|
||||
unless( defined ($date) ) { $date = ""; }
|
||||
|
||||
$last_error = 0;
|
||||
|
||||
$self->assertSessionOpen() || die "Error: failed to open MacCVS session file at $self->{session_file}\n";
|
||||
|
||||
my($revstring) = ($revision ne "") ? $revision : "(none)";
|
||||
my($datestring) = ($date ne "") ? $date : "(none)";
|
||||
|
||||
print "Checking out $module with revision $revstring, date $datestring\n";
|
||||
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(docu), seld:TEXT(@), from:'null'()}, ".
|
||||
q"modl:'TEXT'(@), tagr:'TEXT'(@), tagd:'TEXT'(@) ";
|
||||
|
||||
my($evt) = do_event(qw/MCvs cout/, $gAppSig, $prm, $self->{name}, $module, $revision, $date);
|
||||
return _checkForEventError($evt);
|
||||
}
|
||||
|
||||
|
||||
# update( self, branch tag, list of paths)
|
||||
# MacCVS udate command
|
||||
# returns 1 on success.
|
||||
# NOTE: MacCVS Pro does not correctly support this stuff yet (as of version 2.7d5).
|
||||
sub update()
|
||||
{
|
||||
my($self, $branch, $paths ) = @_;
|
||||
|
||||
$last_error = 0;
|
||||
|
||||
$self->assertSessionOpen() || die "Error: failed to open MacCVS session file at $self->{session_file}\n";
|
||||
|
||||
if ($branch eq "HEAD") {
|
||||
$branch = "";
|
||||
}
|
||||
|
||||
my($paths_list) = "";
|
||||
|
||||
my($path);
|
||||
foreach $path (@$paths)
|
||||
{
|
||||
if ($paths_list ne "") {
|
||||
$paths_list = $paths_list.", ";
|
||||
}
|
||||
|
||||
$paths_list = $paths_list."Ò".$path."Ó";
|
||||
}
|
||||
|
||||
my($prm) =
|
||||
q"'----':obj {form:name, want:type(docu), seld:TEXT(@), from:'null'()}, ".
|
||||
q"tagr:'TEXT'(@), tFls:[";
|
||||
|
||||
$prm = $prm.$paths_list."]";
|
||||
|
||||
my($evt) = do_event(qw/MCvs updt/, $gAppSig, $prm, $self->{name}, $branch);
|
||||
return _checkForEventError($evt);
|
||||
};
|
||||
|
||||
|
||||
sub getLastError()
|
||||
{
|
||||
return $last_error;
|
||||
}
|
||||
|
||||
1;
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
MacCVS - Interface to MacCVS
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use MacCVS;
|
||||
$session = MacCVS->new( <session_file_path>) || die "cannot create session";
|
||||
$session->checkout([module] [revision] [date]) || die "Could not check out";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This is a MacCVS interface for talking to MacCVS Pro client.
|
||||
MacCVSSession is the class used to manipulate the session
|
||||
|
||||
=item new
|
||||
MacCVS->new( <cvs session file path>);
|
||||
|
||||
Creates a new session. Returns undef on failure.
|
||||
|
||||
=item checkout( <module> [revision] [date] )
|
||||
|
||||
cvs checkout command. Revision and date are optional
|
||||
returns 0 on failure
|
||||
|
||||
=cut
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
=over
|
||||
|
||||
=item MacCVS Home Page
|
||||
|
||||
http://www.maccvs.org/
|
||||
|
||||
=back
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Aleks Totic atotic@netscape.com
|
||||
Simon Fraser sfraser@netscape.com
|
||||
|
||||
=cut
|
||||
|
||||
__END__
|
||||
@@ -1,603 +0,0 @@
|
||||
=head1 NAME
|
||||
|
||||
B<Moz> - routines for automating CodeWarrior builds, and some extra-curricular
|
||||
activities related to building Mozilla
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use Moz;
|
||||
|
||||
OpenErrorLog(":::BuildLog");
|
||||
StopForErrors();
|
||||
|
||||
$Moz::QUIET = 1;
|
||||
InstallFromManifest(":projects:MANIFEST", $dist_dir);
|
||||
|
||||
BuildProjectClean(":projects:SomeProject.mcp", "SomeTarget");
|
||||
MakeAlias(":projects:SomeProject.shlb", $dist_dir);
|
||||
|
||||
DontStopForErrors();
|
||||
|
||||
BuildProject(":projects:SomeOtherProject.mcp", "SomeTarget");
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
B<Moz> comprises the routines needed to slap CodeWarrior around, force it
|
||||
to build a sequence of projects, report the results, and a few other things.
|
||||
This module should only contain functions that are generic to any build,
|
||||
not just the Mozilla build.
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
package Moz::Moz;
|
||||
require Exporter;
|
||||
|
||||
use Cwd;
|
||||
|
||||
use File::Copy;
|
||||
use File::Path;
|
||||
use File::Basename;
|
||||
|
||||
use Mac::Types;
|
||||
use Mac::Events;
|
||||
use Mac::Processes;
|
||||
|
||||
use ExtUtils::Manifest 'maniread';
|
||||
|
||||
use Moz::CodeWarriorLib;
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
|
||||
@EXPORT = qw( LaunchCodeWarrior
|
||||
GetCodeWarriorRelativePath
|
||||
current_directory
|
||||
full_path_to
|
||||
DoBuildProject
|
||||
ImportXMLProject
|
||||
ExportProjectToXML
|
||||
OpenErrorLog
|
||||
MakeAlias
|
||||
GetFileModDate
|
||||
StopForErrors
|
||||
DontStopForErrors
|
||||
InstallFromManifest
|
||||
InstallResources
|
||||
RedirectOutputToFile
|
||||
Delay
|
||||
ActivateApplication
|
||||
IsProcessRunning);
|
||||
|
||||
@EXPORT_OK = qw(CloseErrorLog QUIET);
|
||||
|
||||
|
||||
sub current_directory()
|
||||
{
|
||||
my $current_directory = cwd();
|
||||
chop($current_directory) if ( $current_directory =~ m/:$/ );
|
||||
return $current_directory;
|
||||
}
|
||||
|
||||
sub full_path_to($)
|
||||
{
|
||||
my ($path) = @_;
|
||||
if ( $path =~ m/^[^:]+$/ )
|
||||
{
|
||||
$path = ":" . $path;
|
||||
}
|
||||
|
||||
if ( $path =~ m/^:/ )
|
||||
{
|
||||
$path = current_directory() . $path;
|
||||
}
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
$logging = 0;
|
||||
$recent_errors_file = "";
|
||||
$stop_on_1st_error = 1;
|
||||
$QUIET = 0;
|
||||
|
||||
|
||||
|
||||
=head2 Logging all the errors and warnings - C<OpenErrorLog($log_file)>, C<CloseErrorLog()>
|
||||
|
||||
The warnings and errors generated in the course of building projects can be logged to a file.
|
||||
Tinderbox uses this facility to show why a remote build failed.
|
||||
|
||||
Logging is off by default.
|
||||
Start logging at any point in your build process with C<OpenErrorLog($log_file)>.
|
||||
Stop with C<CloseErrorLog()>.
|
||||
You never need to close the log explicitly, unless you want to just log a couple of projects in the middle of a big list.
|
||||
C<CloseErrorLog()> is not exported by default.
|
||||
|
||||
=cut
|
||||
|
||||
sub CloseErrorLog()
|
||||
{
|
||||
if ( $logging )
|
||||
{
|
||||
close(ERROR_LOG);
|
||||
$logging = 0;
|
||||
StopForErrors() if $stop_on_1st_error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub OpenErrorLog($)
|
||||
{
|
||||
my ($log_file) = @_;
|
||||
|
||||
CloseErrorLog();
|
||||
if ( $log_file )
|
||||
{
|
||||
$log_file = full_path_to($log_file);
|
||||
|
||||
open(ERROR_LOG, ">$log_file") || die "Error: Can't open $log_file\n";
|
||||
MacPerl::SetFileInfo("CWIE", "TEXT", $log_file);
|
||||
|
||||
$log_file =~ m/.+:(.+)/;
|
||||
$recent_errors_file = full_path_to("$1.part");
|
||||
$logging = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
=head2 Stopping before it's too late - C<StopForErrors()>, C<DontStopForErrors()>
|
||||
|
||||
When building a long list of projects, you decide whether to continue building subsequent projects when one fails.
|
||||
By default, your build script will C<die> after the first project that generates an error while building.
|
||||
Change this behavior with C<DontStopForErrors()>.
|
||||
Re-enable it with C<StopForErrors()>.
|
||||
|
||||
=cut
|
||||
|
||||
sub StopForErrors()
|
||||
{
|
||||
$stop_on_1st_error = 1;
|
||||
|
||||
# Can't stop for errors unless we notice them.
|
||||
# Can't notice them unless we are logging.
|
||||
# If the user didn't explicitly request logging, log to a temporary file.
|
||||
|
||||
if ( ! $recent_errors_file )
|
||||
{
|
||||
OpenErrorLog("${TMPDIR}BuildResults");
|
||||
}
|
||||
}
|
||||
|
||||
sub DontStopForErrors()
|
||||
{
|
||||
$stop_on_1st_error = 0;
|
||||
}
|
||||
|
||||
sub log_message($)
|
||||
{
|
||||
if ( $logging )
|
||||
{
|
||||
my ($message) = @_;
|
||||
print ERROR_LOG $message;
|
||||
}
|
||||
}
|
||||
|
||||
sub log_message_with_time($)
|
||||
{
|
||||
if ( $logging )
|
||||
{
|
||||
my ($message) = @_;
|
||||
my $time_stamp = localtime();
|
||||
log_message("$message ($time_stamp)\n");
|
||||
}
|
||||
}
|
||||
|
||||
sub log_recent_errors($)
|
||||
{
|
||||
my ($project_name) = @_;
|
||||
my $found_errors = 0;
|
||||
|
||||
if ( $logging )
|
||||
{
|
||||
open(RECENT_ERRORS, "<$recent_errors_file");
|
||||
|
||||
while( <RECENT_ERRORS> )
|
||||
{
|
||||
if ( /^Error/ || /^CouldnÕt find project file/ || /^Link Error/ )
|
||||
{
|
||||
# if (!$found_errors)
|
||||
# print $_;
|
||||
$found_errors = 1;
|
||||
}
|
||||
print ERROR_LOG $_;
|
||||
}
|
||||
|
||||
close(RECENT_ERRORS);
|
||||
unlink("$recent_errors_file");
|
||||
}
|
||||
|
||||
if ( $stop_on_1st_error && $found_errors )
|
||||
{
|
||||
print ERROR_LOG "### Build failed.\n";
|
||||
die "### Errors encountered building \"$project_name\".\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub DoBuildProject($$$)
|
||||
{
|
||||
my ($project_path, $target_name, $clean_build) = @_;
|
||||
$project_path = full_path_to($project_path);
|
||||
|
||||
# $project_path =~ m/.+:(.+)/;
|
||||
# my $project_name = $1;
|
||||
|
||||
log_message_with_time("### Building \"$project_path\"");
|
||||
|
||||
# Check that the given project exists
|
||||
if (! -e $project_path)
|
||||
{
|
||||
print ERROR_LOG "### Build failed.\n";
|
||||
die "### Can't find project file \"$project_path\".\n";
|
||||
}
|
||||
|
||||
print "Building \"$project_path\[$target_name\]\"\n";
|
||||
|
||||
$had_errors = Moz::CodeWarriorLib::build_project(
|
||||
$project_path, $target_name, $recent_errors_file, $clean_build
|
||||
);
|
||||
WaitNextEvent();
|
||||
|
||||
# $had_errors =
|
||||
#MacPerl::DoAppleScript(<<END_OF_APPLESCRIPT);
|
||||
# tell (load script file "$CodeWarriorLib") to BuildProject("$project_path", "$project_name", "$target_name", "$recent_errors_file", $clean_build)
|
||||
#END_OF_APPLESCRIPT
|
||||
|
||||
# Append any errors to the globally accumulated log file
|
||||
# if ( $had_errors ) # Removed this test, because we want warnings, too. -- jrm
|
||||
{
|
||||
log_recent_errors($project_path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub ImportXMLProject($$)
|
||||
{
|
||||
my ($xml_path, $project_path) = @_;
|
||||
|
||||
# my ($codewarrior_ide_name) = Moz::CodeWarriorLib::getCodeWarriorIDEName();
|
||||
# my $ascript = <<EOS;
|
||||
# tell application "$codewarrior_ide_name"
|
||||
# make new (project document) as ("$project_path") with data ("$xml_path")
|
||||
# end tell
|
||||
#EOS
|
||||
# print $ascript."\n";
|
||||
# my($result) = MacPerl::DoAppleScript($ascript);
|
||||
# unless ($result) { die "Error: ImportXMLProject AppleScript failed $^E $result\n"; }
|
||||
#
|
||||
|
||||
my($import_error) = Moz::CodeWarriorLib::import_project($xml_path, $project_path);
|
||||
if ($import_error ne "") {
|
||||
die "Error: ImportXMLProject failed with error $import_error\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub ExportProjectToXML($$)
|
||||
{
|
||||
my ($project_path, $xml_path) = @_;
|
||||
|
||||
my (@suffix_list) = (".mcp");
|
||||
my ($project_name, $project_dir, $suffix) = fileparse($project_path, @suffix_list);
|
||||
if ($suffix eq "") { die "Project: $project_path doesn't look like a project file.\n"; }
|
||||
|
||||
if (-e $xml_path) {
|
||||
print "$xml_path exists - not exporting $project_path\n";
|
||||
}
|
||||
else {
|
||||
print "Exporting $project_path to $xml_path\n";
|
||||
my($export_error) = Moz::CodeWarriorLib::export_project($project_path, $xml_path);
|
||||
if ($export_error ne "") {
|
||||
die "Error: export_project failed with error '$export_error'\n";
|
||||
}
|
||||
|
||||
if (! -e $xml_path) {
|
||||
die "Error: XML export to $xml_path failed\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
=head2 Miscellaneous
|
||||
|
||||
C<MakeAlias($old_file, $new_file)> functions like C<symlink()>, except with better argument defaulting and more explicit error messages.
|
||||
|
||||
=cut
|
||||
|
||||
sub MakeAlias($$)
|
||||
{
|
||||
my ($old_file, $new_file) = @_;
|
||||
|
||||
# if the directory to hold $new_file doesn't exist, create it
|
||||
if ( ($new_file =~ m/(.+:)/) && !-d $1 )
|
||||
{
|
||||
mkpath($1);
|
||||
}
|
||||
|
||||
# if a leaf name wasn't specified for $new_file, use the leaf from $old_file
|
||||
if ( ($new_file =~ m/:$/) && ($old_file =~ m/.+:(.+)/) )
|
||||
{
|
||||
$new_file .= $1;
|
||||
}
|
||||
|
||||
my $message = "Can't create a Finder alias (at \"$new_file\")\n for \"$old_file\"; because ";
|
||||
|
||||
die "Error: $message \"$old_file\" doesn't exist.\n" unless -e $old_file;
|
||||
die "Error: $message I won't replace an existing (non-alias) file with an alias.\n" if ( -e $new_file && ! -l $new_file );
|
||||
|
||||
# now: $old_file exists; $new_file doesn't (or else, is an alias already)
|
||||
|
||||
if ( -l $new_file )
|
||||
{
|
||||
# ...then see if it already points to $old_file
|
||||
my $current_target = full_path_to(readlink($new_file));
|
||||
my $new_target = full_path_to($old_file);
|
||||
|
||||
return if ( $current_target eq $new_target );
|
||||
# if the desired alias already exists and points to the right thing, then we're done
|
||||
|
||||
unlink $new_file;
|
||||
}
|
||||
|
||||
symlink($old_file, $new_file) || die "Error: $message symlink returned an unexpected error.\n";
|
||||
}
|
||||
|
||||
|
||||
=pod
|
||||
|
||||
C<InstallFromManifest()>
|
||||
|
||||
=cut
|
||||
|
||||
sub InstallFromManifest($;$$)
|
||||
{
|
||||
my ($manifest_file, $dest_dir, $flat) = @_;
|
||||
|
||||
$flat = 0 unless defined($flat); # if $flat, all rel. paths in MANIFEST get aliased to the root of $dest_dir
|
||||
|
||||
$dest_dir ||= ":";
|
||||
|
||||
$manifest_file =~ m/(.+):/;
|
||||
my $source_dir = $1;
|
||||
|
||||
chop($dest_dir) if $dest_dir =~ m/:$/;
|
||||
|
||||
#Mac::Events->import();
|
||||
WaitNextEvent();
|
||||
if ($flat)
|
||||
{
|
||||
print "Doing manifest on \"$manifest_file\" FLAT\n" unless $QUIET;
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Doing manifest on \"$manifest_file\"\n" unless $QUIET;
|
||||
}
|
||||
|
||||
my $read = maniread(full_path_to($manifest_file));
|
||||
foreach $file (keys %$read)
|
||||
{
|
||||
next unless $file;
|
||||
|
||||
$subdir = ":";
|
||||
if (!$flat && ($file =~ /:.+:/ ))
|
||||
{
|
||||
$subdir = $&;
|
||||
}
|
||||
|
||||
$file = ":$file" unless $file =~ m/^:/;
|
||||
MakeAlias("$source_dir$file", "$dest_dir$subdir");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
=pod
|
||||
|
||||
C<InstallResources()>
|
||||
|
||||
=cut
|
||||
|
||||
# parameters are path to MANIFEST file, destination dir, true (to make copies) or false (to make aliases)
|
||||
sub InstallResources($;$;$)
|
||||
{
|
||||
my ($manifest_file, $dest_dir, $copy_files) = @_;
|
||||
|
||||
$dest_dir ||= ":";
|
||||
mkpath($dest_dir) if !-d $dest_dir;
|
||||
|
||||
$manifest_file =~ m/(.+):/;
|
||||
my $source_dir = $1;
|
||||
|
||||
chop($dest_dir) if $dest_dir =~ m/:$/;
|
||||
|
||||
WaitNextEvent();
|
||||
print "Installing resources from \"$manifest_file\"\n" unless $QUIET;
|
||||
|
||||
my $read = maniread(full_path_to($manifest_file));
|
||||
foreach $file (keys %$read)
|
||||
{
|
||||
next unless $file;
|
||||
|
||||
if ($copy_files)
|
||||
{
|
||||
copy("$source_dir:$file", "$dest_dir:$file");
|
||||
}
|
||||
else
|
||||
{
|
||||
MakeAlias("$source_dir:$file", "$dest_dir:$file");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// Delay
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub Delay($)
|
||||
{
|
||||
my ($delay_seconds) = @_;
|
||||
|
||||
$now = time;
|
||||
|
||||
$exit_time = $now + $delay_seconds;
|
||||
|
||||
while ($exit_time > $now) {
|
||||
$now = time;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// GetFileModDate
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub GetFileModDate($)
|
||||
{
|
||||
my($filePath)=@_;
|
||||
my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
|
||||
$atime,$mtime,$ctime,$blksize,$blocks) = stat($filePath);
|
||||
return $mtime;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// LaunchCodeWarrior
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub LaunchCodeWarrior($)
|
||||
{
|
||||
my($idepath_file) = @_; # full path to IDE location file
|
||||
my($cur_dir) = cwd();
|
||||
|
||||
# this both launches and writes the IDE path file
|
||||
Moz::CodeWarriorLib::activate($idepath_file);
|
||||
|
||||
chdir($cur_dir);
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// GetCodeWarriorRelativePath
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub GetCodeWarriorRelativePath($)
|
||||
{
|
||||
my($rel_path) = @_;
|
||||
return Moz::CodeWarriorLib::getCodeWarriorPath($rel_path);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// RedirectOutputToFile
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub RedirectOutputToFile($)
|
||||
{
|
||||
my($log_file) = @_;
|
||||
|
||||
# ensure that folders in the path exist
|
||||
my($logdir) = "";
|
||||
my($logfile) = $log_file;
|
||||
|
||||
if ($log_file =~ /(.+?:)([^:]+)$/) # ? for non-greedy match
|
||||
{
|
||||
$logdir = $1;
|
||||
$logfile = $2;
|
||||
|
||||
mkpath($logdir);
|
||||
}
|
||||
|
||||
print "Output is now being redirected to the file '$log_file'\n";
|
||||
|
||||
open(STDOUT, "> $log_file") || die "Can't redirect stdout";
|
||||
open(STDERR, ">&STDOUT") || die "Can't dup stdout";
|
||||
select(STDERR); $| = 1; # make unbuffered
|
||||
select(STDOUT); $| = 1; # make unbuffered
|
||||
|
||||
MacPerl::SetFileInfo("CWIE", "TEXT", $log_file);
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// ActivateApplication
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub ActivateApplication($)
|
||||
{
|
||||
my ($appSignature) = @_;
|
||||
my ($psi, $found);
|
||||
my ($appPSN);
|
||||
|
||||
$found = 0;
|
||||
|
||||
foreach $psi (values(%Process))
|
||||
{
|
||||
if ($psi->processSignature() eq $appSignature)
|
||||
{
|
||||
$appPSN = $psi->processNumber();
|
||||
$found = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
if ($found == 0 || SameProcess($appPSN, GetFrontProcess()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SetFrontProcess($appPSN);
|
||||
|
||||
while (GetFrontProcess() != $appPSN)
|
||||
{
|
||||
WaitNextEvent();
|
||||
}
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// IsProcessRunning
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub IsProcessRunning($)
|
||||
{
|
||||
my($processName, $psn, $psi) = @_;
|
||||
while ( ($psn, $psi) = each(%Process) ) {
|
||||
if ($psi->processName eq $processName) { return 1; }
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Scott Collins <scc@netscape.com>, Simon Fraser <sfraser@netscape.com>, Chris Yeh <cyeh@netscape.com>
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
BuildMozillaDebug.pl (et al), BuildList.pm, CodeWarriorLib (an AppleScript library)
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
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, released
|
||||
March 31, 1998.
|
||||
|
||||
The Initial Developer of the Original Code is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
||||
=cut
|
||||
@@ -1,272 +0,0 @@
|
||||
|
||||
package Moz::Prefs;
|
||||
|
||||
require 5.004;
|
||||
require Exporter;
|
||||
|
||||
# Package that attempts to read a file from the Preferences folder,
|
||||
# and get build settings out of it
|
||||
|
||||
use strict;
|
||||
|
||||
use Exporter;
|
||||
use File::Path;
|
||||
|
||||
use Mac::Files;
|
||||
|
||||
use vars qw(@ISA @EXPORT);
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(ReadMozUserPrefs);
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# GetPrefsFolder
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub GetPrefsFolder()
|
||||
{
|
||||
my($prefs_folder) = FindFolder(kOnSystemDisk, kPreferencesFolderType, 1);
|
||||
return $prefs_folder.":Mozilla build prefs";
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# SetArrayValue
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
sub SetArrayValue($$$)
|
||||
{
|
||||
my($array_ref, $index1, $index2) = @_;
|
||||
|
||||
my($index);
|
||||
foreach $index (@$array_ref)
|
||||
{
|
||||
if ($index->[0] eq $index1)
|
||||
{
|
||||
$index->[1] = $index2;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# WriteDefaultPrefsFile
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub WriteDefaultPrefsFile($)
|
||||
{
|
||||
my($file_path) = @_;
|
||||
|
||||
my($file_contents);
|
||||
$file_contents = <<'EOS';
|
||||
% You can use this file to customize the Mozilla build system.
|
||||
% The following kinds of lines are allowable:
|
||||
% Comment lines, which start with a '%' in the first column
|
||||
% Lines which modify the default build settings. For the list of flags,
|
||||
% see MozBuildFlags.pm. Examples are:
|
||||
%
|
||||
% build pull 0 % don't pull
|
||||
% options mng 1 % turn mng on
|
||||
%
|
||||
% Line containing the special 'buildfrom' flag, which specifies
|
||||
% where to start the build. Example:
|
||||
%
|
||||
% buildfrom nglayout % where to start the build
|
||||
%
|
||||
% Lines which specify the location of the files used to store paths
|
||||
% to the CodeWarrior IDE, and the MacCVS Pro session file. Note quoting
|
||||
% of paths containing whitespace. Examples:
|
||||
%
|
||||
% filepath idepath ::codewarrior.txt
|
||||
% filepath sessionpath ":Some folder:MacCVS session path.txt"
|
||||
%
|
||||
% Lines which modify the build settings like %main::DEBUG.
|
||||
% Any lines which do not match either of the above are assumed
|
||||
% to set variables on $main::. Examples:
|
||||
%
|
||||
% MOZILLA_OFFICIAL 1
|
||||
%
|
||||
EOS
|
||||
|
||||
$file_contents =~ s/%/#/g;
|
||||
|
||||
local(*PREFS_FILE);
|
||||
|
||||
open(PREFS_FILE, "> $file_path") || die "Could not write default prefs file\n";
|
||||
print PREFS_FILE ($file_contents);
|
||||
close(PREFS_FILE);
|
||||
|
||||
MacPerl::SetFileInfo("McPL", "TEXT", $file_path);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# HandlePrefSet
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
sub HandlePrefSet($$$$)
|
||||
{
|
||||
my($flags, $name, $value, $desc) = @_;
|
||||
|
||||
if (SetArrayValue($flags, $name, $value)) {
|
||||
print "Prefs set $desc flag '$name' to '$value'\n";
|
||||
} else {
|
||||
die "$desc setting '$name' is not a valid option\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# HandleBuildFromPref
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
sub HandleBuildFromPref($$)
|
||||
{
|
||||
my($build_array, $name) = @_;
|
||||
|
||||
my($setting) = 0;
|
||||
my($index);
|
||||
foreach $index (@$build_array)
|
||||
{
|
||||
if ($index->[0] eq $name) {
|
||||
$setting = 1;
|
||||
}
|
||||
|
||||
$index->[1] = $setting;
|
||||
}
|
||||
|
||||
if ($setting == 1) {
|
||||
print "Building from $name onwards, as specified by prefs\n";
|
||||
} else {
|
||||
printf "Failed to find buildfrom setting '$name'\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# ReadPrefsFile
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub ReadPrefsFile($$$$$)
|
||||
{
|
||||
my($file_path, $build_flags, $options_flags, $filepath_flags, $create_if_missing) = @_;
|
||||
|
||||
local(*PREFS_FILE);
|
||||
|
||||
if (open(PREFS_FILE, "< $file_path"))
|
||||
{
|
||||
print "Reading build prefs from '$file_path'\n";
|
||||
|
||||
while (<PREFS_FILE>)
|
||||
{
|
||||
my($line) = $_;
|
||||
chomp($line);
|
||||
|
||||
if ($line =~ /^\#/ || $line =~ /^\s*$/) { # ignore comments and empty lines
|
||||
next;
|
||||
}
|
||||
|
||||
if (($line =~ /^\s*([^#\s]+)\s+([^#\s]+)\s+\"(.+)\"(\s+#.+)?/) ||
|
||||
($line =~ /^\s*([^#\s]+)\s+([^#\s]+)\s+\'(.+)\'(\s+#.+)?/) ||
|
||||
($line =~ /^\s*([^#\s]+)\s+([^#\s]+)\s+([^#\s]+)(\s+#.+)?/))
|
||||
{
|
||||
my($array_name) = $1;
|
||||
my($option_name) = $2;
|
||||
my($option_value) = $3;
|
||||
|
||||
# print "Read '$array_name' '$option_name' '$option_value'\n";
|
||||
|
||||
if ($array_name eq "build")
|
||||
{
|
||||
HandlePrefSet($build_flags, $option_name, $option_value, "Build");
|
||||
}
|
||||
elsif ($array_name eq "options")
|
||||
{
|
||||
HandlePrefSet($options_flags, $option_name, $option_value, "Options");
|
||||
}
|
||||
elsif ($array_name eq "filepath" && $option_name && $option_value)
|
||||
{
|
||||
HandlePrefSet($filepath_flags, $option_name, $option_value, "Filepath");
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Unknown pref option at $line\n";
|
||||
}
|
||||
}
|
||||
elsif ($line =~ /^\s*buildfrom\s+([^#\s]+)(\s+#.+)?/)
|
||||
{
|
||||
my($build_start) = $1;
|
||||
HandleBuildFromPref($build_flags, $build_start);
|
||||
}
|
||||
elsif ($line =~ /^\s*([^#\s]+)\s+([^#\s]+)(\s+#.+)?/)
|
||||
{
|
||||
my($build_var) = $1;
|
||||
my($var_setting) = $2;
|
||||
|
||||
print "Setting \$main::$build_var to $var_setting\n";
|
||||
eval "\$main::$build_var = \"$var_setting\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Unrecognized input line at $line\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
close(PREFS_FILE);
|
||||
}
|
||||
elsif ($create_if_missing)
|
||||
{
|
||||
print "No prefs file found at $file_path; using defaults\n";
|
||||
|
||||
my($folder_path) = $file_path;
|
||||
$folder_path =~ s/[^:]+$//;
|
||||
mkpath($folder_path);
|
||||
WriteDefaultPrefsFile($file_path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
# ReadMozUserPrefs
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub ReadMozUserPrefs($$$$)
|
||||
{
|
||||
my($prefs_file_name, $build_flags, $options_flags, $filepath_flags) = @_;
|
||||
|
||||
if ($prefs_file_name eq "") { return; }
|
||||
|
||||
# if local prefs exist, just use those. Othewise, look in the prefs folder
|
||||
if (-e $prefs_file_name)
|
||||
{
|
||||
# read local prefs
|
||||
ReadPrefsFile($prefs_file_name, $build_flags, $options_flags, $filepath_flags, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
# first read prefs folder prefs
|
||||
my($prefs_path) = GetPrefsFolder();
|
||||
$prefs_path .= ":$prefs_file_name";
|
||||
|
||||
ReadPrefsFile($prefs_path, $build_flags, $options_flags, $filepath_flags, 1);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -1,932 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
#
|
||||
# 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):
|
||||
# Simon Fraser <sfraser@netscape.com>
|
||||
#
|
||||
|
||||
package Moz::ProjectXML;
|
||||
|
||||
require 5.004;
|
||||
require Exporter;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
|
||||
use Cwd;
|
||||
use XML::DOM;
|
||||
|
||||
use vars qw(@ISA @EXPORT);
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(
|
||||
ParseXMLDocument
|
||||
DisposeXMLDocument
|
||||
WriteXMLDocument
|
||||
CleanupPro5XML
|
||||
GetTargetsList
|
||||
CloneTarget
|
||||
SetAsSharedLibraryTarget
|
||||
SetAsStaticLibraryTarget
|
||||
AddTarget
|
||||
RemoveTarget
|
||||
GetTargetSetting
|
||||
SetTargetSetting
|
||||
getChildElementTextContents
|
||||
);
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
# A module for reading, manipulating, and writing XML-format CodeWarrior project files.
|
||||
#
|
||||
# Sample usage:
|
||||
#
|
||||
# use ProjectXML;
|
||||
#
|
||||
# my $doc = ProjectXML::ParseXMLDocument("Test.mcp.xml");
|
||||
# ProjectXML::CloneTarget($doc, "Test.shlb", "Test.lib");
|
||||
# ProjectXML::SetAsStaticLibraryTarget($doc, "Test.lib", "TestOutput.lib");
|
||||
# ProjectXML::WriteXMLDocument($doc, "Test_out.xml");
|
||||
# ProjectXML::DisposeXMLDocument($doc);
|
||||
#
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// ParseXMLDocument
|
||||
#// Note that the caller must call DisposeXMLDocument on the returned doc
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub ParseXMLDocument($)
|
||||
{
|
||||
my($doc_path) = @_;
|
||||
|
||||
my $parser = new XML::DOM::Parser(ErrorContext => 2);
|
||||
my $doc = $parser->parsefile($doc_path);
|
||||
|
||||
return $doc;
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// DisposeXMLDocument
|
||||
#// Needed to avoid memory leaks - cleanup circular references for garbage collection
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub DisposeXMLDocument($)
|
||||
{
|
||||
my($doc) = @_;
|
||||
|
||||
$doc->dispose();
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// WriteXMLDocument
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
|
||||
sub _pro5_tag_compression($$)
|
||||
{
|
||||
return 1; # Pro 5 is broken and can't import XML with <foo/> style tags
|
||||
}
|
||||
|
||||
sub _pro6plus_tag_compression($$)
|
||||
{
|
||||
return 0; # Pro 6 can deal with empty XML tags like <foo/>
|
||||
}
|
||||
|
||||
sub WriteXMLDocument($$$)
|
||||
{
|
||||
my($doc, $file_path, $ide_version) = @_;
|
||||
|
||||
if ($ide_version eq "4.0")
|
||||
{
|
||||
XML::DOM::setTagCompression(\&_pro5_tag_compression);
|
||||
}
|
||||
else
|
||||
{
|
||||
XML::DOM::setTagCompression(\&_pro6plus_tag_compression);
|
||||
}
|
||||
|
||||
$doc->printToFile($file_path);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// CleanupPro5XML
|
||||
#// XML Projects exported by Pro 5 contain garbage data under the MWMerge_MacOS_skipResources
|
||||
#// setting. This routine cleans this up, saving the result to a new file
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub CleanupPro5XML($$)
|
||||
{
|
||||
my($xml_path, $out_path) = @_;
|
||||
|
||||
local(*XML_FILE);
|
||||
open(XML_FILE, "< $xml_path") || die "Error: failed to open file $xml_path\n";
|
||||
|
||||
local(*CLEANED_FILE);
|
||||
open(CLEANED_FILE, "> $out_path") || die "Error: failed to open file $out_path for writing\n";
|
||||
|
||||
my $in_skip_resources_settings = 0;
|
||||
|
||||
while(<XML_FILE>)
|
||||
{
|
||||
my($line) = $_;
|
||||
|
||||
if ($line =~ /^<\?codewarrior/) # is processing inst line
|
||||
{
|
||||
my $test_line = $line;
|
||||
chomp($test_line);
|
||||
|
||||
my $out_line = $test_line;
|
||||
if ($test_line =~ /^<\?codewarrior\s+exportversion=\"(.+)\"\s+ideversion=\"(.+)\"\s*\?>$/)
|
||||
{
|
||||
my $export_version = $1;
|
||||
my $ide_version = $2;
|
||||
|
||||
$ide_version = "4.0_mozilla"; # pseudo IDE version so we know we touched it
|
||||
$out_line = "<?codewarrior exportversion=\"".$export_version."\" ideversion=\"".$ide_version."\"?>";
|
||||
}
|
||||
|
||||
print CLEANED_FILE "$out_line\n";
|
||||
next;
|
||||
}
|
||||
|
||||
if ($line =~ /MWMerge_MacOS_skipResources/)
|
||||
{
|
||||
$in_skip_resources_settings = 1;
|
||||
print CLEANED_FILE "$line";
|
||||
}
|
||||
elsif($in_skip_resources_settings && $line =~ /<!-- Settings for/)
|
||||
{
|
||||
# leaving bad settings lines. Write closing tag
|
||||
print CLEANED_FILE " <!-- Corrupted setting entries removed by script -->\n";
|
||||
print CLEANED_FILE " </SETTING>\n\n";
|
||||
|
||||
print CLEANED_FILE "$line";
|
||||
|
||||
$in_skip_resources_settings = 0;
|
||||
}
|
||||
elsif (!$in_skip_resources_settings)
|
||||
{
|
||||
print CLEANED_FILE "$line";
|
||||
}
|
||||
}
|
||||
|
||||
close(XML_FILE);
|
||||
close(CLEANED_FILE);
|
||||
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
# SniffProjectXMLIDEVersion
|
||||
#
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
sub SniffProjectXMLIDEVersion($)
|
||||
{
|
||||
my($xml_path) = @_;
|
||||
|
||||
my $found_version = "";
|
||||
|
||||
local(*XML_FILE);
|
||||
open(XML_FILE, "< $xml_path") || die "Error: failed to open file $xml_path\n";
|
||||
|
||||
while(<XML_FILE>)
|
||||
{
|
||||
my($line) = $_;
|
||||
chomp($line);
|
||||
|
||||
if ($line =~ /^<\?codewarrior/) # is processing inst line
|
||||
{
|
||||
unless ($line =~ /^<\?codewarrior\s+exportversion=\"(.+)\"\s+ideversion=\"(.+)\"\s*\?>$/)
|
||||
{
|
||||
die "Error: Failed to find ideversion in $xml_path in line $line\n";
|
||||
}
|
||||
|
||||
my $export_version = $1;
|
||||
my $ide_version = $2;
|
||||
|
||||
$found_version = $ide_version;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
close(XML_FILE);
|
||||
|
||||
return $found_version;
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// GetTargetsList
|
||||
#// Returns an array of target names
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub GetTargetsList($)
|
||||
{
|
||||
my($doc) = @_;
|
||||
|
||||
my $nodes = $doc->getElementsByTagName("TARGET");
|
||||
my $n = $nodes->getLength;
|
||||
|
||||
my @target_names;
|
||||
|
||||
for (my $i = 0; $i < $n; $i++)
|
||||
{
|
||||
my ($node) = $nodes->item($i);
|
||||
|
||||
my($target_name) = getChildElementTextContents($node, "NAME");
|
||||
push(@target_names, $target_name);
|
||||
}
|
||||
|
||||
return @target_names;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// CloneTarget
|
||||
#// Clone the named target, renaming it to 'new_name'
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub CloneTarget($$$)
|
||||
{
|
||||
my($doc, $target_name, $new_name) = @_;
|
||||
|
||||
my $target_node = getTargetNode($doc, $target_name);
|
||||
|
||||
# clone here
|
||||
my $target_clone = $target_node->cloneNode(1); # deep clone
|
||||
|
||||
# -- munge target settings --
|
||||
|
||||
# set the target name field
|
||||
setChildElementTextContents($doc, $target_clone, "NAME", $new_name);
|
||||
|
||||
# set the targetname pref
|
||||
setTargetNodeSetting($doc, $target_clone, "Targetname", $new_name);
|
||||
|
||||
# -- insert new target subtree --
|
||||
|
||||
my $target_list = $target_node->getParentNode();
|
||||
$target_list->appendChild($target_clone);
|
||||
|
||||
# -- now add to targetorder --
|
||||
my (@target_order_nodes) = getChildOfDocument($doc, "TARGETORDER");
|
||||
|
||||
my $target_order = @target_order_nodes[0];
|
||||
|
||||
my $new_order = $doc->createElement("ORDEREDTARGET");
|
||||
my $order_name = $doc->createElement("NAME");
|
||||
|
||||
$new_order->appendChild($order_name);
|
||||
|
||||
setChildElementTextContents($doc, $new_order, "NAME", $new_name);
|
||||
$target_order->appendChild($new_order);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// SetAsSharedLibraryTarget
|
||||
#//
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub SetAsSharedLibraryTarget($$$)
|
||||
{
|
||||
my($doc, $target_name, $output_name) = @_;
|
||||
|
||||
my $target_node = getTargetNode($doc, $target_name);
|
||||
|
||||
setTargetNodeSetting($doc, $target_node, "MWProject_PPC_type", "SharedLibrary");
|
||||
setTargetNodeSetting($doc, $target_node, "MWProject_PPC_filetype", "1936223330"); #'shlb'
|
||||
setTargetNodeSetting($doc, $target_node, "MWProject_PPC_outfile", $output_name);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// AddFileToTarget
|
||||
#//
|
||||
#// Add a file to the specified target(s).
|
||||
#//
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub AddFileToTarget($$$)
|
||||
{
|
||||
my($doc, $target_list, $file_name) = @_;
|
||||
|
||||
# the file must be added in 3 places:
|
||||
# 1. in <TARGET><FILELIST><FILE> (with linkage flags if necessary)
|
||||
# 2. in <TARGET><LINKORDER><FILEREF>
|
||||
# 3. in <GROUPLIST><GROUP><FILEREF>
|
||||
die "Write me\n";
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// RemoveFileFromTarget
|
||||
#//
|
||||
#// Remove a file from the specified target, removing it from the entire project
|
||||
#// if no other targets reference it.
|
||||
#//
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub RemoveFileFromTarget($$$)
|
||||
{
|
||||
my($doc, $target_node, $file_name) = @_;
|
||||
|
||||
# the file must be removed in 3 places:
|
||||
# 1. in <TARGET><FILELIST><FILE>
|
||||
# 2. in <TARGET><LINKORDER><FILEREF>
|
||||
# 3. in <GROUPLIST><GROUP><FILEREF>
|
||||
|
||||
# first, remove from <FILELIST>
|
||||
my $filelist_node = getFirstChildElement($target_node, "FILELIST");
|
||||
unless ($filelist_node) { die "Error: failed to find FILELIST node\n"; }
|
||||
|
||||
my $file_node = getChildNodeByGrandchildContents($doc, $filelist_node, "FILE", "PATH", $file_name);
|
||||
unless ($file_node) { return; }
|
||||
|
||||
$filelist_node->removeChild($file_node);
|
||||
|
||||
# next, remove from <LINKORDER>
|
||||
my $linkorder_node = getFirstChildElement($target_node, "LINKORDER");
|
||||
unless ($linkorder_node) { die "Error: failed to find LINKORDER node\n"; }
|
||||
|
||||
my $fileref_node = getChildNodeByGrandchildContents($doc, $linkorder_node, "FILEREF", "PATH", $file_name);
|
||||
unless ($fileref_node) { die "Error: link order node for file $file_name not found\n"; }
|
||||
|
||||
$linkorder_node->removeChild($fileref_node);
|
||||
|
||||
# last, remove from <GROUPLIST>
|
||||
# <GROUPLIST> is cross-target, so we have to be careful here.
|
||||
my $grouplist_node = getChildOfDocument($doc, "GROUPLIST");
|
||||
unless ($grouplist_node) { die "Error: failed to find GROUPLIST node\n"; }
|
||||
|
||||
# if the file isn't in any other targets, remove it from the groups
|
||||
if (!GetFileInUse($doc, $file_name))
|
||||
{
|
||||
print "File $file_name is in no other targest. Removing from project\n";
|
||||
|
||||
my @group_nodes;
|
||||
getChildElementsOfType($doc, $grouplist_node, "GROUP", \@group_nodes);
|
||||
my $group_node;
|
||||
foreach $group_node (@group_nodes)
|
||||
{
|
||||
my @fileref_nodes;
|
||||
getChildElementsOfType($doc, $group_node, "FILEREF", \@fileref_nodes);
|
||||
|
||||
my $fileref_node;
|
||||
foreach $fileref_node (@fileref_nodes)
|
||||
{
|
||||
my $path_name = getChildElementTextContents($fileref_node, "PATH");
|
||||
if ($path_name eq $file_name)
|
||||
{
|
||||
print "Removing $file_name from project group list\n";
|
||||
$group_node->removeChild($fileref_node);
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
# can a file appear in more than one group?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// SetAsStaticLibraryTarget
|
||||
#//
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub SetAsStaticLibraryTarget($$$)
|
||||
{
|
||||
my($doc, $target_name, $output_name) = @_;
|
||||
|
||||
my $target_node = getTargetNode($doc, $target_name);
|
||||
|
||||
setTargetNodeSetting($doc, $target_node, "MWProject_PPC_type", "Library");
|
||||
setTargetNodeSetting($doc, $target_node, "MWProject_PPC_filetype", "1061109567"); #'????'
|
||||
setTargetNodeSetting($doc, $target_node, "MWProject_PPC_outfile", $output_name);
|
||||
|
||||
# static targets don't need any library linkage, so we can remove linkage
|
||||
# with all .shlb and .Lib files.
|
||||
|
||||
my(@obsolete_files) = ("NSStdLibStubs", "InterfacesStubs", "InterfaceLib", "InternetConfigLib");
|
||||
|
||||
print " Removing libraries etc. from target\n";
|
||||
|
||||
# get all files in target
|
||||
my @target_files = GetTargetFilesList($doc, $target_name);
|
||||
my $target_file;
|
||||
foreach $target_file (@target_files)
|
||||
{
|
||||
if ($target_file =~ /(\.shlb|\.lib|\.Lib|\.o|\.exp)$/)
|
||||
{
|
||||
RemoveFileFromTarget($doc, $target_node, $target_file);
|
||||
}
|
||||
}
|
||||
|
||||
print " Removing stub libraries from target\n";
|
||||
|
||||
# then remove files with known names
|
||||
my $obs_file;
|
||||
foreach $obs_file (@obsolete_files)
|
||||
{
|
||||
RemoveFileFromTarget($doc, $target_node, $obs_file);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// AddTarget
|
||||
#//
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub AddTarget($$)
|
||||
{
|
||||
my($doc, $target_name) = @_;
|
||||
|
||||
die "Write me\n";
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// RemoveTarget
|
||||
#//
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub RemoveTarget($$)
|
||||
{
|
||||
my($doc, $target_name) = @_;
|
||||
|
||||
die "Write me\n";
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// GetTargetSetting
|
||||
#// Get the value for the specified setting in the specified target
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub GetTargetSetting($$$)
|
||||
{
|
||||
my($doc, $target_name, $setting_name) = @_;
|
||||
|
||||
my $target_node = getTargetNode($doc, $target_name);
|
||||
return getTargetNodeSetting($target_node, "VALUE");
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// SetTargetSetting
|
||||
#// Set the value for the specified setting in the specified target
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub SetTargetSetting($$$$)
|
||||
{
|
||||
my($doc, $target_name, $setting_name, $new_value) = @_;
|
||||
|
||||
my $target_node = getTargetNode($doc, $target_name);
|
||||
setTargetNodeSetting($doc, $target_node, "VALUE", $new_value);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// GetTargetFilesList
|
||||
#// Return an array of the files in the target (in filelist order)
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub GetTargetFilesList($$)
|
||||
{
|
||||
my($doc, $target_name) = @_;
|
||||
|
||||
my $target_node = getTargetNode($doc, $target_name);
|
||||
|
||||
my @files_list;
|
||||
|
||||
my $filelist_node = getFirstChildElement($target_node, "FILELIST");
|
||||
unless ($filelist_node) { die "Error: failed to find FILELIST node\n"; }
|
||||
|
||||
my @file_nodes;
|
||||
getChildElementsOfType($doc, $filelist_node, "FILE", \@file_nodes);
|
||||
|
||||
my $node;
|
||||
foreach $node (@file_nodes)
|
||||
{
|
||||
my $file_name = getChildElementTextContents($node, "PATH");
|
||||
push(@files_list, $file_name);
|
||||
}
|
||||
|
||||
return @files_list;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// FileIsInTarget
|
||||
#//
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub FileIsInTarget($$$)
|
||||
{
|
||||
my($doc, $file_name, $target_name) = @_;
|
||||
|
||||
my $target_node = getTargetNode($doc, $target_name);
|
||||
unless ($target_node) { die "Error: no target found called $target_name\n"; }
|
||||
|
||||
my $file_node = GetTargetFileNode($doc, $target_node, $file_name);
|
||||
if ($file_node) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// GetFileTargetsList
|
||||
#// Return an array of the targets that a file is in (expensive)
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub GetFileTargetsList($$)
|
||||
{
|
||||
my ($doc, $file_name) = @_;
|
||||
|
||||
my @target_list;
|
||||
|
||||
my @targets = GetTargetsList($doc);
|
||||
my $target;
|
||||
|
||||
foreach $target (@targets)
|
||||
{
|
||||
if (FileIsInTarget($doc, $file_name, $target))
|
||||
{
|
||||
push(@target_list, $target);
|
||||
}
|
||||
}
|
||||
|
||||
return @target_list;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// GetTargetFileNode
|
||||
#//
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub GetTargetFileNode($$$)
|
||||
{
|
||||
my($doc, $target_node, $file_name) = @_;
|
||||
|
||||
my $filelist_node = getFirstChildElement($target_node, "FILELIST");
|
||||
unless ($filelist_node) { die "Error: failed to find FILELIST node\n"; }
|
||||
|
||||
my $file_node = getChildNodeByGrandchildContents($doc, $filelist_node, "FILE", "PATH", $file_name);
|
||||
|
||||
return $file_node;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// GetFileInUse
|
||||
#// Return true if the file is used by any target
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub GetFileInUse($$)
|
||||
{
|
||||
my($doc, $file_name) = @_;
|
||||
|
||||
my $targetlist_node = getChildOfDocument($doc, "TARGETLIST");
|
||||
|
||||
my $target_node = $targetlist_node->getFirstChild();
|
||||
|
||||
while ($target_node)
|
||||
{
|
||||
if ($target_node->getNodeTypeName eq "ELEMENT_NODE" &&
|
||||
$target_node->getTagName() eq "TARGET")
|
||||
{
|
||||
# if this is a target node
|
||||
my $file_node = GetTargetFileNode($doc, $target_node, $file_name);
|
||||
if ($file_node) {
|
||||
return 1; # found it
|
||||
}
|
||||
}
|
||||
|
||||
$target_node = $target_node->getNextSibling();
|
||||
}
|
||||
|
||||
# not found
|
||||
return 0;
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// getChildOfDocument
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub getChildOfDocument($$)
|
||||
{
|
||||
my($doc, $child_type) = @_;
|
||||
|
||||
return getFirstChildElement($doc->getDocumentElement(), $child_type);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// getFirstChildElement
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub getFirstChildElement($$)
|
||||
{
|
||||
my($node, $element_name) = @_;
|
||||
|
||||
my $found_node;
|
||||
|
||||
unless ($node) { die "getFirstChildElement called with empty node\n"; }
|
||||
|
||||
#look for the first "element_name" child
|
||||
|
||||
my $child_node = $node->getFirstChild();
|
||||
|
||||
while ($child_node)
|
||||
{
|
||||
if ($child_node->getNodeTypeName eq "ELEMENT_NODE" &&
|
||||
$child_node->getTagName() eq $element_name)
|
||||
{
|
||||
$found_node = $child_node;
|
||||
last;
|
||||
}
|
||||
|
||||
$child_node = $child_node->getNextSibling();
|
||||
}
|
||||
|
||||
return $found_node;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// getChildElementsOfType
|
||||
#//
|
||||
#// Return an array of refs to child nodes of the given type
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub getChildElementsOfType($$$$)
|
||||
{
|
||||
my($doc, $node, $child_type, $array_ref) = @_;
|
||||
|
||||
my $child_node = $node->getFirstChild();
|
||||
|
||||
while ($child_node)
|
||||
{
|
||||
if ($child_node->getNodeTypeName eq "ELEMENT_NODE" &&
|
||||
$child_node->getTagName() eq $child_type)
|
||||
{
|
||||
push(@$array_ref, $child_node);
|
||||
}
|
||||
|
||||
$child_node = $child_node->getNextSibling();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// getChildElementTextContents
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#
|
||||
# Given <FOOPY><NERD>Hi!</NERD></FOOPY>, where $node is <FOOPY>,
|
||||
# returns "Hi!". If > 1 <NERD> node, returns the contents of the first.
|
||||
#
|
||||
sub getChildElementTextContents($$)
|
||||
{
|
||||
my($node, $tag_name) = @_;
|
||||
|
||||
my $first_element = getFirstChildElement($node, $tag_name);
|
||||
my $text_node = $first_element->getFirstChild();
|
||||
|
||||
my $text_contents = "";
|
||||
|
||||
# concat adjacent text nodes
|
||||
while ($text_node)
|
||||
{
|
||||
if ($text_node->getNodeTypeName() ne "TEXT_NODE")
|
||||
{
|
||||
last;
|
||||
}
|
||||
|
||||
$text_contents = $text_contents.$text_node->getData();
|
||||
$text_node = $text_node->getNextSibling();
|
||||
}
|
||||
|
||||
return $text_contents;
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// setChildElementTextContents
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub setChildElementTextContents($$$$)
|
||||
{
|
||||
my($doc, $node, $tag_name, $contents_text) = @_;
|
||||
|
||||
my $first_element = getFirstChildElement($node, $tag_name);
|
||||
my $new_text_node = $doc->createTextNode($contents_text);
|
||||
|
||||
# replace all child elements with a text element
|
||||
removeAllChildren($first_element);
|
||||
|
||||
$first_element->appendChild($new_text_node);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// getChildNodeByContents
|
||||
#//
|
||||
#// Consider <foo><bar><baz>Foopy</baz></bar><bar><baz>Loopy</baz></bar></foo>
|
||||
#// This function, when called with getChildNodeByContents($foonode, "bar", "baz", "Loopy")
|
||||
#// returns the second <bar> node.
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub getChildNodeByGrandchildContents($$$$$)
|
||||
{
|
||||
my($doc, $node, $child_type, $gc_type, $gc_contents) = @_; # gc = grandchild
|
||||
|
||||
my $found_node;
|
||||
my $child_node = $node->getFirstChild();
|
||||
while ($child_node)
|
||||
{
|
||||
if ($child_node->getNodeTypeName eq "ELEMENT_NODE" &&
|
||||
$child_node->getTagName() eq $child_type)
|
||||
{
|
||||
# check for a child of this node of type
|
||||
my $child_contents = getChildElementTextContents($child_node, $gc_type);
|
||||
|
||||
if ($child_contents eq $gc_contents)
|
||||
{
|
||||
$found_node = $child_node;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
$child_node = $child_node->getNextSibling();
|
||||
}
|
||||
|
||||
return $found_node;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// getTargetNode
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub getTargetNode($$)
|
||||
{
|
||||
my($doc, $target_name) = @_;
|
||||
|
||||
my $targetlist_node = getChildOfDocument($doc, "TARGETLIST");
|
||||
return getChildNodeByGrandchildContents($doc, $targetlist_node, "TARGET", "NAME", $target_name);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// getTargetNamedSettingNode
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub getTargetNamedSettingNode($$)
|
||||
{
|
||||
my($target_node, $setting_name) = @_;
|
||||
|
||||
my $setting_node;
|
||||
|
||||
my $settinglist_node = getFirstChildElement($target_node, "SETTINGLIST");
|
||||
my $child_node = $settinglist_node->getFirstChild();
|
||||
|
||||
while ($child_node)
|
||||
{
|
||||
if ($child_node->getNodeTypeName ne "ELEMENT_NODE")
|
||||
{
|
||||
$child_node = $child_node->getNextSibling();
|
||||
next;
|
||||
}
|
||||
|
||||
if ($child_node->getTagName() eq "SETTING")
|
||||
{
|
||||
my $set_name = getChildElementTextContents($child_node, "NAME");
|
||||
|
||||
if ($set_name eq $setting_name)
|
||||
{
|
||||
$setting_node = $child_node;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
$child_node = $child_node->getNextSibling();
|
||||
}
|
||||
|
||||
return $setting_node;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// getTargetNodeSetting
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub getTargetNodeSetting($$)
|
||||
{
|
||||
my($target_node, $setting_name) = @_;
|
||||
|
||||
my $setting_node = getTargetNamedSettingNode($target_node, $setting_name);
|
||||
return getChildElementTextContents($setting_node, "VALUE");
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// setTargetNodeSetting
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub setTargetNodeSetting($$$$)
|
||||
{
|
||||
my($doc, $target_node, $setting_name, $new_value) = @_;
|
||||
|
||||
my $setting_node = getTargetNamedSettingNode($target_node, $setting_name);
|
||||
|
||||
setChildElementTextContents($doc, $setting_node, "VALUE", $new_value);
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// elementInArray
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub elementInArray($$)
|
||||
{
|
||||
my($element, $array) = @_;
|
||||
my $test;
|
||||
foreach $test (@$array)
|
||||
{
|
||||
if ($test eq $element) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// removeAllChildren
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub removeAllChildren($)
|
||||
{
|
||||
my($node) = @_;
|
||||
|
||||
my $child_node = $node->getFirstChild();
|
||||
|
||||
while ($child_node)
|
||||
{
|
||||
$node->removeChild($child_node);
|
||||
$child_node = $node->getFirstChild();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// dumpNodeData
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub dumpNodeData($)
|
||||
{
|
||||
my($node) = @_;
|
||||
|
||||
unless ($node) { die "Null node passed to dumpNodeData\n"; }
|
||||
|
||||
print "Dumping node $node\n";
|
||||
|
||||
my($node_type) = $node->getNodeTypeName();
|
||||
|
||||
if ($node_type eq "ELEMENT_NODE")
|
||||
{
|
||||
my($node_name) = $node->getTagName();
|
||||
print "Element $node_name\n";
|
||||
}
|
||||
elsif ($node_type eq "TEXT_NODE")
|
||||
{
|
||||
my($node_data) = $node->getData;
|
||||
# my(@node_vals) = unpack("C*", $node_data);
|
||||
print "Text '$node_data'\n"; # may contain LF chars
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Node $node_type\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// dumpNodeTree
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub dumpNodeTree($)
|
||||
{
|
||||
my($node) = @_;
|
||||
|
||||
my($child_node) = $node->getFirstChild();
|
||||
|
||||
unless ($child_node) { return; }
|
||||
|
||||
# recurse
|
||||
dumpNodeData($child_node);
|
||||
|
||||
# then go through child nodes
|
||||
while ($child_node)
|
||||
{
|
||||
dumpNodeTree($child_node);
|
||||
|
||||
$child_node = $child_node->getNextSibling();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
#-------------------------------------------------------------------------------
|
||||
# These 3 lists are the 'master lists' to control what gets built.
|
||||
#
|
||||
# Ordering in these arrays is important; it has to reflect the order in
|
||||
# which the build occurs.
|
||||
#
|
||||
# Setting containing spaces must be quoted with double quotes.
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
build_flags
|
||||
all 1
|
||||
pull 0
|
||||
dist 0
|
||||
config 0
|
||||
xpidl 0
|
||||
idl 0
|
||||
stubs 0
|
||||
runtime 0
|
||||
common 0
|
||||
imglib 0
|
||||
libimg2 0
|
||||
necko 0
|
||||
security 0
|
||||
browserutils 0
|
||||
intl 0
|
||||
nglayout 0
|
||||
accessiblity 0
|
||||
editor 0
|
||||
embedding 0
|
||||
viewer 0
|
||||
xpapp 0
|
||||
extensions 0
|
||||
plugins 0
|
||||
mailnews 0
|
||||
apprunner 0
|
||||
resources 0
|
||||
|
||||
options_flags
|
||||
pull_by_date 0
|
||||
chrome_jars 1
|
||||
chrome_files 0
|
||||
use_jars 1
|
||||
transformiix 1
|
||||
mathml 0 MOZ_MATHML
|
||||
svg 0 MOZ_SVG
|
||||
# svg requires libart, which is an lgpl library. You need to pull it
|
||||
# explicitly.
|
||||
libart_lgpl 0
|
||||
mng 1
|
||||
ldap 1 MOZ_LDAP_XPCOM
|
||||
ldap_experimental 0 MOZ_LDAP_XPCOM_EXPERIMENTAL
|
||||
xmlextras 1
|
||||
wsp 0 MOZ_WSP
|
||||
inspector 1
|
||||
mailextras 1
|
||||
xptlink 0
|
||||
psm 0 MOZ_PSM
|
||||
embedding_test 1
|
||||
embedding_chrome 0
|
||||
embedding_xulprefs 0
|
||||
embedding_xulsecurity 0
|
||||
carbon 0 TARGET_CARBON
|
||||
useimg2 1 USE_IMG2
|
||||
lowmem 0 MOZ_MAC_LOWMEM
|
||||
accessible 1 ACCESSIBILITY
|
||||
bidi 1 IBMBIDI
|
||||
p3p 0
|
||||
jsd 1
|
||||
venkman 1
|
||||
moz_logging 1 MOZ_LOGGING
|
||||
chatzilla 1
|
||||
content_packs 1
|
||||
xml_rpc 1
|
||||
cview 1
|
||||
help 1
|
||||
timeline 0 MOZ_TIMELINE
|
||||
static_build 0 MOZ_STATIC_COMPONENT_LIBS
|
||||
string_debug 0 DEBUG_STRING
|
||||
string_stats 0 DEBUG_STRING_STATS
|
||||
xpctools 0 XPC_TOOLS_SUPPORT
|
||||
smime 1
|
||||
mdn 1
|
||||
print_preview 1 NS_PRINT_PREVIEW
|
||||
moz_xul 1 MOZ_XUL
|
||||
|
||||
filepath_flags
|
||||
idepath ":CodeWarrior IDE Path.txt"
|
||||
sessionpath ":Mozilla session path.txt"
|
||||
buildlogfilepath ":Build Logs:Mozilla build log.txt" # this is a path
|
||||
scriptlogfilepath ":Build Logs:Mozilla script log.txt"
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,22 +0,0 @@
|
||||
# List of modules to check out. Format is
|
||||
# module, (tag), (date)
|
||||
# where tag and date are optional (non-trailing commas are required)
|
||||
#
|
||||
# Examples:
|
||||
# mozilla/nsprpub, NSPRPUB_CLIENT_TAG
|
||||
# mozilla/gc, , 10/25/2000 12:00:00
|
||||
#
|
||||
|
||||
mozilla/nsprpub, NETSCAPE_7_0_RTM
|
||||
mozilla/security/nss, NETSCAPE_7_0_RTM
|
||||
mozilla/security/manager, NETSCAPE_7_0_RTM
|
||||
mozilla/accessible, NETSCAPE_7_0_RTM
|
||||
mozilla/directory/c-sdk, NETSCAPE_7_0_RTM
|
||||
mozilla/lib/mac/Instrumentation, NETSCAPE_7_0_RTM
|
||||
mozilla/gfx2, NETSCAPE_7_0_RTM
|
||||
mozilla/modules/libpr0n, NETSCAPE_7_0_RTM
|
||||
SeaMonkeyAll, NETSCAPE_7_0_RTM
|
||||
|
||||
## You need this if you want to be able to use SVG
|
||||
## Note that this library is under the LGPL, not the MPL
|
||||
#mozilla/other-licenses/libart_lgpl
|
||||
@@ -1,79 +0,0 @@
|
||||
#!perl
|
||||
|
||||
#
|
||||
# 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):
|
||||
# Simon Fraser <sfraser@netscape.com>
|
||||
#
|
||||
|
||||
require 5.004;
|
||||
|
||||
use strict;
|
||||
|
||||
use Cwd;
|
||||
use Moz::BuildUtils;
|
||||
use Moz::BuildCore;
|
||||
|
||||
#-------------------------------------------------------------
|
||||
# Where have the build options gone?
|
||||
#
|
||||
# The various build flags have been centralized into one place.
|
||||
# The master list of options is in MozBuildFlags.txt. However,
|
||||
# you should never need to edit that file, or this one.
|
||||
#
|
||||
# To customize what gets built, or where to start the build,
|
||||
# edit the $prefs_file_name file in
|
||||
# System Folder:Preferences:Mozilla build prefs:
|
||||
# Documentation is provided in that file.
|
||||
#-------------------------------------------------------------
|
||||
|
||||
my($prefs_file_name) = "Mozilla pull prefs";
|
||||
|
||||
#-------------------------------------------------------------
|
||||
# hashes to hold build options
|
||||
#-------------------------------------------------------------
|
||||
my(%build);
|
||||
my(%options);
|
||||
my(%filepaths);
|
||||
my(%optiondefines);
|
||||
|
||||
# Hash of input files for this build. Eventually, there will be
|
||||
# input files for manifests, and projects too.
|
||||
my(%inputfiles) = (
|
||||
"buildflags", "MozillaBuildFlags.txt",
|
||||
"checkoutdata", "MozillaCheckoutList.txt",
|
||||
"buildprogress", "",
|
||||
"buildmodule", "MozillaBuildList.pm",
|
||||
"checkouttime", "Mozilla last checkout"
|
||||
);
|
||||
#-------------------------------------------------------------
|
||||
# end build hashes
|
||||
#-------------------------------------------------------------
|
||||
|
||||
# set the build root directory, which is the the dir above mozilla
|
||||
SetupBuildRootDir(":mozilla:build:mac:build_scripts");
|
||||
|
||||
# Set up all the flags on $main::, like DEBUG, CARBON etc.
|
||||
# Override the defaults using the preferences files.
|
||||
SetupDefaultBuildOptions(0, ":mozilla:dist:viewer:", "");
|
||||
|
||||
my($do_checkout) = 1;
|
||||
my($do_build) = 0;
|
||||
|
||||
RunBuild($do_checkout, $do_build, \%inputfiles, $prefs_file_name);
|
||||
@@ -1,511 +0,0 @@
|
||||
# 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=.
|
||||
|
||||
!if !defined(MOZ_TOP)
|
||||
#enable builds from changed top level directories
|
||||
MOZ_TOP=mozilla
|
||||
!endif
|
||||
|
||||
MOZ_SRC_FLIPPED = $(MOZ_SRC:\=/)
|
||||
MOZ_DIST_FLIPPED = $(MOZ_SRC_FLIPPED)/mozilla/dist
|
||||
!ifdef MOZ_DEBUG
|
||||
MOZ_OBJDIR = WIN32_D.OBJ
|
||||
!else
|
||||
MOZ_OBJDIR = WIN32_O.OBJ
|
||||
!endif
|
||||
|
||||
#
|
||||
# Command macro defines
|
||||
#
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#// Figure out how to do the pull.
|
||||
#//------------------------------------------------------------------------
|
||||
# uncomment these, modify branch tag, and check in to branch for milestones
|
||||
MOZ_BRANCH=NETSCAPE_7_0_RTM
|
||||
NSPR_CO_TAG=NETSCAPE_7_0_RTM
|
||||
PSM_CO_TAG=NETSCAPE_7_0_RTM
|
||||
NSS_CO_TAG=NETSCAPE_7_0_RTM
|
||||
LDAPCSDK_CO_TAG=NETSCAPE_7_0_RTM
|
||||
ACCESSIBLE_CO_TAG=NETSCAPE_7_0_RTM
|
||||
IMGLIB2_CO_TAG=NETSCAPE_7_0_RTM
|
||||
GFX2_CO_TAG=NETSCAPE_7_0_RTM
|
||||
|
||||
|
||||
!ifdef MOZ_BRANCH
|
||||
CVS_BRANCH=-r $(MOZ_BRANCH)
|
||||
!endif
|
||||
|
||||
!ifdef MOZ_DATE
|
||||
CVS_BRANCH=$(CVS_BRANCH) -D "$(MOZ_DATE)"
|
||||
!endif
|
||||
|
||||
# default pull is "quiet" but it can be overridden with MOZ_CVS_VERBOSE
|
||||
!ifndef MOZ_CVS_VERBOSE
|
||||
CVS_FLAGS=-q
|
||||
!endif
|
||||
|
||||
# honor any user-defined CVS flags
|
||||
!ifdef MOZ_CVS_FLAGS
|
||||
CVS_FLAGS=$(CVS_FLAGS) $(MOZ_CVS_FLAGS)
|
||||
!endif
|
||||
|
||||
# let's be explicit about CVSROOT... some windows cvs clients
|
||||
# are too stupid to correctly work without the -d option
|
||||
#
|
||||
# if they are too stupid, they should fail. I am
|
||||
# commenting this out because this does not work
|
||||
# under 4nt. (%'s are evaluted differently)
|
||||
#
|
||||
# If it breaks you, mail dougt@netscape.com
|
||||
# and leaf@mozilla.org
|
||||
#
|
||||
!if 0
|
||||
!if defined(CVSROOT)
|
||||
CVS_FLAGS=$(CVS_FLAGS) -d "$(CVSROOT)"
|
||||
!endif
|
||||
!endif
|
||||
|
||||
!ifndef MOZ_CO_FLAGS
|
||||
MOZ_CO_FLAGS = -P
|
||||
!endif
|
||||
|
||||
CVSCO = cvs $(CVS_FLAGS) co $(MOZ_CO_FLAGS) $(CVS_BRANCH)
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#// Figure out how to pull NSPR.
|
||||
#// If no NSPR_CO_TAG is specified, use the default static tag
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
!ifndef NSPR_CO_FLAGS
|
||||
NSPR_CO_FLAGS=$(MOZ_CO_FLAGS)
|
||||
!endif
|
||||
|
||||
NSPR_CO_FLAGS=$(NSPR_CO_FLAGS) $(CVS_BRANCH)
|
||||
|
||||
|
||||
CVSCO_NSPR = cvs $(CVS_FLAGS) co $(NSPR_CO_FLAGS)
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#// Figure out how to pull NSS and PSM libs.
|
||||
#// If no NSS_CO_TAG or PSM_CO_TAG is specified, use the default static tag
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
!ifndef NSS_CO_FLAGS
|
||||
NSS_CO_FLAGS=$(MOZ_CO_FLAGS)
|
||||
!endif
|
||||
|
||||
NSS_CO_FLAGS=$(NSS_CO_FLAGS) $(CVS_BRANCH)
|
||||
|
||||
CVSCO_NSS = cvs $(CVS_FLAGS) co $(NSS_CO_FLAGS)
|
||||
|
||||
!ifndef PSM_CO_FLAGS
|
||||
PSM_CO_FLAGS=$(MOZ_CO_FLAGS)
|
||||
!endif
|
||||
|
||||
PSM_CO_FLAGS=$(PSM_CO_FLAGS) $(CVS_BRANCH)
|
||||
|
||||
CVSCO_PSM = cvs $(CVS_FLAGS) co $(PSM_CO_FLAGS)
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#// Figure out how to pull LDAP C SDK client libs.
|
||||
#// If no LDAPCSDK_CO_TAG is specified, use the default tag
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
|
||||
!ifndef LDAPCSDK_CO_FLAGS
|
||||
LDAPCSDK_CO_FLAGS=$(MOZ_CO_FLAGS)
|
||||
!endif
|
||||
|
||||
LDAPCSDK_CO_FLAGS=$(LDAPCSDK_CO_FLAGS) $(CVS_BRANCH)
|
||||
|
||||
CVSCO_LDAPCSDK = cvs $(CVS_FLAGS) co $(LDAPCSDK_CO_FLAGS)
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#// Figure out how to pull accessibility libs.
|
||||
#// If no ACCESSIBLE_CO_TAG is specified, use the default tag
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
!ifndef ACCESSIBLE_CO_FLAGS
|
||||
ACCESSIBLE_CO_FLAGS=$(MOZ_CO_FLAGS)
|
||||
!endif
|
||||
|
||||
ACCESSIBLE_CO_FLAGS=$(ACCESSIBLE_CO_FLAGS) $(CVS_BRANCH)
|
||||
|
||||
CVSCO_ACCESSIBLE = cvs $(CVS_FLAGS) co $(ACCESSIBLE_CO_FLAGS)
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#// Figure out how to pull new image library.
|
||||
#// If no IMGLIB2_CO_TAG is specified, use the default tag
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
!ifndef IMGLIB2_CO_FLAGS
|
||||
IMGLIB2_CO_FLAGS=$(MOZ_CO_FLAGS)
|
||||
!endif
|
||||
|
||||
IMGLIB2_CO_FLAGS=$(IMGLIB2_CO_FLAGS) $(CVS_BRANCH)
|
||||
|
||||
CVSCO_IMGLIB2 = cvs $(CVS_FLAGS) co $(IMGLIB2_CO_FLAGS)
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#// Figure out how to pull new image library.
|
||||
#// If no GFX2_CO_TAG is specified, use the default tag
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
!ifndef GFX2_CO_FLAGS
|
||||
GFX2_CO_FLAGS=$(MOZ_CO_FLAGS)
|
||||
!endif
|
||||
|
||||
GFX2_CO_FLAGS=$(GFX2_CO_FLAGS) $(CVS_BRANCH)
|
||||
|
||||
CVSCO_GFX2 = cvs $(CVS_FLAGS) co $(GFX2_CO_FLAGS)
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#// Figure out how to pull the internal libart
|
||||
#// (only pulled and built if MOZ_INTERNAL_LIBART_LGPL is set)
|
||||
#// If no MOZ_INTERNAL_LIBART_CO_TAG is specified, use the default tag
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
!if defined(MOZ_SVG) && !defined(MOZ_INTERNAL_LIBART_LGPL)
|
||||
ERR_MESSAGE = ^
|
||||
You are trying to build Mozilla with SVG support (MOZ_SVG=1), but you ^
|
||||
haven not specified that mozilla/other-licenses/libart_lgpl should be ^
|
||||
pulled and built. At the moment Mozilla SVG builds need this patched ^
|
||||
version of libart. You either need to disable SVG support (unset MOZ_SVG) ^
|
||||
or enable pulling and building by setting MOZ_INTERNAL_LIBART_LGPL=1.^
|
||||
^
|
||||
If you choose to pull and build libart, note that it is only licensed^
|
||||
under the terms of the LGPL, not the MPL. (Which is why you have to opt^
|
||||
in explicitly.)
|
||||
!endif
|
||||
|
||||
!if defined(MOZ_INTERNAL_LIBART_LGPL)
|
||||
|
||||
!ifndef MOZ_INTERNAL_LIBART_CO_FLAGS
|
||||
MOZ_INTERNAL_LIBART_CO_FLAGS=$(MOZ_CO_FLAGS)
|
||||
!endif
|
||||
|
||||
!if "$(MOZ_INTERNAL_LIBART_CO_TAG)" != ""
|
||||
MOZ_INTERNAL_LIBART_CO_FLAGS=$(MOZ_INTERNAL_LIBART_CO_FLAGS) -r $(MOZ_INTERNAL_LIBART_CO_TAG)
|
||||
!else
|
||||
MOZ_INTERNAL_LIBART_CO_FLAGS=$(MOZ_INTERNAL_LIBART_CO_FLAGS) $(CVS_BRANCH)
|
||||
!endif
|
||||
|
||||
CVSCO_MOZ_INTERNAL_LIBART = cvs $(CVS_FLAGS) co $(MOZ_INTERNAL_LIBART_CO_FLAGS)
|
||||
|
||||
!endif
|
||||
|
||||
## The master target
|
||||
############################################################
|
||||
|
||||
pull_and_build_all: pull_all build_all_dep
|
||||
|
||||
|
||||
## Rules for pulling the source from the cvs repository
|
||||
############################################################
|
||||
|
||||
pull_clobber_and_build_all: pull_all clobber_all build_all
|
||||
|
||||
!if !defined(MOZ_INTERNAL_LIBART_LGPL)
|
||||
pull_all: pull_nspr pull_psm pull_ldapcsdk pull_accessible pull_gfx2 pull_imglib2 pull_seamonkey
|
||||
!else
|
||||
pull_all: pull_nspr pull_psm pull_ldapcsdk pull_accessible pull_gfx2 pull_imglib2 pull_moz_internal_libart pull_seamonkey
|
||||
!endif
|
||||
|
||||
pull_nspr: pull_clientmak
|
||||
cd $(MOZ_SRC)\.
|
||||
$(CVSCO_NSPR) mozilla/nsprpub
|
||||
|
||||
pull_nss:
|
||||
cd $(MOZ_SRC)\.
|
||||
$(CVSCO_NSS) mozilla/security/coreconf
|
||||
$(CVSCO_NSS) mozilla/security/nss
|
||||
|
||||
pull_psm: pull_nss
|
||||
cd $(MOZ_SRC)\.
|
||||
$(CVSCO_PSM) mozilla/security/manager
|
||||
$(CVSCO_PSM) mozilla/security/makefile.win
|
||||
|
||||
pull_ldapcsdk:
|
||||
cd $(MOZ_SRC)\.
|
||||
$(CVSCO_LDAPCSDK) mozilla/directory/c-sdk
|
||||
|
||||
pull_accessible:
|
||||
cd $(MOZ_SRC)\.
|
||||
$(CVSCO_ACCESSIBLE) mozilla/accessible
|
||||
|
||||
pull_gfx2:
|
||||
cd $(MOZ_SRC)\.
|
||||
$(CVSCO_GFX2) mozilla/gfx2
|
||||
|
||||
pull_imglib2:
|
||||
cd $(MOZ_SRC)\.
|
||||
$(CVSCO_IMGLIB2) mozilla/modules/libpr0n
|
||||
|
||||
!if defined(MOZ_INTERNAL_LIBART_LGPL)
|
||||
pull_moz_internal_libart:
|
||||
cd $(MOZ_SRC)\.
|
||||
$(CVSCO_MOZ_INTERNAL_LIBART) mozilla/other-licenses/libart_lgpl
|
||||
!endif
|
||||
|
||||
pull_xpconnect: pull_nspr
|
||||
cd $(MOZ_SRC)\.
|
||||
$(CVSCO) mozilla/include
|
||||
$(CVSCO) mozilla/config
|
||||
$(CVSCO) -l mozilla/js
|
||||
$(CVSCO) -l mozilla/js/src
|
||||
$(CVSCO) mozilla/js/src/fdlibm
|
||||
$(CVSCO) mozilla/js/src/xpconnect
|
||||
$(CVSCO) mozilla/modules/libreg
|
||||
$(CVSCO) mozilla/xpcom
|
||||
$(CVSCO) mozilla/string
|
||||
|
||||
# pull either layout only or seamonkey the browser
|
||||
pull_layout:
|
||||
cd $(MOZ_SRC)\.
|
||||
$(CVSCO) RaptorWin
|
||||
|
||||
pull_seamonkey: pull_clientmak
|
||||
cd $(MOZ_SRC)\.
|
||||
$(CVSCO) SeaMonkeyAll
|
||||
|
||||
pull_clientmak:
|
||||
cd $(MOZ_SRC)\.
|
||||
$(CVSCO) mozilla/client.mak
|
||||
|
||||
############################################################
|
||||
|
||||
# nmake has to be hardcoded, or we have to depend on mozilla/config
|
||||
# being pulled already to figure out what $(NMAKE) should be.
|
||||
|
||||
clobber_all: clobber_nspr clobber_ldapcsdk clobber_psm clobber_seamonkey
|
||||
|
||||
build_all: build_nspr build_ldapcsdk build_seamonkey
|
||||
|
||||
build_all_dep: depend libs
|
||||
|
||||
distclean:
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\directory\c-sdk
|
||||
gmake -f gmakefile.win distclean MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED)
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\nsprpub
|
||||
gmake -f gmakefile.win distclean MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED)
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)
|
||||
nmake /f client.mak clobber_psm
|
||||
nmake /f client.mak clobber_seamonkey
|
||||
|
||||
clobber_ldapcsdk:
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\directory\c-sdk
|
||||
gmake -f gmakefile.win clobber_all MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED) \
|
||||
SHELL=sh
|
||||
|
||||
clobber_nspr:
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\nsprpub
|
||||
gmake -f gmakefile.win clobber_all MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED)
|
||||
|
||||
clobber_psm:
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\security
|
||||
nmake -f makefile.win clobber_all
|
||||
|
||||
clobber_xpconnect:
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
|
||||
-rd /s /q dist
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\nsprpub
|
||||
gmake -f gmakefile.win clobber_all MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED)
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\include
|
||||
nmake -f makefile.win clobber_all
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\modules\libreg
|
||||
nmake -f makefile.win clobber_all
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\string
|
||||
nmake -f makefile.win clobber_all
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\xpcom
|
||||
nmake -f makefile.win clobber_all
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\js
|
||||
nmake -f makefile.win clobber_all
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\js\src\xpconnect
|
||||
nmake -f makefile.win clobber_all
|
||||
|
||||
clobber_seamonkey:
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
|
||||
-rd /s /q dist
|
||||
nmake -f makefile.win clobber_all
|
||||
|
||||
depend: export
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
|
||||
nmake -f makefile.win depend
|
||||
|
||||
depend_xpconnect:
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\include
|
||||
nmake -f makefile.win depend
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\modules\libreg
|
||||
nmake -f makefile.win depend
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\string
|
||||
nmake -f makefile.win depend
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\xpcom
|
||||
nmake -f makefile.win depend
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\js\src
|
||||
nmake -f makefile.win depend
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\js\src\xpconnect
|
||||
nmake -f makefile.win depend
|
||||
|
||||
build_nspr:
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\nsprpub
|
||||
gmake -f gmakefile.win MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED)
|
||||
|
||||
build_ldapcsdk:
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\directory\c-sdk
|
||||
gmake -f gmakefile.win MOZ_SRC_FLIPPED=$(MOZ_SRC_FLIPPED) SHELL=sh
|
||||
|
||||
build_psm:
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\security
|
||||
nmake -f makefile.win
|
||||
|
||||
build_xpconnect: build_nspr
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\include
|
||||
nmake -f makefile.win all
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\modules\libreg
|
||||
nmake -f makefile.win all
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\xpcom
|
||||
nmake -f makefile.win export
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\string
|
||||
nmake -f makefile.win all
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\xpcom
|
||||
nmake -f makefile.win libs
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\js\src
|
||||
nmake -f makefile.win all
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\js\src\xpconnect
|
||||
nmake -f makefile.win all
|
||||
|
||||
build_seamonkey:
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
|
||||
nmake -f makefile.win all
|
||||
|
||||
build_client:
|
||||
@cd $(MOZ_SRC)\mozilla\.
|
||||
nmake -f makefile.win all
|
||||
|
||||
build_layout:
|
||||
@cd $(MOZ_SRC)\mozilla\.
|
||||
nmake -f makefile.win all
|
||||
|
||||
build_dist:
|
||||
@cd $(MOZ_SRC)\mozilla\.
|
||||
nmake -f makefile.win all
|
||||
|
||||
libs:
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
|
||||
nmake -f makefile.win libs
|
||||
|
||||
export: build_nspr build_ldapcsdk
|
||||
@cd $(MOZ_SRC)\$(MOZ_TOP)\.
|
||||
nmake -f makefile.win export
|
||||
|
||||
clobber_dist:
|
||||
@cd $(MOZ_SRC)\mozilla\.
|
||||
nmake -f makefile.win clobber_all
|
||||
|
||||
clobber_client:
|
||||
@cd $(MOZ_SRC)\mozilla\.
|
||||
nmake -f makefile.win clobber_all
|
||||
|
||||
clobber_layout:
|
||||
@cd $(MOZ_SRC)\mozilla\.
|
||||
nmake -f makefile.win clobber_all
|
||||
|
||||
browse_info::
|
||||
cd $(MOZ_SRC)\$(MOZ_TOP)
|
||||
-dir /s /b *.sbr > sbrlist.tmp
|
||||
-bscmake /Es /o mozilla.bsc @sbrlist.tmp
|
||||
-rm sbrlist.tmp
|
||||
|
||||
regchrome::
|
||||
@cd $(MOZ_SRC)\mozilla\.
|
||||
nmake /f makefile.win regchrome
|
||||
|
||||
deliver::
|
||||
@cd $(MOZ_SRC)\mozilla\.
|
||||
nmake /f makefile.win splitsymbols
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#// Utility stuff...
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
# Verify that MOZ_SRC is set correctly
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
# Check to see if it is set at all
|
||||
!if "$(MOZ_SRC)"==""
|
||||
MOZ_SRC = $(MAKEDIR)\..
|
||||
!endif
|
||||
|
||||
#
|
||||
# create a temp file at the root and make sure it is visible from MOZ_SRC
|
||||
#
|
||||
!if [copy $(MAKEDIR)\client.mak $(MAKEDIR)\xyzzy.tmp > NUL] == 0
|
||||
!endif
|
||||
|
||||
!if !EXIST( $(MOZ_SRC)\mozilla\xyzzy.tmp )
|
||||
ERR_MESSAGE=$(ERR_MESSAGE)^
|
||||
MOZ_SRC isn't set correctly: [$(MOZ_SRC)\mozilla]!=[$(MAKEDIR)]
|
||||
!endif
|
||||
|
||||
!if [del $(MAKEDIR)\xyzzy.tmp]
|
||||
!endif
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
# Verify that MOZ_BITS is set
|
||||
#//------------------------------------------------------------------------
|
||||
!if !defined(MOZ_BITS)
|
||||
ERR_MESSAGE=$(ERR_MESSAGE)^
|
||||
Environment variable MOZ_BITS isn't set.
|
||||
!endif
|
||||
|
||||
!if !defined(MOZ_TOOLS)
|
||||
ERR_MESSAGE=$(ERR_MESSAGE)^
|
||||
Environment variable MOZ_TOOLS isn't set.
|
||||
!endif
|
||||
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#// Display error
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
!if "$(ERR_MESSAGE)" != ""
|
||||
ERR_MESSAGE = ^
|
||||
client.mak: ^
|
||||
$(ERR_MESSAGE) ^
|
||||
^
|
||||
client.mak: usage^
|
||||
^
|
||||
nmake -f client.mak [MOZ_BRANCH=<cvs_branch_name>] ^
|
||||
[MOZ_DATE=<cvs_date>]^
|
||||
[pull_and_build_all]^
|
||||
[pull_all]^
|
||||
[build_all]^
|
||||
^
|
||||
Environment variables:^
|
||||
^
|
||||
MOZ_BITS set to 32^
|
||||
MOZ_TOOLS set to the directory containing the needed tools ^
|
||||
|
||||
!ERROR $(ERR_MESSAGE)
|
||||
|
||||
!endif
|
||||
@@ -1,650 +0,0 @@
|
||||
# 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): Stephen Lamm
|
||||
|
||||
# Build the Mozilla client.
|
||||
#
|
||||
# This needs CVSROOT set to work, e.g.,
|
||||
# setenv CVSROOT :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
|
||||
# or
|
||||
# setenv CVSROOT :pserver:username%somedomain.org@cvs.mozilla.org:/cvsroot
|
||||
#
|
||||
# To checkout and build a tree,
|
||||
# 1. cvs co mozilla/client.mk
|
||||
# 2. cd mozilla
|
||||
# 3. gmake -f client.mk
|
||||
#
|
||||
# Other targets (gmake -f client.mk [targets...]),
|
||||
# checkout
|
||||
# build
|
||||
# clean (realclean is now the same as clean)
|
||||
# distclean
|
||||
#
|
||||
# See http://www.mozilla.org/build/unix.html for more information.
|
||||
#
|
||||
# Options:
|
||||
# MOZ_OBJDIR - Destination object directory
|
||||
# MOZ_CO_DATE - Date tag to use for checkout (default: none)
|
||||
# MOZ_CO_MODULE - Module to checkout (default: SeaMonkeyAll)
|
||||
# MOZ_CVS_FLAGS - Flags to pass cvs (default: -q -z3)
|
||||
# MOZ_CO_FLAGS - Flags to pass after 'cvs co' (default: -P)
|
||||
# MOZ_MAKE_FLAGS - Flags to pass to $(MAKE)
|
||||
# MOZ_CO_BRANCH - Branch tag (Deprecated. Use MOZ_CO_TAG below.)
|
||||
#
|
||||
|
||||
#######################################################################
|
||||
# Checkout Tags
|
||||
#
|
||||
# For branches, uncomment the MOZ_CO_TAG line with the proper tag,
|
||||
# and commit this file on that tag.
|
||||
MOZ_CO_TAG = NETSCAPE_7_0_RTM
|
||||
NSPR_CO_TAG = NETSCAPE_7_0_RTM
|
||||
PSM_CO_TAG = NETSCAPE_7_0_RTM
|
||||
NSS_CO_TAG = NETSCAPE_7_0_RTM
|
||||
LDAPCSDK_CO_TAG = NETSCAPE_7_0_RTM
|
||||
ACCESSIBLE_CO_TAG = NETSCAPE_7_0_RTM
|
||||
GFX2_CO_TAG = NETSCAPE_7_0_RTM
|
||||
IMGLIB2_CO_TAG = NETSCAPE_7_0_RTM
|
||||
BUILD_MODULES = all
|
||||
|
||||
#######################################################################
|
||||
# Defines
|
||||
#
|
||||
CVS = cvs
|
||||
|
||||
CWD := $(shell pwd)
|
||||
|
||||
ifeq "$(CWD)" "/"
|
||||
CWD := /.
|
||||
endif
|
||||
|
||||
ifneq (, $(wildcard client.mk))
|
||||
# Ran from mozilla directory
|
||||
ROOTDIR := $(shell dirname $(CWD))
|
||||
TOPSRCDIR := $(CWD)
|
||||
else
|
||||
# Ran from mozilla/.. directory (?)
|
||||
ROOTDIR := $(CWD)
|
||||
TOPSRCDIR := $(CWD)/mozilla
|
||||
endif
|
||||
|
||||
# on os2, TOPSRCDIR may have two forward slashes in a row, which doesn't
|
||||
# work; replace first instance with one forward slash
|
||||
TOPSRCDIR := $(shell echo "$(TOPSRCDIR)" | sed -e 's%//%/%')
|
||||
|
||||
ifndef TOPSRCDIR_MOZ
|
||||
TOPSRCDIR_MOZ=$(TOPSRCDIR)
|
||||
endif
|
||||
|
||||
# if ROOTDIR equals only drive letter (i.e. "C:"), set to "/"
|
||||
DIRNAME := $(shell echo "$(ROOTDIR)" | sed -e 's/^.://')
|
||||
ifeq ($(DIRNAME),)
|
||||
ROOTDIR := /.
|
||||
endif
|
||||
|
||||
AUTOCONF := autoconf
|
||||
MKDIR := mkdir
|
||||
SH := /bin/sh
|
||||
ifndef MAKE
|
||||
MAKE := gmake
|
||||
endif
|
||||
|
||||
CONFIG_GUESS_SCRIPT := $(wildcard $(TOPSRCDIR)/build/autoconf/config.guess)
|
||||
ifdef CONFIG_GUESS_SCRIPT
|
||||
CONFIG_GUESS = $(shell $(CONFIG_GUESS_SCRIPT))
|
||||
else
|
||||
_IS_FIRST_CHECKOUT := 1
|
||||
endif
|
||||
|
||||
####################################
|
||||
# CVS
|
||||
|
||||
# Add the CVS root to CVS_FLAGS if needed
|
||||
CVS_ROOT_IN_TREE := $(shell cat $(TOPSRCDIR)/CVS/Root 2>/dev/null)
|
||||
ifneq ($(CVS_ROOT_IN_TREE),)
|
||||
ifneq ($(CVS_ROOT_IN_TREE),$(CVSROOT))
|
||||
CVS_FLAGS := -d $(CVS_ROOT_IN_TREE)
|
||||
endif
|
||||
endif
|
||||
|
||||
CVSCO = $(strip $(CVS) $(CVS_FLAGS) co $(CVS_CO_FLAGS))
|
||||
CVSCO_LOGFILE := $(ROOTDIR)/cvsco.log
|
||||
CVSCO_LOGFILE := $(shell echo $(CVSCO_LOGFILE) | sed s%//%/%)
|
||||
|
||||
ifdef MOZ_CO_TAG
|
||||
CVS_CO_FLAGS := -r $(MOZ_CO_TAG)
|
||||
endif
|
||||
|
||||
####################################
|
||||
# Load mozconfig Options
|
||||
|
||||
# See build pages, http://www.mozilla.org/build/unix.html,
|
||||
# for how to set up mozconfig.
|
||||
MOZCONFIG_LOADER := mozilla/build/autoconf/mozconfig2client-mk
|
||||
MOZCONFIG_FINDER := mozilla/build/autoconf/mozconfig-find
|
||||
MOZCONFIG_MODULES := mozilla/build/unix/modules.mk
|
||||
run_for_side_effects := \
|
||||
$(shell cd $(ROOTDIR); \
|
||||
if test "$(_IS_FIRST_CHECKOUT)"; then \
|
||||
$(CVSCO) $(MOZCONFIG_FINDER) $(MOZCONFIG_LOADER) $(MOZCONFIG_MODULES); \
|
||||
else true; \
|
||||
fi; \
|
||||
$(MOZCONFIG_LOADER) $(TOPSRCDIR) mozilla/.mozconfig.mk > mozilla/.mozconfig.out)
|
||||
include $(TOPSRCDIR)/.mozconfig.mk
|
||||
include $(TOPSRCDIR)/build/unix/modules.mk
|
||||
|
||||
####################################
|
||||
# Options that may come from mozconfig
|
||||
|
||||
# Change CVS flags if anonymous root is requested
|
||||
ifdef MOZ_CO_USE_MIRROR
|
||||
CVS_FLAGS := -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
|
||||
endif
|
||||
|
||||
# MOZ_CVS_FLAGS - Basic CVS flags
|
||||
ifeq "$(origin MOZ_CVS_FLAGS)" "undefined"
|
||||
CVS_FLAGS := $(CVS_FLAGS) -q -z 3
|
||||
else
|
||||
CVS_FLAGS := $(MOZ_CVS_FLAGS)
|
||||
endif
|
||||
|
||||
# This option is deprecated. The best way to have client.mk pull a tag
|
||||
# is to set MOZ_CO_TAG (see above) and commit that change on the tag.
|
||||
ifdef MOZ_CO_BRANCH
|
||||
$(warning Use MOZ_CO_TAG instead of MOZ_CO_BRANCH)
|
||||
CVS_CO_FLAGS := -r $(MOZ_CO_BRANCH)
|
||||
endif
|
||||
|
||||
# MOZ_CO_FLAGS - Anything that we should use on all checkouts
|
||||
ifeq "$(origin MOZ_CO_FLAGS)" "undefined"
|
||||
CVS_CO_FLAGS := $(CVS_CO_FLAGS) -P
|
||||
else
|
||||
CVS_CO_FLAGS := $(CVS_CO_FLAGS) $(MOZ_CO_FLAGS)
|
||||
endif
|
||||
|
||||
ifdef MOZ_CO_DATE
|
||||
CVS_CO_DATE_FLAGS := -D "$(MOZ_CO_DATE)"
|
||||
endif
|
||||
|
||||
ifdef MOZ_OBJDIR
|
||||
OBJDIR := $(MOZ_OBJDIR)
|
||||
MOZ_MAKE := $(MAKE) $(MOZ_MAKE_FLAGS) -C $(OBJDIR)
|
||||
else
|
||||
OBJDIR := $(TOPSRCDIR)
|
||||
MOZ_MAKE := $(MAKE) $(MOZ_MAKE_FLAGS)
|
||||
endif
|
||||
|
||||
####################################
|
||||
# CVS defines for PSM
|
||||
#
|
||||
PSM_CO_MODULE= mozilla/security/manager
|
||||
PSM_CO_FLAGS := -P -A
|
||||
ifdef MOZ_CO_FLAGS
|
||||
PSM_CO_FLAGS := $(MOZ_CO_FLAGS)
|
||||
endif
|
||||
ifdef PSM_CO_TAG
|
||||
PSM_CO_FLAGS := $(PSM_CO_FLAGS) -r $(PSM_CO_TAG)
|
||||
endif
|
||||
CVSCO_PSM = $(CVS) $(CVS_FLAGS) co $(PSM_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(PSM_CO_MODULE)
|
||||
|
||||
####################################
|
||||
# CVS defines for NSS
|
||||
#
|
||||
NSS_CO_MODULE = mozilla/security/nss \
|
||||
mozilla/security/coreconf \
|
||||
$(NULL)
|
||||
|
||||
NSS_CO_FLAGS := -P
|
||||
ifdef MOZ_CO_FLAGS
|
||||
NSS_CO_FLAGS := $(MOZ_CO_FLAGS)
|
||||
endif
|
||||
ifdef NSS_CO_TAG
|
||||
NSS_CO_FLAGS := $(NSS_CO_FLAGS) -r $(NSS_CO_TAG)
|
||||
endif
|
||||
# Cannot pull static tags by date
|
||||
ifeq ($(NSS_CO_TAG),NSS_CLIENT_TAG)
|
||||
CVSCO_NSS = $(CVS) $(CVS_FLAGS) co $(NSS_CO_FLAGS) $(NSS_CO_MODULE)
|
||||
else
|
||||
CVSCO_NSS = $(CVS) $(CVS_FLAGS) co $(NSS_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(NSS_CO_MODULE)
|
||||
endif
|
||||
|
||||
####################################
|
||||
# CVS defines for NSPR
|
||||
#
|
||||
NSPR_CO_MODULE = mozilla/nsprpub
|
||||
NSPR_CO_FLAGS := -P
|
||||
ifdef MOZ_CO_FLAGS
|
||||
NSPR_CO_FLAGS := $(MOZ_CO_FLAGS)
|
||||
endif
|
||||
ifdef NSPR_CO_TAG
|
||||
NSPR_CO_FLAGS := $(NSPR_CO_FLAGS) -r $(NSPR_CO_TAG)
|
||||
endif
|
||||
# Cannot pull static tags by date
|
||||
ifeq ($(NSPR_CO_TAG),NSPRPUB_CLIENT_TAG)
|
||||
CVSCO_NSPR = $(CVS) $(CVS_FLAGS) co $(NSPR_CO_FLAGS) $(NSPR_CO_MODULE)
|
||||
else
|
||||
CVSCO_NSPR = $(CVS) $(CVS_FLAGS) co $(NSPR_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(NSPR_CO_MODULE)
|
||||
endif
|
||||
|
||||
####################################
|
||||
# CVS defines for the C LDAP SDK
|
||||
#
|
||||
LDAPCSDK_CO_MODULE = mozilla/directory/c-sdk
|
||||
LDAPCSDK_CO_FLAGS := -P
|
||||
ifdef MOZ_CO_FLAGS
|
||||
LDAPCSDK_CO_FLAGS := $(MOZ_CO_FLAGS)
|
||||
endif
|
||||
ifdef LDAPCSDK_CO_TAG
|
||||
LDAPCSDK_CO_FLAGS := $(LDAPCSDK_CO_FLAGS) -r $(LDAPCSDK_CO_TAG)
|
||||
endif
|
||||
CVSCO_LDAPCSDK = $(CVS) $(CVS_FLAGS) co $(LDAPCSDK_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(LDAPCSDK_CO_MODULE)
|
||||
|
||||
####################################
|
||||
# CVS defines for the C LDAP SDK
|
||||
#
|
||||
ACCESSIBLE_CO_MODULE = mozilla/accessible
|
||||
ACCESSIBLE_CO_FLAGS := -P
|
||||
ifdef MOZ_CO_FLAGS
|
||||
ACCESSIBLE_CO_FLAGS := $(MOZ_CO_FLAGS)
|
||||
endif
|
||||
ifdef ACCESSIBLE_CO_TAG
|
||||
ACCESSIBLE_CO_FLAGS := $(ACCESSIBLE_CO_FLAGS) -r $(ACCESSIBLE_CO_TAG)
|
||||
endif
|
||||
CVSCO_ACCESSIBLE = $(CVS) $(CVS_FLAGS) co $(ACCESSIBLE_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(ACCESSIBLE_CO_MODULE)
|
||||
|
||||
####################################
|
||||
# CVS defines for gfx2
|
||||
#
|
||||
GFX2_CO_MODULE = mozilla/gfx2
|
||||
GFX2_CO_FLAGS := -P
|
||||
ifdef MOZ_CO_FLAGS
|
||||
GFX2_CO_FLAGS := $(MOZ_CO_FLAGS)
|
||||
endif
|
||||
ifdef GFX2_CO_TAG
|
||||
GFX2_CO_FLAGS := $(GFX2_CO_FLAGS) -r $(GFX2_CO_TAG)
|
||||
endif
|
||||
CVSCO_GFX2 = $(CVS) $(CVS_FLAGS) co $(GFX2_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(GFX2_CO_MODULE)
|
||||
|
||||
####################################
|
||||
# CVS defines for new image library
|
||||
#
|
||||
IMGLIB2_CO_MODULE = mozilla/modules/libpr0n
|
||||
IMGLIB2_CO_FLAGS := -P
|
||||
ifdef MOZ_CO_FLAGS
|
||||
IMGLIB2_CO_FLAGS := $(MOZ_CO_FLAGS)
|
||||
endif
|
||||
ifdef IMGLIB2_CO_TAG
|
||||
IMGLIB2_CO_FLAGS := $(IMGLIB2_CO_FLAGS) -r $(IMGLIB2_CO_TAG)
|
||||
endif
|
||||
CVSCO_IMGLIB2 = $(CVS) $(CVS_FLAGS) co $(IMGLIB2_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(IMGLIB2_CO_MODULE)
|
||||
|
||||
####################################
|
||||
# CVS defines for standalone modules
|
||||
#
|
||||
ifneq ($(BUILD_MODULES),all)
|
||||
MOZ_CO_MODULE := $(filter-out $(NSPRPUB_DIR) security directory/c-sdk, $(BUILD_MODULE_CVS))
|
||||
MOZ_CO_MODULE += allmakefiles.sh client.mk aclocal.m4 configure configure.in
|
||||
MOZ_CO_MODULE += Makefile.in
|
||||
MOZ_CO_MODULE := $(addprefix mozilla/, $(MOZ_CO_MODULE))
|
||||
|
||||
NOSUBDIRS_MODULE := $(addprefix mozilla/, $(BUILD_MODULE_CVS_NS))
|
||||
ifneq ($(NOSUBDIRS_MODULE),)
|
||||
CVSCO_NOSUBDIRS := $(CVSCO) -l $(CVS_CO_DATE_FLAGS) $(NOSUBDIRS_MODULE)
|
||||
endif
|
||||
|
||||
ifeq (,$(filter $(NSPRPUB_DIR), $(BUILD_MODULE_CVS)))
|
||||
CVSCO_NSPR :=
|
||||
endif
|
||||
ifeq (,$(filter security security/manager, $(BUILD_MODULE_CVS)))
|
||||
CVSCO_PSM :=
|
||||
CVSCO_NSS :=
|
||||
endif
|
||||
ifeq (,$(filter directory/c-sdk, $(BUILD_MODULE_CVS)))
|
||||
CVSCO_LDAPCSDK :=
|
||||
endif
|
||||
ifeq (,$(filter accessible, $(BUILD_MODULE_CVS)))
|
||||
CVSCO_ACCESSIBLE :=
|
||||
endif
|
||||
ifeq (,$(filter gfx2, $(BUILD_MODULE_CVS)))
|
||||
CVSCO_GFX2 :=
|
||||
endif
|
||||
ifeq (,$(filter modules/libpr0n, $(BUILD_MODULE_CVS)))
|
||||
CVSCO_IMGLIB2 :=
|
||||
endif
|
||||
endif
|
||||
|
||||
####################################
|
||||
# CVS defines for SeaMonkey
|
||||
#
|
||||
ifeq ($(MOZ_CO_MODULE),)
|
||||
MOZ_CO_MODULE := SeaMonkeyAll
|
||||
endif
|
||||
CVSCO_SEAMONKEY := $(CVSCO) $(CVS_CO_DATE_FLAGS) $(MOZ_CO_MODULE)
|
||||
|
||||
####################################
|
||||
# CVS defined for libart (pulled and built if MOZ_INTERNAL_LIBART_LGPL is set)
|
||||
#
|
||||
CVSCO_LIBART := $(CVSCO) $(CVS_CO_DATE_FLAGS) mozilla/other-licenses/libart_lgpl
|
||||
|
||||
ifdef MOZ_INTERNAL_LIBART_LGPL
|
||||
FASTUPDATE_LIBART := fast_update $(CVSCO_LIBART)
|
||||
CHECKOUT_LIBART := cvs_co $(CVSCO_LIBART)
|
||||
else
|
||||
CHECKOUT_LIBART := true
|
||||
FASTUPDATE_LIBART := true
|
||||
endif
|
||||
|
||||
####################################
|
||||
# CVS defines for Calendar (pulled and built if MOZ_CALENDAR is set)
|
||||
#
|
||||
CVSCO_CALENDAR := $(CVSCO) $(CVS_CO_DATE_FLAGS) mozilla/calendar
|
||||
|
||||
ifdef MOZ_CALENDAR
|
||||
FASTUPDATE_CALENDAR := fast_update $(CVSCO_CALENDAR)
|
||||
CHECKOUT_CALENDAR := cvs_co $(CVSCO_CALENDAR)
|
||||
else
|
||||
CHECKOUT_CALENDAR := true
|
||||
FASTUPDATE_CALENDAR := true
|
||||
endif
|
||||
|
||||
|
||||
# because some cygwin tools can't handle native dos-drive paths & vice-versa
|
||||
# force configure to use a relative path for --srcdir
|
||||
# need a better check for win32
|
||||
# and we need to get OBJDIR earlier
|
||||
ifdef MOZ_TOOLS
|
||||
_tmpobjdir := $(shell cygpath -u $(OBJDIR))
|
||||
_abs2rel := $(shell cygpath -w $(TOPSRCDIR)/build/unix/abs2rel.pl | sed -e 's|\\|/|g')
|
||||
_OBJ2SRCPATH := $(shell $(_abs2rel) $(TOPSRCDIR) $(_tmpobjdir))
|
||||
endif
|
||||
|
||||
#######################################################################
|
||||
# Rules
|
||||
#
|
||||
|
||||
# Print out any options loaded from mozconfig.
|
||||
all build checkout clean depend distclean export libs install realclean::
|
||||
@if test -f .mozconfig.out; then \
|
||||
cat .mozconfig.out; \
|
||||
rm -f .mozconfig.out; \
|
||||
else true; \
|
||||
fi
|
||||
|
||||
ifdef _IS_FIRST_CHECKOUT
|
||||
all:: checkout build
|
||||
else
|
||||
all:: checkout alldep
|
||||
endif
|
||||
|
||||
# Windows equivalents
|
||||
pull_all: checkout
|
||||
build_all: build
|
||||
build_all_dep: alldep
|
||||
build_all_depend: alldep
|
||||
clobber clobber_all: clean
|
||||
pull_and_build_all: checkout alldep
|
||||
|
||||
# Do everything from scratch
|
||||
everything: checkout clean build
|
||||
|
||||
####################################
|
||||
# CVS checkout
|
||||
#
|
||||
checkout::
|
||||
# @: Backup the last checkout log.
|
||||
@if test -f $(CVSCO_LOGFILE) ; then \
|
||||
mv $(CVSCO_LOGFILE) $(CVSCO_LOGFILE).old; \
|
||||
else true; \
|
||||
fi
|
||||
ifdef RUN_AUTOCONF_LOCALLY
|
||||
@echo "Removing local configures" ; \
|
||||
cd $(ROOTDIR) && \
|
||||
$(RM) -f mozilla/configure mozilla/nsprpub/configure \
|
||||
mozilla/directory/c-sdk/configure
|
||||
endif
|
||||
@echo "checkout start: "`date` | tee $(CVSCO_LOGFILE)
|
||||
@echo '$(CVSCO) mozilla/client.mk mozilla/build/unix/modules.mk'; \
|
||||
cd $(ROOTDIR) && \
|
||||
$(CVSCO) mozilla/client.mk mozilla/build/unix/modules.mk
|
||||
@cd $(ROOTDIR) && $(MAKE) -f mozilla/client.mk real_checkout
|
||||
|
||||
real_checkout:
|
||||
# @: Start the checkout. Split the output to the tty and a log file. \
|
||||
# : If it fails, touch an error file because "tee" hides the error.
|
||||
@failed=.cvs-failed.tmp; rm -f $$failed*; \
|
||||
cvs_co() { echo "$$@" ; \
|
||||
("$$@" || touch $$failed) 2>&1 | tee -a $(CVSCO_LOGFILE) && \
|
||||
if test -f $$failed; then false; else true; fi; }; \
|
||||
cvs_co $(CVSCO_NSPR) && \
|
||||
cvs_co $(CVSCO_NSS) && \
|
||||
cvs_co $(CVSCO_PSM) && \
|
||||
cvs_co $(CVSCO_LDAPCSDK) && \
|
||||
cvs_co $(CVSCO_ACCESSIBLE) && \
|
||||
cvs_co $(CVSCO_GFX2) && \
|
||||
cvs_co $(CVSCO_IMGLIB2) && \
|
||||
$(CHECKOUT_CALENDAR) && \
|
||||
$(CHECKOUT_LIBART) && \
|
||||
cvs_co $(CVSCO_SEAMONKEY) && \
|
||||
cvs_co $(CVSCO_NOSUBDIRS)
|
||||
@echo "checkout finish: "`date` | tee -a $(CVSCO_LOGFILE)
|
||||
# @: Check the log for conflicts. ;
|
||||
@conflicts=`egrep "^C " $(CVSCO_LOGFILE)` ;\
|
||||
if test "$$conflicts" ; then \
|
||||
echo "$(MAKE): *** Conflicts during checkout." ;\
|
||||
echo "$$conflicts" ;\
|
||||
echo "$(MAKE): Refer to $(CVSCO_LOGFILE) for full log." ;\
|
||||
false; \
|
||||
else true; \
|
||||
fi
|
||||
ifdef RUN_AUTOCONF_LOCALLY
|
||||
@echo Generating configures using $(AUTOCONF) ; \
|
||||
cd $(TOPSRCDIR) && $(AUTOCONF) && \
|
||||
cd $(TOPSRCDIR)/nsprpub && $(AUTOCONF) && \
|
||||
cd $(TOPSRCDIR)/directory/c-sdk && $(AUTOCONF)
|
||||
endif
|
||||
|
||||
fast-update:
|
||||
# @: Backup the last checkout log.
|
||||
@if test -f $(CVSCO_LOGFILE) ; then \
|
||||
mv $(CVSCO_LOGFILE) $(CVSCO_LOGFILE).old; \
|
||||
else true; \
|
||||
fi
|
||||
ifdef RUN_AUTOCONF_LOCALLY
|
||||
@echo "Removing local configures" ; \
|
||||
cd $(ROOTDIR) && \
|
||||
$(RM) -f mozilla/configure mozilla/nsprpub/configure \
|
||||
mozilla/directory/c-sdk/configure
|
||||
endif
|
||||
@echo "checkout start: "`date` | tee $(CVSCO_LOGFILE)
|
||||
@echo '$(CVSCO) mozilla/client.mk mozilla/build/unix/modules.mk'; \
|
||||
cd $(ROOTDIR) && \
|
||||
$(CVSCO) mozilla/client.mk mozilla/build/unix/modules.mk
|
||||
@cd $(TOPSRCDIR) && \
|
||||
$(MAKE) -f client.mk real_fast-update
|
||||
|
||||
real_fast-update:
|
||||
# @: Start the update. Split the output to the tty and a log file. \
|
||||
# : If it fails, touch an error file because "tee" hides the error.
|
||||
@failed=.fast_update-failed.tmp; rm -f $$failed*; \
|
||||
fast_update() { (config/cvsco-fast-update.pl $$@ || touch $$failed) 2>&1 | tee -a $(CVSCO_LOGFILE) && \
|
||||
if test -f $$failed; then false; else true; fi; }; \
|
||||
cvs_co() { echo "$$@" ; \
|
||||
("$$@" || touch $$failed) 2>&1 | tee -a $(CVSCO_LOGFILE) && \
|
||||
if test -f $$failed; then false; else true; fi; }; \
|
||||
fast_update $(CVSCO_NSPR) && \
|
||||
cd $(ROOTDIR) && \
|
||||
failed=mozilla/.fast_update-failed.tmp && \
|
||||
cvs_co $(CVSCO_NSS) && \
|
||||
failed=.fast_update-failed.tmp && \
|
||||
cd mozilla && \
|
||||
fast_update $(CVSCO_PSM) && \
|
||||
fast_update $(CVSCO_LDAPCSDK) && \
|
||||
fast_update $(CVSCO_ACCESSIBLE) && \
|
||||
fast_update $(CVSCO_GFX2) && \
|
||||
fast_update $(CVSCO_IMGLIB2) && \
|
||||
$(FASTUPDATE_CALENDAR) && \
|
||||
$(FASTUPDATE_LIBART) && \
|
||||
fast_update $(CVSCO_SEAMONKEY) && \
|
||||
fast_update $(CVSCO_NOSUBDIRS)
|
||||
@echo "fast_update finish: "`date` | tee -a $(CVSCO_LOGFILE)
|
||||
# @: Check the log for conflicts. ;
|
||||
@conflicts=`egrep "^C " $(CVSCO_LOGFILE)` ;\
|
||||
if test "$$conflicts" ; then \
|
||||
echo "$(MAKE): *** Conflicts during fast-update." ;\
|
||||
echo "$$conflicts" ;\
|
||||
echo "$(MAKE): Refer to $(CVSCO_LOGFILE) for full log." ;\
|
||||
false; \
|
||||
else true; \
|
||||
fi
|
||||
ifdef RUN_AUTOCONF_LOCALLY
|
||||
@echo Generating configures using $(AUTOCONF) ; \
|
||||
cd $(TOPSRCDIR) && $(AUTOCONF) && \
|
||||
cd $(TOPSRCDIR)/nsprpub && $(AUTOCONF) && \
|
||||
cd $(TOPSRCDIR)/directory/c-sdk && $(AUTOCONF)
|
||||
endif
|
||||
|
||||
####################################
|
||||
# Web configure
|
||||
|
||||
WEBCONFIG_FILE := $(HOME)/.mozconfig
|
||||
|
||||
MOZCONFIG2CONFIGURATOR := build/autoconf/mozconfig2configurator
|
||||
webconfig:
|
||||
@cd $(TOPSRCDIR); \
|
||||
url=`$(MOZCONFIG2CONFIGURATOR) $(TOPSRCDIR)`; \
|
||||
echo Running mozilla with the following url: ;\
|
||||
echo ;\
|
||||
echo $$url ;\
|
||||
mozilla -remote "openURL($$url)" || \
|
||||
netscape -remote "openURL($$url)" || \
|
||||
mozilla $$url || \
|
||||
netscape $$url ;\
|
||||
echo ;\
|
||||
echo 1. Fill out the form on the browser. ;\
|
||||
echo 2. Save the results to $(WEBCONFIG_FILE)
|
||||
|
||||
#####################################################
|
||||
# First Checkout
|
||||
|
||||
ifdef _IS_FIRST_CHECKOUT
|
||||
# First time, do build target in a new process to pick up new files.
|
||||
build::
|
||||
$(MAKE) -f $(TOPSRCDIR)/client.mk build
|
||||
else
|
||||
|
||||
#####################################################
|
||||
# After First Checkout
|
||||
|
||||
|
||||
####################################
|
||||
# Configure
|
||||
|
||||
CONFIG_STATUS := $(wildcard $(OBJDIR)/config.status)
|
||||
CONFIG_CACHE := $(wildcard $(OBJDIR)/config.cache)
|
||||
|
||||
ifdef RUN_AUTOCONF_LOCALLY
|
||||
EXTRA_CONFIG_DEPS := \
|
||||
$(TOPSRCDIR)/aclocal.m4 \
|
||||
$(wildcard $(TOPSRCDIR)/build/autoconf/*.m4) \
|
||||
$(NULL)
|
||||
|
||||
$(TOPSRCDIR)/configure: $(TOPSRCDIR)/configure.in $(EXTRA_CONFIG_DEPS)
|
||||
@echo Generating $@ using autoconf
|
||||
cd $(TOPSRCDIR); $(AUTOCONF)
|
||||
endif
|
||||
|
||||
CONFIG_STATUS_DEPS_L10N := $(wildcard $(TOPSRCDIR)/l10n/makefiles.all)
|
||||
|
||||
CONFIG_STATUS_DEPS := \
|
||||
$(TOPSRCDIR)/configure \
|
||||
$(TOPSRCDIR)/allmakefiles.sh \
|
||||
$(TOPSRCDIR)/.mozconfig.mk \
|
||||
$(wildcard $(TOPSRCDIR)/nsprpub/configure) \
|
||||
$(wildcard $(TOPSRCDIR)/directory/c-sdk/configure) \
|
||||
$(wildcard $(TOPSRCDIR)/mailnews/makefiles) \
|
||||
$(CONFIG_STATUS_DEPS_L10N) \
|
||||
$(wildcard $(TOPSRCDIR)/themes/makefiles) \
|
||||
$(NULL)
|
||||
|
||||
# configure uses the program name to determine @srcdir@. Calling it without
|
||||
# $(TOPSRCDIR) will set @srcdir@ to "."; otherwise, it is set to the full
|
||||
# path of $(TOPSRCDIR).
|
||||
ifeq ($(TOPSRCDIR),$(OBJDIR))
|
||||
CONFIGURE := ./configure
|
||||
else
|
||||
CONFIGURE := $(TOPSRCDIR)/configure
|
||||
endif
|
||||
|
||||
ifdef _OBJ2SRCPATH
|
||||
CONFIGURE_ARGS := --srcdir=$(_OBJ2SRCPATH) $(CONFIGURE_ARGS)
|
||||
endif
|
||||
|
||||
$(OBJDIR)/Makefile $(OBJDIR)/config.status: $(CONFIG_STATUS_DEPS)
|
||||
@if test ! -d $(OBJDIR); then $(MKDIR) $(OBJDIR); else true; fi
|
||||
@echo cd $(OBJDIR);
|
||||
@echo $(CONFIGURE) $(CONFIGURE_ARGS)
|
||||
@cd $(OBJDIR) && $(CONFIGURE_ENV_ARGS) $(CONFIGURE) $(CONFIGURE_ARGS) \
|
||||
|| ( echo "*** Fix above errors and then restart with\
|
||||
\"$(MAKE) -f client.mk build\"" && exit 1 )
|
||||
@touch $(OBJDIR)/Makefile
|
||||
|
||||
ifdef CONFIG_STATUS
|
||||
$(OBJDIR)/config/autoconf.mk: $(TOPSRCDIR)/config/autoconf.mk.in
|
||||
cd $(OBJDIR); \
|
||||
CONFIG_FILES=config/autoconf.mk ./config.status
|
||||
endif
|
||||
|
||||
|
||||
####################################
|
||||
# Depend
|
||||
|
||||
depend:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
|
||||
$(MOZ_MAKE) export && $(MOZ_MAKE) depend
|
||||
|
||||
####################################
|
||||
# Build it
|
||||
|
||||
build:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
|
||||
$(MOZ_MAKE)
|
||||
|
||||
####################################
|
||||
# Other targets
|
||||
|
||||
# Pass these target onto the real build system
|
||||
install export libs clean realclean distclean alldep:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
|
||||
$(MOZ_MAKE) $@
|
||||
|
||||
cleansrcdir:
|
||||
@cd $(TOPSRCDIR); \
|
||||
if [ -f webshell/embed/gtk/Makefile ]; then \
|
||||
$(MAKE) -C webshell/embed/gtk distclean; \
|
||||
fi; \
|
||||
if [ -f Makefile ]; then \
|
||||
$(MAKE) distclean ; \
|
||||
else \
|
||||
echo "Removing object files from srcdir..."; \
|
||||
rm -fr `find . -type d \( -name .deps -print -o -name CVS \
|
||||
-o -exec test ! -d {}/CVS \; \) -prune \
|
||||
-o \( -name '*.[ao]' -o -name '*.so' \) -type f -print`; \
|
||||
build/autoconf/clean-config.sh; \
|
||||
fi;
|
||||
|
||||
# (! IS_FIRST_CHECKOUT)
|
||||
endif
|
||||
|
||||
.PHONY: checkout real_checkout depend build export libs alldep install clean realclean distclean cleansrcdir pull_all build_all clobber clobber_all pull_and_build_all everything
|
||||
49
mozilla/content/xul/content/public/nsIXULPopupListener.h
Normal file
49
mozilla/content/xul/content/public/nsIXULPopupListener.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/* -*- 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.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):
|
||||
*/
|
||||
|
||||
#ifndef nsIXULPopupListener_h__
|
||||
#define nsIXULPopupListener_h__
|
||||
|
||||
// {2C453161-0942-11d3-BF87-00105A1B0627}
|
||||
#define NS_IXULPOPUPLISTENER_IID \
|
||||
{ 0x2c453161, 0x942, 0x11d3, { 0xbf, 0x87, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } }
|
||||
|
||||
class nsIDOMElement;
|
||||
|
||||
typedef enum {
|
||||
eXULPopupType_popup,
|
||||
eXULPopupType_context,
|
||||
eXULPopupType_tooltip,
|
||||
eXULPopupType_blur
|
||||
} XULPopupType;
|
||||
|
||||
class nsIXULPopupListener: public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IXULPOPUPLISTENER_IID; return iid; }
|
||||
|
||||
NS_IMETHOD Init(nsIDOMElement* anElement, const XULPopupType& aPopupType) = 0;
|
||||
};
|
||||
|
||||
extern nsresult
|
||||
NS_NewXULPopupListener(nsIXULPopupListener** result);
|
||||
|
||||
#endif // nsIXULPopupListener_h__
|
||||
43
mozilla/content/xul/content/src/nsIRDFNodeList.h
Normal file
43
mozilla/content/xul/content/src/nsIRDFNodeList.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/* -*- 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):
|
||||
*/
|
||||
|
||||
#ifndef nsIRDFNodeList_h__
|
||||
#define nsIRDFNodeList_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
// {661D1971-5CD2-11d3-BE36-00104BDE6048}
|
||||
#define NS_IRDFNODELIST_IID \
|
||||
{ 0x661d1971, 0x5cd2, 0x11d3, { 0xbe, 0x36, 0x0, 0x10, 0x4b, 0xde, 0x60, 0x48 } }
|
||||
|
||||
class nsIRDFNodeList : public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IRDFNODELIST_IID; return iid; }
|
||||
|
||||
NS_IMETHOD AppendNode(nsIDOMNode* aNode) = 0;
|
||||
NS_IMETHOD RemoveNode(nsIDOMNode* aNode) = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif // nsIRDFNodeList_h__
|
||||
|
||||
47
mozilla/content/xul/content/src/nsIXULTreeContent.h
Normal file
47
mozilla/content/xul/content/src/nsIXULTreeContent.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/* -*- 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):
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
A private interface to the tree element
|
||||
|
||||
*/
|
||||
|
||||
#ifndef nsIXULTreeContent_h__
|
||||
#define nsIXULTreeContent_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
// {661D1970-5CD2-11d3-BE36-00104BDE6048}
|
||||
#define NS_IXULTREECONTENT_IID \
|
||||
{ 0x661d1970, 0x5cd2, 0x11d3, { 0xbe, 0x36, 0x0, 0x10, 0x4b, 0xde, 0x60, 0x48 } }
|
||||
|
||||
|
||||
class nsIXULTreeContent : public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IXULTREECONTENT_IID; return iid; }
|
||||
|
||||
NS_IMETHOD FireOnSelectHandler() = 0;
|
||||
};
|
||||
|
||||
#endif // nsIXULTreeContent_h__
|
||||
241
mozilla/content/xul/content/src/nsRDFDOMNodeList.cpp
Normal file
241
mozilla/content/xul/content/src/nsRDFDOMNodeList.cpp
Normal file
@@ -0,0 +1,241 @@
|
||||
/* -*- 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):
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Helper class to implement the nsIDOMNodeList interface.
|
||||
|
||||
XXX It's probably wrong in some sense, as it uses the "naked"
|
||||
content interface to look for kids. (I assume in general this is
|
||||
bad because there may be pseudo-elements created for presentation
|
||||
that aren't visible to the DOM.)
|
||||
|
||||
*/
|
||||
|
||||
#include "nsDOMCID.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMScriptObjectFactory.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsRDFDOMNodeList.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// GUID definitions
|
||||
|
||||
static NS_DEFINE_IID(kIDOMNodeIID, NS_IDOMNODE_IID);
|
||||
static NS_DEFINE_IID(kIDOMNodeListIID, NS_IDOMNODELIST_IID);
|
||||
static NS_DEFINE_IID(kIDOMScriptObjectFactoryIID, NS_IDOM_SCRIPT_OBJECT_FACTORY_IID);
|
||||
|
||||
static NS_DEFINE_CID(kDOMScriptObjectFactoryCID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// ctors & dtors
|
||||
|
||||
|
||||
nsRDFDOMNodeList::nsRDFDOMNodeList(void)
|
||||
: //mInner(nsnull), Not being used?
|
||||
mElements(nsnull),
|
||||
mScriptObject(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsRDFDOMNodeList::~nsRDFDOMNodeList(void)
|
||||
{
|
||||
#ifdef DEBUG_REFS
|
||||
--gInstanceCount;
|
||||
fprintf(stdout, "%d - RDF: nsRDFDOMNodeList\n", gInstanceCount);
|
||||
#endif
|
||||
|
||||
NS_IF_RELEASE(mElements);
|
||||
//delete mInner; Not being used?
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsRDFDOMNodeList::Create(nsRDFDOMNodeList** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsRDFDOMNodeList* list = new nsRDFDOMNodeList();
|
||||
if (! list)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv;
|
||||
if (NS_FAILED(rv = list->Init())) {
|
||||
delete list;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_ADDREF(list);
|
||||
*aResult = list;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsISupports interface
|
||||
|
||||
NS_IMPL_ADDREF(nsRDFDOMNodeList);
|
||||
NS_IMPL_RELEASE(nsRDFDOMNodeList);
|
||||
|
||||
nsresult
|
||||
nsRDFDOMNodeList::QueryInterface(REFNSIID aIID, void** aResult)
|
||||
{
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
|
||||
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsIDOMNodeList>::GetIID()) ||
|
||||
aIID.Equals(kISupportsIID)) {
|
||||
*aResult = NS_STATIC_CAST(nsIDOMNodeList*, this);
|
||||
}
|
||||
else if (aIID.Equals(nsCOMTypeInfo<nsIRDFNodeList>::GetIID())) {
|
||||
*aResult = NS_STATIC_CAST(nsIRDFNodeList*, this);
|
||||
}
|
||||
else if (aIID.Equals(kIScriptObjectOwnerIID)) {
|
||||
*aResult = NS_STATIC_CAST(nsIScriptObjectOwner*, this);
|
||||
}
|
||||
else {
|
||||
*aResult = nsnull;
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_ADDREF(this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsIDOMNodeList interface
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRDFDOMNodeList::GetLength(PRUint32* aLength)
|
||||
{
|
||||
NS_ASSERTION(aLength != nsnull, "null ptr");
|
||||
if (! aLength)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
PRUint32 cnt;
|
||||
nsresult rv = mElements->Count(&cnt);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
*aLength = cnt;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRDFDOMNodeList::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
|
||||
{
|
||||
NS_PRECONDITION(aReturn != nsnull, "null ptr");
|
||||
if (! aReturn)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
PRUint32 cnt;
|
||||
nsresult rv = mElements->Count(&cnt);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
NS_PRECONDITION(aIndex < cnt, "invalid arg");
|
||||
if (aIndex >= (PRUint32) cnt)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
// Cast is okay because we're in a closed system.
|
||||
*aReturn = (nsIDOMNode*) mElements->ElementAt(aIndex);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsIScriptObjectOwner interface
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRDFDOMNodeList::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsIScriptGlobalObject* global = aContext->GetGlobalObject();
|
||||
|
||||
if (nsnull == mScriptObject) {
|
||||
nsIDOMScriptObjectFactory *factory;
|
||||
|
||||
if (NS_SUCCEEDED(rv = nsServiceManager::GetService(kDOMScriptObjectFactoryCID,
|
||||
kIDOMScriptObjectFactoryIID,
|
||||
(nsISupports **)&factory))) {
|
||||
rv = factory->NewScriptNodeList(aContext,
|
||||
(nsISupports*)(nsIDOMNodeList*)this,
|
||||
global,
|
||||
(void**)&mScriptObject);
|
||||
|
||||
nsServiceManager::ReleaseService(kDOMScriptObjectFactoryCID, factory);
|
||||
}
|
||||
}
|
||||
*aScriptObject = mScriptObject;
|
||||
|
||||
NS_RELEASE(global);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRDFDOMNodeList::SetScriptObject(void* aScriptObject)
|
||||
{
|
||||
mScriptObject = aScriptObject;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Implementation methods
|
||||
|
||||
nsresult
|
||||
nsRDFDOMNodeList::Init(void)
|
||||
{
|
||||
nsresult rv;
|
||||
if (NS_FAILED(rv = NS_NewISupportsArray(&mElements))) {
|
||||
NS_ERROR("unable to create elements array");
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRDFDOMNodeList::AppendNode(nsIDOMNode* aNode)
|
||||
{
|
||||
NS_PRECONDITION(aNode != nsnull, "null ptr");
|
||||
if (! aNode)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
return mElements->AppendElement(aNode);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRDFDOMNodeList::RemoveNode(nsIDOMNode* aNode)
|
||||
{
|
||||
NS_PRECONDITION(aNode != nsnull, "null ptr");
|
||||
if (! aNode)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
return mElements->RemoveElement(aNode);
|
||||
}
|
||||
64
mozilla/content/xul/content/src/nsRDFDOMNodeList.h
Normal file
64
mozilla/content/xul/content/src/nsRDFDOMNodeList.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/* -*- 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):
|
||||
*/
|
||||
|
||||
#ifndef nsRDFDOMNodeList_h__
|
||||
#define nsRDFDOMNodeList_h__
|
||||
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIRDFNodeList.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
class nsIDOMNode;
|
||||
class nsISupportsArray;
|
||||
|
||||
class nsRDFDOMNodeList : public nsIDOMNodeList,
|
||||
public nsIRDFNodeList,
|
||||
public nsIScriptObjectOwner
|
||||
{
|
||||
private:
|
||||
//nsISupports* mInner; Not being used?
|
||||
nsISupportsArray* mElements;
|
||||
void* mScriptObject;
|
||||
|
||||
nsRDFDOMNodeList(void);
|
||||
nsresult Init(void);
|
||||
|
||||
public:
|
||||
static nsresult Create(nsRDFDOMNodeList** aResult);
|
||||
virtual ~nsRDFDOMNodeList(void);
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMNodeList interface
|
||||
NS_DECL_IDOMNODELIST
|
||||
|
||||
// nsIScriptObjectOwner interface
|
||||
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
|
||||
NS_IMETHOD SetScriptObject(void* aScriptObject);
|
||||
|
||||
// Implementation methods
|
||||
NS_IMETHOD AppendNode(nsIDOMNode* aNode);
|
||||
NS_IMETHOD RemoveNode(nsIDOMNode* aNode);
|
||||
};
|
||||
|
||||
#endif // nsRDFDOMNodeList_h__
|
||||
|
||||
705
mozilla/content/xul/content/src/nsXULAttributes.cpp
Normal file
705
mozilla/content/xul/content/src/nsXULAttributes.cpp
Normal file
@@ -0,0 +1,705 @@
|
||||
/* -*- 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):
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
A helper class used to implement attributes.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Notes
|
||||
*
|
||||
* A lot of these methods delegate back to the original content node
|
||||
* that created them. This is so that we can lazily produce attribute
|
||||
* values from the RDF graph as they're asked for.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDOMCID.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsICSSParser.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMScriptObjectFactory.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsXULAttributes.h"
|
||||
#include "nsLayoutCID.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_CID(kDOMScriptObjectFactoryCID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
|
||||
static NS_DEFINE_CID(kCSSParserCID, NS_CSSPARSER_CID);
|
||||
static NS_DEFINE_CID(kICSSParserIID, NS_ICSS_PARSER_IID);
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//
|
||||
// nsClassList
|
||||
//
|
||||
|
||||
PRBool
|
||||
nsClassList::HasClass(nsClassList* aList, nsIAtom* aClass)
|
||||
{
|
||||
const nsClassList* classList = aList;
|
||||
while (nsnull != classList) {
|
||||
if (classList->mAtom.get() == aClass) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
classList = classList->mNext;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsClassList::GetClasses(nsClassList* aList, nsVoidArray& aArray)
|
||||
{
|
||||
aArray.Clear();
|
||||
const nsClassList* classList = aList;
|
||||
while (nsnull != classList) {
|
||||
aArray.AppendElement(classList->mAtom); // NOTE atom is not addrefed
|
||||
classList = classList->mNext;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
nsresult
|
||||
nsClassList::ParseClasses(nsClassList** aList, const nsString& aClassString)
|
||||
{
|
||||
static const PRUnichar kNullCh = PRUnichar('\0');
|
||||
|
||||
if (*aList != nsnull) {
|
||||
delete *aList;
|
||||
*aList = nsnull;
|
||||
}
|
||||
|
||||
if (aClassString.Length() > 0) {
|
||||
nsAutoString classStr(aClassString); // copy to work buffer
|
||||
classStr.Append(kNullCh); // put an extra null at the end
|
||||
|
||||
PRUnichar* start = (PRUnichar*)(const PRUnichar*)classStr.GetUnicode();
|
||||
PRUnichar* end = start;
|
||||
|
||||
while (kNullCh != *start) {
|
||||
while ((kNullCh != *start) && nsString::IsSpace(*start)) { // skip leading space
|
||||
start++;
|
||||
}
|
||||
end = start;
|
||||
|
||||
while ((kNullCh != *end) && (PR_FALSE == nsString::IsSpace(*end))) { // look for space or end
|
||||
end++;
|
||||
}
|
||||
*end = kNullCh; // end string here
|
||||
|
||||
if (start < end) {
|
||||
*aList = new nsClassList(NS_NewAtom(start));
|
||||
aList = &((*aList)->mNext);
|
||||
}
|
||||
|
||||
start = ++end;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//
|
||||
// nsXULAttribute
|
||||
//
|
||||
|
||||
|
||||
nsXULAttribute::nsXULAttribute(nsIContent* aContent,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aName,
|
||||
const nsString& aValue)
|
||||
: mNameSpaceID(aNameSpaceID),
|
||||
mName(aName),
|
||||
mValue(aValue),
|
||||
mContent(aContent),
|
||||
mScriptObject(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
NS_IF_ADDREF(aName);
|
||||
}
|
||||
|
||||
nsXULAttribute::~nsXULAttribute()
|
||||
{
|
||||
NS_IF_RELEASE(mName);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULAttribute::Create(nsIContent* aContent,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aName,
|
||||
const nsString& aValue,
|
||||
nsXULAttribute** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (! (*aResult = new nsXULAttribute(aContent, aNameSpaceID, aName, aValue)))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsISupports interface
|
||||
NS_IMPL_ADDREF(nsXULAttribute);
|
||||
NS_IMPL_RELEASE(nsXULAttribute);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttribute::QueryInterface(REFNSIID aIID, void** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aIID.Equals(nsIDOMAttr::GetIID()) ||
|
||||
aIID.Equals(nsIDOMNode::GetIID()) ||
|
||||
aIID.Equals(kISupportsIID)) {
|
||||
*aResult = NS_STATIC_CAST(nsIDOMAttr*, this);
|
||||
NS_ADDREF(this);
|
||||
return NS_OK;
|
||||
}
|
||||
else if (aIID.Equals(nsIScriptObjectOwner::GetIID())) {
|
||||
*aResult = NS_STATIC_CAST(nsIScriptObjectOwner*, this);
|
||||
NS_ADDREF(this);
|
||||
return NS_OK;
|
||||
}
|
||||
else {
|
||||
*aResult = nsnull;
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
// nsIDOMNode interface
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttribute::GetNodeName(nsString& aNodeName)
|
||||
{
|
||||
const PRUnichar *unicodeString;
|
||||
mName->GetUnicode(&unicodeString);
|
||||
|
||||
aNodeName.SetString(unicodeString);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttribute::GetNodeValue(nsString& aNodeValue)
|
||||
{
|
||||
aNodeValue=mValue;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP
|
||||
nsXULAttribute::SetNodeValue(const nsString& aNodeValue)
|
||||
{
|
||||
return SetValue(aNodeValue);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttribute::GetNodeType(PRUint16* aNodeType)
|
||||
{
|
||||
*aNodeType = (PRUint16)nsIDOMNode::ATTRIBUTE_NODE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttribute::GetParentNode(nsIDOMNode** aParentNode)
|
||||
{
|
||||
*aParentNode = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttribute::GetChildNodes(nsIDOMNodeList** aChildNodes)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("write me");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttribute::GetFirstChild(nsIDOMNode** aFirstChild)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("write me");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttribute::GetLastChild(nsIDOMNode** aLastChild)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("write me");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttribute::GetPreviousSibling(nsIDOMNode** aPreviousSibling)
|
||||
{
|
||||
*aPreviousSibling = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttribute::GetNextSibling(nsIDOMNode** aNextSibling)
|
||||
{
|
||||
*aNextSibling = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttribute::GetAttributes(nsIDOMNamedNodeMap** aAttributes)
|
||||
{
|
||||
*aAttributes = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttribute::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("write me");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttribute::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttribute::ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttribute::RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttribute::AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttribute::HasChildNodes(PRBool* aReturn)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("write me");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttribute::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("write me");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// nsIDOMAttr interface
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttribute::GetName(nsString& aName)
|
||||
{
|
||||
const PRUnichar *unicodeString;
|
||||
mName->GetUnicode(&unicodeString);
|
||||
aName.SetString(unicodeString);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttribute::GetSpecified(PRBool* aSpecified)
|
||||
{
|
||||
// XXX this'll break when we make Clone() work
|
||||
*aSpecified = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttribute::GetValue(nsString& aValue)
|
||||
{
|
||||
aValue=mValue;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttribute::SetValue(const nsString& aValue)
|
||||
{
|
||||
// We call back to the content node's SetValue() method so we can
|
||||
// share all of the work that it does.
|
||||
nsCOMPtr<nsIDOMElement> element( do_QueryInterface(mContent) );
|
||||
if (element) {
|
||||
nsAutoString qualifiedName;
|
||||
GetQualifiedName(qualifiedName);
|
||||
return element->SetAttribute(qualifiedName, aValue);
|
||||
}
|
||||
else {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// nsIScriptObjectOwner interface
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttribute::GetScriptObject(nsIScriptContext* aContext, void** aScriptObject)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (! mScriptObject) {
|
||||
nsIDOMScriptObjectFactory *factory;
|
||||
|
||||
rv = nsServiceManager::GetService(kDOMScriptObjectFactoryCID,
|
||||
nsIDOMScriptObjectFactory::GetIID(),
|
||||
(nsISupports **)&factory);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = factory->NewScriptAttr(aContext,
|
||||
(nsISupports*)(nsIDOMAttr*) this,
|
||||
(nsISupports*) mContent,
|
||||
(void**) &mScriptObject);
|
||||
|
||||
nsServiceManager::ReleaseService(kDOMScriptObjectFactoryCID, factory);
|
||||
}
|
||||
|
||||
*aScriptObject = mScriptObject;
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttribute::SetScriptObject(void *aScriptObject)
|
||||
{
|
||||
mScriptObject = aScriptObject;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// Implementation methods
|
||||
|
||||
void
|
||||
nsXULAttribute::GetQualifiedName(nsString& aQualifiedName)
|
||||
{
|
||||
aQualifiedName.Truncate();
|
||||
if ((mNameSpaceID != kNameSpaceID_None) &&
|
||||
(mNameSpaceID != kNameSpaceID_Unknown)) {
|
||||
nsresult rv;
|
||||
|
||||
nsIAtom* prefix;
|
||||
rv = mContent->GetNameSpacePrefixFromId(mNameSpaceID, prefix);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && (prefix != nsnull)) {
|
||||
const PRUnichar *unicodeString;
|
||||
prefix->GetUnicode(&unicodeString);
|
||||
aQualifiedName.Append(unicodeString);
|
||||
aQualifiedName.Append(':');
|
||||
NS_RELEASE(prefix);
|
||||
}
|
||||
}
|
||||
const PRUnichar *unicodeString;
|
||||
mName->GetUnicode(&unicodeString);
|
||||
aQualifiedName.Append(unicodeString);
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//
|
||||
// nsXULAttributes
|
||||
//
|
||||
|
||||
nsXULAttributes::nsXULAttributes(nsIContent* aContent)
|
||||
: mContent(aContent),
|
||||
mClassList(nsnull),
|
||||
mStyleRule(nsnull),
|
||||
mScriptObject(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
|
||||
nsXULAttributes::~nsXULAttributes()
|
||||
{
|
||||
PRInt32 count = mAttributes.Count();
|
||||
for (PRInt32 indx = 0; indx < count; indx++) {
|
||||
nsXULAttribute* attr = NS_REINTERPRET_CAST(nsXULAttribute*, mAttributes.ElementAt(indx));
|
||||
NS_RELEASE(attr);
|
||||
}
|
||||
delete mClassList;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsXULAttributes::Create(nsIContent* aContent, nsXULAttributes** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (! (*aResult = new nsXULAttributes(aContent)))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// nsISupports interface
|
||||
|
||||
NS_IMPL_ADDREF(nsXULAttributes);
|
||||
NS_IMPL_RELEASE(nsXULAttributes);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttributes::QueryInterface(REFNSIID aIID, void** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aIID.Equals(nsIDOMNamedNodeMap::GetIID()) ||
|
||||
aIID.Equals(kISupportsIID)) {
|
||||
*aResult = NS_STATIC_CAST(nsIDOMNamedNodeMap*, this);
|
||||
NS_ADDREF(this);
|
||||
return NS_OK;
|
||||
}
|
||||
else if (aIID.Equals(nsIScriptObjectOwner::GetIID())) {
|
||||
*aResult = NS_STATIC_CAST(nsIScriptObjectOwner*, this);
|
||||
NS_ADDREF(this);
|
||||
return NS_OK;
|
||||
}
|
||||
else {
|
||||
*aResult = nsnull;
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// nsIDOMNamedNodeMap interface
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttributes::GetLength(PRUint32* aLength)
|
||||
{
|
||||
NS_PRECONDITION(aLength != nsnull, "null ptr");
|
||||
if (! aLength)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aLength = mAttributes.Count();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttributes::GetNamedItem(const nsString& aName, nsIDOMNode** aReturn)
|
||||
{
|
||||
NS_PRECONDITION(aReturn != nsnull, "null ptr");
|
||||
if (! aReturn)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsresult rv;
|
||||
*aReturn = nsnull;
|
||||
|
||||
PRInt32 nameSpaceID;
|
||||
nsIAtom* name;
|
||||
|
||||
if (NS_FAILED(rv = mContent->ParseAttributeString(aName, name, nameSpaceID)))
|
||||
return rv;
|
||||
|
||||
if (kNameSpaceID_Unknown == nameSpaceID) {
|
||||
nameSpaceID = kNameSpaceID_None; // ignore unknown prefix XXX is this correct?
|
||||
}
|
||||
// XXX doing this instead of calling mContent->GetAttribute() will
|
||||
// make it a lot harder to lazily instantiate properties from the
|
||||
// graph. The problem is, how else do we get the named item?
|
||||
for (PRInt32 i = mAttributes.Count() - 1; i >= 0; --i) {
|
||||
nsXULAttribute* attr = (nsXULAttribute*) mAttributes[i];
|
||||
if (((nameSpaceID == attr->GetNameSpaceID()) ||
|
||||
(nameSpaceID == kNameSpaceID_Unknown) ||
|
||||
(nameSpaceID == kNameSpaceID_None)) &&
|
||||
(name == attr->GetName())) {
|
||||
NS_ADDREF(attr);
|
||||
*aReturn = attr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
NS_RELEASE(name);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttributes::SetNamedItem(nsIDOMNode* aArg, nsIDOMNode** aReturn)
|
||||
{
|
||||
NS_NOTYETIMPLEMENTED("write me");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttributes::RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> element( do_QueryInterface(mContent) );
|
||||
if (element) {
|
||||
return element->RemoveAttribute(aName);
|
||||
*aReturn = nsnull; // XXX should be the element we just removed
|
||||
return NS_OK;
|
||||
}
|
||||
else {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttributes::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
|
||||
{
|
||||
*aReturn = (nsXULAttribute*) mAttributes[aIndex];
|
||||
NS_IF_ADDREF(*aReturn);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// nsIScriptObjectOwner interface
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttributes::GetScriptObject(nsIScriptContext* aContext, void** aScriptObject)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (! mScriptObject) {
|
||||
nsIDOMScriptObjectFactory *factory;
|
||||
|
||||
rv = nsServiceManager::GetService(kDOMScriptObjectFactoryCID,
|
||||
nsIDOMScriptObjectFactory::GetIID(),
|
||||
(nsISupports **)&factory);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = factory->NewScriptNamedNodeMap(aContext,
|
||||
(nsISupports*)(nsIDOMNamedNodeMap*) this,
|
||||
(nsISupports*) mContent,
|
||||
(void**) &mScriptObject);
|
||||
|
||||
nsServiceManager::ReleaseService(kDOMScriptObjectFactoryCID, factory);
|
||||
}
|
||||
|
||||
*aScriptObject = mScriptObject;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAttributes::SetScriptObject(void *aScriptObject)
|
||||
{
|
||||
mScriptObject = aScriptObject;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Implementation methods
|
||||
|
||||
nsresult
|
||||
nsXULAttributes::GetClasses(nsVoidArray& aArray) const
|
||||
{
|
||||
return nsClassList::GetClasses(mClassList, aArray);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULAttributes::HasClass(nsIAtom* aClass) const
|
||||
{
|
||||
return nsClassList::HasClass(mClassList, aClass) ? NS_OK : NS_COMFALSE;
|
||||
}
|
||||
|
||||
nsresult nsXULAttributes::SetClassList(nsClassList* aClassList)
|
||||
{
|
||||
delete mClassList;
|
||||
if (aClassList) {
|
||||
mClassList = new nsClassList(*aClassList);
|
||||
}
|
||||
else {
|
||||
mClassList = nsnull;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXULAttributes::UpdateClassList(const nsString& aValue)
|
||||
{
|
||||
return nsClassList::ParseClasses(&mClassList, aValue);
|
||||
}
|
||||
|
||||
nsresult nsXULAttributes::UpdateStyleRule(nsIURI* aDocURL, const nsString& aValue)
|
||||
{
|
||||
if (aValue == "")
|
||||
{
|
||||
// XXX: Removing the rule. Is this sufficient?
|
||||
mStyleRule = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsICSSParser> css;
|
||||
nsresult result = nsComponentManager::CreateInstance(kCSSParserCID,
|
||||
nsnull,
|
||||
kICSSParserIID,
|
||||
getter_AddRefs(css));
|
||||
if (NS_OK != result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIStyleRule> rule;
|
||||
result = css->ParseDeclarations(aValue, aDocURL, *getter_AddRefs(rule));
|
||||
|
||||
if ((NS_OK == result) && rule) {
|
||||
mStyleRule = rule;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult nsXULAttributes::SetInlineStyleRule(nsIStyleRule* aRule)
|
||||
{
|
||||
mStyleRule = aRule;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsXULAttributes::GetInlineStyleRule(nsIStyleRule*& aRule)
|
||||
{
|
||||
nsresult result = NS_ERROR_NULL_POINTER;
|
||||
if (mStyleRule != nsnull)
|
||||
{
|
||||
aRule = mStyleRule;
|
||||
NS_ADDREF(aRule);
|
||||
result = NS_OK;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
194
mozilla/content/xul/content/src/nsXULAttributes.h
Normal file
194
mozilla/content/xul/content/src/nsXULAttributes.h
Normal file
@@ -0,0 +1,194 @@
|
||||
/* -*- 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):
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
A set of helper classes used to implement attributes.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef nsXULAttributes_h__
|
||||
#define nsXULAttributes_h__
|
||||
|
||||
#include "nsIDOMAttr.h"
|
||||
#include "nsIDOMNamedNodeMap.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIStyleRule.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
class nsIURI;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class nsClassList {
|
||||
public:
|
||||
nsClassList(nsIAtom* aAtom)
|
||||
: mAtom(aAtom), mNext(nsnull)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsClassList);
|
||||
}
|
||||
|
||||
|
||||
nsClassList(const nsClassList& aCopy)
|
||||
: mAtom(aCopy.mAtom), mNext(nsnull)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsClassList);
|
||||
if (aCopy.mNext) mNext = new nsClassList(*(aCopy.mNext));
|
||||
}
|
||||
|
||||
nsClassList& operator=(const nsClassList& aClassList)
|
||||
{
|
||||
if (this != &aClassList) {
|
||||
delete mNext;
|
||||
mNext = nsnull;
|
||||
mAtom = aClassList.mAtom;
|
||||
|
||||
if (aClassList.mNext) {
|
||||
mNext = new nsClassList(*(aClassList.mNext));
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
~nsClassList(void)
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsClassList);
|
||||
delete mNext;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> mAtom;
|
||||
nsClassList* mNext;
|
||||
|
||||
static PRBool
|
||||
HasClass(nsClassList* aList, nsIAtom* aClass);
|
||||
|
||||
static nsresult
|
||||
GetClasses(nsClassList* aList, nsVoidArray& aArray);
|
||||
|
||||
static nsresult
|
||||
ParseClasses(nsClassList** aList, const nsString& aValue);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsXULAttribute : public nsIDOMAttr,
|
||||
public nsIScriptObjectOwner
|
||||
{
|
||||
protected:
|
||||
nsXULAttribute(nsIContent* aContent,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aName,
|
||||
const nsString& aValue);
|
||||
|
||||
virtual ~nsXULAttribute();
|
||||
|
||||
public:
|
||||
static nsresult
|
||||
Create(nsIContent* aContent,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aName,
|
||||
const nsString& aValue,
|
||||
nsXULAttribute** aResult);
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMNode interface
|
||||
NS_DECL_IDOMNODE
|
||||
|
||||
// nsIDOMAttr interface
|
||||
NS_DECL_IDOMATTR
|
||||
|
||||
// nsIScriptObjectOwner interface
|
||||
NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject);
|
||||
NS_IMETHOD SetScriptObject(void *aScriptObject);
|
||||
|
||||
// Implementation methods
|
||||
void GetQualifiedName(nsString& aAttributeName);
|
||||
|
||||
PRInt32 GetNameSpaceID() const { return mNameSpaceID; }
|
||||
nsIAtom* GetName() const { return mName; }
|
||||
void SetValueInternal(const nsString& aValue) { mValue = aValue; }
|
||||
|
||||
protected:
|
||||
PRInt32 mNameSpaceID;
|
||||
nsIAtom* mName;
|
||||
nsString mValue;
|
||||
nsIContent* mContent;
|
||||
void* mScriptObject;
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsXULAttributes : public nsIDOMNamedNodeMap,
|
||||
public nsIScriptObjectOwner
|
||||
{
|
||||
public:
|
||||
static nsresult
|
||||
Create(nsIContent* aElement, nsXULAttributes** aResult);
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMNamedNodeMap interface
|
||||
NS_DECL_IDOMNAMEDNODEMAP
|
||||
|
||||
// nsIScriptObjectOwner interface
|
||||
NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject);
|
||||
NS_IMETHOD SetScriptObject(void *aScriptObject);
|
||||
|
||||
// Implementation methods
|
||||
// VoidArray Helpers
|
||||
PRInt32 Count() { return mAttributes.Count(); };
|
||||
nsXULAttribute* ElementAt(PRInt32 i) { return (nsXULAttribute*)mAttributes.ElementAt(i); };
|
||||
void AppendElement(nsXULAttribute* aElement) { mAttributes.AppendElement((void*)aElement); };
|
||||
void RemoveElementAt(PRInt32 aIndex) { mAttributes.RemoveElementAt(aIndex); };
|
||||
|
||||
// Style Helpers
|
||||
nsresult GetClasses(nsVoidArray& aArray) const;
|
||||
nsresult HasClass(nsIAtom* aClass) const;
|
||||
|
||||
nsresult SetClassList(nsClassList* aClassList);
|
||||
nsresult UpdateClassList(const nsString& aValue);
|
||||
nsresult UpdateStyleRule(nsIURI* aDocURL, const nsString& aValue);
|
||||
|
||||
nsresult SetInlineStyleRule(nsIStyleRule* aRule);
|
||||
nsresult GetInlineStyleRule(nsIStyleRule*& aRule);
|
||||
|
||||
protected:
|
||||
nsXULAttributes(nsIContent* aContent);
|
||||
virtual ~nsXULAttributes();
|
||||
|
||||
nsIContent* mContent;
|
||||
nsClassList* mClassList;
|
||||
nsCOMPtr<nsIStyleRule> mStyleRule;
|
||||
nsVoidArray mAttributes;
|
||||
void* mScriptObject;
|
||||
};
|
||||
|
||||
|
||||
#endif // nsXULAttributes_h__
|
||||
|
||||
3651
mozilla/content/xul/content/src/nsXULElement.cpp
Normal file
3651
mozilla/content/xul/content/src/nsXULElement.cpp
Normal file
File diff suppressed because it is too large
Load Diff
509
mozilla/content/xul/content/src/nsXULElement.h
Normal file
509
mozilla/content/xul/content/src/nsXULElement.h
Normal file
@@ -0,0 +1,509 @@
|
||||
/* -*- 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):
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
The base XUL element class and associates.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef nsXULElement_h__
|
||||
#define nsXULElement_h__
|
||||
|
||||
// XXX because nsIEventListenerManager has broken includes
|
||||
#include "nslayout.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
|
||||
#include "nsForwardReference.h"
|
||||
#include "nsHTMLValue.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIControllers.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIDOMXULTreeElement.h"
|
||||
#include "nsIEventListenerManager.h"
|
||||
#include "nsIFocusableContent.h"
|
||||
#include "nsIJSScriptObject.h"
|
||||
#include "nsINameSpace.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIRDFCompositeDataSource.h"
|
||||
#include "nsIRDFResource.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIStyleRule.h"
|
||||
#include "nsIStyledContent.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIXMLContent.h"
|
||||
#include "nsIXULContent.h"
|
||||
#include "nsXULAttributes.h"
|
||||
|
||||
class nsIDocument;
|
||||
class nsIRDFService;
|
||||
class nsISupportsArray;
|
||||
class nsIXULContentUtils;
|
||||
class nsIXULPrototypeDocument;
|
||||
class nsRDFDOMNodeList;
|
||||
class nsString;
|
||||
class nsVoidArray;
|
||||
class nsXULAttributes;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
|
||||
A prototype attribute for an nsXULPrototypeElement.
|
||||
|
||||
*/
|
||||
|
||||
class nsXULPrototypeAttribute
|
||||
{
|
||||
public:
|
||||
nsXULPrototypeAttribute() : mNameSpaceID(kNameSpaceID_Unknown) {}
|
||||
|
||||
PRInt32 mNameSpaceID;
|
||||
nsCOMPtr<nsIAtom> mName;
|
||||
nsString mValue;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
|
||||
A prototype content model element that holds the "primordial" values
|
||||
that have been parsed from the original XUL document. A
|
||||
'lightweight' nsXULElement may delegate its representation to this
|
||||
structure, which is shared.
|
||||
|
||||
*/
|
||||
|
||||
class nsXULPrototypeElement;
|
||||
|
||||
class nsXULPrototypeNode
|
||||
{
|
||||
public:
|
||||
enum Type { eType_Element, eType_Script, eType_Text };
|
||||
|
||||
Type mType;
|
||||
PRInt32 mLineNo;
|
||||
|
||||
virtual ~nsXULPrototypeNode() {}
|
||||
|
||||
protected:
|
||||
nsXULPrototypeNode(Type aType, PRInt32 aLineNo)
|
||||
: mType(aType), mLineNo(aLineNo) {}
|
||||
};
|
||||
|
||||
class nsXULPrototypeElement : public nsXULPrototypeNode
|
||||
{
|
||||
public:
|
||||
nsXULPrototypeElement(PRInt32 aLineNo)
|
||||
: nsXULPrototypeNode(eType_Element, aLineNo),
|
||||
mDocument(nsnull),
|
||||
mNumChildren(0),
|
||||
mChildren(nsnull),
|
||||
mNumAttributes(0),
|
||||
mAttributes(nsnull),
|
||||
mClassList(nsnull)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsXULPrototypeElement);
|
||||
}
|
||||
|
||||
virtual ~nsXULPrototypeElement()
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsXULPrototypeElement);
|
||||
|
||||
delete[] mAttributes;
|
||||
delete mClassList;
|
||||
|
||||
for (PRInt32 i = mNumChildren - 1; i >= 0; --i)
|
||||
delete mChildren[i];
|
||||
|
||||
delete[] mChildren;
|
||||
}
|
||||
|
||||
|
||||
nsIXULPrototypeDocument* mDocument; // [WEAK] because doc is refcounted
|
||||
PRInt32 mNumChildren;
|
||||
nsXULPrototypeNode** mChildren; // [OWNER]
|
||||
|
||||
nsCOMPtr<nsINameSpace> mNameSpace; // [OWNER]
|
||||
nsCOMPtr<nsIAtom> mNameSpacePrefix; // [OWNER]
|
||||
PRInt32 mNameSpaceID;
|
||||
nsCOMPtr<nsIAtom> mTag; // [OWNER]
|
||||
|
||||
PRInt32 mNumAttributes;
|
||||
nsXULPrototypeAttribute* mAttributes; // [OWNER]
|
||||
|
||||
nsCOMPtr<nsIStyleRule> mInlineStyleRule; // [OWNER]
|
||||
nsClassList* mClassList;
|
||||
|
||||
nsresult GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsString& aValue);
|
||||
};
|
||||
|
||||
struct JSRuntime;
|
||||
struct JSObject;
|
||||
class nsXULDocument;
|
||||
|
||||
class nsXULPrototypeScript : public nsXULPrototypeNode
|
||||
{
|
||||
public:
|
||||
nsXULPrototypeScript(PRInt32 aLineNo, const char *aVersion);
|
||||
virtual ~nsXULPrototypeScript();
|
||||
|
||||
nsresult Compile(const PRUnichar* aText, PRInt32 aTextLength,
|
||||
nsIURI* aURI, PRInt32 aLineNo,
|
||||
nsIDocument* aDocument);
|
||||
|
||||
nsCOMPtr<nsIURI> mSrcURI;
|
||||
PRBool mSrcLoading;
|
||||
nsXULDocument* mSrcLoadWaiters; // [OWNER] but not COMPtr
|
||||
JSRuntime* mScriptRuntime; // XXX use service, save space?
|
||||
JSObject* mScriptObject;
|
||||
const char* mLangVersion;
|
||||
};
|
||||
|
||||
class nsXULPrototypeText : public nsXULPrototypeNode
|
||||
{
|
||||
public:
|
||||
nsXULPrototypeText(PRInt32 aLineNo)
|
||||
: nsXULPrototypeNode(eType_Text, aLineNo)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsXULPrototypeText);
|
||||
}
|
||||
|
||||
virtual ~nsXULPrototypeText()
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsXULPrototypeText);
|
||||
}
|
||||
|
||||
nsString mValue;
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
|
||||
This class serves as a base for aggregates that will implement a
|
||||
per-element XUL API.
|
||||
|
||||
*/
|
||||
|
||||
class nsXULAggregateElement : public nsISupports
|
||||
{
|
||||
protected:
|
||||
nsIDOMXULElement* mOuter;
|
||||
nsXULAggregateElement(nsIDOMXULElement* aOuter) : mOuter(aOuter) {}
|
||||
|
||||
public:
|
||||
virtual ~nsXULAggregateElement() {};
|
||||
|
||||
// nsISupports interface. Subclasses should use the
|
||||
// NS_DECL/IMPL_ISUPPORTS_INHERITED macros to implement the
|
||||
// nsISupports interface.
|
||||
NS_IMETHOD_(nsrefcnt) AddRef() {
|
||||
return mOuter->AddRef();
|
||||
}
|
||||
|
||||
NS_IMETHOD_(nsrefcnt) Release() {
|
||||
return mOuter->Release();
|
||||
}
|
||||
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aResult) {
|
||||
return mOuter->QueryInterface(aIID, aResult);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
|
||||
The XUL element.
|
||||
|
||||
*/
|
||||
|
||||
class nsXULElement : public nsIStyledContent,
|
||||
public nsIXMLContent,
|
||||
public nsIXULContent,
|
||||
public nsIFocusableContent,
|
||||
public nsIDOMXULElement,
|
||||
public nsIDOMEventReceiver,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIJSScriptObject,
|
||||
public nsIStyleRule
|
||||
{
|
||||
public:
|
||||
protected:
|
||||
// pseudo-constants
|
||||
static nsrefcnt gRefCnt;
|
||||
static nsIRDFService* gRDFService;
|
||||
static nsINameSpaceManager* gNameSpaceManager;
|
||||
static nsIXULContentUtils* gXULUtils;
|
||||
static PRInt32 kNameSpaceID_RDF;
|
||||
static PRInt32 kNameSpaceID_XUL;
|
||||
|
||||
static nsIAtom* kClassAtom;
|
||||
static nsIAtom* kContextAtom;
|
||||
static nsIAtom* kIdAtom;
|
||||
static nsIAtom* kObservesAtom;
|
||||
static nsIAtom* kPopupAtom;
|
||||
static nsIAtom* kRefAtom;
|
||||
static nsIAtom* kSelectedAtom;
|
||||
static nsIAtom* kStyleAtom;
|
||||
static nsIAtom* kTitledButtonAtom;
|
||||
static nsIAtom* kTooltipAtom;
|
||||
static nsIAtom* kTreeAtom;
|
||||
static nsIAtom* kTreeCellAtom;
|
||||
static nsIAtom* kTreeChildrenAtom;
|
||||
static nsIAtom* kTreeColAtom;
|
||||
static nsIAtom* kTreeItemAtom;
|
||||
static nsIAtom* kTreeRowAtom;
|
||||
static nsIAtom* kEditorAtom;
|
||||
static nsIAtom* kWindowAtom;
|
||||
|
||||
public:
|
||||
static nsresult
|
||||
Create(nsXULPrototypeElement* aPrototype, nsIDocument* aDocument, PRBool aIsScriptable, nsIContent** aResult);
|
||||
|
||||
static nsresult
|
||||
Create(PRInt32 aNameSpaceID, nsIAtom* aTag, nsIContent** aResult);
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIContent (from nsIStyledContent)
|
||||
NS_IMETHOD GetDocument(nsIDocument*& aResult) const;
|
||||
NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep);
|
||||
NS_IMETHOD GetParent(nsIContent*& aResult) const;
|
||||
NS_IMETHOD SetParent(nsIContent* aParent);
|
||||
NS_IMETHOD CanContainChildren(PRBool& aResult) const;
|
||||
NS_IMETHOD ChildCount(PRInt32& aResult) const;
|
||||
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIContent*& aResult) const;
|
||||
NS_IMETHOD IndexOf(nsIContent* aPossibleChild, PRInt32& aResult) const;
|
||||
NS_IMETHOD InsertChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify);
|
||||
NS_IMETHOD ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex, PRBool aNotify);
|
||||
NS_IMETHOD AppendChildTo(nsIContent* aKid, PRBool aNotify);
|
||||
NS_IMETHOD RemoveChildAt(PRInt32 aIndex, PRBool aNotify);
|
||||
NS_IMETHOD IsSynthetic(PRBool& aResult);
|
||||
NS_IMETHOD GetNameSpaceID(PRInt32& aNameSpeceID) const;
|
||||
NS_IMETHOD GetTag(nsIAtom*& aResult) const;
|
||||
NS_IMETHOD ParseAttributeString(const nsString& aStr, nsIAtom*& aName, PRInt32& aNameSpaceID);
|
||||
NS_IMETHOD GetNameSpacePrefixFromId(PRInt32 aNameSpaceID, nsIAtom*& aPrefix);
|
||||
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, const nsString& aValue, PRBool aNotify);
|
||||
NS_IMETHOD GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsString& aResult) const;
|
||||
NS_IMETHOD UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify);
|
||||
NS_IMETHOD GetAttributeNameAt(PRInt32 aIndex, PRInt32& aNameSpaceID,
|
||||
nsIAtom*& aName) const;
|
||||
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const;
|
||||
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
|
||||
NS_IMETHOD BeginConvertToXIF(nsXIFConverter& aConverter) const;
|
||||
NS_IMETHOD ConvertContentToXIF(nsXIFConverter& aConverter) const;
|
||||
NS_IMETHOD FinishConvertToXIF(nsXIFConverter& aConverter) const;
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
||||
NS_IMETHOD HandleDOMEvent(nsIPresContext& aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus& aEventStatus);
|
||||
|
||||
NS_IMETHOD GetContentID(PRUint32* aID);
|
||||
NS_IMETHOD SetContentID(PRUint32 aID);
|
||||
|
||||
NS_IMETHOD RangeAdd(nsIDOMRange& aRange);
|
||||
NS_IMETHOD RangeRemove(nsIDOMRange& aRange);
|
||||
NS_IMETHOD GetRangeList(nsVoidArray*& aResult) const;
|
||||
|
||||
// nsIStyledContent
|
||||
NS_IMETHOD GetID(nsIAtom*& aResult) const;
|
||||
NS_IMETHOD GetClasses(nsVoidArray& aArray) const;
|
||||
NS_IMETHOD HasClass(nsIAtom* aClass) const;
|
||||
|
||||
NS_IMETHOD GetContentStyleRules(nsISupportsArray* aRules);
|
||||
NS_IMETHOD GetInlineStyleRules(nsISupportsArray* aRules);
|
||||
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute,
|
||||
PRInt32& aHint) const;
|
||||
|
||||
// nsIXMLContent
|
||||
NS_IMETHOD SetContainingNameSpace(nsINameSpace* aNameSpace);
|
||||
NS_IMETHOD GetContainingNameSpace(nsINameSpace*& aNameSpace) const;
|
||||
NS_IMETHOD SetNameSpacePrefix(nsIAtom* aNameSpace);
|
||||
NS_IMETHOD GetNameSpacePrefix(nsIAtom*& aNameSpace) const;
|
||||
NS_IMETHOD SetNameSpaceID(PRInt32 aNameSpaceID);
|
||||
|
||||
// nsIXULContent
|
||||
NS_IMETHOD PeekChildCount(PRInt32& aCount) const;
|
||||
NS_IMETHOD SetLazyState(PRInt32 aFlags);
|
||||
NS_IMETHOD ClearLazyState(PRInt32 aFlags);
|
||||
NS_IMETHOD GetLazyState(PRInt32 aFlag, PRBool& aValue);
|
||||
NS_IMETHOD AddScriptEventListener(nsIAtom* aName, const nsString& aValue, REFNSIID aIID);
|
||||
NS_IMETHOD ForceElementToOwnResource(PRBool aForce);
|
||||
|
||||
// nsIFocusableContent interface
|
||||
NS_IMETHOD SetFocus(nsIPresContext* aPresContext);
|
||||
NS_IMETHOD RemoveFocus(nsIPresContext* aPresContext);
|
||||
|
||||
// nsIDOMNode (from nsIDOMElement)
|
||||
NS_DECL_IDOMNODE
|
||||
|
||||
// nsIDOMElement
|
||||
NS_DECL_IDOMELEMENT
|
||||
|
||||
// nsIDOMXULElement
|
||||
NS_DECL_IDOMXULELEMENT
|
||||
|
||||
// nsIDOMEventTarget interface (from nsIDOMEventReceiver)
|
||||
NS_IMETHOD AddEventListener(const nsString& aType, nsIDOMEventListener* aListener,
|
||||
PRBool aUseCapture);
|
||||
NS_IMETHOD RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener,
|
||||
PRBool aUseCapture);
|
||||
|
||||
// nsIDOMEventReceiver
|
||||
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);
|
||||
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);
|
||||
NS_IMETHOD GetListenerManager(nsIEventListenerManager** aInstancePtrResult);
|
||||
NS_IMETHOD GetNewListenerManager(nsIEventListenerManager **aInstancePtrResult);
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject);
|
||||
NS_IMETHOD SetScriptObject(void *aScriptObject);
|
||||
|
||||
// nsIJSScriptObject
|
||||
virtual PRBool AddProperty(JSContext *aContext, jsval aID, jsval *aVp);
|
||||
virtual PRBool DeleteProperty(JSContext *aContext, jsval aID, jsval *aVp);
|
||||
virtual PRBool GetProperty(JSContext *aContext, jsval aID, jsval *aVp);
|
||||
virtual PRBool SetProperty(JSContext *aContext, jsval aID, jsval *aVp);
|
||||
virtual PRBool EnumerateProperty(JSContext *aContext);
|
||||
virtual PRBool Resolve(JSContext *aContext, jsval aID);
|
||||
virtual PRBool Convert(JSContext *aContext, jsval aID);
|
||||
virtual void Finalize(JSContext *aContext);
|
||||
|
||||
// nsIStyleRule interface. The node implements this to deal with attributes that
|
||||
// need to be mapped into style contexts (e.g., width in treecols).
|
||||
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const;
|
||||
NS_IMETHOD GetStrength(PRInt32& aStrength) const;
|
||||
NS_IMETHOD MapFontStyleInto(nsIMutableStyleContext* aContext, nsIPresContext* aPresContext);
|
||||
NS_IMETHOD MapStyleInto(nsIMutableStyleContext* aContext, nsIPresContext* aPresContext);
|
||||
|
||||
protected:
|
||||
nsXULElement();
|
||||
nsresult Init();
|
||||
virtual ~nsXULElement(void);
|
||||
|
||||
|
||||
// Implementation methods
|
||||
nsresult EnsureContentsGenerated(void) const;
|
||||
|
||||
nsresult ExecuteOnBroadcastHandler(nsIDOMElement* anElement, const nsString& attrName);
|
||||
|
||||
PRBool ElementIsInDocument();
|
||||
|
||||
static nsresult
|
||||
ExecuteJSCode(nsIDOMElement* anElement, nsEvent* aEvent);
|
||||
|
||||
// Used with treecol width attributes
|
||||
static PRBool ParseNumericValue(const nsString& aString,
|
||||
PRInt32& aIntValue,
|
||||
float& aFloatValue,
|
||||
nsHTMLUnit& aValueUnit);
|
||||
|
||||
// Static helpers
|
||||
static nsresult
|
||||
GetElementsByTagName(nsIDOMNode* aNode,
|
||||
const nsString& aTagName,
|
||||
nsRDFDOMNodeList* aElements);
|
||||
|
||||
static nsresult
|
||||
GetElementsByAttribute(nsIDOMNode* aNode,
|
||||
const nsString& aAttributeName,
|
||||
const nsString& aAttributeValue,
|
||||
nsRDFDOMNodeList* aElements);
|
||||
|
||||
static PRBool IsAncestor(nsIDOMNode* aParentNode, nsIDOMNode* aChildNode);
|
||||
|
||||
// Helper routine that crawls a parent chain looking for a tree element.
|
||||
NS_IMETHOD GetParentTree(nsIDOMXULTreeElement** aTreeElement);
|
||||
|
||||
PRBool IsFocusableContent();
|
||||
|
||||
nsresult AddPopupListener(nsIAtom* aName);
|
||||
|
||||
protected:
|
||||
// Required fields
|
||||
nsXULPrototypeElement* mPrototype;
|
||||
nsIDocument* mDocument; // [WEAK]
|
||||
nsIContent* mParent; // [WEAK]
|
||||
nsCOMPtr<nsISupportsArray> mChildren; // [OWNER]
|
||||
nsCOMPtr<nsIEventListenerManager> mListenerManager; // [OWNER]
|
||||
void* mScriptObject; // [OWNER]
|
||||
|
||||
// The state of our sloth for lazy content model construction via
|
||||
// RDF; see nsIXULContent and nsRDFGenericBuilder.
|
||||
PRInt32 mLazyState;
|
||||
|
||||
// Lazily instantiated if/when object is mutated. Instantiating
|
||||
// the mSlots makes an nsXULElement 'heavyweight'.
|
||||
struct Slots {
|
||||
Slots(nsXULElement* mElement);
|
||||
~Slots();
|
||||
|
||||
nsXULElement* mElement; // [WEAK]
|
||||
PRInt32 mNameSpaceID;
|
||||
nsCOMPtr<nsINameSpace> mNameSpace; // [OWNER]
|
||||
nsCOMPtr<nsIAtom> mNameSpacePrefix; // [OWNER]
|
||||
nsCOMPtr<nsIAtom> mTag; // [OWNER]
|
||||
nsVoidArray* mBroadcastListeners; // [WEAK]
|
||||
nsIDOMXULElement* mBroadcaster; // [WEAK]
|
||||
nsCOMPtr<nsIControllers> mControllers; // [OWNER]
|
||||
nsCOMPtr<nsIRDFCompositeDataSource> mDatabase; // [OWNER]
|
||||
nsCOMPtr<nsIRDFResource> mOwnedResource; // [OWNER]
|
||||
nsXULAttributes* mAttributes;
|
||||
|
||||
// An unreferenced bare pointer to an aggregate that can
|
||||
// implement element-specific APIs.
|
||||
nsXULAggregateElement* mInnerXULElement;
|
||||
};
|
||||
|
||||
friend struct Slots;
|
||||
Slots* mSlots;
|
||||
nsresult EnsureSlots();
|
||||
|
||||
|
||||
protected:
|
||||
// Internal accessors. These shadow the 'Slots', and return
|
||||
// appropriate default values if there are no slots defined in the
|
||||
// delegate.
|
||||
PRInt32 NameSpaceID() const { return mSlots ? mSlots->mNameSpaceID : mPrototype->mNameSpaceID; }
|
||||
nsINameSpace* NameSpace() const { return mSlots ? mSlots->mNameSpace.get() : mPrototype->mNameSpace.get(); }
|
||||
nsIAtom* NameSpacePrefix() const { return mSlots ? mSlots->mNameSpacePrefix.get() : mPrototype->mNameSpacePrefix.get(); }
|
||||
nsIAtom* Tag() const { return mSlots ? mSlots->mTag.get() : mPrototype->mTag.get(); }
|
||||
nsVoidArray* BroadcastListeners() const { return mSlots ? mSlots->mBroadcastListeners : nsnull; }
|
||||
nsIDOMXULElement* Broadcaster() const { return mSlots ? mSlots->mBroadcaster : nsnull; }
|
||||
nsIControllers* Controllers() const { return mSlots ? mSlots->mControllers.get() : nsnull; }
|
||||
nsIRDFCompositeDataSource* Database() const { return mSlots ? mSlots->mDatabase.get() : nsnull; }
|
||||
nsIRDFResource* OwnedResource() const { return mSlots ? mSlots->mOwnedResource.get() : nsnull; }
|
||||
nsXULAttributes* Attributes() const { return mSlots ? mSlots->mAttributes : nsnull; }
|
||||
nsXULAggregateElement* InnerXULElement() const { return mSlots ? mSlots->mInnerXULElement : nsnull; }
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // nsXULElement_h__
|
||||
548
mozilla/content/xul/content/src/nsXULPopupListener.cpp
Normal file
548
mozilla/content/xul/content/src/nsXULPopupListener.cpp
Normal file
@@ -0,0 +1,548 @@
|
||||
/* -*- 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.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):
|
||||
*/
|
||||
|
||||
/*
|
||||
This file provides the implementation for xul popup listener which
|
||||
tracks xul popups, context menus, and tooltips
|
||||
*/
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIXULPopupListener.h"
|
||||
#include "nsIDOMMouseListener.h"
|
||||
#include "nsIDOMMouseMotionListener.h"
|
||||
#include "nsRDFCID.h"
|
||||
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIScriptContextOwner.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsITimer.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static NS_DEFINE_IID(kXULPopupListenerCID, NS_XULPOPUPLISTENER_CID);
|
||||
static NS_DEFINE_IID(kIXULPopupListenerIID, NS_IXULPOPUPLISTENER_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
static NS_DEFINE_IID(kIDomEventListenerIID, NS_IDOMEVENTLISTENER_IID);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// PopupListenerImpl
|
||||
//
|
||||
// This is the popup listener implementation for popup menus, context menus,
|
||||
// and tooltips.
|
||||
//
|
||||
class XULPopupListenerImpl : public nsIXULPopupListener,
|
||||
public nsIDOMMouseListener,
|
||||
public nsIDOMMouseMotionListener
|
||||
{
|
||||
public:
|
||||
XULPopupListenerImpl(void);
|
||||
virtual ~XULPopupListenerImpl(void);
|
||||
|
||||
public:
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIXULPopupListener
|
||||
NS_IMETHOD Init(nsIDOMElement* aElement, const XULPopupType& popupType);
|
||||
|
||||
// nsIDOMMouseListener
|
||||
virtual nsresult MouseDown(nsIDOMEvent* aMouseEvent);
|
||||
virtual nsresult MouseUp(nsIDOMEvent* aMouseEvent) { return NS_OK; };
|
||||
virtual nsresult MouseClick(nsIDOMEvent* aMouseEvent) { return NS_OK; };
|
||||
virtual nsresult MouseDblClick(nsIDOMEvent* aMouseEvent) { return NS_OK; };
|
||||
virtual nsresult MouseOver(nsIDOMEvent* aMouseEvent) { return NS_OK; };
|
||||
virtual nsresult MouseOut(nsIDOMEvent* aMouseEvent) ;
|
||||
|
||||
// nsIDOMMouseMotionListener
|
||||
virtual nsresult MouseMove(nsIDOMEvent* aMouseEvent);
|
||||
virtual nsresult DragMove(nsIDOMEvent* aMouseEvent) { return NS_OK; };
|
||||
|
||||
// nsIDOMEventListener
|
||||
virtual nsresult HandleEvent(nsIDOMEvent* anEvent) { return NS_OK; };
|
||||
|
||||
protected:
|
||||
|
||||
virtual nsresult LaunchPopup(nsIDOMEvent* anEvent);
|
||||
virtual nsresult LaunchPopup(PRInt32 aClientX, PRInt32 aClientY) ;
|
||||
|
||||
nsresult FindDocumentForNode(nsIDOMNode* inNode, nsIDOMXULDocument** outDoc) ;
|
||||
|
||||
private:
|
||||
// |mElement| is the node to which this listener is attached.
|
||||
nsIDOMElement* mElement; // Weak ref. The element will go away first.
|
||||
|
||||
// The popup that is getting shown on top of mElement.
|
||||
nsIDOMElement* mPopupContent;
|
||||
|
||||
// The type of the popup
|
||||
XULPopupType popupType;
|
||||
|
||||
// The following members are not used unless |popupType| is tooltip.
|
||||
|
||||
// a timer for determining if a tooltip should be displayed.
|
||||
static void sTooltipCallback ( nsITimer *aTimer, void *aClosure ) ;
|
||||
nsCOMPtr<nsITimer> mTooltipTimer;
|
||||
PRInt32 mMouseClientX, mMouseClientY; // mouse coordinates for tooltip event
|
||||
|
||||
// The node hovered over that fired the timer. This may turn into the node that
|
||||
// triggered the tooltip, but only if the timer ever gets around to firing.
|
||||
nsIDOMNode* mPossibleTooltipNode; // weak ref.
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
XULPopupListenerImpl::XULPopupListenerImpl(void)
|
||||
: mElement(nsnull), mPopupContent(nsnull),
|
||||
mMouseClientX(0), mMouseClientY(0),
|
||||
mPossibleTooltipNode(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
XULPopupListenerImpl::~XULPopupListenerImpl(void)
|
||||
{
|
||||
//XXX do we need to close the popup here? Will we get the right events as
|
||||
//XXX the topLevel window is going away when the closebox is pressed?
|
||||
|
||||
#ifdef DEBUG_REFS
|
||||
--gInstanceCount;
|
||||
fprintf(stdout, "%d - RDF: XULPopupListenerImpl\n", gInstanceCount);
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(XULPopupListenerImpl)
|
||||
NS_IMPL_RELEASE(XULPopupListenerImpl)
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULPopupListenerImpl::QueryInterface(REFNSIID iid, void** result)
|
||||
{
|
||||
if (! result)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*result = nsnull;
|
||||
if (iid.Equals(nsIXULPopupListener::GetIID()) ||
|
||||
iid.Equals(kISupportsIID)) {
|
||||
*result = NS_STATIC_CAST(nsIXULPopupListener*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
else if (iid.Equals(nsIDOMMouseListener::GetIID())) {
|
||||
*result = NS_STATIC_CAST(nsIDOMMouseListener*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
else if (iid.Equals(nsIDOMMouseMotionListener::GetIID())) {
|
||||
*result = NS_STATIC_CAST(nsIDOMMouseMotionListener*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
// compiler problems with nsIDOMEventListener::GetIID() cause us to do it this
|
||||
// way. Please excuse the lameness (hyatt and pinkerton).
|
||||
else if (iid.Equals(kIDomEventListenerIID)) {
|
||||
*result = (nsIDOMEventListener*)(nsIDOMMouseListener*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULPopupListenerImpl::Init(nsIDOMElement* aElement, const XULPopupType& popup)
|
||||
{
|
||||
mElement = aElement; // Weak reference. Don't addref it.
|
||||
popupType = popup;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// nsIDOMMouseListener
|
||||
|
||||
nsresult
|
||||
XULPopupListenerImpl::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
PRUint16 button;
|
||||
|
||||
nsCOMPtr<nsIDOMMouseEvent> mouseEvent;
|
||||
mouseEvent = do_QueryInterface(aMouseEvent);
|
||||
if (!mouseEvent) {
|
||||
//non-ui event passed in. bad things.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Get the node that was clicked on.
|
||||
nsCOMPtr<nsIDOMNode> targetNode;
|
||||
mouseEvent->GetTarget( getter_AddRefs( targetNode ) );
|
||||
|
||||
// Get the document with the popup.
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mElement);
|
||||
nsresult rv;
|
||||
if (NS_FAILED(rv = content->GetDocument(*getter_AddRefs(document)))) {
|
||||
NS_ERROR("Unable to retrieve the document.");
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Turn the document into a XUL document so we can use SetPopupNode.
|
||||
nsCOMPtr<nsIDOMXULDocument> xulDocument = do_QueryInterface(document);
|
||||
if (xulDocument == nsnull) {
|
||||
NS_ERROR("Popup attached to an element that isn't in XUL!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Store clicked-on node in xul document.
|
||||
xulDocument->SetPopupNode( targetNode );
|
||||
|
||||
switch (popupType) {
|
||||
case eXULPopupType_popup:
|
||||
// Check for left mouse button down
|
||||
mouseEvent->GetButton(&button);
|
||||
if (button == 1) {
|
||||
// Time to launch a popup menu.
|
||||
LaunchPopup(aMouseEvent);
|
||||
}
|
||||
break;
|
||||
case eXULPopupType_context:
|
||||
#ifdef XP_MAC
|
||||
// XXX: Handle Mac (currently checks if CTRL key is down)
|
||||
PRBool ctrlKey = PR_FALSE;
|
||||
mouseEvent->GetCtrlKey(&ctrlKey);
|
||||
if (ctrlKey == PR_TRUE)
|
||||
#else
|
||||
// Check for right mouse button down
|
||||
mouseEvent->GetButton(&button);
|
||||
if (button == 3)
|
||||
#endif
|
||||
{
|
||||
// Time to launch a context menu.
|
||||
LaunchPopup(aMouseEvent);
|
||||
}
|
||||
break;
|
||||
|
||||
case eXULPopupType_tooltip:
|
||||
case eXULPopupType_blur:
|
||||
// ignore
|
||||
break;
|
||||
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// MouseMove
|
||||
//
|
||||
// If we're a tooltip, fire off a timer to see if a tooltip should be shown.
|
||||
//
|
||||
nsresult
|
||||
XULPopupListenerImpl::MouseMove(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
// make sure we're a tooltip. if not, bail.
|
||||
if ( popupType != eXULPopupType_tooltip )
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMMouseEvent> mouseEvent ( do_QueryInterface(aMouseEvent) );
|
||||
if (!mouseEvent)
|
||||
return NS_OK;
|
||||
|
||||
// stash the coordinates of the event so that we can still get back to it from within the
|
||||
// timer scallback. Also stash the node that started this so we can put it into the
|
||||
// document later on (if the timer ever fires).
|
||||
mouseEvent->GetClientX(&mMouseClientX);
|
||||
mouseEvent->GetClientY(&mMouseClientY);
|
||||
|
||||
//XXX recognize when a popup is already up and immediately show the
|
||||
//XXX tooltip for the new item if the dom element is different than
|
||||
//XXX the element for which we are currently displaying the tip.
|
||||
//XXX
|
||||
//XXX for now, just be stupid to get things working.
|
||||
if (mPopupContent || mTooltipTimer)
|
||||
return NS_OK;
|
||||
|
||||
NS_NewTimer ( getter_AddRefs(mTooltipTimer) );
|
||||
if ( mTooltipTimer ) {
|
||||
nsCOMPtr<nsIDOMNode> eventTarget;
|
||||
aMouseEvent->GetTarget(getter_AddRefs(eventTarget));
|
||||
mPossibleTooltipNode = eventTarget.get();
|
||||
mTooltipTimer->Init(sTooltipCallback, this, 500); // 500 ms delay
|
||||
}
|
||||
else
|
||||
NS_WARNING ( "Could not create a timer for tooltip tracking" );
|
||||
|
||||
return NS_OK;
|
||||
|
||||
} // MouseMove
|
||||
|
||||
|
||||
//
|
||||
// MouseOut
|
||||
//
|
||||
// If we're a tooltip, hide any tip that might be showing and remove any
|
||||
// timer that is pending since the mouse is no longer over this area.
|
||||
//
|
||||
nsresult
|
||||
XULPopupListenerImpl::MouseOut(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
// make sure we're a tooltip. if not, bail.
|
||||
if ( popupType != eXULPopupType_tooltip )
|
||||
return NS_OK;
|
||||
|
||||
if ( mTooltipTimer ) {
|
||||
mTooltipTimer->Cancel();
|
||||
mTooltipTimer = nsnull;
|
||||
}
|
||||
|
||||
if ( mPopupContent ) {
|
||||
mPopupContent->RemoveAttribute("menugenerated"); // hide the popup
|
||||
mPopupContent->RemoveAttribute("menuactive");
|
||||
|
||||
mPopupContent = nsnull; // release the popup
|
||||
|
||||
// clear out the tooltip node on the document
|
||||
nsCOMPtr<nsIDOMNode> eventTarget;
|
||||
aMouseEvent->GetTarget(getter_AddRefs(eventTarget));
|
||||
nsCOMPtr<nsIDOMXULDocument> doc;
|
||||
FindDocumentForNode ( eventTarget, getter_AddRefs(doc) );
|
||||
if ( doc )
|
||||
doc->SetTooltipNode(nsnull);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
||||
} // MouseOut
|
||||
|
||||
|
||||
//
|
||||
// FindDocumentForNode
|
||||
//
|
||||
// Given a DOM content node, finds the XUL document associated with it
|
||||
//
|
||||
nsresult
|
||||
XULPopupListenerImpl :: FindDocumentForNode ( nsIDOMNode* inElement, nsIDOMXULDocument** outDoc )
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if ( !outDoc || !inElement )
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
// get the document associated with this content element
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(inElement);
|
||||
if (!content)
|
||||
return rv;
|
||||
|
||||
if (NS_FAILED(rv = content->GetDocument(*getter_AddRefs(document)))) {
|
||||
NS_ERROR("Unable to retrieve the document.");
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Turn the document into a XUL document so we can use getElementById
|
||||
nsCOMPtr<nsIDOMXULDocument> xulDocument = do_QueryInterface(document);
|
||||
if (xulDocument == nsnull) {
|
||||
NS_ERROR("Popup attached to an element that isn't in XUL!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
*outDoc = xulDocument;
|
||||
NS_ADDREF ( *outDoc );
|
||||
|
||||
return rv;
|
||||
|
||||
} // FindDocumentForNode
|
||||
|
||||
|
||||
//
|
||||
// LaunchPopup
|
||||
//
|
||||
nsresult
|
||||
XULPopupListenerImpl::LaunchPopup ( nsIDOMEvent* anEvent )
|
||||
{
|
||||
// Retrieve our x and y position.
|
||||
nsCOMPtr<nsIDOMMouseEvent> mouseEvent ( do_QueryInterface(anEvent) );
|
||||
if (!mouseEvent) {
|
||||
//non-ui event passed in. bad things.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRInt32 xPos, yPos;
|
||||
mouseEvent->GetClientX(&xPos);
|
||||
mouseEvent->GetClientY(&yPos);
|
||||
|
||||
return LaunchPopup(xPos, yPos);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// LaunchPopup
|
||||
//
|
||||
// Given the element on which the event was triggered and the mouse locations in
|
||||
// Client and widget coordinates, popup a new window showing the appropriate
|
||||
// content.
|
||||
//
|
||||
// This looks for an attribute on |aElement| of the appropriate popup type
|
||||
// (popup, context, tooltip) and uses that attribute's value as an ID for
|
||||
// the popup content in the document.
|
||||
//
|
||||
nsresult
|
||||
XULPopupListenerImpl::LaunchPopup(PRInt32 aClientX, PRInt32 aClientY)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsAutoString type("popup");
|
||||
if ( popupType == eXULPopupType_context )
|
||||
type = "context";
|
||||
else if ( popupType == eXULPopupType_tooltip )
|
||||
type = "tooltip";
|
||||
|
||||
nsAutoString identifier;
|
||||
mElement->GetAttribute(type, identifier);
|
||||
|
||||
if (identifier == "")
|
||||
return rv;
|
||||
|
||||
// Try to find the popup content and the document. We don't use FindDocumentForNode()
|
||||
// in this case because we need the nsIDocument interface anyway for the script
|
||||
// context.
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mElement);
|
||||
if (NS_FAILED(rv = content->GetDocument(*getter_AddRefs(document)))) {
|
||||
NS_ERROR("Unable to retrieve the document.");
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Turn the document into a XUL document so we can use getElementById
|
||||
nsCOMPtr<nsIDOMXULDocument> xulDocument = do_QueryInterface(document);
|
||||
if (xulDocument == nsnull) {
|
||||
NS_ERROR("Popup attached to an element that isn't in XUL!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// XXX Handle the _child case for popups and context menus!
|
||||
|
||||
// Use getElementById to obtain the popup content and gracefully fail if
|
||||
// we didn't find any popup content in the document.
|
||||
nsCOMPtr<nsIDOMElement> popupContent;
|
||||
if (NS_FAILED(rv = xulDocument->GetElementById(identifier, getter_AddRefs(popupContent)))) {
|
||||
NS_ERROR("GetElementById had some kind of spasm.");
|
||||
return rv;
|
||||
}
|
||||
if ( !popupContent )
|
||||
return NS_OK;
|
||||
|
||||
// We have some popup content. Obtain our window.
|
||||
nsIScriptContextOwner* owner = document->GetScriptContextOwner();
|
||||
nsCOMPtr<nsIScriptContext> context;
|
||||
if (NS_OK == owner->GetScriptContext(getter_AddRefs(context))) {
|
||||
nsIScriptGlobalObject* global = context->GetGlobalObject();
|
||||
if (global) {
|
||||
// Get the DOM window
|
||||
nsCOMPtr<nsIDOMWindow> domWindow = do_QueryInterface(global);
|
||||
if (domWindow != nsnull) {
|
||||
// Find out if we're anchored.
|
||||
nsAutoString anchorAlignment("none");
|
||||
mElement->GetAttribute("popupanchor", anchorAlignment);
|
||||
|
||||
nsAutoString popupAlignment("topleft");
|
||||
mElement->GetAttribute("popupalign", popupAlignment);
|
||||
|
||||
PRInt32 xPos = aClientX, yPos = aClientY;
|
||||
|
||||
mPopupContent = popupContent.get();
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> uselessPopup; // XXX Should go away.
|
||||
domWindow->CreatePopup(mElement, popupContent,
|
||||
xPos, yPos,
|
||||
type, anchorAlignment, popupAlignment,
|
||||
getter_AddRefs(uselessPopup));
|
||||
}
|
||||
NS_RELEASE(global);
|
||||
}
|
||||
}
|
||||
NS_IF_RELEASE(owner);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//
|
||||
// sTooltipCallback
|
||||
//
|
||||
// A timer callback, fired when the mouse has hovered inside of a frame for the
|
||||
// appropriate amount of time. Getting to this point means that we should show the
|
||||
// toolip.
|
||||
//
|
||||
// This relies on certain things being cached into the |aClosure| object passed to
|
||||
// us by the timer:
|
||||
// -- the x/y coordinates of the mouse
|
||||
// -- the dom node the user hovered over
|
||||
//
|
||||
void
|
||||
XULPopupListenerImpl :: sTooltipCallback (nsITimer *aTimer, void *aClosure)
|
||||
{
|
||||
XULPopupListenerImpl* self = NS_STATIC_CAST(XULPopupListenerImpl*, aClosure);
|
||||
if ( self ) {
|
||||
// set the node in the document that triggered the tooltip and show it
|
||||
nsCOMPtr<nsIDOMXULDocument> doc;
|
||||
self->FindDocumentForNode ( self->mPossibleTooltipNode, getter_AddRefs(doc) );
|
||||
if ( doc ) {
|
||||
nsCOMPtr<nsIDOMElement> element ( do_QueryInterface(self->mPossibleTooltipNode) );
|
||||
if ( element ) {
|
||||
// check that node is enabled before showing tooltip
|
||||
nsAutoString disabledState;
|
||||
element->GetAttribute ( "disabled", disabledState );
|
||||
if ( disabledState != "true" ) {
|
||||
doc->SetTooltipNode ( element );
|
||||
self->LaunchPopup (self->mMouseClientX, self->mMouseClientY+16);
|
||||
} // if node enabled
|
||||
} else {
|
||||
// Tooltip on non-element; e.g., text
|
||||
doc->SetTooltipNode ( self->mPossibleTooltipNode );
|
||||
self->LaunchPopup ( self->mMouseClientX, self->mMouseClientY+16);
|
||||
}
|
||||
} // if document
|
||||
} // if "self" data valid
|
||||
|
||||
} // sTimerCallback
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
nsresult
|
||||
NS_NewXULPopupListener(nsIXULPopupListener** pop)
|
||||
{
|
||||
XULPopupListenerImpl* popup = new XULPopupListenerImpl();
|
||||
if (!popup)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(popup);
|
||||
*pop = popup;
|
||||
return NS_OK;
|
||||
}
|
||||
384
mozilla/content/xul/content/src/nsXULTreeElement.cpp
Normal file
384
mozilla/content/xul/content/src/nsXULTreeElement.cpp
Normal file
@@ -0,0 +1,384 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Implementation methods for the XUL tree element APIs.
|
||||
|
||||
*/
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsXULTreeElement.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsString.h"
|
||||
|
||||
nsIAtom* nsXULTreeElement::kSelectedAtom;
|
||||
int nsXULTreeElement::gRefCnt = 0;
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsXULTreeElement, nsXULAggregateElement);
|
||||
NS_IMPL_RELEASE_INHERITED(nsXULTreeElement, nsXULAggregateElement);
|
||||
|
||||
nsresult
|
||||
nsXULTreeElement::QueryInterface(REFNSIID aIID, void** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsIDOMXULTreeElement>::GetIID())) {
|
||||
*aResult = NS_STATIC_CAST(nsIDOMXULTreeElement*, this);
|
||||
}
|
||||
else if (aIID.Equals(nsCOMTypeInfo<nsIXULTreeContent>::GetIID())) {
|
||||
*aResult = NS_STATIC_CAST(nsIXULTreeContent*, this);
|
||||
}
|
||||
else {
|
||||
return nsXULAggregateElement::QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
NS_ADDREF(NS_REINTERPRET_CAST(nsISupports*, *aResult));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsXULTreeElement::nsXULTreeElement(nsIDOMXULElement* aOuter)
|
||||
: nsXULAggregateElement(aOuter)
|
||||
{
|
||||
if (gRefCnt++ == 0) {
|
||||
kSelectedAtom = NS_NewAtom("selected");
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsRDFDOMNodeList* children;
|
||||
rv = nsRDFDOMNodeList::Create(&children);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create DOM node list");
|
||||
if (NS_FAILED(rv)) return;
|
||||
|
||||
mSelectedItems = children;
|
||||
|
||||
children = nsnull;
|
||||
rv = nsRDFDOMNodeList::Create(&children);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create DOM node list");
|
||||
if (NS_FAILED(rv)) return;
|
||||
|
||||
mSelectedCells = children;
|
||||
}
|
||||
|
||||
nsXULTreeElement::~nsXULTreeElement()
|
||||
{
|
||||
#ifdef DEBUG_REFS
|
||||
--gInstanceCount;
|
||||
fprintf(stdout, "%d - RDF: nsXULTreeElement\n", gInstanceCount);
|
||||
#endif
|
||||
|
||||
NS_IF_RELEASE(mSelectedItems);
|
||||
NS_IF_RELEASE(mSelectedCells);
|
||||
|
||||
if (--gRefCnt == 0) {
|
||||
NS_IF_RELEASE(kSelectedAtom);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeElement::GetSelectedItems(nsIDOMNodeList** aSelectedItems)
|
||||
{
|
||||
NS_IF_ADDREF(mSelectedItems);
|
||||
*aSelectedItems = mSelectedItems;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeElement::GetSelectedCells(nsIDOMNodeList** aSelectedCells)
|
||||
{
|
||||
NS_IF_ADDREF(mSelectedCells);
|
||||
*aSelectedCells = mSelectedCells;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeElement::SelectItem(nsIDOMXULElement* aTreeItem)
|
||||
{
|
||||
// Sanity check. If we're the only item, just bail.
|
||||
PRUint32 length;
|
||||
mSelectedItems->GetLength(&length);
|
||||
if (length == 1) {
|
||||
// See if the single item already selected is us.
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
mSelectedItems->Item(0, getter_AddRefs(domNode));
|
||||
nsCOMPtr<nsIDOMXULElement> treeItem = do_QueryInterface(domNode);
|
||||
if (treeItem.get() == aTreeItem)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// First clear our selection.
|
||||
ClearItemSelectionInternal();
|
||||
|
||||
// Now add ourselves to the selection by setting our selected attribute.
|
||||
AddItemToSelectionInternal(aTreeItem);
|
||||
|
||||
FireOnSelectHandler();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeElement::SelectCell(nsIDOMXULElement* aTreeCell)
|
||||
{
|
||||
// Sanity check. If we're the only item, just bail.
|
||||
PRUint32 length;
|
||||
mSelectedCells->GetLength(&length);
|
||||
if (length == 1) {
|
||||
// See if the single item already selected is us.
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
mSelectedCells->Item(0, getter_AddRefs(domNode));
|
||||
nsCOMPtr<nsIDOMXULElement> treeCell = do_QueryInterface(domNode);
|
||||
if (treeCell.get() == aTreeCell)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// First clear our selection.
|
||||
ClearCellSelectionInternal();
|
||||
|
||||
// Now add ourselves to the selection by setting our selected attribute.
|
||||
AddCellToSelectionInternal(aTreeCell);
|
||||
|
||||
FireOnSelectHandler();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeElement::ClearItemSelection()
|
||||
{
|
||||
ClearItemSelectionInternal();
|
||||
FireOnSelectHandler();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsXULTreeElement::ClearItemSelectionInternal()
|
||||
{
|
||||
// Enumerate the elements and remove them from the selection.
|
||||
PRUint32 length;
|
||||
mSelectedItems->GetLength(&length);
|
||||
for (PRUint32 i = 0; i < length; i++) {
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
mSelectedItems->Item(0, getter_AddRefs(node));
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(node);
|
||||
content->UnsetAttribute(kNameSpaceID_None, kSelectedAtom, PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsXULTreeElement::ClearCellSelectionInternal()
|
||||
{
|
||||
// Enumerate the elements and remove them from the selection.
|
||||
PRUint32 length;
|
||||
mSelectedCells->GetLength(&length);
|
||||
for (PRUint32 i = 0; i < length; i++) {
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
mSelectedCells->Item(0, getter_AddRefs(node));
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(node);
|
||||
content->UnsetAttribute(kNameSpaceID_None, kSelectedAtom, PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeElement::ClearCellSelection()
|
||||
{
|
||||
ClearCellSelectionInternal();
|
||||
FireOnSelectHandler();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsXULTreeElement::AddItemToSelectionInternal(nsIDOMXULElement* aTreeItem)
|
||||
{
|
||||
// Without clearing the selection, perform the add.
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aTreeItem);
|
||||
content->SetAttribute(kNameSpaceID_None, kSelectedAtom, nsAutoString("true"), PR_TRUE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeElement::AddItemToSelection(nsIDOMXULElement* aTreeItem)
|
||||
{
|
||||
// Without clearing the selection, perform the add.
|
||||
AddItemToSelectionInternal(aTreeItem);
|
||||
FireOnSelectHandler();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsXULTreeElement::RemoveItemFromSelectionInternal(nsIDOMXULElement* aTreeItem)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aTreeItem);
|
||||
content->UnsetAttribute(kNameSpaceID_None, kSelectedAtom, PR_TRUE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeElement::RemoveItemFromSelection(nsIDOMXULElement* aTreeItem)
|
||||
{
|
||||
RemoveItemFromSelectionInternal(aTreeItem);
|
||||
FireOnSelectHandler();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsXULTreeElement::AddCellToSelectionInternal(nsIDOMXULElement* aTreeCell)
|
||||
{
|
||||
// Without clearing the selection, perform the add.
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aTreeCell);
|
||||
content->SetAttribute(kNameSpaceID_None, kSelectedAtom, nsAutoString("true"), PR_TRUE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeElement::AddCellToSelection(nsIDOMXULElement* aTreeCell)
|
||||
{
|
||||
AddCellToSelectionInternal(aTreeCell);
|
||||
FireOnSelectHandler();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsXULTreeElement::RemoveCellFromSelectionInternal(nsIDOMXULElement* aTreeCell)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aTreeCell);
|
||||
content->UnsetAttribute(kNameSpaceID_None, kSelectedAtom, PR_TRUE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeElement::RemoveCellFromSelection(nsIDOMXULElement* aTreeCell)
|
||||
{
|
||||
RemoveCellFromSelectionInternal(aTreeCell);
|
||||
FireOnSelectHandler();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeElement::ToggleItemSelection(nsIDOMXULElement* aTreeItem)
|
||||
{
|
||||
nsAutoString isSelected;
|
||||
aTreeItem->GetAttribute("selected", isSelected);
|
||||
if (isSelected == "true")
|
||||
RemoveItemFromSelectionInternal(aTreeItem);
|
||||
else AddItemToSelectionInternal(aTreeItem);
|
||||
|
||||
FireOnSelectHandler();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeElement::ToggleCellSelection(nsIDOMXULElement* aTreeCell)
|
||||
{
|
||||
nsAutoString isSelected;
|
||||
aTreeCell->GetAttribute("selected", isSelected);
|
||||
if (isSelected == "true")
|
||||
RemoveCellFromSelectionInternal(aTreeCell);
|
||||
else AddCellToSelectionInternal(aTreeCell);
|
||||
|
||||
FireOnSelectHandler();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeElement::SelectItemRange(nsIDOMXULElement* aStartItem, nsIDOMXULElement* aEndItem)
|
||||
{
|
||||
// XXX Fill in.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeElement::SelectCellRange(nsIDOMXULElement* aStartItem, nsIDOMXULElement* aEndItem)
|
||||
{
|
||||
// XXX Fill in.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeElement::SelectAll()
|
||||
{
|
||||
// XXX Select anything that isn't selected.
|
||||
// Write later.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULTreeElement::InvertSelection()
|
||||
{
|
||||
// XXX Woo hoo. Write this later.
|
||||
// Yikes. Involves an enumeration of the whole tree.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULTreeElement::FireOnSelectHandler()
|
||||
{
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mOuter);
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
content->GetDocument(*getter_AddRefs(document));
|
||||
|
||||
// If there's no document (e.g., a selection is occuring in a
|
||||
// 'orphaned' node), then there ain't a whole lot to do here!
|
||||
if (! document) {
|
||||
NS_WARNING("FireOnSelectHandler occurred in orphaned node");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// The frame code can suppress the firing of this handler by setting an attribute
|
||||
// for us. Look for that and bail if it's present.
|
||||
nsCOMPtr<nsIAtom> kSuppressSelectChange = dont_AddRef(NS_NewAtom("suppressonselect"));
|
||||
nsAutoString value;
|
||||
content->GetAttribute(kNameSpaceID_None, kSuppressSelectChange, value);
|
||||
if (value == "true")
|
||||
return NS_OK;
|
||||
|
||||
PRInt32 count = document->GetNumberOfShells();
|
||||
for (PRInt32 i = 0; i < count; i++) {
|
||||
nsIPresShell* shell = document->GetShellAt(i);
|
||||
if (nsnull == shell)
|
||||
continue;
|
||||
|
||||
// Retrieve the context in which our DOM event will fire.
|
||||
nsCOMPtr<nsIPresContext> aPresContext;
|
||||
shell->GetPresContext(getter_AddRefs(aPresContext));
|
||||
|
||||
NS_RELEASE(shell);
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsEvent event;
|
||||
event.eventStructType = NS_EVENT;
|
||||
event.message = NS_FORM_SELECTED;
|
||||
|
||||
content->HandleDOMEvent(*aPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, status);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
80
mozilla/content/xul/content/src/nsXULTreeElement.h
Normal file
80
mozilla/content/xul/content/src/nsXULTreeElement.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/* -*- 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):
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
An aggregate object that implements the XUL tree widget APIs
|
||||
|
||||
*/
|
||||
|
||||
#ifndef nsXULTreeElement_h__
|
||||
#define nsXULTreeElement_h__
|
||||
|
||||
#include "nsXULElement.h"
|
||||
#include "nsIDOMXULTreeElement.h"
|
||||
#include "nsIXULTreeContent.h"
|
||||
#include "nsRDFDOMNodeList.h"
|
||||
|
||||
class nsXULTreeElement : public nsXULAggregateElement,
|
||||
public nsIDOMXULTreeElement,
|
||||
public nsIXULTreeContent
|
||||
{
|
||||
public:
|
||||
nsXULTreeElement(nsIDOMXULElement* aOuter);
|
||||
~nsXULTreeElement();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIDOMNode interface
|
||||
NS_FORWARD_IDOMNODE(mOuter->);
|
||||
|
||||
// nsIDOMElement interface
|
||||
NS_FORWARD_IDOMELEMENT(mOuter->);
|
||||
|
||||
// nsIDOMXULElement interface
|
||||
NS_FORWARD_IDOMXULELEMENT(mOuter->);
|
||||
|
||||
// nsIDOMXULTreeElement interface
|
||||
NS_DECL_IDOMXULTREEELEMENT
|
||||
|
||||
// nsIXULTreeContent interface
|
||||
NS_IMETHOD FireOnSelectHandler();
|
||||
|
||||
static nsIAtom* kSelectedAtom;
|
||||
static int gRefCnt;
|
||||
|
||||
protected:
|
||||
// Helpers
|
||||
void ClearItemSelectionInternal();
|
||||
void ClearCellSelectionInternal();
|
||||
void AddItemToSelectionInternal(nsIDOMXULElement* aTreeItem);
|
||||
void RemoveItemFromSelectionInternal(nsIDOMXULElement* aTreeItem);
|
||||
void AddCellToSelectionInternal(nsIDOMXULElement* aTreeCell);
|
||||
void RemoveCellFromSelectionInternal(nsIDOMXULElement* aTreeCell);
|
||||
|
||||
protected:
|
||||
nsRDFDOMNodeList* mSelectedItems;
|
||||
nsRDFDOMNodeList* mSelectedCells;
|
||||
};
|
||||
|
||||
|
||||
#endif // nsXULTreeElement_h__
|
||||
54
mozilla/content/xul/document/public/nsIXULContentSink.h
Normal file
54
mozilla/content/xul/document/public/nsIXULContentSink.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/* -*- 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):
|
||||
*/
|
||||
|
||||
|
||||
#ifndef nsIXULContentSink_h__
|
||||
#define nsIXULContentSink_h__
|
||||
|
||||
#include "nsIXMLContentSink.h"
|
||||
|
||||
class nsIDocument;
|
||||
class nsIXULPrototypeDocument;
|
||||
|
||||
// {E49AA620-C16C-11d2-A6AA-00104BDE6048}
|
||||
#define NS_IXULCONTENTSINK_IID \
|
||||
{ 0xe49aa620, 0xc16c, 0x11d2, { 0xa6, 0xaa, 0x0, 0x10, 0x4b, 0xde, 0x60, 0x48 } }
|
||||
|
||||
|
||||
class nsIXULContentSink : public nsIXMLContentSink
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IXULCONTENTSINK_IID; return iid; }
|
||||
|
||||
/**
|
||||
* Initialize the content sink, giving it an nsIDocument object
|
||||
* with which to communicate with the outside world, and an
|
||||
* nsIXULPrototypeDocument to build.
|
||||
*/
|
||||
NS_IMETHOD Init(nsIDocument* aDocument, nsIXULPrototypeDocument* aPrototype) = 0;
|
||||
};
|
||||
|
||||
|
||||
nsresult
|
||||
NS_NewXULContentSink(nsIXULContentSink** aResult);
|
||||
|
||||
#endif // nsIXULContentSink_h__
|
||||
64
mozilla/content/xul/document/public/nsIXULPrototypeCache.h
Normal file
64
mozilla/content/xul/document/public/nsIXULPrototypeCache.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/* -*- 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):
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#ifndef nsIXULPrototypeCache_h__
|
||||
#define nsIXULPrototypeCache_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
class nsICSSStyleSheet;
|
||||
class nsIURI;
|
||||
class nsIXULPrototypeDocument;
|
||||
|
||||
// {3A0A0FC0-8349-11d3-BE47-00104BDE6048}
|
||||
#define NS_IXULPROTOTYPECACHE_IID \
|
||||
{ 0x3a0a0fc0, 0x8349, 0x11d3, { 0xbe, 0x47, 0x0, 0x10, 0x4b, 0xde, 0x60, 0x48 } }
|
||||
|
||||
|
||||
class nsIXULPrototypeCache : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IXULPROTOTYPECACHE_IID);
|
||||
|
||||
NS_IMETHOD GetPrototype(nsIURI* aURI, nsIXULPrototypeDocument** _result) = 0;
|
||||
NS_IMETHOD PutPrototype(nsIXULPrototypeDocument* aDocument) = 0;
|
||||
|
||||
NS_IMETHOD GetStyleSheet(nsIURI* aURI, nsICSSStyleSheet** _result) = 0;
|
||||
NS_IMETHOD PutStyleSheet(nsICSSStyleSheet* aStyleSheet) = 0;
|
||||
|
||||
/**
|
||||
* Flush the cache; remove all XUL prototype documents, style
|
||||
* sheets, and scripts.
|
||||
*/
|
||||
NS_IMETHOD Flush() = 0;
|
||||
};
|
||||
|
||||
|
||||
extern NS_IMETHODIMP
|
||||
NS_NewXULPrototypeCache(nsISupports* aOuter, REFNSIID aIID, void** aResult);
|
||||
|
||||
#endif // nsIXULPrototypeCache_h__
|
||||
378
mozilla/content/xul/document/src/nsElementMap.cpp
Normal file
378
mozilla/content/xul/document/src/nsElementMap.cpp
Normal file
@@ -0,0 +1,378 @@
|
||||
/* -*- 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):
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Maps IDs to elements.
|
||||
|
||||
*/
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsElementMap.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsString.h"
|
||||
#include "prlog.h"
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
static PRLogModuleInfo* gMapLog;
|
||||
#endif
|
||||
|
||||
nsElementMap::nsElementMap()
|
||||
{
|
||||
MOZ_COUNT_CTOR(RDF_nsElementMap);
|
||||
|
||||
// Create a table for mapping IDs to elements in the content tree.
|
||||
static PRInt32 kInitialResourceTableSize = 1023;
|
||||
mMap = PL_NewHashTable(kInitialResourceTableSize,
|
||||
Hash,
|
||||
Compare,
|
||||
PL_CompareValues,
|
||||
nsnull,
|
||||
nsnull);
|
||||
|
||||
NS_ASSERTION(mMap != nsnull, "could not create hash table for resources");
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
if (! gMapLog)
|
||||
gMapLog = PR_NewLogModule("nsElementMap");
|
||||
|
||||
|
||||
PR_LOG(gMapLog, PR_LOG_ALWAYS,
|
||||
("xulelemap(%p) created", this));
|
||||
#endif
|
||||
}
|
||||
|
||||
nsElementMap::~nsElementMap()
|
||||
{
|
||||
MOZ_COUNT_DTOR(RDF_nsElementMap);
|
||||
|
||||
if (mMap) {
|
||||
PL_HashTableEnumerateEntries(mMap, ReleaseContentList, nsnull);
|
||||
PL_HashTableDestroy(mMap);
|
||||
}
|
||||
|
||||
PR_LOG(gMapLog, PR_LOG_ALWAYS,
|
||||
("xulelemap(%p) destroyed", this));
|
||||
}
|
||||
|
||||
|
||||
PRIntn
|
||||
nsElementMap::ReleaseContentList(PLHashEntry* aHashEntry, PRIntn aIndex, void* aClosure)
|
||||
{
|
||||
PRUnichar* id =
|
||||
NS_REINTERPRET_CAST(PRUnichar*, NS_CONST_CAST(void*, aHashEntry->key));
|
||||
|
||||
delete[] id;
|
||||
|
||||
ContentListItem* head =
|
||||
NS_REINTERPRET_CAST(ContentListItem*, aHashEntry->value);
|
||||
|
||||
while (head) {
|
||||
ContentListItem* doomed = head;
|
||||
head = head->mNext;
|
||||
delete doomed;
|
||||
}
|
||||
|
||||
return HT_ENUMERATE_NEXT;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsElementMap::Add(const nsString& aID, nsIContent* aContent)
|
||||
{
|
||||
NS_PRECONDITION(mMap != nsnull, "not initialized");
|
||||
if (! mMap)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
ContentListItem* head =
|
||||
(ContentListItem*) PL_HashTableLookup(mMap, aID.GetUnicode());
|
||||
|
||||
if (! head) {
|
||||
head = new ContentListItem(aContent);
|
||||
if (! head)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
PRUnichar* key = new PRUnichar[aID.Length() + 1];
|
||||
if (! key)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsCRT::memcpy(key, aID.GetUnicode(), aID.Length() * sizeof(PRUnichar));
|
||||
key[aID.Length()] = PRUnichar(0);
|
||||
|
||||
PL_HashTableAdd(mMap, key, head);
|
||||
}
|
||||
else {
|
||||
while (1) {
|
||||
if (head->mContent.get() == aContent) {
|
||||
// This can happen if an element that was created via
|
||||
// frame construction code is then "appended" to the
|
||||
// content model with aNotify == PR_TRUE. If you see
|
||||
// this warning, it's an indication that you're
|
||||
// unnecessarily notifying the frame system, and
|
||||
// potentially causing unnecessary reflow.
|
||||
//NS_ERROR("element was already in the map");
|
||||
#ifdef PR_LOGGING
|
||||
if (PR_LOG_TEST(gMapLog, PR_LOG_ALWAYS)) {
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
rv = aContent->GetTag(*getter_AddRefs(tag));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAutoString tagname;
|
||||
rv = tag->ToString(tagname);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PR_LOG(gMapLog, PR_LOG_ALWAYS,
|
||||
("xulelemap(%p) dup %s[%p] <-- %s\n",
|
||||
this,
|
||||
(const char*) nsCAutoString(tagname),
|
||||
aContent,
|
||||
(const char*) nsCAutoString(aID)));
|
||||
}
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
if (! head->mNext)
|
||||
break;
|
||||
|
||||
head = head->mNext;
|
||||
}
|
||||
|
||||
head->mNext = new ContentListItem(aContent);
|
||||
if (! head->mNext)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
if (PR_LOG_TEST(gMapLog, PR_LOG_ALWAYS)) {
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
rv = aContent->GetTag(*getter_AddRefs(tag));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAutoString tagname;
|
||||
rv = tag->ToString(tagname);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PR_LOG(gMapLog, PR_LOG_ALWAYS,
|
||||
("xulelemap(%p) add %s[%p] <-- %s\n",
|
||||
this,
|
||||
(const char*) nsCAutoString(tagname),
|
||||
aContent,
|
||||
(const char*) nsCAutoString(aID)));
|
||||
}
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsElementMap::Remove(const nsString& aID, nsIContent* aContent)
|
||||
{
|
||||
NS_PRECONDITION(mMap != nsnull, "not initialized");
|
||||
if (! mMap)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
if (PR_LOG_TEST(gMapLog, PR_LOG_ALWAYS)) {
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
rv = aContent->GetTag(*getter_AddRefs(tag));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAutoString tagname;
|
||||
rv = tag->ToString(tagname);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PR_LOG(gMapLog, PR_LOG_ALWAYS,
|
||||
("xulelemap(%p) remove %s[%p] <-- %s\n",
|
||||
this,
|
||||
(const char*) nsCAutoString(tagname),
|
||||
aContent,
|
||||
(const char*) nsCAutoString(aID)));
|
||||
}
|
||||
#endif
|
||||
|
||||
PLHashEntry** hep = PL_HashTableRawLookup(mMap,
|
||||
Hash(aID.GetUnicode()),
|
||||
aID.GetUnicode());
|
||||
|
||||
// XXX Don't comment out this assert: if you get here, something
|
||||
// has gone dreadfully, horribly wrong. Curse. Scream. File a bug
|
||||
// against waterson@netscape.com.
|
||||
NS_ASSERTION(hep != nsnull && *hep != nsnull, "attempt to remove an element that was never added");
|
||||
if (!hep || !*hep)
|
||||
return NS_OK;
|
||||
|
||||
ContentListItem* head = NS_REINTERPRET_CAST(ContentListItem*, (*hep)->value);
|
||||
|
||||
if (head->mContent.get() == aContent) {
|
||||
ContentListItem* next = head->mNext;
|
||||
if (next) {
|
||||
(*hep)->value = next;
|
||||
}
|
||||
else {
|
||||
// It was the last reference in the table
|
||||
PRUnichar* key = NS_REINTERPRET_CAST(PRUnichar*, NS_CONST_CAST(void*, (*hep)->key));
|
||||
PL_HashTableRawRemove(mMap, hep, *hep);
|
||||
delete[] key;
|
||||
}
|
||||
delete head;
|
||||
}
|
||||
else {
|
||||
ContentListItem* item = head->mNext;
|
||||
while (item) {
|
||||
if (item->mContent.get() == aContent) {
|
||||
head->mNext = item->mNext;
|
||||
delete item;
|
||||
break;
|
||||
}
|
||||
head = item;
|
||||
item = item->mNext;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
nsresult
|
||||
nsElementMap::Find(const nsString& aID, nsISupportsArray* aResults)
|
||||
{
|
||||
NS_PRECONDITION(mMap != nsnull, "not initialized");
|
||||
if (! mMap)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
aResults->Clear();
|
||||
ContentListItem* item =
|
||||
NS_REINTERPRET_CAST(ContentListItem*, PL_HashTableLookup(mMap, aID.GetUnicode()));
|
||||
|
||||
while (item) {
|
||||
aResults->AppendElement(item->mContent);
|
||||
item = item->mNext;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsElementMap::FindFirst(const nsString& aID, nsIContent** aResult)
|
||||
{
|
||||
NS_PRECONDITION(mMap != nsnull, "not initialized");
|
||||
if (! mMap)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
ContentListItem* item =
|
||||
NS_REINTERPRET_CAST(ContentListItem*, PL_HashTableLookup(mMap, aID.GetUnicode()));
|
||||
|
||||
if (item) {
|
||||
*aResult = item->mContent;
|
||||
NS_ADDREF(*aResult);
|
||||
}
|
||||
else {
|
||||
*aResult = nsnull;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsElementMap::Enumerate(nsElementMapEnumerator aEnumerator, void* aClosure)
|
||||
{
|
||||
EnumerateClosure closure = { aEnumerator, aClosure };
|
||||
PL_HashTableEnumerateEntries(mMap, EnumerateImpl, &closure);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
PRIntn
|
||||
nsElementMap::EnumerateImpl(PLHashEntry* aHashEntry, PRIntn aIndex, void* aClosure)
|
||||
{
|
||||
// This routine will be called once for each key in the
|
||||
// hashtable. It will in turn call the enumerator that the user
|
||||
// has passed in via Enumerate() once for each element that's been
|
||||
// mapped to this ID.
|
||||
EnumerateClosure* closure = NS_REINTERPRET_CAST(EnumerateClosure*, aClosure);
|
||||
|
||||
const PRUnichar* id =
|
||||
NS_REINTERPRET_CAST(const PRUnichar*, aHashEntry->key);
|
||||
|
||||
// 'link' holds a pointer to the previous element's link field.
|
||||
ContentListItem** link =
|
||||
NS_REINTERPRET_CAST(ContentListItem**, &aHashEntry->value);
|
||||
|
||||
ContentListItem* item = *link;
|
||||
|
||||
// Iterate through each content node that's been mapped to this ID
|
||||
while (item) {
|
||||
ContentListItem* current = item;
|
||||
item = item->mNext;
|
||||
PRIntn result = (*closure->mEnumerator)(id, current->mContent, closure->mClosure);
|
||||
|
||||
if (result == HT_ENUMERATE_REMOVE) {
|
||||
// If the user wants to remove the current, then deal.
|
||||
*link = item;
|
||||
delete current;
|
||||
|
||||
if ((! *link) && (link == NS_REINTERPRET_CAST(ContentListItem**, &aHashEntry->value))) {
|
||||
// It's the last content node that was mapped to this
|
||||
// ID. Unhash it.
|
||||
PRUnichar* key = NS_CONST_CAST(PRUnichar*, id);
|
||||
delete[] key;
|
||||
return HT_ENUMERATE_REMOVE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
link = ¤t->mNext;
|
||||
}
|
||||
}
|
||||
|
||||
return HT_ENUMERATE_NEXT;
|
||||
}
|
||||
|
||||
|
||||
PLHashNumber
|
||||
nsElementMap::Hash(const void* aKey)
|
||||
{
|
||||
PLHashNumber result = 0;
|
||||
const PRUnichar* s = NS_REINTERPRET_CAST(const PRUnichar*, aKey);
|
||||
while (*s != nsnull) {
|
||||
result = (result >> 28) ^ (result << 4) ^ *s;
|
||||
++s;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
PRIntn
|
||||
nsElementMap::Compare(const void* aLeft, const void* aRight)
|
||||
{
|
||||
return 0 == nsCRT::strcmp(NS_REINTERPRET_CAST(const PRUnichar*, aLeft),
|
||||
NS_REINTERPRET_CAST(const PRUnichar*, aRight));
|
||||
}
|
||||
102
mozilla/content/xul/document/src/nsElementMap.h
Normal file
102
mozilla/content/xul/document/src/nsElementMap.h
Normal file
@@ -0,0 +1,102 @@
|
||||
/* -*- 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):
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Maintains one-to-many mapping between element IDs and content
|
||||
nodes.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef nsElementMap_h__
|
||||
#define nsElementMap_h__
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsError.h"
|
||||
#include "plhash.h"
|
||||
#include "nsIContent.h"
|
||||
|
||||
class nsString;
|
||||
class nsISupportsArray;
|
||||
|
||||
class nsElementMap
|
||||
{
|
||||
private:
|
||||
PLHashTable* mMap;
|
||||
|
||||
class ContentListItem {
|
||||
public:
|
||||
ContentListItem(nsIContent* aContent) : mNext(nsnull), mContent(aContent) {
|
||||
MOZ_COUNT_CTOR(RDF_nsElementMap_ContentListItem);
|
||||
}
|
||||
|
||||
~ContentListItem() {
|
||||
MOZ_COUNT_DTOR(RDF_nsElementMap_ContentListItem);
|
||||
}
|
||||
|
||||
ContentListItem* mNext;
|
||||
nsCOMPtr<nsIContent> mContent;
|
||||
};
|
||||
|
||||
static PLHashNumber
|
||||
Hash(const void* akey);
|
||||
|
||||
static PRIntn
|
||||
Compare(const void* aLeft, const void* aRight);
|
||||
|
||||
static PRIntn
|
||||
ReleaseContentList(PLHashEntry* aHashEntry, PRIntn aIndex, void* aClosure);
|
||||
|
||||
public:
|
||||
nsElementMap(void);
|
||||
virtual ~nsElementMap();
|
||||
|
||||
nsresult
|
||||
Add(const nsString& aID, nsIContent* aContent);
|
||||
|
||||
nsresult
|
||||
Remove(const nsString& aID, nsIContent* aContent);
|
||||
|
||||
nsresult
|
||||
Find(const nsString& aID, nsISupportsArray* aResults);
|
||||
|
||||
nsresult
|
||||
FindFirst(const nsString& aID, nsIContent** aContent);
|
||||
|
||||
typedef PRIntn (*nsElementMapEnumerator)(const nsString& aID,
|
||||
nsIContent* aElement,
|
||||
void* aClosure);
|
||||
nsresult
|
||||
Enumerate(nsElementMapEnumerator aEnumerator, void* aClosure);
|
||||
|
||||
private:
|
||||
struct EnumerateClosure {
|
||||
nsElementMapEnumerator mEnumerator;
|
||||
void* mClosure;
|
||||
};
|
||||
|
||||
static PRIntn
|
||||
EnumerateImpl(PLHashEntry* aHashEntry, PRIntn aIndex, void* aClosure);
|
||||
};
|
||||
|
||||
|
||||
#endif // nsElementMap_h__
|
||||
90
mozilla/content/xul/document/src/nsForwardReference.h
Normal file
90
mozilla/content/xul/document/src/nsForwardReference.h
Normal file
@@ -0,0 +1,90 @@
|
||||
/* -*- 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):
|
||||
*/
|
||||
|
||||
#ifndef nsForwardReference_h__
|
||||
#define nsForwardReference_h__
|
||||
|
||||
class nsForwardReference
|
||||
{
|
||||
protected:
|
||||
nsForwardReference() {}
|
||||
|
||||
public:
|
||||
virtual ~nsForwardReference() {}
|
||||
|
||||
/**
|
||||
* Priority codes returned from GetPriority()
|
||||
*/
|
||||
enum Priority {
|
||||
/** The initial pass, after which the content model will be
|
||||
fully built */
|
||||
ePriority_Construction,
|
||||
|
||||
/** A second pass, after which all 'magic attribute' hookup
|
||||
will have been performed */
|
||||
ePriority_Hookup,
|
||||
|
||||
/** A dummy marker, used in kPasses to indicate termination */
|
||||
ePriority_Done
|
||||
};
|
||||
|
||||
/**
|
||||
* Forward references are categorized by 'priority', and all
|
||||
* forward references in a higher priority are resolved before any
|
||||
* reference in a lower priority. This variable specifies this
|
||||
* ordering. The last Priority is guaranteed to be ePriority_Done.
|
||||
*/
|
||||
static const Priority kPasses[];
|
||||
|
||||
/**
|
||||
* Get the priority of the forward reference. 'ePriority_Construction'
|
||||
* references are all resolved before 'ePriority_Hookup' references
|
||||
* are resolved.
|
||||
*
|
||||
* @return the Priority of the reference
|
||||
*/
|
||||
virtual Priority GetPriority() = 0;
|
||||
|
||||
/**
|
||||
* Result codes returned from Resolve()
|
||||
*/
|
||||
enum Result {
|
||||
/** Resolution succeeded, I'm done. */
|
||||
eResolve_Succeeded,
|
||||
|
||||
/** Couldn't resolve, but try me later. */
|
||||
eResolve_Later,
|
||||
|
||||
/** Something bad happened, don't try again. */
|
||||
eResolve_Error
|
||||
};
|
||||
|
||||
/**
|
||||
* Attempt to resolve the forward reference.
|
||||
*
|
||||
* @return a Result that tells the resolver how to treat
|
||||
* the reference.
|
||||
*/
|
||||
virtual Result Resolve() = 0;
|
||||
};
|
||||
|
||||
#endif // nsForwardReference_h__
|
||||
555
mozilla/content/xul/document/src/nsXULCommandDispatcher.cpp
Normal file
555
mozilla/content/xul/document/src/nsXULCommandDispatcher.cpp
Normal file
@@ -0,0 +1,555 @@
|
||||
/* -*- 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.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):
|
||||
*/
|
||||
|
||||
/*
|
||||
This file provides the implementation for the XUL Command Dispatcher.
|
||||
*/
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMXULCommandDispatcher.h"
|
||||
#include "nsIXULCommandDispatcher.h"
|
||||
#include "nsIDOMFocusListener.h"
|
||||
#include "nsRDFCID.h"
|
||||
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIScriptContextOwner.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMUIEvent.h"
|
||||
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIControllers.h"
|
||||
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
#include "prlog.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
static NS_DEFINE_IID(kIDomNodeIID, NS_IDOMNODE_IID);
|
||||
static NS_DEFINE_IID(kIDomElementIID, NS_IDOMELEMENT_IID);
|
||||
static NS_DEFINE_IID(kIDomEventListenerIID, NS_IDOMEVENTLISTENER_IID);
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
static PRLogModuleInfo* gLog;
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// XULCommandDispatcherImpl
|
||||
//
|
||||
// This is the focus manager for XUL documents.
|
||||
//
|
||||
class XULCommandDispatcherImpl : public nsIDOMXULCommandDispatcher,
|
||||
public nsIXULCommandDispatcher,
|
||||
public nsIDOMFocusListener,
|
||||
public nsIScriptObjectOwner
|
||||
{
|
||||
public:
|
||||
XULCommandDispatcherImpl(void);
|
||||
virtual ~XULCommandDispatcherImpl(void);
|
||||
|
||||
public:
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMXULCommandDispatcher interface
|
||||
NS_DECL_IDOMXULCOMMANDDISPATCHER
|
||||
|
||||
// nsIDOMFocusListener
|
||||
virtual nsresult Focus(nsIDOMEvent* aEvent);
|
||||
virtual nsresult Blur(nsIDOMEvent* aEvent);
|
||||
|
||||
// nsIDOMEventListener
|
||||
virtual nsresult HandleEvent(nsIDOMEvent* anEvent) { return NS_OK; };
|
||||
|
||||
// nsIScriptObjectOwner interface
|
||||
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
|
||||
NS_IMETHOD SetScriptObject(void *aScriptObject);
|
||||
|
||||
protected:
|
||||
NS_IMETHOD GetParentWindowFromElement(nsIDOMElement* aElement, nsPIDOMWindow** aPWindow);
|
||||
|
||||
void* mScriptObject; // ????
|
||||
|
||||
// XXX THis was supposed to be WEAK, but c'mon, that's an accident
|
||||
// waiting to happen! If somebody deletes the node, then asks us
|
||||
// for the focus, we'll get killed!
|
||||
nsCOMPtr<nsIDOMNode> mCurrentNode; // [OWNER]
|
||||
|
||||
class Updater {
|
||||
public:
|
||||
Updater(nsIDOMElement* aElement,
|
||||
const nsString& aEvents,
|
||||
const nsString& aTargets)
|
||||
: mElement(aElement),
|
||||
mEvents(aEvents),
|
||||
mTargets(aTargets),
|
||||
mNext(nsnull)
|
||||
{}
|
||||
|
||||
nsIDOMElement* mElement; // [WEAK]
|
||||
nsString mEvents;
|
||||
nsString mTargets;
|
||||
Updater* mNext;
|
||||
};
|
||||
|
||||
Updater* mUpdaters;
|
||||
|
||||
PRBool Matches(const nsString& aList, const nsString& aElement);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
XULCommandDispatcherImpl::XULCommandDispatcherImpl(void)
|
||||
: mScriptObject(nsnull), mCurrentNode(nsnull), mUpdaters(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
if (! gLog)
|
||||
gLog = PR_NewLogModule("nsXULCommandDispatcher");
|
||||
#endif
|
||||
}
|
||||
|
||||
XULCommandDispatcherImpl::~XULCommandDispatcherImpl(void)
|
||||
{
|
||||
while (mUpdaters) {
|
||||
Updater* doomed = mUpdaters;
|
||||
mUpdaters = mUpdaters->mNext;
|
||||
delete doomed;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(XULCommandDispatcherImpl)
|
||||
NS_IMPL_RELEASE(XULCommandDispatcherImpl)
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULCommandDispatcherImpl::QueryInterface(REFNSIID iid, void** result)
|
||||
{
|
||||
if (! result)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*result = nsnull;
|
||||
if (iid.Equals(kISupportsIID)) {
|
||||
*result = (nsISupports*)(nsIXULCommandDispatcher*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
else if (iid.Equals(nsIXULCommandDispatcher::GetIID())) {
|
||||
*result = NS_STATIC_CAST(nsIXULCommandDispatcher*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
else if (iid.Equals(nsIDOMXULCommandDispatcher::GetIID())) {
|
||||
*result = NS_STATIC_CAST(nsIDOMXULCommandDispatcher*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
else if (iid.Equals(nsIDOMFocusListener::GetIID())) {
|
||||
*result = NS_STATIC_CAST(nsIDOMFocusListener*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
else if (iid.Equals(kIDomEventListenerIID)) {
|
||||
*result = (nsIDOMEventListener*)(nsIDOMFocusListener*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
else if (iid.Equals(kIScriptObjectOwnerIID)) {
|
||||
*result = NS_STATIC_CAST(nsIScriptObjectOwner*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// nsIDOMXULTracker Interface
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULCommandDispatcherImpl::GetFocusedNode(nsIDOMNode** aNode)
|
||||
{
|
||||
*aNode = mCurrentNode;
|
||||
NS_IF_ADDREF(*aNode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULCommandDispatcherImpl::SetFocusedNode(nsIDOMNode* aNode)
|
||||
{
|
||||
// XXX On a blur, will need to fire an updatecommands (focus) on the
|
||||
// parent window.
|
||||
mCurrentNode = aNode;
|
||||
if (mCurrentNode)
|
||||
UpdateCommands(nsAutoString("focus"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULCommandDispatcherImpl::AddCommandUpdater(nsIDOMElement* aElement,
|
||||
const nsString& aEvents,
|
||||
const nsString& aTargets)
|
||||
{
|
||||
NS_PRECONDITION(aElement != nsnull, "null ptr");
|
||||
if (! aElement)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
Updater* updater = mUpdaters;
|
||||
Updater** link = &mUpdaters;
|
||||
|
||||
while (updater) {
|
||||
if (updater->mElement == aElement) {
|
||||
PR_LOG(gLog, PR_LOG_ALWAYS,
|
||||
("xulcmd[%p] replace %p(events=%s targets=%s) with (events=%s targets=%s)",
|
||||
this, aElement,
|
||||
(const char*) nsCAutoString(updater->mEvents),
|
||||
(const char*) nsCAutoString(updater->mTargets),
|
||||
(const char*) nsCAutoString(aEvents),
|
||||
(const char*) nsCAutoString(aTargets)));
|
||||
|
||||
// If the updater was already in the list, then replace
|
||||
// (?) the 'events' and 'targets' filters with the new
|
||||
// specification.
|
||||
updater->mEvents = aEvents;
|
||||
updater->mTargets = aTargets;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
link = &(updater->mNext);
|
||||
updater = updater->mNext;
|
||||
}
|
||||
|
||||
PR_LOG(gLog, PR_LOG_ALWAYS,
|
||||
("xulcmd[%p] add %p(events=%s targets=%s)",
|
||||
this, aElement,
|
||||
(const char*) nsCAutoString(aEvents),
|
||||
(const char*) nsCAutoString(aTargets)));
|
||||
|
||||
// If we get here, this is a new updater. Append it to the list.
|
||||
updater = new Updater(aElement, aEvents, aTargets);
|
||||
if (! updater)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
*link = updater;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULCommandDispatcherImpl::RemoveCommandUpdater(nsIDOMElement* aElement)
|
||||
{
|
||||
NS_PRECONDITION(aElement != nsnull, "null ptr");
|
||||
if (! aElement)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
Updater* updater = mUpdaters;
|
||||
Updater** link = &mUpdaters;
|
||||
|
||||
while (updater) {
|
||||
if (updater->mElement == aElement) {
|
||||
PR_LOG(gLog, PR_LOG_ALWAYS,
|
||||
("xulcmd[%p] remove %p(events=%s targets=%s)",
|
||||
this, aElement,
|
||||
(const char*) nsCAutoString(updater->mEvents),
|
||||
(const char*) nsCAutoString(updater->mTargets)));
|
||||
|
||||
*link = updater->mNext;
|
||||
delete updater;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
link = &(updater->mNext);
|
||||
updater = updater->mNext;
|
||||
}
|
||||
|
||||
// Hmm. Not found. Oh well.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULCommandDispatcherImpl::UpdateCommands(const nsString& aEventName)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsAutoString id;
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mCurrentNode);
|
||||
if (element) {
|
||||
rv = element->GetAttribute(nsAutoString("id"), id);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get element's id");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
for (Updater* updater = mUpdaters; updater != nsnull; updater = updater->mNext) {
|
||||
// Skip any nodes that don't match our 'events' or 'targets'
|
||||
// filters.
|
||||
if (! Matches(updater->mEvents, aEventName))
|
||||
continue;
|
||||
|
||||
if (! Matches(updater->mTargets, id))
|
||||
continue;
|
||||
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(updater->mElement);
|
||||
NS_ASSERTION(content != nsnull, "not an nsIContent");
|
||||
if (! content)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
rv = content->GetDocument(*getter_AddRefs(document));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get document");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
NS_ASSERTION(document != nsnull, "element has no document");
|
||||
if (! document)
|
||||
continue;
|
||||
|
||||
PR_LOG(gLog, PR_LOG_ALWAYS,
|
||||
("xulcmd[%p] update %p event=%s",
|
||||
this, updater->mElement,
|
||||
(const char*) nsCAutoString(aEventName)));
|
||||
|
||||
PRInt32 count = document->GetNumberOfShells();
|
||||
for (PRInt32 i = 0; i < count; i++) {
|
||||
nsCOMPtr<nsIPresShell> shell = dont_AddRef(document->GetShellAt(i));
|
||||
if (! shell)
|
||||
continue;
|
||||
|
||||
// Retrieve the context in which our DOM event will fire.
|
||||
nsCOMPtr<nsIPresContext> context;
|
||||
rv = shell->GetPresContext(getter_AddRefs(context));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Handle the DOM event
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsEvent event;
|
||||
event.eventStructType = NS_EVENT;
|
||||
event.message = NS_XUL_COMMAND_UPDATE;
|
||||
content->HandleDOMEvent(*context, &event, nsnull, NS_EVENT_FLAG_INIT, status);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULCommandDispatcherImpl::GetControllers(nsIControllers** aResult)
|
||||
{
|
||||
if (mCurrentNode) {
|
||||
nsCOMPtr<nsIDOMXULElement> xulElement = do_QueryInterface(mCurrentNode);
|
||||
if (xulElement)
|
||||
return xulElement->GetControllers(aResult);
|
||||
else {
|
||||
nsCOMPtr<nsIDOMWindow> domWindow = do_QueryInterface(mCurrentNode);
|
||||
if (domWindow)
|
||||
return domWindow->GetControllers(aResult);
|
||||
}
|
||||
}
|
||||
|
||||
*aResult = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/////
|
||||
// nsIDOMFocusListener
|
||||
/////
|
||||
|
||||
nsresult
|
||||
XULCommandDispatcherImpl::Focus(nsIDOMEvent* aEvent)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> t;
|
||||
aEvent->GetTarget(getter_AddRefs(t));
|
||||
|
||||
// XXX: Bad fix
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(t);
|
||||
if(element) {
|
||||
SetFocusedNode(t);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
XULCommandDispatcherImpl::Blur(nsIDOMEvent* aEvent)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> t;
|
||||
aEvent->GetTarget(getter_AddRefs(t));
|
||||
if( t == mCurrentNode ) {
|
||||
SetFocusedNode(nsnull);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsIScriptObjectOwner interface
|
||||
NS_IMETHODIMP
|
||||
XULCommandDispatcherImpl::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
nsIScriptGlobalObject *global = aContext->GetGlobalObject();
|
||||
|
||||
if (nsnull == mScriptObject) {
|
||||
res = NS_NewScriptXULCommandDispatcher(aContext, (nsISupports *)(nsIDOMXULCommandDispatcher*)this, global, (void**)&mScriptObject);
|
||||
}
|
||||
*aScriptObject = mScriptObject;
|
||||
|
||||
NS_RELEASE(global);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULCommandDispatcherImpl::SetScriptObject(void *aScriptObject)
|
||||
{
|
||||
mScriptObject = aScriptObject;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
PRBool
|
||||
XULCommandDispatcherImpl::Matches(const nsString& aList, const nsString& aElement)
|
||||
{
|
||||
if (aList == "*")
|
||||
return PR_TRUE; // match _everything_!
|
||||
|
||||
PRInt32 indx = aList.Find(aElement);
|
||||
if (indx == -1)
|
||||
return PR_FALSE; // not in the list at all
|
||||
|
||||
// okay, now make sure it's not a substring snafu; e.g., 'ur'
|
||||
// found inside of 'blur'.
|
||||
if (indx > 0) {
|
||||
PRUnichar ch = aList[indx - 1];
|
||||
if (! nsString::IsSpace(ch) && ch != PRUnichar(','))
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
if (indx + aElement.Length() < aList.Length()) {
|
||||
PRUnichar ch = aList[indx + aElement.Length()];
|
||||
if (! nsString::IsSpace(ch) && ch != PRUnichar(','))
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP XULCommandDispatcherImpl::GetParentWindowFromElement(nsIDOMElement* aElement, nsPIDOMWindow** aPWindow)
|
||||
{
|
||||
nsCOMPtr<nsIDOMDocument> document;
|
||||
aElement->GetOwnerDocument(getter_AddRefs(document));
|
||||
if(!document) return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDocument> objectOwner = do_QueryInterface(document);
|
||||
if(!objectOwner) return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIScriptContextOwner> contextOwner = dont_QueryInterface(objectOwner->GetScriptContextOwner());
|
||||
if(!contextOwner) return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObject;
|
||||
contextOwner->GetScriptGlobalObject(getter_AddRefs(globalObject));
|
||||
if(!globalObject) return NS_OK;
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> privateDOMWindow = do_QueryInterface(globalObject);
|
||||
if(!privateDOMWindow) return NS_OK;
|
||||
|
||||
privateDOMWindow->GetPrivateParent(aPWindow);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP XULCommandDispatcherImpl::GetControllerForCommand(const nsString& command, nsIController** _retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
|
||||
nsCOMPtr<nsIControllers> controllers;
|
||||
GetControllers(getter_AddRefs(controllers));
|
||||
if(controllers) {
|
||||
nsCOMPtr<nsIController> controller;
|
||||
controllers->GetControllerForCommand(command.GetUnicode(), getter_AddRefs(controller));
|
||||
if(controller) {
|
||||
*_retval = controller;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if(!mCurrentNode) return NS_OK;
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> currentWindow;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mCurrentNode);
|
||||
if(element) {
|
||||
GetParentWindowFromElement(element, getter_AddRefs(currentWindow));
|
||||
} else {
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(mCurrentNode);
|
||||
if(!window) return NS_OK;
|
||||
|
||||
window->GetPrivateParent(getter_AddRefs(currentWindow));
|
||||
}
|
||||
|
||||
while(currentWindow) {
|
||||
nsCOMPtr<nsIDOMWindow> domWindow = do_QueryInterface(currentWindow);
|
||||
if(domWindow) {
|
||||
nsCOMPtr<nsIControllers> controllers2;
|
||||
domWindow->GetControllers(getter_AddRefs(controllers2));
|
||||
if(controllers2) {
|
||||
nsCOMPtr<nsIController> controller;
|
||||
controllers2->GetControllerForCommand(command.GetUnicode(), getter_AddRefs(controller));
|
||||
if(controller) {
|
||||
*_retval = controller;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
nsCOMPtr<nsPIDOMWindow> parentPWindow = currentWindow;
|
||||
parentPWindow->GetPrivateParent(getter_AddRefs(currentWindow));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
nsresult
|
||||
NS_NewXULCommandDispatcher(nsIXULCommandDispatcher** CommandDispatcher)
|
||||
{
|
||||
XULCommandDispatcherImpl* focus = new XULCommandDispatcherImpl();
|
||||
if (!focus)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(focus);
|
||||
*CommandDispatcher = focus;
|
||||
return NS_OK;
|
||||
}
|
||||
1750
mozilla/content/xul/document/src/nsXULContentSink.cpp
Normal file
1750
mozilla/content/xul/document/src/nsXULContentSink.cpp
Normal file
File diff suppressed because it is too large
Load Diff
228
mozilla/content/xul/document/src/nsXULControllers.cpp
Normal file
228
mozilla/content/xul/document/src/nsXULControllers.cpp
Normal file
@@ -0,0 +1,228 @@
|
||||
/* -*- 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.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):
|
||||
*/
|
||||
|
||||
/*
|
||||
This file provides the implementation for the XUL Command Dispatcher.
|
||||
*/
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsISupportsArray.h"
|
||||
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIXULCommandDispatcher.h"
|
||||
#include "nsIDOMFocusListener.h"
|
||||
#include "nsRDFCID.h"
|
||||
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIScriptContextOwner.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMUIEvent.h"
|
||||
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIControllers.h"
|
||||
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
static NS_DEFINE_IID(kIDomNodeIID, NS_IDOMNODE_IID);
|
||||
static NS_DEFINE_IID(kIDomElementIID, NS_IDOMELEMENT_IID);
|
||||
static NS_DEFINE_IID(kIDomEventListenerIID, NS_IDOMEVENTLISTENER_IID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// XULControllersImpl
|
||||
//
|
||||
// This is the focus manager for XUL documents.
|
||||
//
|
||||
class XULControllersImpl : public nsIControllers
|
||||
{
|
||||
public:
|
||||
XULControllersImpl(void);
|
||||
virtual ~XULControllersImpl(void);
|
||||
|
||||
public:
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_DECL_NSICONTROLLERS
|
||||
|
||||
|
||||
protected:
|
||||
nsISupportsArray* mControllers;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
XULControllersImpl::XULControllersImpl(void) :
|
||||
mControllers(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
XULControllersImpl::~XULControllersImpl(void)
|
||||
{
|
||||
NS_IF_RELEASE(mControllers);
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(XULControllersImpl)
|
||||
NS_IMPL_RELEASE(XULControllersImpl)
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULControllersImpl::QueryInterface(REFNSIID iid, void** result)
|
||||
{
|
||||
if (! result)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*result = nsnull;
|
||||
if (iid.Equals(kISupportsIID)) {
|
||||
*result = (nsISupports*)(nsIControllers*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
else if (iid.Equals(nsIControllers::GetIID())) {
|
||||
*result = NS_STATIC_CAST(nsIControllers*, this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
||||
/* boolean SupportsCommand (in string command); */
|
||||
NS_IMETHODIMP XULControllersImpl::GetControllerForCommand(const PRUnichar *command, nsIController** _retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
if(!mControllers)
|
||||
return NS_OK;
|
||||
|
||||
PRUint32 count;
|
||||
mControllers->Count(&count);
|
||||
for(PRUint32 i=0; i < count; i++) {
|
||||
nsCOMPtr<nsIController> controller;
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
mControllers->GetElementAt(i, getter_AddRefs(supports));
|
||||
controller = do_QueryInterface(supports);
|
||||
if( controller ) {
|
||||
PRBool supportsCommand;
|
||||
controller->SupportsCommand(command, &supportsCommand);
|
||||
if(supportsCommand) {
|
||||
*_retval = controller;
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void InsertControllerAt (in short index, in nsIController controller); */
|
||||
NS_IMETHODIMP XULControllersImpl::InsertControllerAt(PRUint32 index, nsIController *controller)
|
||||
{
|
||||
if(! mControllers )
|
||||
NS_NewISupportsArray(&mControllers);
|
||||
|
||||
mControllers->InsertElementAt(controller, index);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIController RemoveControllerAt (in short index); */
|
||||
NS_IMETHODIMP XULControllersImpl::RemoveControllerAt(PRUint32 index, nsIController **_retval)
|
||||
{
|
||||
if(mControllers) {
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
mControllers->GetElementAt(index, getter_AddRefs(supports));
|
||||
supports->QueryInterface(nsIController::GetIID(), (void**)_retval);
|
||||
mControllers->RemoveElementAt(index);
|
||||
} else
|
||||
*_retval = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIController GetControllerAt (in short index); */
|
||||
NS_IMETHODIMP XULControllersImpl::GetControllerAt(PRUint32 index, nsIController **_retval)
|
||||
{
|
||||
if(mControllers) {
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
mControllers->GetElementAt(index, getter_AddRefs(supports));
|
||||
supports->QueryInterface(nsIController::GetIID(), (void**)_retval);
|
||||
} else
|
||||
*_retval = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void AppendController (in nsIController controller); */
|
||||
NS_IMETHODIMP XULControllersImpl::AppendController(nsIController *controller)
|
||||
{
|
||||
if(! mControllers )
|
||||
NS_NewISupportsArray(&mControllers);
|
||||
|
||||
mControllers->AppendElement(controller);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void RemoveController (in nsIController controller); */
|
||||
NS_IMETHODIMP XULControllersImpl::RemoveController(nsIController *controller)
|
||||
{
|
||||
if(mControllers) {
|
||||
nsCOMPtr<nsISupports> supports = do_QueryInterface(controller);
|
||||
mControllers->RemoveElement(supports);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* short GetControllerCount (); */
|
||||
NS_IMETHODIMP XULControllersImpl::GetControllerCount(PRUint32 *_retval)
|
||||
{
|
||||
*_retval = 0;
|
||||
if(mControllers)
|
||||
mControllers->Count(_retval);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
nsresult
|
||||
NS_NewXULControllers(nsIControllers** aControllers)
|
||||
{
|
||||
nsIControllers* impl = new XULControllersImpl();
|
||||
if (!impl)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(impl);
|
||||
*aControllers = impl;
|
||||
return NS_OK;
|
||||
}
|
||||
5353
mozilla/content/xul/document/src/nsXULDocument.cpp
Normal file
5353
mozilla/content/xul/document/src/nsXULDocument.cpp
Normal file
File diff suppressed because it is too large
Load Diff
749
mozilla/content/xul/document/src/nsXULDocument.h
Normal file
749
mozilla/content/xul/document/src/nsXULDocument.h
Normal file
@@ -0,0 +1,749 @@
|
||||
/* -*- 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):
|
||||
*/
|
||||
|
||||
#ifndef nsXULDocument_h__
|
||||
#define nsXULDocument_h__
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsElementMap.h"
|
||||
#include "nsForwardReference.h"
|
||||
#include "nsIArena.h"
|
||||
#include "nsICSSLoader.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMEventCapturer.h"
|
||||
#include "nsIDOMHTMLFormElement.h"
|
||||
#include "nsIDOMNSDocument.h"
|
||||
#include "nsIDOMSelection.h"
|
||||
#include "nsIDOMXULCommandDispatcher.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIEventListenerManager.h"
|
||||
#include "nsIHTMLCSSStyleSheet.h"
|
||||
#include "nsIHTMLContentContainer.h"
|
||||
#include "nsIHTMLStyleSheet.h"
|
||||
#include "nsIJSScriptObject.h"
|
||||
#include "nsILineBreakerFactory.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIParser.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIRDFDataSource.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIStreamLoadableDocument.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIWordBreakerFactory.h"
|
||||
#include "nsIXULDocument.h"
|
||||
#include "nsIXULPrototypeDocument.h"
|
||||
#include "nsRDFDOMNodeList.h"
|
||||
#include "nsTime.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsWeakPtr.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIUnicharStreamLoader.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsIHTMLElementFactory;
|
||||
class nsILoadGroup;
|
||||
class nsIRDFResource;
|
||||
class nsIRDFService;
|
||||
class nsIScriptContextOwner;
|
||||
class nsIUnicharStreamLoader;
|
||||
class nsIXMLElementFactory;
|
||||
class nsIXULContentUtils;
|
||||
class nsIXULPrototypeCache;
|
||||
#if 0 // XXXbe save me, scc (need NSCAP_FORWARD_DECL(nsXULPrototypeScript))
|
||||
class nsIXULPrototypeScript;
|
||||
#else
|
||||
#include "nsXULElement.h"
|
||||
#endif
|
||||
|
||||
struct JSObject;
|
||||
struct PRLogModuleInfo;
|
||||
|
||||
/**
|
||||
* The XUL document class
|
||||
*/
|
||||
class nsXULDocument : public nsIDocument,
|
||||
public nsIXULDocument,
|
||||
public nsIStreamLoadableDocument,
|
||||
public nsIDOMXULDocument,
|
||||
public nsIDOMNSDocument,
|
||||
public nsIDOMEventCapturer,
|
||||
public nsIJSScriptObject,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIHTMLContentContainer,
|
||||
public nsIUnicharStreamLoaderObserver,
|
||||
public nsSupportsWeakReference
|
||||
{
|
||||
public:
|
||||
nsXULDocument();
|
||||
virtual ~nsXULDocument();
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIUNICHARSTREAMLOADEROBSERVER
|
||||
|
||||
// nsIDocument interface
|
||||
virtual nsIArena* GetArena();
|
||||
|
||||
NS_IMETHOD GetContentType(nsString& aContentType) const;
|
||||
|
||||
NS_IMETHOD StartDocumentLoad(const char* aCommand,
|
||||
nsIChannel* aChannel,
|
||||
nsILoadGroup* aLoadGroup,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
nsIStreamListener **aDocListener);
|
||||
|
||||
virtual const nsString* GetDocumentTitle() const;
|
||||
|
||||
virtual nsIURI* GetDocumentURL() const;
|
||||
|
||||
virtual nsIPrincipal* GetDocumentPrincipal();
|
||||
|
||||
NS_IMETHOD GetDocumentLoadGroup(nsILoadGroup **aGroup) const;
|
||||
|
||||
NS_IMETHOD GetBaseURL(nsIURI*& aURL) const;
|
||||
|
||||
NS_IMETHOD GetDocumentCharacterSet(nsString& oCharSetID);
|
||||
|
||||
NS_IMETHOD SetDocumentCharacterSet(const nsString& aCharSetID);
|
||||
|
||||
NS_IMETHOD GetLineBreaker(nsILineBreaker** aResult) ;
|
||||
NS_IMETHOD SetLineBreaker(nsILineBreaker* aLineBreaker) ;
|
||||
NS_IMETHOD GetWordBreaker(nsIWordBreaker** aResult) ;
|
||||
NS_IMETHOD SetWordBreaker(nsIWordBreaker* aWordBreaker) ;
|
||||
|
||||
NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, nsString& aData) const;
|
||||
NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, const nsString& aData);
|
||||
|
||||
NS_IMETHOD CreateShell(nsIPresContext* aContext,
|
||||
nsIViewManager* aViewManager,
|
||||
nsIStyleSet* aStyleSet,
|
||||
nsIPresShell** aInstancePtrResult);
|
||||
|
||||
virtual PRBool DeleteShell(nsIPresShell* aShell);
|
||||
|
||||
virtual PRInt32 GetNumberOfShells();
|
||||
|
||||
virtual nsIPresShell* GetShellAt(PRInt32 aIndex);
|
||||
|
||||
virtual nsIDocument* GetParentDocument();
|
||||
|
||||
virtual void SetParentDocument(nsIDocument* aParent);
|
||||
|
||||
virtual void AddSubDocument(nsIDocument* aSubDoc);
|
||||
|
||||
virtual PRInt32 GetNumberOfSubDocuments();
|
||||
|
||||
virtual nsIDocument* GetSubDocumentAt(PRInt32 aIndex);
|
||||
|
||||
virtual nsIContent* GetRootContent();
|
||||
|
||||
virtual void SetRootContent(nsIContent* aRoot);
|
||||
|
||||
NS_IMETHOD AppendToProlog(nsIContent* aContent);
|
||||
NS_IMETHOD AppendToEpilog(nsIContent* aContent);
|
||||
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIContent*& aResult) const;
|
||||
NS_IMETHOD IndexOf(nsIContent* aPossibleChild, PRInt32& aIndex) const;
|
||||
NS_IMETHOD GetChildCount(PRInt32& aCount);
|
||||
|
||||
virtual PRInt32 GetNumberOfStyleSheets();
|
||||
|
||||
virtual nsIStyleSheet* GetStyleSheetAt(PRInt32 aIndex);
|
||||
|
||||
virtual PRInt32 GetIndexOfStyleSheet(nsIStyleSheet* aSheet);
|
||||
|
||||
virtual void AddStyleSheet(nsIStyleSheet* aSheet);
|
||||
NS_IMETHOD InsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex, PRBool aNotify);
|
||||
|
||||
virtual void SetStyleSheetDisabledState(nsIStyleSheet* aSheet,
|
||||
PRBool mDisabled);
|
||||
|
||||
NS_IMETHOD GetCSSLoader(nsICSSLoader*& aLoader);
|
||||
|
||||
virtual nsIScriptContextOwner *GetScriptContextOwner();
|
||||
|
||||
virtual void SetScriptContextOwner(nsIScriptContextOwner *aScriptContextOwner);
|
||||
|
||||
NS_IMETHOD GetNameSpaceManager(nsINameSpaceManager*& aManager);
|
||||
|
||||
virtual void AddObserver(nsIDocumentObserver* aObserver);
|
||||
|
||||
virtual PRBool RemoveObserver(nsIDocumentObserver* aObserver);
|
||||
|
||||
NS_IMETHOD BeginLoad();
|
||||
|
||||
NS_IMETHOD EndLoad();
|
||||
|
||||
NS_IMETHOD ContentChanged(nsIContent* aContent,
|
||||
nsISupports* aSubContent);
|
||||
|
||||
NS_IMETHOD ContentStatesChanged(nsIContent* aContent1, nsIContent* aContent2);
|
||||
|
||||
NS_IMETHOD AttributeChanged(nsIContent* aChild,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aHint); // See nsStyleConsts fot hint values
|
||||
|
||||
NS_IMETHOD ContentAppended(nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer);
|
||||
|
||||
NS_IMETHOD ContentInserted(nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer);
|
||||
|
||||
NS_IMETHOD ContentReplaced(nsIContent* aContainer,
|
||||
nsIContent* aOldChild,
|
||||
nsIContent* aNewChild,
|
||||
PRInt32 aIndexInContainer);
|
||||
|
||||
NS_IMETHOD ContentRemoved(nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer);
|
||||
|
||||
NS_IMETHOD StyleRuleChanged(nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule,
|
||||
PRInt32 aHint); // See nsStyleConsts fot hint values
|
||||
|
||||
NS_IMETHOD StyleRuleAdded(nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule);
|
||||
|
||||
NS_IMETHOD StyleRuleRemoved(nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule);
|
||||
|
||||
NS_IMETHOD GetSelection(nsIDOMSelection** aSelection);
|
||||
|
||||
NS_IMETHOD SelectAll();
|
||||
|
||||
NS_IMETHOD FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound);
|
||||
|
||||
NS_IMETHOD CreateXIF(nsString & aBuffer, nsIDOMSelection* aSelection);
|
||||
|
||||
NS_IMETHOD ToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode);
|
||||
|
||||
virtual void BeginConvertToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode);
|
||||
|
||||
virtual void ConvertChildrenToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode);
|
||||
|
||||
virtual void FinishConvertToXIF(nsXIFConverter& aConverter, nsIDOMNode* aNode);
|
||||
|
||||
virtual PRBool IsInRange(const nsIContent *aStartContent, const nsIContent* aEndContent, const nsIContent* aContent) const;
|
||||
|
||||
virtual PRBool IsBefore(const nsIContent *aNewContent, const nsIContent* aCurrentContent) const;
|
||||
|
||||
virtual PRBool IsInSelection(nsIDOMSelection* aSelection, const nsIContent *aContent) const;
|
||||
|
||||
virtual nsIContent* GetPrevContent(const nsIContent *aContent) const;
|
||||
|
||||
virtual nsIContent* GetNextContent(const nsIContent *aContent) const;
|
||||
|
||||
virtual void SetDisplaySelection(PRBool aToggle);
|
||||
|
||||
virtual PRBool GetDisplaySelection() const;
|
||||
|
||||
NS_IMETHOD HandleDOMEvent(nsIPresContext& aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus& aEventStatus);
|
||||
|
||||
|
||||
// nsIXMLDocument interface
|
||||
NS_IMETHOD GetContentById(const nsString& aName, nsIContent** aContent);
|
||||
#ifdef XSL
|
||||
NS_IMETHOD SetTransformMediator(nsITransformMediator* aMediator);
|
||||
#endif
|
||||
|
||||
// nsIXULDocument interface
|
||||
NS_IMETHOD AddElementForID(const nsString& aID, nsIContent* aElement);
|
||||
NS_IMETHOD RemoveElementForID(const nsString& aID, nsIContent* aElement);
|
||||
NS_IMETHOD GetElementsForID(const nsString& aID, nsISupportsArray* aElements);
|
||||
NS_IMETHOD CreateContents(nsIContent* aElement);
|
||||
NS_IMETHOD AddContentModelBuilder(nsIRDFContentModelBuilder* aBuilder);
|
||||
NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm);
|
||||
NS_IMETHOD SetForm(nsIDOMHTMLFormElement* aForm);
|
||||
NS_IMETHOD AddForwardReference(nsForwardReference* aRef);
|
||||
NS_IMETHOD ResolveForwardReferences();
|
||||
|
||||
NS_IMETHOD CreateFromPrototype(const char* aCommand,
|
||||
nsIXULPrototypeDocument* aPrototype,
|
||||
nsIContentViewerContainer* aContainer);
|
||||
|
||||
// nsIStreamLoadableDocument interface
|
||||
NS_IMETHOD LoadFromStream(nsIInputStream& xulStream,
|
||||
nsIContentViewerContainer* aContainer,
|
||||
const char* aCommand );
|
||||
|
||||
// nsIDOMEventCapturer interface
|
||||
NS_IMETHOD CaptureEvent(const nsString& aType);
|
||||
NS_IMETHOD ReleaseEvent(const nsString& aType);
|
||||
|
||||
// nsIDOMEventReceiver interface (yuck. inherited from nsIDOMEventCapturer)
|
||||
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);
|
||||
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);
|
||||
NS_IMETHOD GetListenerManager(nsIEventListenerManager** aInstancePtrResult);
|
||||
NS_IMETHOD GetNewListenerManager(nsIEventListenerManager **aInstancePtrResult);
|
||||
|
||||
// nsIDOMEventTarget interface
|
||||
NS_IMETHOD AddEventListener(const nsString& aType, nsIDOMEventListener* aListener,
|
||||
PRBool aUseCapture);
|
||||
NS_IMETHOD RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener,
|
||||
PRBool aUseCapture);
|
||||
|
||||
// nsIDOMDocument interface
|
||||
NS_IMETHOD GetDoctype(nsIDOMDocumentType** aDoctype);
|
||||
NS_IMETHOD GetImplementation(nsIDOMDOMImplementation** aImplementation);
|
||||
NS_IMETHOD GetDocumentElement(nsIDOMElement** aDocumentElement);
|
||||
|
||||
NS_IMETHOD CreateElement(const nsString& aTagName, nsIDOMElement** aReturn);
|
||||
NS_IMETHOD CreateDocumentFragment(nsIDOMDocumentFragment** aReturn);
|
||||
NS_IMETHOD CreateTextNode(const nsString& aData, nsIDOMText** aReturn);
|
||||
NS_IMETHOD CreateComment(const nsString& aData, nsIDOMComment** aReturn);
|
||||
NS_IMETHOD CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aReturn);
|
||||
NS_IMETHOD CreateProcessingInstruction(const nsString& aTarget, const nsString& aData, nsIDOMProcessingInstruction** aReturn);
|
||||
NS_IMETHOD CreateAttribute(const nsString& aName, nsIDOMAttr** aReturn);
|
||||
NS_IMETHOD CreateEntityReference(const nsString& aName, nsIDOMEntityReference** aReturn);
|
||||
NS_IMETHOD GetElementsByTagName(const nsString& aTagname, nsIDOMNodeList** aReturn);
|
||||
|
||||
// nsIDOMNSDocument interface
|
||||
NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetCollection** aStyleSheets);
|
||||
NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName, const nsString& aNameSpace, nsIDOMElement** aResult);
|
||||
NS_IMETHOD CreateRange(nsIDOMRange** aRange);
|
||||
NS_IMETHOD GetWidth(PRInt32* aWidth);
|
||||
NS_IMETHOD GetHeight(PRInt32* aHeight);
|
||||
|
||||
// nsIDOMXULDocument interface
|
||||
NS_DECL_IDOMXULDOCUMENT
|
||||
|
||||
// nsIDOMNode interface
|
||||
NS_IMETHOD GetNodeName(nsString& aNodeName);
|
||||
NS_IMETHOD GetNodeValue(nsString& aNodeValue);
|
||||
NS_IMETHOD SetNodeValue(const nsString& aNodeValue);
|
||||
NS_IMETHOD GetNodeType(PRUint16* aNodeType);
|
||||
NS_IMETHOD GetParentNode(nsIDOMNode** aParentNode);
|
||||
NS_IMETHOD GetChildNodes(nsIDOMNodeList** aChildNodes);
|
||||
NS_IMETHOD HasChildNodes(PRBool* aHasChildNodes);
|
||||
NS_IMETHOD GetFirstChild(nsIDOMNode** aFirstChild);
|
||||
NS_IMETHOD GetLastChild(nsIDOMNode** aLastChild);
|
||||
NS_IMETHOD GetPreviousSibling(nsIDOMNode** aPreviousSibling);
|
||||
NS_IMETHOD GetNextSibling(nsIDOMNode** aNextSibling);
|
||||
NS_IMETHOD GetAttributes(nsIDOMNamedNodeMap** aAttributes);
|
||||
NS_IMETHOD GetOwnerDocument(nsIDOMDocument** aOwnerDocument);
|
||||
NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn);
|
||||
NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn);
|
||||
NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn);
|
||||
NS_IMETHOD AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn);
|
||||
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn);
|
||||
|
||||
// nsIJSScriptObject interface
|
||||
virtual PRBool AddProperty(JSContext *aContext, jsval aID, jsval *aVp);
|
||||
virtual PRBool DeleteProperty(JSContext *aContext, jsval aID, jsval *aVp);
|
||||
virtual PRBool GetProperty(JSContext *aContext, jsval aID, jsval *aVp);
|
||||
virtual PRBool SetProperty(JSContext *aContext, jsval aID, jsval *aVp);
|
||||
virtual PRBool EnumerateProperty(JSContext *aContext);
|
||||
virtual PRBool Resolve(JSContext *aContext, jsval aID);
|
||||
virtual PRBool Convert(JSContext *aContext, jsval aID);
|
||||
virtual void Finalize(JSContext *aContext);
|
||||
|
||||
// nsIScriptObjectOwner interface
|
||||
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
|
||||
NS_IMETHOD SetScriptObject(void *aScriptObject);
|
||||
|
||||
// nsIHTMLContentContainer interface
|
||||
NS_IMETHOD GetAttributeStyleSheet(nsIHTMLStyleSheet** aResult);
|
||||
NS_IMETHOD GetInlineStyleSheet(nsIHTMLCSSStyleSheet** aResult);
|
||||
|
||||
protected:
|
||||
// Implementation methods
|
||||
friend nsresult
|
||||
NS_NewXULDocument(nsIXULDocument** aResult);
|
||||
|
||||
nsresult Init(void);
|
||||
nsresult StartLayout(void);
|
||||
|
||||
nsresult OpenWidgetItem(nsIContent* aElement);
|
||||
nsresult CloseWidgetItem(nsIContent* aElement);
|
||||
nsresult RebuildWidgetItem(nsIContent* aElement);
|
||||
|
||||
nsresult
|
||||
AddSubtreeToDocument(nsIContent* aElement);
|
||||
|
||||
nsresult
|
||||
RemoveSubtreeFromDocument(nsIContent* aElement);
|
||||
|
||||
nsresult
|
||||
AddElementToMap(nsIContent* aElement);
|
||||
|
||||
nsresult
|
||||
RemoveElementFromMap(nsIContent* aElement);
|
||||
|
||||
static PRIntn
|
||||
RemoveElementsFromMapByContent(const nsString& aID,
|
||||
nsIContent* aElement,
|
||||
void* aClosure);
|
||||
|
||||
static nsresult
|
||||
GetElementsByTagName(nsIDOMNode* aNode,
|
||||
const nsString& aTagName,
|
||||
nsRDFDOMNodeList* aElements);
|
||||
|
||||
static nsresult
|
||||
GetElementsByAttribute(nsIDOMNode* aNode,
|
||||
const nsString& aAttribute,
|
||||
const nsString& aValue,
|
||||
nsRDFDOMNodeList* aElements);
|
||||
|
||||
nsresult
|
||||
ParseTagString(const nsString& aTagName, nsIAtom*& aName, PRInt32& aNameSpaceID);
|
||||
|
||||
NS_IMETHOD PrepareStyleSheets(nsIURI* anURL);
|
||||
|
||||
void SetDocumentURLAndGroup(nsIURI* anURL);
|
||||
void SetIsPopup(PRBool isPopup) { mIsPopup = isPopup; };
|
||||
|
||||
nsresult CreateElement(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aTag,
|
||||
nsIContent** aResult);
|
||||
|
||||
nsresult PrepareToLoad(nsIContentViewerContainer* aContainer,
|
||||
const char* aCommand,
|
||||
nsIChannel* aChannel,
|
||||
nsILoadGroup* aLoadGroup,
|
||||
nsIParser** aResult);
|
||||
|
||||
nsresult
|
||||
PrepareToLoadPrototype(nsIURI* aURI,
|
||||
const char* aCommand,
|
||||
nsIPrincipal* aDocumentPrincipal,
|
||||
nsIParser** aResult);
|
||||
|
||||
nsresult ApplyPersistentAttributes();
|
||||
nsresult ApplyPersistentAttributesToElements(nsIRDFResource* aResource, nsISupportsArray* aElements);
|
||||
|
||||
protected:
|
||||
// pseudo constants
|
||||
static PRInt32 gRefCnt;
|
||||
|
||||
static nsIAtom* kAttributeAtom;
|
||||
static nsIAtom* kCommandUpdaterAtom;
|
||||
static nsIAtom* kDataSourcesAtom;
|
||||
static nsIAtom* kElementAtom;
|
||||
static nsIAtom* kIdAtom;
|
||||
static nsIAtom* kKeysetAtom;
|
||||
static nsIAtom* kObservesAtom;
|
||||
static nsIAtom* kOpenAtom;
|
||||
static nsIAtom* kOverlayAtom;
|
||||
static nsIAtom* kPersistAtom;
|
||||
static nsIAtom* kPositionAtom;
|
||||
static nsIAtom* kRefAtom;
|
||||
static nsIAtom* kRuleAtom;
|
||||
static nsIAtom* kTemplateAtom;
|
||||
|
||||
static nsIAtom** kIdentityAttrs[];
|
||||
|
||||
static nsIRDFService* gRDFService;
|
||||
static nsIRDFResource* kNC_persist;
|
||||
static nsIRDFResource* kNC_attribute;
|
||||
static nsIRDFResource* kNC_value;
|
||||
|
||||
static nsIHTMLElementFactory* gHTMLElementFactory;
|
||||
static nsIXMLElementFactory* gXMLElementFactory;
|
||||
|
||||
static nsINameSpaceManager* gNameSpaceManager;
|
||||
static PRInt32 kNameSpaceID_XUL;
|
||||
|
||||
static nsIXULContentUtils* gXULUtils;
|
||||
static nsIXULPrototypeCache* gXULCache;
|
||||
|
||||
static PRLogModuleInfo* gXULLog;
|
||||
|
||||
nsIContent*
|
||||
FindContent(const nsIContent* aStartNode,
|
||||
const nsIContent* aTest1,
|
||||
const nsIContent* aTest2) const;
|
||||
|
||||
nsresult
|
||||
Persist(nsIContent* aElement, PRInt32 aNameSpaceID, nsIAtom* aAttribute);
|
||||
|
||||
nsresult
|
||||
DestroyForwardReferences();
|
||||
|
||||
// IMPORTANT: The ownership implicit in the following member variables has been
|
||||
// explicitly checked and set using nsCOMPtr for owning pointers and raw COM interface
|
||||
// pointers for weak (ie, non owning) references. If you add any members to this
|
||||
// class, please make the ownership explicit (pinkerton, scc).
|
||||
// NOTE, THIS IS STILL IN PROGRESS, TALK TO PINK OR SCC BEFORE CHANGING
|
||||
|
||||
nsCOMPtr<nsIArena> mArena;
|
||||
nsVoidArray mObservers;
|
||||
nsAutoString mDocumentTitle;
|
||||
nsCOMPtr<nsIURI> mDocumentURL; // [OWNER] ??? compare with loader
|
||||
nsWeakPtr mDocumentLoadGroup; // [WEAK] leads to loader
|
||||
nsCOMPtr<nsIPrincipal> mDocumentPrincipal; // [OWNER]
|
||||
nsCOMPtr<nsIContent> mRootContent; // [OWNER]
|
||||
nsIDocument* mParentDocument; // [WEAK]
|
||||
nsIScriptContextOwner* mScriptContextOwner; // [WEAK] it owns me! (indirectly)
|
||||
void* mScriptObject; // ????
|
||||
nsXULDocument* mNextSrcLoadWaiter; // [OWNER] but not COMPtr
|
||||
nsString mCharSetID;
|
||||
nsVoidArray mStyleSheets;
|
||||
nsCOMPtr<nsIDOMSelection> mSelection; // [OWNER]
|
||||
PRBool mDisplaySelection;
|
||||
nsVoidArray mPresShells;
|
||||
nsCOMPtr<nsIEventListenerManager> mListenerManager; // [OWNER]
|
||||
nsCOMPtr<nsINameSpaceManager> mNameSpaceManager; // [OWNER]
|
||||
nsCOMPtr<nsIHTMLStyleSheet> mAttrStyleSheet; // [OWNER]
|
||||
nsCOMPtr<nsIHTMLCSSStyleSheet> mInlineStyleSheet; // [OWNER]
|
||||
nsCOMPtr<nsICSSLoader> mCSSLoader; // [OWNER]
|
||||
nsElementMap mElementMap;
|
||||
nsCOMPtr<nsISupportsArray> mBuilders; // [OWNER] of array, elements shouldn't own this, but they do
|
||||
nsCOMPtr<nsIRDFDataSource> mLocalStore;
|
||||
nsCOMPtr<nsILineBreaker> mLineBreaker; // [OWNER]
|
||||
nsCOMPtr<nsIWordBreaker> mWordBreaker; // [OWNER]
|
||||
nsIContentViewerContainer* mContentViewerContainer; // [WEAK] it owns me! (indirectly)
|
||||
nsString mCommand;
|
||||
nsVoidArray mSubDocuments; // [OWNER] of subelements
|
||||
PRBool mIsPopup;
|
||||
nsCOMPtr<nsIDOMHTMLFormElement> mHiddenForm; // [OWNER] of this content element
|
||||
nsCOMPtr<nsIDOMXULCommandDispatcher> mCommandDispatcher; // [OWNER] of the focus tracker
|
||||
|
||||
nsVoidArray mForwardReferences;
|
||||
PRBool mForwardReferencesResolved;
|
||||
|
||||
// The following are pointers into the content model which provide access to
|
||||
// the objects triggering either a popup or a tooltip. These are marked as
|
||||
// [OWNER] only because someone could, through DOM calls, delete the object from the
|
||||
// content model while the popup/tooltip was visible. If we didn't have a reference
|
||||
// to it, the object would go away and we'd be left pointing to garbage. This
|
||||
// does not introduce cycles into the ownership model because this is still
|
||||
// parent/child ownership. Just wanted the reader to know hyatt and I had thought about
|
||||
// this (pinkerton).
|
||||
nsCOMPtr<nsIDOMNode> mPopupNode; // [OWNER] element triggering the popup
|
||||
nsCOMPtr<nsIDOMNode> mTooltipNode; // [OWNER] element triggering the tooltip
|
||||
|
||||
/**
|
||||
* Context stack, which maintains the state of the Builder and allows
|
||||
* it to be interrupted.
|
||||
*/
|
||||
class ContextStack {
|
||||
protected:
|
||||
struct Entry {
|
||||
nsXULPrototypeElement* mPrototype;
|
||||
nsIContent* mElement;
|
||||
PRInt32 mIndex;
|
||||
Entry* mNext;
|
||||
};
|
||||
|
||||
Entry* mTop;
|
||||
PRInt32 mDepth;
|
||||
|
||||
public:
|
||||
ContextStack();
|
||||
~ContextStack();
|
||||
|
||||
PRInt32 Depth() { return mDepth; }
|
||||
|
||||
nsresult Push(nsXULPrototypeElement* aPrototype, nsIContent* aElement);
|
||||
nsresult Pop();
|
||||
nsresult Peek(nsXULPrototypeElement** aPrototype, nsIContent** aElement, PRInt32* aIndex);
|
||||
|
||||
nsresult SetTopIndex(PRInt32 aIndex);
|
||||
|
||||
PRBool IsInsideXULTemplate();
|
||||
};
|
||||
|
||||
friend class ContextStack;
|
||||
ContextStack mContextStack;
|
||||
|
||||
enum State { eState_Master, eState_Overlay };
|
||||
State mState;
|
||||
|
||||
/**
|
||||
* An array of overlay nsIURIs that have yet to be resolved. The
|
||||
* order of the array is significant: overlays at the _end_ of the
|
||||
* array are resolved before overlays earlier in the array (i.e.,
|
||||
* it is a stack).
|
||||
*/
|
||||
nsCOMPtr<nsISupportsArray> mUnloadedOverlays;
|
||||
|
||||
/**
|
||||
* Load the transcluded script at the specified URI. If the
|
||||
* prototype construction must 'block' until the load has
|
||||
* completed, aBlock will be set to true.
|
||||
*/
|
||||
nsresult LoadScript(nsXULPrototypeScript *aScriptProto, PRBool* aBlock);
|
||||
|
||||
/**
|
||||
* Execute the precompiled script object scoped by this XUL document's
|
||||
* containing window object, and using its associated script context.
|
||||
*/
|
||||
nsresult ExecuteScript(JSObject* aScriptObject);
|
||||
|
||||
/**
|
||||
* Create a delegate content model element from a prototype.
|
||||
*/
|
||||
nsresult CreateElement(nsXULPrototypeElement* aPrototype, nsIContent** aResult);
|
||||
|
||||
/**
|
||||
* Create a temporary 'overlay' element to which content nodes
|
||||
* can be attached for later resolution.
|
||||
*/
|
||||
nsresult CreateOverlayElement(nsXULPrototypeElement* aPrototype, nsIContent** aResult);
|
||||
|
||||
/**
|
||||
* Add attributes from the prototype to the element.
|
||||
*/
|
||||
nsresult AddAttributes(nsXULPrototypeElement* aPrototype, nsIContent* aElement);
|
||||
|
||||
/**
|
||||
* The prototype-script of the current transcluded script that is being
|
||||
* loaded. For document.write('<script src="nestedwrite.js"><\/script>')
|
||||
* to work, these need to be in a stack element type, and we need to hold
|
||||
* the top of stack here.
|
||||
*/
|
||||
nsXULPrototypeScript* mCurrentScriptProto;
|
||||
|
||||
/**
|
||||
* Create a XUL template builder on the specified node if a 'datasources'
|
||||
* attribute is present.
|
||||
*/
|
||||
static nsresult
|
||||
CheckTemplateBuilder(nsIContent* aElement);
|
||||
|
||||
/**
|
||||
* Do hookup for <xul:observes> tag
|
||||
*/
|
||||
nsresult HookupObserver(nsIContent* aElement);
|
||||
|
||||
/**
|
||||
* Add the current prototype's style sheets to the document.
|
||||
*/
|
||||
nsresult AddPrototypeSheets();
|
||||
|
||||
/**
|
||||
* Used to resolve broadcaster references
|
||||
*/
|
||||
class BroadcasterHookup : public nsForwardReference
|
||||
{
|
||||
protected:
|
||||
nsXULDocument* mDocument; // [WEAK]
|
||||
nsCOMPtr<nsIContent> mObservesElement; // [OWNER]
|
||||
PRBool mResolved;
|
||||
|
||||
public:
|
||||
BroadcasterHookup(nsXULDocument* aDocument, nsIContent* aObservesElement) :
|
||||
mDocument(aDocument),
|
||||
mObservesElement(aObservesElement),
|
||||
mResolved(PR_FALSE) {}
|
||||
|
||||
virtual ~BroadcasterHookup();
|
||||
|
||||
virtual Priority GetPriority() { return ePriority_Hookup; }
|
||||
virtual Result Resolve();
|
||||
};
|
||||
|
||||
friend class BroadcasterHookup;
|
||||
|
||||
|
||||
/**
|
||||
* Used to hook up overlays
|
||||
*/
|
||||
class OverlayForwardReference : public nsForwardReference
|
||||
{
|
||||
protected:
|
||||
nsXULDocument* mDocument; // [WEAK]
|
||||
nsCOMPtr<nsIContent> mOverlay; // [OWNER]
|
||||
PRBool mResolved;
|
||||
|
||||
nsresult Merge(nsIContent* aTargetNode, nsIContent* aOverlayNode);
|
||||
|
||||
public:
|
||||
OverlayForwardReference(nsXULDocument* aDocument, nsIContent* aOverlay)
|
||||
: mDocument(aDocument), mOverlay(aOverlay), mResolved(PR_FALSE) {}
|
||||
|
||||
virtual ~OverlayForwardReference();
|
||||
|
||||
virtual Priority GetPriority() { return ePriority_Construction; }
|
||||
virtual Result Resolve();
|
||||
};
|
||||
|
||||
friend class OverlayForwardReference;
|
||||
|
||||
|
||||
static
|
||||
nsresult
|
||||
CheckBroadcasterHookup(nsXULDocument* aDocument,
|
||||
nsIContent* aElement,
|
||||
PRBool* aDidResolve);
|
||||
|
||||
static
|
||||
nsresult
|
||||
InsertElement(nsIContent* aParent, nsIContent* aChild);
|
||||
|
||||
static
|
||||
PRBool
|
||||
IsChromeURI(nsIURI* aURI);
|
||||
|
||||
/**
|
||||
* The current prototype that we are walking to construct the
|
||||
* content model.
|
||||
*/
|
||||
nsCOMPtr<nsIXULPrototypeDocument> mCurrentPrototype;
|
||||
|
||||
/**
|
||||
* The master document (outermost, .xul) prototype, from which
|
||||
* all subdocuments get their security principals.
|
||||
*/
|
||||
nsCOMPtr<nsIXULPrototypeDocument> mMasterPrototype;
|
||||
|
||||
/**
|
||||
* Owning references to all of the prototype documents that were
|
||||
* used to construct this document.
|
||||
*/
|
||||
nsCOMPtr<nsISupportsArray> mPrototypes;
|
||||
|
||||
/**
|
||||
* Prepare to walk the current prototype.
|
||||
*/
|
||||
nsresult PrepareToWalk();
|
||||
|
||||
/**
|
||||
* Add overlays from the chrome registry to the set of unprocessed
|
||||
* overlays still to do.
|
||||
*/
|
||||
nsresult AddChromeOverlays();
|
||||
|
||||
/**
|
||||
* Resume (or initiate) an interrupted (or newly prepared)
|
||||
* prototype walk.
|
||||
*/
|
||||
nsresult ResumeWalk();
|
||||
|
||||
#if defined(DEBUG_waterson) || defined(DEBUG_hyatt)
|
||||
// timing
|
||||
nsTime mLoadStart;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // nsXULDocument_h__
|
||||
183
mozilla/content/xul/document/src/nsXULPrototypeCache.cpp
Normal file
183
mozilla/content/xul/document/src/nsXULPrototypeCache.cpp
Normal file
@@ -0,0 +1,183 @@
|
||||
/* -*- 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):
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsICSSStyleSheet.h"
|
||||
#include "nsIXULPrototypeCache.h"
|
||||
#include "nsIXULPrototypeDocument.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "plstr.h"
|
||||
|
||||
|
||||
class nsXULPrototypeCache : public nsIXULPrototypeCache
|
||||
{
|
||||
public:
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetPrototype(nsIURI* aURI, nsIXULPrototypeDocument** _result);
|
||||
NS_IMETHOD PutPrototype(nsIXULPrototypeDocument* aDocument);
|
||||
|
||||
NS_IMETHOD GetStyleSheet(nsIURI* aURI, nsICSSStyleSheet** _result);
|
||||
NS_IMETHOD PutStyleSheet(nsICSSStyleSheet* aStyleSheet);
|
||||
|
||||
NS_IMETHOD Flush();
|
||||
|
||||
protected:
|
||||
friend NS_IMETHODIMP
|
||||
NS_NewXULPrototypeCache(nsISupports* aOuter, REFNSIID aIID, void** aResult);
|
||||
|
||||
nsXULPrototypeCache();
|
||||
virtual ~nsXULPrototypeCache();
|
||||
|
||||
nsSupportsHashtable mPrototypeTable;
|
||||
nsSupportsHashtable mStyleSheetTable;
|
||||
|
||||
|
||||
class nsIURIKey : public nsHashKey {
|
||||
protected:
|
||||
nsCOMPtr<nsIURI> mKey;
|
||||
|
||||
public:
|
||||
nsIURIKey(nsIURI* key) : mKey(key) {}
|
||||
~nsIURIKey(void) {}
|
||||
|
||||
PRUint32 HashValue(void) const {
|
||||
nsXPIDLCString spec;
|
||||
mKey->GetSpec(getter_Copies(spec));
|
||||
return (PRUint32) PL_HashString(spec);
|
||||
}
|
||||
|
||||
PRBool Equals(const nsHashKey *aKey) const {
|
||||
PRBool eq;
|
||||
mKey->Equals( ((nsIURIKey*) aKey)->mKey, &eq );
|
||||
return eq;
|
||||
}
|
||||
|
||||
nsHashKey *Clone(void) const {
|
||||
return new nsIURIKey(mKey);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
nsXULPrototypeCache::nsXULPrototypeCache()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
|
||||
nsXULPrototypeCache::~nsXULPrototypeCache()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsXULPrototypeCache, nsIXULPrototypeCache);
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_NewXULPrototypeCache(nsISupports* aOuter, REFNSIID aIID, void** aResult)
|
||||
{
|
||||
NS_PRECONDITION(! aOuter, "no aggregation");
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
nsXULPrototypeCache* result = new nsXULPrototypeCache();
|
||||
if (! result)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
NS_ADDREF(result);
|
||||
rv = result->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(result);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULPrototypeCache::GetPrototype(nsIURI* aURI, nsIXULPrototypeDocument** _result)
|
||||
{
|
||||
nsIURIKey key(aURI);
|
||||
*_result = NS_STATIC_CAST(nsIXULPrototypeDocument*, mPrototypeTable.Get(&key));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULPrototypeCache::PutPrototype(nsIXULPrototypeDocument* aDocument)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = aDocument->GetURI(getter_AddRefs(uri));
|
||||
|
||||
nsIURIKey key(uri);
|
||||
mPrototypeTable.Put(&key, aDocument);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULPrototypeCache::GetStyleSheet(nsIURI* aURI, nsICSSStyleSheet** _result)
|
||||
{
|
||||
nsIURIKey key(aURI);
|
||||
*_result = NS_STATIC_CAST(nsICSSStyleSheet*, mStyleSheetTable.Get(&key));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULPrototypeCache::PutStyleSheet(nsICSSStyleSheet* aStyleSheet)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = aStyleSheet->GetURL(*getter_AddRefs(uri));
|
||||
|
||||
nsIURIKey key(uri);
|
||||
mStyleSheetTable.Put(&key, aStyleSheet);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULPrototypeCache::Flush()
|
||||
{
|
||||
mPrototypeTable.Reset();
|
||||
mStyleSheetTable.Reset();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
263
mozilla/content/xul/document/src/nsXULPrototypeDocument.cpp
Normal file
263
mozilla/content/xul/document/src/nsXULPrototypeDocument.cpp
Normal file
@@ -0,0 +1,263 @@
|
||||
/* -*- 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):
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString2.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIXULPrototypeDocument.h"
|
||||
#include "nsXULElement.h"
|
||||
|
||||
class nsXULPrototypeDocument : public nsIXULPrototypeDocument
|
||||
{
|
||||
public:
|
||||
static nsresult
|
||||
Create(nsIURI* aURI, nsXULPrototypeDocument** aResult);
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIXULPrototypeDocument interface
|
||||
NS_IMETHOD GetURI(nsIURI** aResult);
|
||||
NS_IMETHOD SetURI(nsIURI* aURI);
|
||||
|
||||
NS_IMETHOD GetRootElement(nsXULPrototypeElement** aResult);
|
||||
NS_IMETHOD SetRootElement(nsXULPrototypeElement* aElement);
|
||||
|
||||
NS_IMETHOD AddStyleSheetReference(nsIURI* aStyleSheet);
|
||||
NS_IMETHOD GetStyleSheetReferences(nsISupportsArray** aResult);
|
||||
|
||||
NS_IMETHOD AddOverlayReference(nsIURI* aURI);
|
||||
NS_IMETHOD GetOverlayReferences(nsISupportsArray** aResult);
|
||||
|
||||
NS_IMETHOD GetHeaderData(nsIAtom* aField, nsString& aData) const;
|
||||
NS_IMETHOD SetHeaderData(nsIAtom* aField, const nsString& aData);
|
||||
|
||||
NS_IMETHOD GetDocumentPrincipal(nsIPrincipal** aResult);
|
||||
NS_IMETHOD SetDocumentPrincipal(nsIPrincipal* aPrincipal);
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
nsXULPrototypeElement* mRoot;
|
||||
nsCOMPtr<nsISupportsArray> mStyleSheetReferences;
|
||||
nsCOMPtr<nsISupportsArray> mOverlayReferences;
|
||||
nsCOMPtr<nsIPrincipal> mDocumentPrincipal;
|
||||
|
||||
nsXULPrototypeDocument();
|
||||
virtual ~nsXULPrototypeDocument();
|
||||
nsresult Init();
|
||||
|
||||
friend NS_IMETHODIMP
|
||||
NS_NewXULPrototypeDocument(nsISupports* aOuter, REFNSIID aIID, void** aResult);
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsXULPrototypeDocument::nsXULPrototypeDocument()
|
||||
: mRoot(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsXULPrototypeDocument::Init()
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(mStyleSheetReferences));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(mOverlayReferences));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsXULPrototypeDocument::~nsXULPrototypeDocument()
|
||||
{
|
||||
delete mRoot;
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsXULPrototypeDocument, nsIXULPrototypeDocument);
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_NewXULPrototypeDocument(nsISupports* aOuter, REFNSIID aIID, void** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aOuter == nsnull, "no aggregation");
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
nsXULPrototypeDocument* result = new nsXULPrototypeDocument();
|
||||
if (! result)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv;
|
||||
rv = result->Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
delete result;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_ADDREF(result);
|
||||
rv = result->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(result);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULPrototypeDocument::GetURI(nsIURI** aResult)
|
||||
{
|
||||
*aResult = mURI;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULPrototypeDocument::SetURI(nsIURI* aURI)
|
||||
{
|
||||
mURI = aURI;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULPrototypeDocument::GetRootElement(nsXULPrototypeElement** aResult)
|
||||
{
|
||||
*aResult = mRoot;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULPrototypeDocument::SetRootElement(nsXULPrototypeElement* aElement)
|
||||
{
|
||||
mRoot = aElement;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULPrototypeDocument::AddStyleSheetReference(nsIURI* aURI)
|
||||
{
|
||||
NS_PRECONDITION(aURI != nsnull, "null ptr");
|
||||
if (! aURI)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
mStyleSheetReferences->AppendElement(aURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULPrototypeDocument::GetStyleSheetReferences(nsISupportsArray** aResult)
|
||||
{
|
||||
*aResult = mStyleSheetReferences;
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULPrototypeDocument::AddOverlayReference(nsIURI* aURI)
|
||||
{
|
||||
NS_PRECONDITION(aURI != nsnull, "null ptr");
|
||||
if (! aURI)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
mOverlayReferences->AppendElement(aURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULPrototypeDocument::GetOverlayReferences(nsISupportsArray** aResult)
|
||||
{
|
||||
*aResult = mOverlayReferences;
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULPrototypeDocument::GetHeaderData(nsIAtom* aField, nsString& aData) const
|
||||
{
|
||||
// XXX Not implemented
|
||||
aData.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULPrototypeDocument::SetHeaderData(nsIAtom* aField, const nsString& aData)
|
||||
{
|
||||
// XXX Not implemented
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULPrototypeDocument::GetDocumentPrincipal(nsIPrincipal** aResult)
|
||||
{
|
||||
if (!mDocumentPrincipal) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, securityManager,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return NS_ERROR_FAILURE;
|
||||
rv = securityManager->CreateCodebasePrincipal(mURI, getter_AddRefs(mDocumentPrincipal));
|
||||
if (NS_FAILED(rv))
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
*aResult = mDocumentPrincipal;
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULPrototypeDocument::SetDocumentPrincipal(nsIPrincipal* aPrincipal)
|
||||
{
|
||||
mDocumentPrincipal = aPrincipal;
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/* -*- 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):
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
A content model builder interface. An object that implements this
|
||||
interface is associated with an nsIXULDocument object to construct
|
||||
an NGLayout content model.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef nsIRDFContentModelBuilder_h__
|
||||
#define nsIRDFContentModelBuilder_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsIContent;
|
||||
class nsIRDFCompositeDataSource;
|
||||
class nsIXULDocument;
|
||||
class nsIRDFNode;
|
||||
class nsIRDFResource;
|
||||
|
||||
// {541AFCB0-A9A3-11d2-8EC5-00805F29F370}
|
||||
#define NS_IRDFCONTENTMODELBUILDER_IID \
|
||||
{ 0x541afcb0, 0xa9a3, 0x11d2, { 0x8e, 0xc5, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
|
||||
|
||||
class nsIRDFContentModelBuilder : public nsISupports
|
||||
{
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IRDFCONTENTMODELBUILDER_IID; return iid; }
|
||||
|
||||
/**
|
||||
* Point the content model builder to the document. The content model
|
||||
* builder must not reference count the document.
|
||||
*/
|
||||
NS_IMETHOD SetDocument(nsIXULDocument* aDocument) = 0;
|
||||
|
||||
NS_IMETHOD SetDataBase(nsIRDFCompositeDataSource* aDataBase) = 0;
|
||||
NS_IMETHOD GetDataBase(nsIRDFCompositeDataSource** aDataBase) = 0;
|
||||
|
||||
/**
|
||||
* Set the root element from which this content model will
|
||||
* operate.
|
||||
*/
|
||||
NS_IMETHOD CreateRootContent(nsIRDFResource* aResource) = 0;
|
||||
NS_IMETHOD SetRootContent(nsIContent* aElement) = 0;
|
||||
|
||||
/**
|
||||
* Construct the contents for a container element.
|
||||
*/
|
||||
NS_IMETHOD CreateContents(nsIContent* aElement) = 0;
|
||||
|
||||
/**
|
||||
* 'Open' a container element that was closed before. This gives
|
||||
* the container a chance to populate its contents.
|
||||
*/
|
||||
NS_IMETHOD OpenContainer(nsIContent* aContainer) = 0;
|
||||
|
||||
/**
|
||||
* 'Close' an open container. This gives the container a chance to
|
||||
* release unused content nodes.
|
||||
*/
|
||||
NS_IMETHOD CloseContainer(nsIContent* aContainer) = 0;
|
||||
|
||||
/**
|
||||
* Rebuild the contents of a container.
|
||||
*/
|
||||
NS_IMETHOD RebuildContainer(nsIContent* aContainer) = 0;
|
||||
};
|
||||
|
||||
extern nsresult NS_NewXULTemplateBuilder(nsIRDFContentModelBuilder** aResult);
|
||||
extern nsresult NS_NewRDFXULBuilder(nsIRDFContentModelBuilder** aResult);
|
||||
|
||||
#endif // nsIRDFContentModelBuilder_h__
|
||||
997
mozilla/content/xul/templates/src/nsXULContentUtils.cpp
Normal file
997
mozilla/content/xul/templates/src/nsXULContentUtils.cpp
Normal file
@@ -0,0 +1,997 @@
|
||||
/* -*- 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):
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
A package of routines shared by the XUL content code.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMXULCommandDispatcher.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDOMMouseListener.h"
|
||||
#include "nsIDOMMouseMotionListener.h"
|
||||
#include "nsIDOMLoadListener.h"
|
||||
#include "nsIDOMFocusListener.h"
|
||||
#include "nsIDOMPaintListener.h"
|
||||
#include "nsIDOMKeyListener.h"
|
||||
#include "nsIDOMFormListener.h"
|
||||
#include "nsIDOMMenuListener.h"
|
||||
#include "nsIDOMDragListener.h"
|
||||
#include "nsIRDFNode.h"
|
||||
#include "nsINameSpace.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIPref.h"
|
||||
#include "nsIRDFService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsITextContent.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIXMLContent.h"
|
||||
#include "nsIXULContentUtils.h"
|
||||
#include "nsIXULPrototypeCache.h"
|
||||
#include "nsLayoutCID.h"
|
||||
#include "nsNeckoUtil.h"
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsString.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "prlog.h"
|
||||
#include "prtime.h"
|
||||
#include "rdf.h"
|
||||
#include "rdfutil.h"
|
||||
|
||||
#include "nsILocale.h"
|
||||
#include "nsLocaleCID.h"
|
||||
#include "nsILocaleFactory.h"
|
||||
|
||||
#include "nsIDateTimeFormat.h"
|
||||
#include "nsDateTimeFormatCID.h"
|
||||
#include "nsIScriptableDateFormat.h"
|
||||
|
||||
|
||||
static NS_DEFINE_CID(kDateTimeFormatCID, NS_DATETIMEFORMAT_CID);
|
||||
static NS_DEFINE_CID(kDateTimeFormatIID, NS_IDATETIMEFORMAT_IID);
|
||||
static NS_DEFINE_CID(kLocaleCID, NS_LOCALE_CID);
|
||||
static NS_DEFINE_CID(kLocaleFactoryCID, NS_LOCALEFACTORY_CID);
|
||||
static NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
|
||||
static NS_DEFINE_CID(kXULPrototypeCacheCID, NS_XULPROTOTYPECACHE_CID);
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class nsXULContentUtils : public nsIXULContentUtils
|
||||
{
|
||||
protected:
|
||||
nsXULContentUtils();
|
||||
nsresult Init();
|
||||
virtual ~nsXULContentUtils();
|
||||
|
||||
friend NS_IMETHODIMP
|
||||
NS_NewXULContentUtils(nsISupports* aOuter, const nsIID& aIID, void** aResult);
|
||||
|
||||
static nsrefcnt gRefCnt;
|
||||
static nsIRDFService* gRDF;
|
||||
static nsINameSpaceManager* gNameSpaceManager;
|
||||
static nsIDateTimeFormat* gFormat;
|
||||
|
||||
static nsIAtom* kEventsAtom;
|
||||
static nsIAtom* kTargetsAtom;
|
||||
|
||||
struct EventHandlerMapEntry {
|
||||
const char* mAttributeName;
|
||||
nsIAtom* mAttributeAtom;
|
||||
const nsIID* mHandlerIID;
|
||||
};
|
||||
|
||||
static EventHandlerMapEntry kEventHandlerMap[];
|
||||
|
||||
static PRBool gDisableXULCache;
|
||||
|
||||
static int
|
||||
DisableXULCacheChangedCallback(const char* aPrefName, void* aClosure);
|
||||
|
||||
public:
|
||||
// nsISupports methods
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIXULContentUtils methods
|
||||
NS_IMETHOD
|
||||
AttachTextNode(nsIContent* parent, nsIRDFNode* value);
|
||||
|
||||
NS_IMETHOD
|
||||
FindChildByTag(nsIContent *aElement,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aTag,
|
||||
nsIContent **aResult);
|
||||
|
||||
NS_IMETHOD
|
||||
FindChildByResource(nsIContent* aElement,
|
||||
nsIRDFResource* aResource,
|
||||
nsIContent** aResult);
|
||||
|
||||
NS_IMETHOD
|
||||
GetElementResource(nsIContent* aElement, nsIRDFResource** aResult);
|
||||
|
||||
NS_IMETHOD
|
||||
GetElementRefResource(nsIContent* aElement, nsIRDFResource** aResult);
|
||||
|
||||
NS_IMETHOD
|
||||
GetTextForNode(nsIRDFNode* aNode, nsString& aResult);
|
||||
|
||||
NS_IMETHOD
|
||||
GetElementLogString(nsIContent* aElement, nsString& aResult);
|
||||
|
||||
NS_IMETHOD
|
||||
GetAttributeLogString(nsIContent* aElement, PRInt32 aNameSpaceID, nsIAtom* aTag, nsString& aResult);
|
||||
|
||||
NS_IMETHOD
|
||||
MakeElementURI(nsIDocument* aDocument, const nsString& aElementID, nsCString& aURI);
|
||||
|
||||
NS_IMETHOD
|
||||
MakeElementResource(nsIDocument* aDocument, const nsString& aElementID, nsIRDFResource** aResult);
|
||||
|
||||
NS_IMETHOD
|
||||
MakeElementID(nsIDocument* aDocument, const nsString& aURI, nsString& aElementID);
|
||||
|
||||
NS_IMETHOD_(PRBool)
|
||||
IsContainedBy(nsIContent* aElement, nsIContent* aContainer);
|
||||
|
||||
NS_IMETHOD
|
||||
GetResource(PRInt32 aNameSpaceID, nsIAtom* aAttribute, nsIRDFResource** aResult);
|
||||
|
||||
NS_IMETHOD
|
||||
GetResource(PRInt32 aNameSpaceID, const nsString& aAttribute, nsIRDFResource** aResult);
|
||||
|
||||
NS_IMETHOD
|
||||
SetCommandUpdater(nsIDocument* aDocument, nsIContent* aElement);
|
||||
|
||||
NS_IMETHOD
|
||||
GetEventHandlerIID(nsIAtom* aName, nsIID* aIID, PRBool* aFound);
|
||||
|
||||
NS_IMETHOD_(PRBool)
|
||||
UseXULCache();
|
||||
};
|
||||
|
||||
nsrefcnt nsXULContentUtils::gRefCnt;
|
||||
nsIRDFService* nsXULContentUtils::gRDF;
|
||||
nsINameSpaceManager* nsXULContentUtils::gNameSpaceManager;
|
||||
nsIDateTimeFormat* nsXULContentUtils::gFormat;
|
||||
|
||||
nsIAtom* nsXULContentUtils::kEventsAtom;
|
||||
nsIAtom* nsXULContentUtils::kTargetsAtom;
|
||||
|
||||
nsXULContentUtils::EventHandlerMapEntry
|
||||
nsXULContentUtils::kEventHandlerMap[] = {
|
||||
{ "onclick", nsnull, &NS_GET_IID(nsIDOMMouseListener) },
|
||||
{ "ondblclick", nsnull, &NS_GET_IID(nsIDOMMouseListener) },
|
||||
{ "onmousedown", nsnull, &NS_GET_IID(nsIDOMMouseListener) },
|
||||
{ "onmouseup", nsnull, &NS_GET_IID(nsIDOMMouseListener) },
|
||||
{ "onmouseover", nsnull, &NS_GET_IID(nsIDOMMouseListener) },
|
||||
{ "onmouseout", nsnull, &NS_GET_IID(nsIDOMMouseListener) },
|
||||
|
||||
{ "onmousemove", nsnull, &NS_GET_IID(nsIDOMMouseMotionListener) },
|
||||
|
||||
{ "onkeydown", nsnull, &NS_GET_IID(nsIDOMKeyListener) },
|
||||
{ "onkeyup", nsnull, &NS_GET_IID(nsIDOMKeyListener) },
|
||||
{ "onkeypress", nsnull, &NS_GET_IID(nsIDOMKeyListener) },
|
||||
|
||||
{ "onload", nsnull, &NS_GET_IID(nsIDOMLoadListener) },
|
||||
{ "onunload", nsnull, &NS_GET_IID(nsIDOMLoadListener) },
|
||||
{ "onabort", nsnull, &NS_GET_IID(nsIDOMLoadListener) },
|
||||
{ "onerror", nsnull, &NS_GET_IID(nsIDOMLoadListener) },
|
||||
|
||||
{ "oncreate", nsnull, &NS_GET_IID(nsIDOMMenuListener) },
|
||||
{ "ondestroy", nsnull, &NS_GET_IID(nsIDOMMenuListener) },
|
||||
{ "oncommand", nsnull, &NS_GET_IID(nsIDOMMenuListener) },
|
||||
{ "onbroadcast", nsnull, &NS_GET_IID(nsIDOMMenuListener) },
|
||||
{ "oncommandupdate", nsnull, &NS_GET_IID(nsIDOMMenuListener) },
|
||||
|
||||
{ "onfocus", nsnull, &NS_GET_IID(nsIDOMFocusListener) },
|
||||
{ "onblur", nsnull, &NS_GET_IID(nsIDOMFocusListener) },
|
||||
|
||||
{ "onsubmit", nsnull, &NS_GET_IID(nsIDOMFormListener) },
|
||||
{ "onreset", nsnull, &NS_GET_IID(nsIDOMFormListener) },
|
||||
{ "onchange", nsnull, &NS_GET_IID(nsIDOMFormListener) },
|
||||
{ "onselect", nsnull, &NS_GET_IID(nsIDOMFormListener) },
|
||||
{ "oninput", nsnull, &NS_GET_IID(nsIDOMFormListener) },
|
||||
|
||||
{ "onpaint", nsnull, &NS_GET_IID(nsIDOMPaintListener) },
|
||||
|
||||
{ "ondragenter", nsnull, &NS_GET_IID(nsIDOMDragListener) },
|
||||
{ "ondragover", nsnull, &NS_GET_IID(nsIDOMDragListener) },
|
||||
{ "ondragexit", nsnull, &NS_GET_IID(nsIDOMDragListener) },
|
||||
{ "ondragdrop", nsnull, &NS_GET_IID(nsIDOMDragListener) },
|
||||
{ "ondraggesture", nsnull, &NS_GET_IID(nsIDOMDragListener) },
|
||||
|
||||
{ nsnull, nsnull, nsnull }
|
||||
};
|
||||
|
||||
|
||||
// Enabled by default. Must be over-ridden to disable
|
||||
PRBool nsXULContentUtils::gDisableXULCache = PR_FALSE;
|
||||
|
||||
|
||||
static const char kDisableXULCachePref[] = "nglayout.debug.disable_xul_cache";
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Constructors n' stuff
|
||||
//
|
||||
|
||||
nsXULContentUtils::nsXULContentUtils()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULContentUtils::Init()
|
||||
{
|
||||
if (gRefCnt++ == 0) {
|
||||
nsresult rv;
|
||||
rv = nsServiceManager::GetService(kRDFServiceCID,
|
||||
NS_GET_IID(nsIRDFService),
|
||||
(nsISupports**) &gRDF);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kNameSpaceManagerCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsINameSpaceManager),
|
||||
(void**) &gNameSpaceManager);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kDateTimeFormatCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIDateTimeFormat),
|
||||
(void**) &gFormat);
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
kEventsAtom = NS_NewAtom("events");
|
||||
kTargetsAtom = NS_NewAtom("targets");
|
||||
|
||||
EventHandlerMapEntry* entry = kEventHandlerMap;
|
||||
while (entry->mAttributeName) {
|
||||
entry->mAttributeAtom = NS_NewAtom(entry->mAttributeName);
|
||||
++entry;
|
||||
}
|
||||
|
||||
NS_WITH_SERVICE(nsIPref, prefs, NS_PREF_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// XXX Ignore return values.
|
||||
prefs->GetBoolPref(kDisableXULCachePref, &gDisableXULCache);
|
||||
prefs->RegisterCallback(kDisableXULCachePref, DisableXULCacheChangedCallback, nsnull);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsXULContentUtils::~nsXULContentUtils()
|
||||
{
|
||||
#ifdef DEBUG_REFS
|
||||
--gInstanceCount;
|
||||
fprintf(stdout, "%d - RDF: nsXULContentUtils\n", gInstanceCount);
|
||||
#endif
|
||||
|
||||
if (--gRefCnt == 0) {
|
||||
if (gRDF) {
|
||||
nsServiceManager::ReleaseService(kRDFServiceCID, gRDF);
|
||||
gRDF = nsnull;
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(gNameSpaceManager);
|
||||
|
||||
NS_IF_RELEASE(kEventsAtom);
|
||||
NS_IF_RELEASE(kTargetsAtom);
|
||||
|
||||
EventHandlerMapEntry* entry = kEventHandlerMap;
|
||||
while (entry->mAttributeName) {
|
||||
NS_IF_RELEASE(entry->mAttributeAtom);
|
||||
++entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_NewXULContentUtils(nsISupports* aOuter, const nsIID& aIID, void** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
NS_PRECONDITION(aOuter == nsnull, "no aggregation");
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
nsXULContentUtils* result = new nsXULContentUtils();
|
||||
if (! result)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv;
|
||||
rv = result->Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
delete result;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_ADDREF(result);
|
||||
rv = result->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(result);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsXULContentUtils, NS_GET_IID(nsIXULContentUtils));
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// nsIXULContentUtils methods
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULContentUtils::AttachTextNode(nsIContent* parent, nsIRDFNode* value)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsAutoString s;
|
||||
rv = GetTextForNode(value, s);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsITextContent> text;
|
||||
rv = nsComponentManager::CreateInstance(kTextNodeCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsITextContent),
|
||||
getter_AddRefs(text));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
||||
rv = text->SetText(s.GetUnicode(), s.Length(), PR_FALSE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// hook it up to the child
|
||||
rv = parent->AppendChildTo(nsCOMPtr<nsIContent>( do_QueryInterface(text) ), PR_FALSE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULContentUtils::FindChildByTag(nsIContent* aElement,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aTag,
|
||||
nsIContent** aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
PRInt32 count;
|
||||
if (NS_FAILED(rv = aElement->ChildCount(count)))
|
||||
return rv;
|
||||
|
||||
for (PRInt32 i = 0; i < count; ++i) {
|
||||
nsCOMPtr<nsIContent> kid;
|
||||
if (NS_FAILED(rv = aElement->ChildAt(i, *getter_AddRefs(kid))))
|
||||
return rv; // XXX fatal
|
||||
|
||||
PRInt32 nameSpaceID;
|
||||
if (NS_FAILED(rv = kid->GetNameSpaceID(nameSpaceID)))
|
||||
return rv; // XXX fatal
|
||||
|
||||
if (nameSpaceID != aNameSpaceID)
|
||||
continue; // wrong namespace
|
||||
|
||||
nsCOMPtr<nsIAtom> kidTag;
|
||||
if (NS_FAILED(rv = kid->GetTag(*getter_AddRefs(kidTag))))
|
||||
return rv; // XXX fatal
|
||||
|
||||
if (kidTag.get() != aTag)
|
||||
continue;
|
||||
|
||||
*aResult = kid;
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_RDF_NO_VALUE; // not found
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULContentUtils::FindChildByResource(nsIContent* aElement,
|
||||
nsIRDFResource* aResource,
|
||||
nsIContent** aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
PRInt32 count;
|
||||
if (NS_FAILED(rv = aElement->ChildCount(count)))
|
||||
return rv;
|
||||
|
||||
for (PRInt32 i = 0; i < count; ++i) {
|
||||
nsCOMPtr<nsIContent> kid;
|
||||
if (NS_FAILED(rv = aElement->ChildAt(i, *getter_AddRefs(kid))))
|
||||
return rv; // XXX fatal
|
||||
|
||||
// Now get the resource ID from the RDF:ID attribute. We do it
|
||||
// via the content model, because you're never sure who
|
||||
// might've added this stuff in...
|
||||
nsCOMPtr<nsIRDFResource> resource;
|
||||
rv = GetElementResource(kid, getter_AddRefs(resource));
|
||||
if (NS_FAILED(rv)) continue;
|
||||
|
||||
if (resource.get() != aResource)
|
||||
continue; // not the resource we want
|
||||
|
||||
// Fount it!
|
||||
*aResult = kid;
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_RDF_NO_VALUE; // not found
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULContentUtils::GetElementResource(nsIContent* aElement, nsIRDFResource** aResult)
|
||||
{
|
||||
// Perform a reverse mapping from an element in the content model
|
||||
// to an RDF resource.
|
||||
nsresult rv;
|
||||
|
||||
PRUnichar buf[128];
|
||||
nsAutoString id(CBufDescriptor(buf, PR_TRUE, sizeof(buf) / sizeof(PRUnichar), 0));
|
||||
|
||||
nsCOMPtr<nsIAtom> kIdAtom( dont_AddRef(NS_NewAtom("id")) );
|
||||
rv = aElement->GetAttribute(kNameSpaceID_None, kIdAtom, id);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "severe error retrieving attribute");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (rv != NS_CONTENT_ATTR_HAS_VALUE)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Since the element will store its ID attribute as a document-relative value,
|
||||
// we may need to qualify it first...
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
rv = aElement->GetDocument(*getter_AddRefs(doc));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
NS_ASSERTION(doc != nsnull, "element is not in any document");
|
||||
if (! doc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
rv = nsXULContentUtils::MakeElementResource(doc, id, aResult);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULContentUtils::GetElementRefResource(nsIContent* aElement, nsIRDFResource** aResult)
|
||||
{
|
||||
// Perform a reverse mapping from an element in the content model
|
||||
// to an RDF resource. Check for a "ref" attribute first, then
|
||||
// fallback on an "id" attribute.
|
||||
nsresult rv;
|
||||
PRUnichar buf[128];
|
||||
nsAutoString uri(CBufDescriptor(buf, PR_TRUE, sizeof(buf) / sizeof(PRUnichar), 0));
|
||||
|
||||
nsCOMPtr<nsIAtom> kIdAtom( dont_AddRef(NS_NewAtom("ref")) );
|
||||
rv = aElement->GetAttribute(kNameSpaceID_None, kIdAtom, uri);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "severe error retrieving attribute");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (rv == NS_CONTENT_ATTR_HAS_VALUE) {
|
||||
// We'll use rdf_MakeAbsolute() to translate this to a URL.
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
rv = aElement->GetDocument(*getter_AddRefs(doc));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIURI> url = dont_AddRef( doc->GetDocumentURL() );
|
||||
NS_ASSERTION(url != nsnull, "element has no document");
|
||||
if (! url)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
rv = rdf_MakeAbsoluteURI(url, uri);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = gRDF->GetUnicodeResource(uri.GetUnicode(), aResult);
|
||||
}
|
||||
else {
|
||||
rv = GetElementResource(aElement, aResult);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Note: this routine is similiar, yet distinctly different from, nsBookmarksService::GetTextForNode
|
||||
*/
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULContentUtils::GetTextForNode(nsIRDFNode* aNode, nsString& aResult)
|
||||
{
|
||||
if (! aNode) {
|
||||
aResult.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
|
||||
// Literals are the most common, so try these first.
|
||||
nsCOMPtr<nsIRDFLiteral> literal = do_QueryInterface(aNode);
|
||||
if (literal) {
|
||||
const PRUnichar* p;
|
||||
rv = literal->GetValueConst(&p);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
aResult = p;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRDFDate> dateLiteral = do_QueryInterface(aNode);
|
||||
if (dateLiteral) {
|
||||
PRInt64 value;
|
||||
rv = dateLiteral->GetValue(&value);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = gFormat->FormatPRTime(nsnull /* nsILocale* locale */,
|
||||
kDateFormatShort,
|
||||
kTimeFormatSeconds,
|
||||
PRTime(value),
|
||||
aResult);
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRDFInt> intLiteral = do_QueryInterface(aNode);
|
||||
if (intLiteral) {
|
||||
PRInt32 value;
|
||||
rv = intLiteral->GetValue(&value);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
aResult.Truncate();
|
||||
aResult.Append(value, 10);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsCOMPtr<nsIRDFResource> resource = do_QueryInterface(aNode);
|
||||
if (resource) {
|
||||
const char* p;
|
||||
rv = resource->GetValueConst(&p);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
aResult = p;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_ERROR("not a resource or a literal");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULContentUtils::GetElementLogString(nsIContent* aElement, nsString& aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
aResult = '<';
|
||||
|
||||
nsCOMPtr<nsINameSpace> ns;
|
||||
|
||||
PRInt32 elementNameSpaceID;
|
||||
rv = aElement->GetNameSpaceID(elementNameSpaceID);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (kNameSpaceID_HTML == elementNameSpaceID) {
|
||||
aResult.Append("html:");
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsIXMLContent> xml( do_QueryInterface(aElement) );
|
||||
NS_ASSERTION(xml != nsnull, "not an XML or HTML element");
|
||||
if (! xml) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
rv = xml->GetContainingNameSpace(*getter_AddRefs(ns));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIAtom> prefix;
|
||||
rv = ns->FindNameSpacePrefix(elementNameSpaceID, *getter_AddRefs(prefix));
|
||||
if (NS_SUCCEEDED(rv) && (prefix != nsnull)) {
|
||||
nsAutoString prefixStr;
|
||||
prefix->ToString(prefixStr);
|
||||
if (prefixStr.Length()) {
|
||||
const PRUnichar *unicodeString;
|
||||
prefix->GetUnicode(&unicodeString);
|
||||
aResult.Append(unicodeString);
|
||||
aResult.Append(':');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
rv = aElement->GetTag(*getter_AddRefs(tag));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
const PRUnichar *unicodeString;
|
||||
tag->GetUnicode(&unicodeString);
|
||||
aResult.Append(unicodeString);
|
||||
|
||||
PRInt32 count;
|
||||
rv = aElement->GetAttributeCount(count);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
for (PRInt32 i = 0; i < count; ++i) {
|
||||
aResult.Append(' ');
|
||||
|
||||
PRInt32 nameSpaceID;
|
||||
nsCOMPtr<nsIAtom> name;
|
||||
rv = aElement->GetAttributeNameAt(i, nameSpaceID, *getter_AddRefs(name));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAutoString attr;
|
||||
nsXULContentUtils::GetAttributeLogString(aElement, nameSpaceID, name, attr);
|
||||
|
||||
aResult.Append(attr);
|
||||
aResult.Append("=\"");
|
||||
|
||||
nsAutoString value;
|
||||
rv = aElement->GetAttribute(nameSpaceID, name, value);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
aResult.Append(value);
|
||||
aResult.Append("\"");
|
||||
}
|
||||
|
||||
aResult.Append('>');
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULContentUtils::GetAttributeLogString(nsIContent* aElement, PRInt32 aNameSpaceID, nsIAtom* aTag, nsString& aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
PRInt32 elementNameSpaceID;
|
||||
rv = aElement->GetNameSpaceID(elementNameSpaceID);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if ((kNameSpaceID_HTML == elementNameSpaceID) ||
|
||||
(kNameSpaceID_None == aNameSpaceID)) {
|
||||
aResult.Truncate();
|
||||
}
|
||||
else {
|
||||
// we may have a namespace prefix on the attribute
|
||||
nsCOMPtr<nsIXMLContent> xml( do_QueryInterface(aElement) );
|
||||
NS_ASSERTION(xml != nsnull, "not an XML or HTML element");
|
||||
if (! xml) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsCOMPtr<nsINameSpace> ns;
|
||||
rv = xml->GetContainingNameSpace(*getter_AddRefs(ns));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIAtom> prefix;
|
||||
rv = ns->FindNameSpacePrefix(aNameSpaceID, *getter_AddRefs(prefix));
|
||||
if (NS_SUCCEEDED(rv) && (prefix != nsnull)) {
|
||||
nsAutoString prefixStr;
|
||||
prefix->ToString(prefixStr);
|
||||
if (prefixStr.Length()) {
|
||||
const PRUnichar *unicodeString;
|
||||
prefix->GetUnicode(&unicodeString);
|
||||
aResult.Append(unicodeString);
|
||||
aResult.Append(':');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const PRUnichar *unicodeString;
|
||||
aTag->GetUnicode(&unicodeString);
|
||||
aResult.Append(unicodeString);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULContentUtils::MakeElementURI(nsIDocument* aDocument, const nsString& aElementID, nsCString& aURI)
|
||||
{
|
||||
// Convert an element's ID to a URI that can be used to refer to
|
||||
// the element in the XUL graph.
|
||||
|
||||
if (aElementID.FindChar(':') > 0) {
|
||||
// Assume it's absolute already. Use as is.
|
||||
aURI = aElementID;
|
||||
}
|
||||
else {
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIURI> docURL;
|
||||
rv = aDocument->GetBaseURL(*getter_AddRefs(docURL));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// XXX Urgh. This is so broken; I'd really just like to use
|
||||
// NS_MakeAbsolueURI(). Unfortunatly, doing that breaks
|
||||
// MakeElementID in some cases that I haven't yet been able to
|
||||
// figure out.
|
||||
#define USE_BROKEN_RELATIVE_PARSING
|
||||
#ifdef USE_BROKEN_RELATIVE_PARSING
|
||||
nsXPIDLCString spec;
|
||||
docURL->GetSpec(getter_Copies(spec));
|
||||
if (! spec)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
aURI = spec;
|
||||
|
||||
if (aElementID.First() != '#') {
|
||||
aURI.Append('#');
|
||||
}
|
||||
aURI.Append(nsCAutoString(aElementID));
|
||||
#else
|
||||
nsXPIDLCString spec;
|
||||
rv = NS_MakeAbsoluteURI(nsCAutoString(aElementID), docURL, getter_Copies(spec));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aURI = spec;
|
||||
}
|
||||
else {
|
||||
NS_WARNING("MakeElementURI: NS_MakeAbsoluteURI failed");
|
||||
aURI = aElementID;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULContentUtils::MakeElementResource(nsIDocument* aDocument, const nsString& aID, nsIRDFResource** aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
char buf[256];
|
||||
nsCAutoString uri(CBufDescriptor(buf, PR_TRUE, sizeof(buf), 0));
|
||||
rv = MakeElementURI(aDocument, aID, uri);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = gRDF->GetResource(uri, aResult);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create resource");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULContentUtils::MakeElementID(nsIDocument* aDocument, const nsString& aURI, nsString& aElementID)
|
||||
{
|
||||
// Convert a URI into an element ID that can be accessed from the
|
||||
// DOM APIs.
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIURI> docURL;
|
||||
rv = aDocument->GetBaseURL(*getter_AddRefs(docURL));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsXPIDLCString spec;
|
||||
docURL->GetSpec(getter_Copies(spec));
|
||||
if (! spec)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (aURI.Find(spec) == 0) {
|
||||
#ifdef USE_BROKEN_RELATIVE_PARSING
|
||||
static const PRInt32 kFudge = 1; // XXX assume '#'
|
||||
#else
|
||||
static const PRInt32 kFudge = 0;
|
||||
#endif
|
||||
PRInt32 len = PL_strlen(spec);
|
||||
aURI.Right(aElementID, aURI.Length() - (len + kFudge));
|
||||
}
|
||||
else {
|
||||
aElementID = aURI;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(PRBool)
|
||||
nsXULContentUtils::IsContainedBy(nsIContent* aElement, nsIContent* aContainer)
|
||||
{
|
||||
nsCOMPtr<nsIContent> element( dont_QueryInterface(aElement) );
|
||||
while (element) {
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIContent> parent;
|
||||
rv = element->GetParent(*getter_AddRefs(parent));
|
||||
if (NS_FAILED(rv)) return PR_FALSE;
|
||||
|
||||
if (parent.get() == aContainer)
|
||||
return PR_TRUE;
|
||||
|
||||
element = parent;
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULContentUtils::GetResource(PRInt32 aNameSpaceID, nsIAtom* aAttribute, nsIRDFResource** aResult)
|
||||
{
|
||||
// construct a fully-qualified URI from the namespace/tag pair.
|
||||
NS_PRECONDITION(aAttribute != nsnull, "null ptr");
|
||||
if (! aAttribute)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsAutoString attr;
|
||||
rv = aAttribute->ToString(attr);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return GetResource(aNameSpaceID, attr, aResult);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULContentUtils::GetResource(PRInt32 aNameSpaceID, const nsString& aAttribute, nsIRDFResource** aResult)
|
||||
{
|
||||
// construct a fully-qualified URI from the namespace/tag pair.
|
||||
|
||||
// XXX should we allow nodes with no namespace???
|
||||
//NS_PRECONDITION(aNameSpaceID != kNameSpaceID_Unknown, "no namespace");
|
||||
//if (aNameSpaceID == kNameSpaceID_Unknown)
|
||||
// return NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
PRUnichar buf[256];
|
||||
nsAutoString uri(CBufDescriptor(buf, PR_TRUE, sizeof(buf) / sizeof(PRUnichar), 0));
|
||||
if (aNameSpaceID != kNameSpaceID_Unknown && aNameSpaceID != kNameSpaceID_None) {
|
||||
rv = gNameSpaceManager->GetNameSpaceURI(aNameSpaceID, uri);
|
||||
// XXX ignore failure; treat as "no namespace"
|
||||
}
|
||||
|
||||
// XXX check to see if we need to insert a '/' or a '#'. Oy.
|
||||
if (uri.Length() > 0 && uri.Last() != '#' && uri.Last() != '/' && aAttribute.First() != '#')
|
||||
uri.Append('#');
|
||||
|
||||
uri.Append(aAttribute);
|
||||
|
||||
rv = gRDF->GetUnicodeResource(uri.GetUnicode(), aResult);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get resource");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULContentUtils::SetCommandUpdater(nsIDocument* aDocument, nsIContent* aElement)
|
||||
{
|
||||
// Deal with setting up a 'commandupdater'. Pulls the 'events' and
|
||||
// 'targets' attributes off of aElement, and adds it to the
|
||||
// document's command dispatcher.
|
||||
NS_PRECONDITION(aDocument != nsnull, "null ptr");
|
||||
if (! aDocument)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
NS_PRECONDITION(aElement != nsnull, "null ptr");
|
||||
if (! aElement)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIDOMXULDocument> xuldoc = do_QueryInterface(aDocument);
|
||||
NS_ASSERTION(xuldoc != nsnull, "not a xul document");
|
||||
if (! xuldoc)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsCOMPtr<nsIDOMXULCommandDispatcher> dispatcher;
|
||||
rv = xuldoc->GetCommandDispatcher(getter_AddRefs(dispatcher));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get dispatcher");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
NS_ASSERTION(dispatcher != nsnull, "no dispatcher");
|
||||
if (! dispatcher)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsAutoString events;
|
||||
rv = aElement->GetAttribute(kNameSpaceID_None, kEventsAtom, events);
|
||||
|
||||
if (rv != NS_CONTENT_ATTR_HAS_VALUE)
|
||||
events = "*";
|
||||
|
||||
nsAutoString targets;
|
||||
rv = aElement->GetAttribute(kNameSpaceID_None, kTargetsAtom, targets);
|
||||
|
||||
if (rv != NS_CONTENT_ATTR_HAS_VALUE)
|
||||
targets = "*";
|
||||
|
||||
nsCOMPtr<nsIDOMElement> domelement = do_QueryInterface(aElement);
|
||||
NS_ASSERTION(domelement != nsnull, "not a DOM element");
|
||||
if (! domelement)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
rv = dispatcher->AddCommandUpdater(domelement, events, targets);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULContentUtils::GetEventHandlerIID(nsIAtom* aName, nsIID* aIID, PRBool* aFound)
|
||||
{
|
||||
*aFound = PR_FALSE;
|
||||
|
||||
EventHandlerMapEntry* entry = kEventHandlerMap;
|
||||
while (entry->mAttributeAtom) {
|
||||
if (entry->mAttributeAtom == aName) {
|
||||
*aIID = *entry->mHandlerIID;
|
||||
*aFound = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
++entry;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP_(PRBool)
|
||||
nsXULContentUtils::UseXULCache()
|
||||
{
|
||||
return !gDisableXULCache;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
int
|
||||
nsXULContentUtils::DisableXULCacheChangedCallback(const char* aPref, void* aClosure)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
NS_WITH_SERVICE(nsIPref, prefs, NS_PREF_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
prefs->GetBoolPref(kDisableXULCachePref, &gDisableXULCache);
|
||||
}
|
||||
|
||||
// Flush the cache, regardless
|
||||
NS_WITH_SERVICE(nsIXULPrototypeCache, cache, kXULPrototypeCacheCID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
cache->Flush();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
1674
mozilla/content/xul/templates/src/nsXULSortService.cpp
Normal file
1674
mozilla/content/xul/templates/src/nsXULSortService.cpp
Normal file
File diff suppressed because it is too large
Load Diff
3066
mozilla/content/xul/templates/src/nsXULTemplateBuilder.cpp
Normal file
3066
mozilla/content/xul/templates/src/nsXULTemplateBuilder.cpp
Normal file
File diff suppressed because it is too large
Load Diff
37
mozilla/dom/public/MANIFEST
Normal file
37
mozilla/dom/public/MANIFEST
Normal file
@@ -0,0 +1,37 @@
|
||||
# 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):
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist:dom directory
|
||||
#
|
||||
|
||||
nsIScriptContext.h
|
||||
nsIJSScriptObject.h
|
||||
nsIJSNativeInitializer.h
|
||||
nsIScriptObjectOwner.h
|
||||
nsIScriptContextOwner.h
|
||||
nsIScriptGlobalObject.h
|
||||
nsIScriptEventListener.h
|
||||
nsIDOMScriptObjectFactory.h
|
||||
nsIDOMNativeObjectRegistry.h
|
||||
nsDOMCID.h
|
||||
nsIScriptGlobalObjectData.h
|
||||
nsIScriptNameSetRegistry.h
|
||||
nsIScriptExternalNameSet.h
|
||||
nsIScriptNameSpaceManager.h
|
||||
nsDOMError.h
|
||||
1
mozilla/dom/public/MANIFEST_IDL
Normal file
1
mozilla/dom/public/MANIFEST_IDL
Normal file
@@ -0,0 +1 @@
|
||||
domstubs.idl
|
||||
56
mozilla/dom/public/Makefile.in
Normal file
56
mozilla/dom/public/Makefile.in
Normal file
@@ -0,0 +1,56 @@
|
||||
#
|
||||
# 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 = dom
|
||||
|
||||
DIRS = base coreDom coreEvents range events html css
|
||||
|
||||
XPIDLSRCS = domstubs.idl
|
||||
|
||||
EXPORTS = \
|
||||
nsIScriptContext.h \
|
||||
nsIScriptContextOwner.h \
|
||||
nsIJSScriptObject.h \
|
||||
nsIJSNativeInitializer.h \
|
||||
nsIScriptEventListener.h \
|
||||
nsIScriptObjectOwner.h \
|
||||
nsIScriptGlobalObject.h \
|
||||
nsIDOMScriptObjectFactory.h \
|
||||
nsIDOMNativeObjectRegistry.h \
|
||||
nsDOMCID.h \
|
||||
nsIScriptGlobalObjectData.h \
|
||||
nsIScriptNameSetRegistry.h \
|
||||
nsIScriptExternalNameSet.h \
|
||||
nsIScriptNameSpaceManager.h \
|
||||
nsDOMError.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
37
mozilla/dom/public/base/MANIFEST
Normal file
37
mozilla/dom/public/base/MANIFEST
Normal file
@@ -0,0 +1,37 @@
|
||||
# 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):
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist:dom directory
|
||||
#
|
||||
|
||||
nsIDOMWindow.h
|
||||
nsIDOMLocation.h
|
||||
nsIDOMNSLocation.h
|
||||
nsIDOMNavigator.h
|
||||
nsIDOMWindowCollection.h
|
||||
nsIDOMScreen.h
|
||||
nsIDOMHistory.h
|
||||
nsIDOMMimeType.h
|
||||
nsIDOMMimeTypeArray.h
|
||||
nsIDOMPlugin.h
|
||||
nsIDOMPluginArray.h
|
||||
nsIDOMBarProp.h
|
||||
nsIDOMDOMException.h
|
||||
nsPIDOMWindow.h
|
||||
nsIDOMAbstractView.h
|
||||
52
mozilla/dom/public/base/Makefile.in
Normal file
52
mozilla/dom/public/base/Makefile.in
Normal file
@@ -0,0 +1,52 @@
|
||||
#
|
||||
# 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 = dom
|
||||
|
||||
EXPORTS = \
|
||||
nsIDOMWindow.h \
|
||||
nsIDOMNavigator.h \
|
||||
nsIDOMLocation.h \
|
||||
nsIDOMNSLocation.h \
|
||||
nsIDOMWindowCollection.h \
|
||||
nsIDOMScreen.h \
|
||||
nsIDOMHistory.h \
|
||||
nsIDOMMimeType.h \
|
||||
nsIDOMMimeTypeArray.h \
|
||||
nsIDOMPlugin.h \
|
||||
nsIDOMPluginArray.h \
|
||||
nsIDOMBarProp.h \
|
||||
nsIDOMDOMException.h \
|
||||
nsPIDOMWindow.h \
|
||||
nsIDOMAbstractView.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
35
mozilla/dom/public/base/makefile.win
Normal file
35
mozilla/dom/public/base/makefile.win
Normal file
@@ -0,0 +1,35 @@
|
||||
#!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=..\..\..
|
||||
|
||||
|
||||
DEFINES=-D_IMPL_NS_DOM
|
||||
EXPORTS=nsIDOMWindow.h nsIDOMNavigator.h nsIDOMLocation.h nsIDOMNSLocation.h \
|
||||
nsIDOMWindowCollection.h nsIDOMScreen.h nsIDOMHistory.h \
|
||||
nsIDOMMimeType.h nsIDOMMimeTypeArray.h \
|
||||
nsIDOMPlugin.h nsIDOMPluginArray.h nsIDOMBarProp.h \
|
||||
nsIDOMDOMException.h nsPIDOMWindow.h nsIDOMAbstractView.h
|
||||
|
||||
MODULE=dom
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
54
mozilla/dom/public/base/nsIDOMAbstractView.h
Normal file
54
mozilla/dom/public/base/nsIDOMAbstractView.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMAbstractView_h__
|
||||
#define nsIDOMAbstractView_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
class nsIDOMDocument;
|
||||
|
||||
#define NS_IDOMABSTRACTVIEW_IID \
|
||||
{ 0xf51ebade, 0x8b1a, 0x11d3, \
|
||||
{ 0xaa, 0xe7, 0x00, 0x10, 0x83, 0x01, 0x23, 0xb4 } }
|
||||
|
||||
class nsIDOMAbstractView : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMABSTRACTVIEW_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetDocument(nsIDOMDocument** aDocument)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMABSTRACTVIEW \
|
||||
NS_IMETHOD GetDocument(nsIDOMDocument** aDocument); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMABSTRACTVIEW(_to) \
|
||||
NS_IMETHOD GetDocument(nsIDOMDocument** aDocument) { return _to GetDocument(aDocument); } \
|
||||
|
||||
|
||||
#endif // nsIDOMAbstractView_h__
|
||||
60
mozilla/dom/public/base/nsIDOMBarProp.h
Normal file
60
mozilla/dom/public/base/nsIDOMBarProp.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMBarProp_h__
|
||||
#define nsIDOMBarProp_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
|
||||
#define NS_IDOMBARPROP_IID \
|
||||
{ 0x9eb2c150, 0x1d56, 0x11d3, \
|
||||
{ 0x82, 0x21, 0x00, 0x60, 0x08, 0x3a, 0x0b, 0xcf } }
|
||||
|
||||
class nsIDOMBarProp : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMBARPROP_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetVisible(PRBool* aVisible)=0;
|
||||
NS_IMETHOD SetVisible(PRBool aVisible)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMBARPROP \
|
||||
NS_IMETHOD GetVisible(PRBool* aVisible); \
|
||||
NS_IMETHOD SetVisible(PRBool aVisible); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMBARPROP(_to) \
|
||||
NS_IMETHOD GetVisible(PRBool* aVisible) { return _to GetVisible(aVisible); } \
|
||||
NS_IMETHOD SetVisible(PRBool aVisible) { return _to SetVisible(aVisible); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitBarPropClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptBarProp(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMBarProp_h__
|
||||
85
mozilla/dom/public/base/nsIDOMDOMException.h
Normal file
85
mozilla/dom/public/base/nsIDOMDOMException.h
Normal file
@@ -0,0 +1,85 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMDOMException_h__
|
||||
#define nsIDOMDOMException_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
|
||||
#define NS_IDOMDOMEXCEPTION_IID \
|
||||
{ 0xa6cf910a, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMDOMException : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMDOMEXCEPTION_IID; return iid; }
|
||||
enum {
|
||||
INDEX_SIZE_ERR = 1,
|
||||
DOMSTRING_SIZE_ERR = 2,
|
||||
HIERARCHY_REQUEST_ERR = 3,
|
||||
WRONG_DOCUMENT_ERR = 4,
|
||||
INVALID_CHARACTER_ERR = 5,
|
||||
NO_DATA_ALLOWED_ERR = 6,
|
||||
NO_MODIFICATION_ALLOWED_ERR = 7,
|
||||
NOT_FOUND_ERR = 8,
|
||||
NOT_SUPPORTED_ERR = 9,
|
||||
INUSE_ATTRIBUTE_ERR = 10
|
||||
};
|
||||
|
||||
NS_IMETHOD GetCode(PRUint32* aCode)=0;
|
||||
|
||||
NS_IMETHOD GetResult(PRUint32* aResult)=0;
|
||||
|
||||
NS_IMETHOD GetMessage(nsString& aMessage)=0;
|
||||
|
||||
NS_IMETHOD GetName(nsString& aName)=0;
|
||||
|
||||
NS_IMETHOD ToString(nsString& aReturn)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMDOMEXCEPTION \
|
||||
NS_IMETHOD GetCode(PRUint32* aCode); \
|
||||
NS_IMETHOD GetResult(PRUint32* aResult); \
|
||||
NS_IMETHOD GetMessage(nsString& aMessage); \
|
||||
NS_IMETHOD GetName(nsString& aName); \
|
||||
NS_IMETHOD ToString(nsString& aReturn); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMDOMEXCEPTION(_to) \
|
||||
NS_IMETHOD GetCode(PRUint32* aCode) { return _to GetCode(aCode); } \
|
||||
NS_IMETHOD GetResult(PRUint32* aResult) { return _to GetResult(aResult); } \
|
||||
NS_IMETHOD GetMessage(nsString& aMessage) { return _to GetMessage(aMessage); } \
|
||||
NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \
|
||||
NS_IMETHOD ToString(nsString& aReturn) { return _to ToString(aReturn); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitDOMExceptionClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptDOMException(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMDOMException_h__
|
||||
82
mozilla/dom/public/base/nsIDOMHistory.h
Normal file
82
mozilla/dom/public/base/nsIDOMHistory.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMHistory_h__
|
||||
#define nsIDOMHistory_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "jsapi.h"
|
||||
|
||||
|
||||
#define NS_IDOMHISTORY_IID \
|
||||
{ 0x896d1d20, 0xb4c4, 0x11d2, \
|
||||
{ 0xbd, 0x93, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4 } }
|
||||
|
||||
class nsIDOMHistory : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMHISTORY_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetLength(PRInt32* aLength)=0;
|
||||
|
||||
NS_IMETHOD GetCurrent(nsString& aCurrent)=0;
|
||||
|
||||
NS_IMETHOD GetPrevious(nsString& aPrevious)=0;
|
||||
|
||||
NS_IMETHOD GetNext(nsString& aNext)=0;
|
||||
|
||||
NS_IMETHOD Back()=0;
|
||||
|
||||
NS_IMETHOD Forward()=0;
|
||||
|
||||
NS_IMETHOD Go(JSContext* cx, jsval* argv, PRUint32 argc)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMHISTORY \
|
||||
NS_IMETHOD GetLength(PRInt32* aLength); \
|
||||
NS_IMETHOD GetCurrent(nsString& aCurrent); \
|
||||
NS_IMETHOD GetPrevious(nsString& aPrevious); \
|
||||
NS_IMETHOD GetNext(nsString& aNext); \
|
||||
NS_IMETHOD Back(); \
|
||||
NS_IMETHOD Forward(); \
|
||||
NS_IMETHOD Go(JSContext* cx, jsval* argv, PRUint32 argc); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMHISTORY(_to) \
|
||||
NS_IMETHOD GetLength(PRInt32* aLength) { return _to GetLength(aLength); } \
|
||||
NS_IMETHOD GetCurrent(nsString& aCurrent) { return _to GetCurrent(aCurrent); } \
|
||||
NS_IMETHOD GetPrevious(nsString& aPrevious) { return _to GetPrevious(aPrevious); } \
|
||||
NS_IMETHOD GetNext(nsString& aNext) { return _to GetNext(aNext); } \
|
||||
NS_IMETHOD Back() { return _to Back(); } \
|
||||
NS_IMETHOD Forward() { return _to Forward(); } \
|
||||
NS_IMETHOD Go(JSContext* cx, jsval* argv, PRUint32 argc) { return _to Go(cx, argv, argc); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitHistoryClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptHistory(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMHistory_h__
|
||||
121
mozilla/dom/public/base/nsIDOMLocation.h
Normal file
121
mozilla/dom/public/base/nsIDOMLocation.h
Normal file
@@ -0,0 +1,121 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMLocation_h__
|
||||
#define nsIDOMLocation_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
|
||||
#define NS_IDOMLOCATION_IID \
|
||||
{ 0xa6cf906d, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMLocation : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMLOCATION_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetHash(nsString& aHash)=0;
|
||||
NS_IMETHOD SetHash(const nsString& aHash)=0;
|
||||
|
||||
NS_IMETHOD GetHost(nsString& aHost)=0;
|
||||
NS_IMETHOD SetHost(const nsString& aHost)=0;
|
||||
|
||||
NS_IMETHOD GetHostname(nsString& aHostname)=0;
|
||||
NS_IMETHOD SetHostname(const nsString& aHostname)=0;
|
||||
|
||||
NS_IMETHOD GetHref(nsString& aHref)=0;
|
||||
NS_IMETHOD SetHref(const nsString& aHref)=0;
|
||||
|
||||
NS_IMETHOD GetPathname(nsString& aPathname)=0;
|
||||
NS_IMETHOD SetPathname(const nsString& aPathname)=0;
|
||||
|
||||
NS_IMETHOD GetPort(nsString& aPort)=0;
|
||||
NS_IMETHOD SetPort(const nsString& aPort)=0;
|
||||
|
||||
NS_IMETHOD GetProtocol(nsString& aProtocol)=0;
|
||||
NS_IMETHOD SetProtocol(const nsString& aProtocol)=0;
|
||||
|
||||
NS_IMETHOD GetSearch(nsString& aSearch)=0;
|
||||
NS_IMETHOD SetSearch(const nsString& aSearch)=0;
|
||||
|
||||
NS_IMETHOD Reload(PRBool aForceget)=0;
|
||||
|
||||
NS_IMETHOD Replace(const nsString& aUrl)=0;
|
||||
|
||||
NS_IMETHOD ToString(nsString& aReturn)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMLOCATION \
|
||||
NS_IMETHOD GetHash(nsString& aHash); \
|
||||
NS_IMETHOD SetHash(const nsString& aHash); \
|
||||
NS_IMETHOD GetHost(nsString& aHost); \
|
||||
NS_IMETHOD SetHost(const nsString& aHost); \
|
||||
NS_IMETHOD GetHostname(nsString& aHostname); \
|
||||
NS_IMETHOD SetHostname(const nsString& aHostname); \
|
||||
NS_IMETHOD GetHref(nsString& aHref); \
|
||||
NS_IMETHOD SetHref(const nsString& aHref); \
|
||||
NS_IMETHOD GetPathname(nsString& aPathname); \
|
||||
NS_IMETHOD SetPathname(const nsString& aPathname); \
|
||||
NS_IMETHOD GetPort(nsString& aPort); \
|
||||
NS_IMETHOD SetPort(const nsString& aPort); \
|
||||
NS_IMETHOD GetProtocol(nsString& aProtocol); \
|
||||
NS_IMETHOD SetProtocol(const nsString& aProtocol); \
|
||||
NS_IMETHOD GetSearch(nsString& aSearch); \
|
||||
NS_IMETHOD SetSearch(const nsString& aSearch); \
|
||||
NS_IMETHOD Reload(PRBool aForceget); \
|
||||
NS_IMETHOD Replace(const nsString& aUrl); \
|
||||
NS_IMETHOD ToString(nsString& aReturn); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMLOCATION(_to) \
|
||||
NS_IMETHOD GetHash(nsString& aHash) { return _to GetHash(aHash); } \
|
||||
NS_IMETHOD SetHash(const nsString& aHash) { return _to SetHash(aHash); } \
|
||||
NS_IMETHOD GetHost(nsString& aHost) { return _to GetHost(aHost); } \
|
||||
NS_IMETHOD SetHost(const nsString& aHost) { return _to SetHost(aHost); } \
|
||||
NS_IMETHOD GetHostname(nsString& aHostname) { return _to GetHostname(aHostname); } \
|
||||
NS_IMETHOD SetHostname(const nsString& aHostname) { return _to SetHostname(aHostname); } \
|
||||
NS_IMETHOD GetHref(nsString& aHref) { return _to GetHref(aHref); } \
|
||||
NS_IMETHOD SetHref(const nsString& aHref) { return _to SetHref(aHref); } \
|
||||
NS_IMETHOD GetPathname(nsString& aPathname) { return _to GetPathname(aPathname); } \
|
||||
NS_IMETHOD SetPathname(const nsString& aPathname) { return _to SetPathname(aPathname); } \
|
||||
NS_IMETHOD GetPort(nsString& aPort) { return _to GetPort(aPort); } \
|
||||
NS_IMETHOD SetPort(const nsString& aPort) { return _to SetPort(aPort); } \
|
||||
NS_IMETHOD GetProtocol(nsString& aProtocol) { return _to GetProtocol(aProtocol); } \
|
||||
NS_IMETHOD SetProtocol(const nsString& aProtocol) { return _to SetProtocol(aProtocol); } \
|
||||
NS_IMETHOD GetSearch(nsString& aSearch) { return _to GetSearch(aSearch); } \
|
||||
NS_IMETHOD SetSearch(const nsString& aSearch) { return _to SetSearch(aSearch); } \
|
||||
NS_IMETHOD Reload(PRBool aForceget) { return _to Reload(aForceget); } \
|
||||
NS_IMETHOD Replace(const nsString& aUrl) { return _to Replace(aUrl); } \
|
||||
NS_IMETHOD ToString(nsString& aReturn) { return _to ToString(aReturn); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitLocationClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptLocation(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMLocation_h__
|
||||
69
mozilla/dom/public/base/nsIDOMMimeType.h
Normal file
69
mozilla/dom/public/base/nsIDOMMimeType.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMMimeType_h__
|
||||
#define nsIDOMMimeType_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
class nsIDOMPlugin;
|
||||
|
||||
#define NS_IDOMMIMETYPE_IID \
|
||||
{ 0xf6134682, 0xf28b, 0x11d2, { 0x83, 0x60, 0xc9, 0x08, 0x99, 0x04, 0x9c, 0x3c } }
|
||||
|
||||
class nsIDOMMimeType : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMMIMETYPE_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetDescription(nsString& aDescription)=0;
|
||||
|
||||
NS_IMETHOD GetEnabledPlugin(nsIDOMPlugin** aEnabledPlugin)=0;
|
||||
|
||||
NS_IMETHOD GetSuffixes(nsString& aSuffixes)=0;
|
||||
|
||||
NS_IMETHOD GetType(nsString& aType)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMMIMETYPE \
|
||||
NS_IMETHOD GetDescription(nsString& aDescription); \
|
||||
NS_IMETHOD GetEnabledPlugin(nsIDOMPlugin** aEnabledPlugin); \
|
||||
NS_IMETHOD GetSuffixes(nsString& aSuffixes); \
|
||||
NS_IMETHOD GetType(nsString& aType); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMMIMETYPE(_to) \
|
||||
NS_IMETHOD GetDescription(nsString& aDescription) { return _to GetDescription(aDescription); } \
|
||||
NS_IMETHOD GetEnabledPlugin(nsIDOMPlugin** aEnabledPlugin) { return _to GetEnabledPlugin(aEnabledPlugin); } \
|
||||
NS_IMETHOD GetSuffixes(nsString& aSuffixes) { return _to GetSuffixes(aSuffixes); } \
|
||||
NS_IMETHOD GetType(nsString& aType) { return _to GetType(aType); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitMimeTypeClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptMimeType(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMMimeType_h__
|
||||
65
mozilla/dom/public/base/nsIDOMMimeTypeArray.h
Normal file
65
mozilla/dom/public/base/nsIDOMMimeTypeArray.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMMimeTypeArray_h__
|
||||
#define nsIDOMMimeTypeArray_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
class nsIDOMMimeType;
|
||||
|
||||
#define NS_IDOMMIMETYPEARRAY_IID \
|
||||
{ 0xf6134683, 0xf28b, 0x11d2, { 0x83, 0x60, 0xc9, 0x08, 0x99, 0x04, 0x9c, 0x3c } }
|
||||
|
||||
class nsIDOMMimeTypeArray : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMMIMETYPEARRAY_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetLength(PRUint32* aLength)=0;
|
||||
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMMimeType** aReturn)=0;
|
||||
|
||||
NS_IMETHOD NamedItem(const nsString& aName, nsIDOMMimeType** aReturn)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMMIMETYPEARRAY \
|
||||
NS_IMETHOD GetLength(PRUint32* aLength); \
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMMimeType** aReturn); \
|
||||
NS_IMETHOD NamedItem(const nsString& aName, nsIDOMMimeType** aReturn); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMMIMETYPEARRAY(_to) \
|
||||
NS_IMETHOD GetLength(PRUint32* aLength) { return _to GetLength(aLength); } \
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMMimeType** aReturn) { return _to Item(aIndex, aReturn); } \
|
||||
NS_IMETHOD NamedItem(const nsString& aName, nsIDOMMimeType** aReturn) { return _to NamedItem(aName, aReturn); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitMimeTypeArrayClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptMimeTypeArray(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMMimeTypeArray_h__
|
||||
58
mozilla/dom/public/base/nsIDOMNSLocation.h
Normal file
58
mozilla/dom/public/base/nsIDOMNSLocation.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMNSLocation_h__
|
||||
#define nsIDOMNSLocation_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "jsapi.h"
|
||||
|
||||
|
||||
#define NS_IDOMNSLOCATION_IID \
|
||||
{ 0xa6cf9108, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMNSLocation : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMNSLOCATION_IID; return iid; }
|
||||
|
||||
NS_IMETHOD Reload(JSContext* cx, jsval* argv, PRUint32 argc)=0;
|
||||
|
||||
NS_IMETHOD Replace(JSContext* cx, jsval* argv, PRUint32 argc)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMNSLOCATION \
|
||||
NS_IMETHOD Reload(JSContext* cx, jsval* argv, PRUint32 argc); \
|
||||
NS_IMETHOD Replace(JSContext* cx, jsval* argv, PRUint32 argc); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMNSLOCATION(_to) \
|
||||
NS_IMETHOD Reload(JSContext* cx, jsval* argv, PRUint32 argc) { return _to Reload(cx, argv, argc); } \
|
||||
NS_IMETHOD Replace(JSContext* cx, jsval* argv, PRUint32 argc) { return _to Replace(cx, argv, argc); } \
|
||||
|
||||
|
||||
#endif // nsIDOMNSLocation_h__
|
||||
104
mozilla/dom/public/base/nsIDOMNavigator.h
Normal file
104
mozilla/dom/public/base/nsIDOMNavigator.h
Normal file
@@ -0,0 +1,104 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMNavigator_h__
|
||||
#define nsIDOMNavigator_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "jsapi.h"
|
||||
|
||||
class nsIDOMPluginArray;
|
||||
class nsIDOMMimeTypeArray;
|
||||
|
||||
#define NS_IDOMNAVIGATOR_IID \
|
||||
{ 0xa6cf906e, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMNavigator : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMNAVIGATOR_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetAppCodeName(nsString& aAppCodeName)=0;
|
||||
|
||||
NS_IMETHOD GetAppName(nsString& aAppName)=0;
|
||||
|
||||
NS_IMETHOD GetAppVersion(nsString& aAppVersion)=0;
|
||||
|
||||
NS_IMETHOD GetLanguage(nsString& aLanguage)=0;
|
||||
|
||||
NS_IMETHOD GetMimeTypes(nsIDOMMimeTypeArray** aMimeTypes)=0;
|
||||
|
||||
NS_IMETHOD GetPlatform(nsString& aPlatform)=0;
|
||||
|
||||
NS_IMETHOD GetPlugins(nsIDOMPluginArray** aPlugins)=0;
|
||||
|
||||
NS_IMETHOD GetSecurityPolicy(nsString& aSecurityPolicy)=0;
|
||||
|
||||
NS_IMETHOD GetUserAgent(nsString& aUserAgent)=0;
|
||||
|
||||
NS_IMETHOD JavaEnabled(PRBool* aReturn)=0;
|
||||
|
||||
NS_IMETHOD TaintEnabled(PRBool* aReturn)=0;
|
||||
|
||||
NS_IMETHOD Preference(JSContext* cx, jsval* argv, PRUint32 argc, jsval* aReturn)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMNAVIGATOR \
|
||||
NS_IMETHOD GetAppCodeName(nsString& aAppCodeName); \
|
||||
NS_IMETHOD GetAppName(nsString& aAppName); \
|
||||
NS_IMETHOD GetAppVersion(nsString& aAppVersion); \
|
||||
NS_IMETHOD GetLanguage(nsString& aLanguage); \
|
||||
NS_IMETHOD GetMimeTypes(nsIDOMMimeTypeArray** aMimeTypes); \
|
||||
NS_IMETHOD GetPlatform(nsString& aPlatform); \
|
||||
NS_IMETHOD GetPlugins(nsIDOMPluginArray** aPlugins); \
|
||||
NS_IMETHOD GetSecurityPolicy(nsString& aSecurityPolicy); \
|
||||
NS_IMETHOD GetUserAgent(nsString& aUserAgent); \
|
||||
NS_IMETHOD JavaEnabled(PRBool* aReturn); \
|
||||
NS_IMETHOD TaintEnabled(PRBool* aReturn); \
|
||||
NS_IMETHOD Preference(JSContext* cx, jsval* argv, PRUint32 argc, jsval* aReturn); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMNAVIGATOR(_to) \
|
||||
NS_IMETHOD GetAppCodeName(nsString& aAppCodeName) { return _to GetAppCodeName(aAppCodeName); } \
|
||||
NS_IMETHOD GetAppName(nsString& aAppName) { return _to GetAppName(aAppName); } \
|
||||
NS_IMETHOD GetAppVersion(nsString& aAppVersion) { return _to GetAppVersion(aAppVersion); } \
|
||||
NS_IMETHOD GetLanguage(nsString& aLanguage) { return _to GetLanguage(aLanguage); } \
|
||||
NS_IMETHOD GetMimeTypes(nsIDOMMimeTypeArray** aMimeTypes) { return _to GetMimeTypes(aMimeTypes); } \
|
||||
NS_IMETHOD GetPlatform(nsString& aPlatform) { return _to GetPlatform(aPlatform); } \
|
||||
NS_IMETHOD GetPlugins(nsIDOMPluginArray** aPlugins) { return _to GetPlugins(aPlugins); } \
|
||||
NS_IMETHOD GetSecurityPolicy(nsString& aSecurityPolicy) { return _to GetSecurityPolicy(aSecurityPolicy); } \
|
||||
NS_IMETHOD GetUserAgent(nsString& aUserAgent) { return _to GetUserAgent(aUserAgent); } \
|
||||
NS_IMETHOD JavaEnabled(PRBool* aReturn) { return _to JavaEnabled(aReturn); } \
|
||||
NS_IMETHOD TaintEnabled(PRBool* aReturn) { return _to TaintEnabled(aReturn); } \
|
||||
NS_IMETHOD Preference(JSContext* cx, jsval* argv, PRUint32 argc, jsval* aReturn) { return _to Preference(cx, argv, argc, aReturn); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitNavigatorClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptNavigator(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMNavigator_h__
|
||||
77
mozilla/dom/public/base/nsIDOMPlugin.h
Normal file
77
mozilla/dom/public/base/nsIDOMPlugin.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMPlugin_h__
|
||||
#define nsIDOMPlugin_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
class nsIDOMMimeType;
|
||||
|
||||
#define NS_IDOMPLUGIN_IID \
|
||||
{ 0xf6134681, 0xf28b, 0x11d2, { 0x83, 0x60, 0xc9, 0x08, 0x99, 0x04, 0x9c, 0x3c } }
|
||||
|
||||
class nsIDOMPlugin : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMPLUGIN_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetDescription(nsString& aDescription)=0;
|
||||
|
||||
NS_IMETHOD GetFilename(nsString& aFilename)=0;
|
||||
|
||||
NS_IMETHOD GetName(nsString& aName)=0;
|
||||
|
||||
NS_IMETHOD GetLength(PRUint32* aLength)=0;
|
||||
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMMimeType** aReturn)=0;
|
||||
|
||||
NS_IMETHOD NamedItem(const nsString& aName, nsIDOMMimeType** aReturn)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMPLUGIN \
|
||||
NS_IMETHOD GetDescription(nsString& aDescription); \
|
||||
NS_IMETHOD GetFilename(nsString& aFilename); \
|
||||
NS_IMETHOD GetName(nsString& aName); \
|
||||
NS_IMETHOD GetLength(PRUint32* aLength); \
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMMimeType** aReturn); \
|
||||
NS_IMETHOD NamedItem(const nsString& aName, nsIDOMMimeType** aReturn); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMPLUGIN(_to) \
|
||||
NS_IMETHOD GetDescription(nsString& aDescription) { return _to GetDescription(aDescription); } \
|
||||
NS_IMETHOD GetFilename(nsString& aFilename) { return _to GetFilename(aFilename); } \
|
||||
NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \
|
||||
NS_IMETHOD GetLength(PRUint32* aLength) { return _to GetLength(aLength); } \
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMMimeType** aReturn) { return _to Item(aIndex, aReturn); } \
|
||||
NS_IMETHOD NamedItem(const nsString& aName, nsIDOMMimeType** aReturn) { return _to NamedItem(aName, aReturn); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitPluginClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptPlugin(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMPlugin_h__
|
||||
69
mozilla/dom/public/base/nsIDOMPluginArray.h
Normal file
69
mozilla/dom/public/base/nsIDOMPluginArray.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMPluginArray_h__
|
||||
#define nsIDOMPluginArray_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
class nsIDOMPlugin;
|
||||
|
||||
#define NS_IDOMPLUGINARRAY_IID \
|
||||
{ 0xf6134680, 0xf28b, 0x11d2, { 0x83, 0x60, 0xc9, 0x08, 0x99, 0x04, 0x9c, 0x3c } }
|
||||
|
||||
class nsIDOMPluginArray : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMPLUGINARRAY_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetLength(PRUint32* aLength)=0;
|
||||
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMPlugin** aReturn)=0;
|
||||
|
||||
NS_IMETHOD NamedItem(const nsString& aName, nsIDOMPlugin** aReturn)=0;
|
||||
|
||||
NS_IMETHOD Refresh(PRBool aReloadDocuments)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMPLUGINARRAY \
|
||||
NS_IMETHOD GetLength(PRUint32* aLength); \
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMPlugin** aReturn); \
|
||||
NS_IMETHOD NamedItem(const nsString& aName, nsIDOMPlugin** aReturn); \
|
||||
NS_IMETHOD Refresh(PRBool aReloadDocuments); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMPLUGINARRAY(_to) \
|
||||
NS_IMETHOD GetLength(PRUint32* aLength) { return _to GetLength(aLength); } \
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMPlugin** aReturn) { return _to Item(aIndex, aReturn); } \
|
||||
NS_IMETHOD NamedItem(const nsString& aName, nsIDOMPlugin** aReturn) { return _to NamedItem(aName, aReturn); } \
|
||||
NS_IMETHOD Refresh(PRBool aReloadDocuments) { return _to Refresh(aReloadDocuments); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitPluginArrayClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptPluginArray(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMPluginArray_h__
|
||||
85
mozilla/dom/public/base/nsIDOMScreen.h
Normal file
85
mozilla/dom/public/base/nsIDOMScreen.h
Normal file
@@ -0,0 +1,85 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMScreen_h__
|
||||
#define nsIDOMScreen_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
|
||||
#define NS_IDOMSCREEN_IID \
|
||||
{ 0x77947960, 0xb4af, 0x11d2, \
|
||||
{ 0xbd, 0x93, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4 } }
|
||||
|
||||
class nsIDOMScreen : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMSCREEN_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetWidth(PRInt32* aWidth)=0;
|
||||
|
||||
NS_IMETHOD GetHeight(PRInt32* aHeight)=0;
|
||||
|
||||
NS_IMETHOD GetPixelDepth(PRInt32* aPixelDepth)=0;
|
||||
|
||||
NS_IMETHOD GetColorDepth(PRInt32* aColorDepth)=0;
|
||||
|
||||
NS_IMETHOD GetAvailWidth(PRInt32* aAvailWidth)=0;
|
||||
|
||||
NS_IMETHOD GetAvailHeight(PRInt32* aAvailHeight)=0;
|
||||
|
||||
NS_IMETHOD GetAvailLeft(PRInt32* aAvailLeft)=0;
|
||||
|
||||
NS_IMETHOD GetAvailTop(PRInt32* aAvailTop)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMSCREEN \
|
||||
NS_IMETHOD GetWidth(PRInt32* aWidth); \
|
||||
NS_IMETHOD GetHeight(PRInt32* aHeight); \
|
||||
NS_IMETHOD GetPixelDepth(PRInt32* aPixelDepth); \
|
||||
NS_IMETHOD GetColorDepth(PRInt32* aColorDepth); \
|
||||
NS_IMETHOD GetAvailWidth(PRInt32* aAvailWidth); \
|
||||
NS_IMETHOD GetAvailHeight(PRInt32* aAvailHeight); \
|
||||
NS_IMETHOD GetAvailLeft(PRInt32* aAvailLeft); \
|
||||
NS_IMETHOD GetAvailTop(PRInt32* aAvailTop); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMSCREEN(_to) \
|
||||
NS_IMETHOD GetWidth(PRInt32* aWidth) { return _to GetWidth(aWidth); } \
|
||||
NS_IMETHOD GetHeight(PRInt32* aHeight) { return _to GetHeight(aHeight); } \
|
||||
NS_IMETHOD GetPixelDepth(PRInt32* aPixelDepth) { return _to GetPixelDepth(aPixelDepth); } \
|
||||
NS_IMETHOD GetColorDepth(PRInt32* aColorDepth) { return _to GetColorDepth(aColorDepth); } \
|
||||
NS_IMETHOD GetAvailWidth(PRInt32* aAvailWidth) { return _to GetAvailWidth(aAvailWidth); } \
|
||||
NS_IMETHOD GetAvailHeight(PRInt32* aAvailHeight) { return _to GetAvailHeight(aAvailHeight); } \
|
||||
NS_IMETHOD GetAvailLeft(PRInt32* aAvailLeft) { return _to GetAvailLeft(aAvailLeft); } \
|
||||
NS_IMETHOD GetAvailTop(PRInt32* aAvailTop) { return _to GetAvailTop(aAvailTop); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitScreenClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptScreen(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMScreen_h__
|
||||
360
mozilla/dom/public/base/nsIDOMWindow.h
Normal file
360
mozilla/dom/public/base/nsIDOMWindow.h
Normal file
@@ -0,0 +1,360 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMWindow_h__
|
||||
#define nsIDOMWindow_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "jsapi.h"
|
||||
|
||||
class nsIDOMNavigator;
|
||||
class nsIDOMElement;
|
||||
class nsIDOMDocument;
|
||||
class nsIDOMBarProp;
|
||||
class nsIDOMScreen;
|
||||
class nsIDOMHistory;
|
||||
class nsIDOMWindowCollection;
|
||||
class nsIDOMEvent;
|
||||
class nsIDOMWindow;
|
||||
class nsIControllers;
|
||||
|
||||
#define NS_IDOMWINDOW_IID \
|
||||
{ 0xa6cf906b, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMWindow : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMWINDOW_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetWindow(nsIDOMWindow** aWindow)=0;
|
||||
|
||||
NS_IMETHOD GetSelf(nsIDOMWindow** aSelf)=0;
|
||||
|
||||
NS_IMETHOD GetDocument(nsIDOMDocument** aDocument)=0;
|
||||
|
||||
NS_IMETHOD GetNavigator(nsIDOMNavigator** aNavigator)=0;
|
||||
|
||||
NS_IMETHOD GetScreen(nsIDOMScreen** aScreen)=0;
|
||||
|
||||
NS_IMETHOD GetHistory(nsIDOMHistory** aHistory)=0;
|
||||
|
||||
NS_IMETHOD GetParent(nsIDOMWindow** aParent)=0;
|
||||
|
||||
NS_IMETHOD GetTop(nsIDOMWindow** aTop)=0;
|
||||
|
||||
NS_IMETHOD GetContent(nsIDOMWindow** aContent)=0;
|
||||
|
||||
NS_IMETHOD GetMenubar(nsIDOMBarProp** aMenubar)=0;
|
||||
|
||||
NS_IMETHOD GetToolbar(nsIDOMBarProp** aToolbar)=0;
|
||||
|
||||
NS_IMETHOD GetLocationbar(nsIDOMBarProp** aLocationbar)=0;
|
||||
|
||||
NS_IMETHOD GetPersonalbar(nsIDOMBarProp** aPersonalbar)=0;
|
||||
|
||||
NS_IMETHOD GetStatusbar(nsIDOMBarProp** aStatusbar)=0;
|
||||
|
||||
NS_IMETHOD GetScrollbars(nsIDOMBarProp** aScrollbars)=0;
|
||||
|
||||
NS_IMETHOD GetDirectories(nsIDOMBarProp** aDirectories)=0;
|
||||
|
||||
NS_IMETHOD GetClosed(PRBool* aClosed)=0;
|
||||
|
||||
NS_IMETHOD GetFrames(nsIDOMWindowCollection** aFrames)=0;
|
||||
|
||||
NS_IMETHOD GetControllers(nsIControllers** aControllers)=0;
|
||||
|
||||
NS_IMETHOD GetOpener(nsIDOMWindow** aOpener)=0;
|
||||
NS_IMETHOD SetOpener(nsIDOMWindow* aOpener)=0;
|
||||
|
||||
NS_IMETHOD GetStatus(nsString& aStatus)=0;
|
||||
NS_IMETHOD SetStatus(const nsString& aStatus)=0;
|
||||
|
||||
NS_IMETHOD GetDefaultStatus(nsString& aDefaultStatus)=0;
|
||||
NS_IMETHOD SetDefaultStatus(const nsString& aDefaultStatus)=0;
|
||||
|
||||
NS_IMETHOD GetName(nsString& aName)=0;
|
||||
NS_IMETHOD SetName(const nsString& aName)=0;
|
||||
|
||||
NS_IMETHOD GetInnerWidth(PRInt32* aInnerWidth)=0;
|
||||
NS_IMETHOD SetInnerWidth(PRInt32 aInnerWidth)=0;
|
||||
|
||||
NS_IMETHOD GetInnerHeight(PRInt32* aInnerHeight)=0;
|
||||
NS_IMETHOD SetInnerHeight(PRInt32 aInnerHeight)=0;
|
||||
|
||||
NS_IMETHOD GetOuterWidth(PRInt32* aOuterWidth)=0;
|
||||
NS_IMETHOD SetOuterWidth(PRInt32 aOuterWidth)=0;
|
||||
|
||||
NS_IMETHOD GetOuterHeight(PRInt32* aOuterHeight)=0;
|
||||
NS_IMETHOD SetOuterHeight(PRInt32 aOuterHeight)=0;
|
||||
|
||||
NS_IMETHOD GetScreenX(PRInt32* aScreenX)=0;
|
||||
NS_IMETHOD SetScreenX(PRInt32 aScreenX)=0;
|
||||
|
||||
NS_IMETHOD GetScreenY(PRInt32* aScreenY)=0;
|
||||
NS_IMETHOD SetScreenY(PRInt32 aScreenY)=0;
|
||||
|
||||
NS_IMETHOD GetPageXOffset(PRInt32* aPageXOffset)=0;
|
||||
NS_IMETHOD SetPageXOffset(PRInt32 aPageXOffset)=0;
|
||||
|
||||
NS_IMETHOD GetPageYOffset(PRInt32* aPageYOffset)=0;
|
||||
NS_IMETHOD SetPageYOffset(PRInt32 aPageYOffset)=0;
|
||||
|
||||
NS_IMETHOD GetScrollX(PRInt32* aScrollX)=0;
|
||||
|
||||
NS_IMETHOD GetScrollY(PRInt32* aScrollY)=0;
|
||||
|
||||
NS_IMETHOD Dump(const nsString& aStr)=0;
|
||||
|
||||
NS_IMETHOD Alert(JSContext* cx, jsval* argv, PRUint32 argc)=0;
|
||||
|
||||
NS_IMETHOD Confirm(JSContext* cx, jsval* argv, PRUint32 argc, PRBool* aReturn)=0;
|
||||
|
||||
NS_IMETHOD Prompt(JSContext* cx, jsval* argv, PRUint32 argc, nsString& aReturn)=0;
|
||||
|
||||
NS_IMETHOD Focus()=0;
|
||||
|
||||
NS_IMETHOD Blur()=0;
|
||||
|
||||
NS_IMETHOD Back()=0;
|
||||
|
||||
NS_IMETHOD Forward()=0;
|
||||
|
||||
NS_IMETHOD Home()=0;
|
||||
|
||||
NS_IMETHOD Stop()=0;
|
||||
|
||||
NS_IMETHOD Print()=0;
|
||||
|
||||
NS_IMETHOD MoveTo(PRInt32 aXPos, PRInt32 aYPos)=0;
|
||||
|
||||
NS_IMETHOD MoveBy(PRInt32 aXDif, PRInt32 aYDif)=0;
|
||||
|
||||
NS_IMETHOD ResizeTo(PRInt32 aWidth, PRInt32 aHeight)=0;
|
||||
|
||||
NS_IMETHOD ResizeBy(PRInt32 aWidthDif, PRInt32 aHeightDif)=0;
|
||||
|
||||
NS_IMETHOD SizeToContent()=0;
|
||||
|
||||
NS_IMETHOD ScrollTo(PRInt32 aXScroll, PRInt32 aYScroll)=0;
|
||||
|
||||
NS_IMETHOD ScrollBy(PRInt32 aXScrollDif, PRInt32 aYScrollDif)=0;
|
||||
|
||||
NS_IMETHOD ClearTimeout(PRInt32 aTimerID)=0;
|
||||
|
||||
NS_IMETHOD ClearInterval(PRInt32 aTimerID)=0;
|
||||
|
||||
NS_IMETHOD SetTimeout(JSContext* cx, jsval* argv, PRUint32 argc, PRInt32* aReturn)=0;
|
||||
|
||||
NS_IMETHOD SetInterval(JSContext* cx, jsval* argv, PRUint32 argc, PRInt32* aReturn)=0;
|
||||
|
||||
NS_IMETHOD CaptureEvents(PRInt32 aEventFlags)=0;
|
||||
|
||||
NS_IMETHOD ReleaseEvents(PRInt32 aEventFlags)=0;
|
||||
|
||||
NS_IMETHOD RouteEvent(nsIDOMEvent* aEvt)=0;
|
||||
|
||||
NS_IMETHOD EnableExternalCapture()=0;
|
||||
|
||||
NS_IMETHOD DisableExternalCapture()=0;
|
||||
|
||||
NS_IMETHOD CreatePopup(nsIDOMElement* aElement, nsIDOMElement* aPopupContent, PRInt32 aXPos, PRInt32 aYPos, const nsString& aPopupType, const nsString& aAnchorAlignment, const nsString& aPopupAlignment, nsIDOMWindow** aReturn)=0;
|
||||
|
||||
NS_IMETHOD Open(JSContext* cx, jsval* argv, PRUint32 argc, nsIDOMWindow** aReturn)=0;
|
||||
|
||||
NS_IMETHOD OpenDialog(JSContext* cx, jsval* argv, PRUint32 argc, nsIDOMWindow** aReturn)=0;
|
||||
|
||||
NS_IMETHOD Close()=0;
|
||||
|
||||
NS_IMETHOD Close(JSContext* cx, jsval* argv, PRUint32 argc)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMWINDOW \
|
||||
NS_IMETHOD GetWindow(nsIDOMWindow** aWindow); \
|
||||
NS_IMETHOD GetSelf(nsIDOMWindow** aSelf); \
|
||||
NS_IMETHOD GetDocument(nsIDOMDocument** aDocument); \
|
||||
NS_IMETHOD GetNavigator(nsIDOMNavigator** aNavigator); \
|
||||
NS_IMETHOD GetScreen(nsIDOMScreen** aScreen); \
|
||||
NS_IMETHOD GetHistory(nsIDOMHistory** aHistory); \
|
||||
NS_IMETHOD GetParent(nsIDOMWindow** aParent); \
|
||||
NS_IMETHOD GetTop(nsIDOMWindow** aTop); \
|
||||
NS_IMETHOD GetContent(nsIDOMWindow** aContent); \
|
||||
NS_IMETHOD GetMenubar(nsIDOMBarProp** aMenubar); \
|
||||
NS_IMETHOD GetToolbar(nsIDOMBarProp** aToolbar); \
|
||||
NS_IMETHOD GetLocationbar(nsIDOMBarProp** aLocationbar); \
|
||||
NS_IMETHOD GetPersonalbar(nsIDOMBarProp** aPersonalbar); \
|
||||
NS_IMETHOD GetStatusbar(nsIDOMBarProp** aStatusbar); \
|
||||
NS_IMETHOD GetScrollbars(nsIDOMBarProp** aScrollbars); \
|
||||
NS_IMETHOD GetDirectories(nsIDOMBarProp** aDirectories); \
|
||||
NS_IMETHOD GetClosed(PRBool* aClosed); \
|
||||
NS_IMETHOD GetFrames(nsIDOMWindowCollection** aFrames); \
|
||||
NS_IMETHOD GetControllers(nsIControllers** aControllers); \
|
||||
NS_IMETHOD GetOpener(nsIDOMWindow** aOpener); \
|
||||
NS_IMETHOD SetOpener(nsIDOMWindow* aOpener); \
|
||||
NS_IMETHOD GetStatus(nsString& aStatus); \
|
||||
NS_IMETHOD SetStatus(const nsString& aStatus); \
|
||||
NS_IMETHOD GetDefaultStatus(nsString& aDefaultStatus); \
|
||||
NS_IMETHOD SetDefaultStatus(const nsString& aDefaultStatus); \
|
||||
NS_IMETHOD GetName(nsString& aName); \
|
||||
NS_IMETHOD SetName(const nsString& aName); \
|
||||
NS_IMETHOD GetInnerWidth(PRInt32* aInnerWidth); \
|
||||
NS_IMETHOD SetInnerWidth(PRInt32 aInnerWidth); \
|
||||
NS_IMETHOD GetInnerHeight(PRInt32* aInnerHeight); \
|
||||
NS_IMETHOD SetInnerHeight(PRInt32 aInnerHeight); \
|
||||
NS_IMETHOD GetOuterWidth(PRInt32* aOuterWidth); \
|
||||
NS_IMETHOD SetOuterWidth(PRInt32 aOuterWidth); \
|
||||
NS_IMETHOD GetOuterHeight(PRInt32* aOuterHeight); \
|
||||
NS_IMETHOD SetOuterHeight(PRInt32 aOuterHeight); \
|
||||
NS_IMETHOD GetScreenX(PRInt32* aScreenX); \
|
||||
NS_IMETHOD SetScreenX(PRInt32 aScreenX); \
|
||||
NS_IMETHOD GetScreenY(PRInt32* aScreenY); \
|
||||
NS_IMETHOD SetScreenY(PRInt32 aScreenY); \
|
||||
NS_IMETHOD GetPageXOffset(PRInt32* aPageXOffset); \
|
||||
NS_IMETHOD SetPageXOffset(PRInt32 aPageXOffset); \
|
||||
NS_IMETHOD GetPageYOffset(PRInt32* aPageYOffset); \
|
||||
NS_IMETHOD SetPageYOffset(PRInt32 aPageYOffset); \
|
||||
NS_IMETHOD GetScrollX(PRInt32* aScrollX); \
|
||||
NS_IMETHOD GetScrollY(PRInt32* aScrollY); \
|
||||
NS_IMETHOD Dump(const nsString& aStr); \
|
||||
NS_IMETHOD Alert(JSContext* cx, jsval* argv, PRUint32 argc); \
|
||||
NS_IMETHOD Confirm(JSContext* cx, jsval* argv, PRUint32 argc, PRBool* aReturn); \
|
||||
NS_IMETHOD Prompt(JSContext* cx, jsval* argv, PRUint32 argc, nsString& aReturn); \
|
||||
NS_IMETHOD Focus(); \
|
||||
NS_IMETHOD Blur(); \
|
||||
NS_IMETHOD Back(); \
|
||||
NS_IMETHOD Forward(); \
|
||||
NS_IMETHOD Home(); \
|
||||
NS_IMETHOD Stop(); \
|
||||
NS_IMETHOD Print(); \
|
||||
NS_IMETHOD MoveTo(PRInt32 aXPos, PRInt32 aYPos); \
|
||||
NS_IMETHOD MoveBy(PRInt32 aXDif, PRInt32 aYDif); \
|
||||
NS_IMETHOD ResizeTo(PRInt32 aWidth, PRInt32 aHeight); \
|
||||
NS_IMETHOD ResizeBy(PRInt32 aWidthDif, PRInt32 aHeightDif); \
|
||||
NS_IMETHOD SizeToContent(); \
|
||||
NS_IMETHOD ScrollTo(PRInt32 aXScroll, PRInt32 aYScroll); \
|
||||
NS_IMETHOD ScrollBy(PRInt32 aXScrollDif, PRInt32 aYScrollDif); \
|
||||
NS_IMETHOD ClearTimeout(PRInt32 aTimerID); \
|
||||
NS_IMETHOD ClearInterval(PRInt32 aTimerID); \
|
||||
NS_IMETHOD SetTimeout(JSContext* cx, jsval* argv, PRUint32 argc, PRInt32* aReturn); \
|
||||
NS_IMETHOD SetInterval(JSContext* cx, jsval* argv, PRUint32 argc, PRInt32* aReturn); \
|
||||
NS_IMETHOD CaptureEvents(PRInt32 aEventFlags); \
|
||||
NS_IMETHOD ReleaseEvents(PRInt32 aEventFlags); \
|
||||
NS_IMETHOD RouteEvent(nsIDOMEvent* aEvt); \
|
||||
NS_IMETHOD EnableExternalCapture(); \
|
||||
NS_IMETHOD DisableExternalCapture(); \
|
||||
NS_IMETHOD CreatePopup(nsIDOMElement* aElement, nsIDOMElement* aPopupContent, PRInt32 aXPos, PRInt32 aYPos, const nsString& aPopupType, const nsString& aAnchorAlignment, const nsString& aPopupAlignment, nsIDOMWindow** aReturn); \
|
||||
NS_IMETHOD Open(JSContext* cx, jsval* argv, PRUint32 argc, nsIDOMWindow** aReturn); \
|
||||
NS_IMETHOD OpenDialog(JSContext* cx, jsval* argv, PRUint32 argc, nsIDOMWindow** aReturn); \
|
||||
NS_IMETHOD Close(); \
|
||||
NS_IMETHOD Close(JSContext* cx, jsval* argv, PRUint32 argc); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMWINDOW(_to) \
|
||||
NS_IMETHOD GetWindow(nsIDOMWindow** aWindow) { return _to GetWindow(aWindow); } \
|
||||
NS_IMETHOD GetSelf(nsIDOMWindow** aSelf) { return _to GetSelf(aSelf); } \
|
||||
NS_IMETHOD GetDocument(nsIDOMDocument** aDocument) { return _to GetDocument(aDocument); } \
|
||||
NS_IMETHOD GetNavigator(nsIDOMNavigator** aNavigator) { return _to GetNavigator(aNavigator); } \
|
||||
NS_IMETHOD GetScreen(nsIDOMScreen** aScreen) { return _to GetScreen(aScreen); } \
|
||||
NS_IMETHOD GetHistory(nsIDOMHistory** aHistory) { return _to GetHistory(aHistory); } \
|
||||
NS_IMETHOD GetParent(nsIDOMWindow** aParent) { return _to GetParent(aParent); } \
|
||||
NS_IMETHOD GetTop(nsIDOMWindow** aTop) { return _to GetTop(aTop); } \
|
||||
NS_IMETHOD GetContent(nsIDOMWindow** aContent) { return _to GetContent(aContent); } \
|
||||
NS_IMETHOD GetMenubar(nsIDOMBarProp** aMenubar) { return _to GetMenubar(aMenubar); } \
|
||||
NS_IMETHOD GetToolbar(nsIDOMBarProp** aToolbar) { return _to GetToolbar(aToolbar); } \
|
||||
NS_IMETHOD GetLocationbar(nsIDOMBarProp** aLocationbar) { return _to GetLocationbar(aLocationbar); } \
|
||||
NS_IMETHOD GetPersonalbar(nsIDOMBarProp** aPersonalbar) { return _to GetPersonalbar(aPersonalbar); } \
|
||||
NS_IMETHOD GetStatusbar(nsIDOMBarProp** aStatusbar) { return _to GetStatusbar(aStatusbar); } \
|
||||
NS_IMETHOD GetScrollbars(nsIDOMBarProp** aScrollbars) { return _to GetScrollbars(aScrollbars); } \
|
||||
NS_IMETHOD GetDirectories(nsIDOMBarProp** aDirectories) { return _to GetDirectories(aDirectories); } \
|
||||
NS_IMETHOD GetClosed(PRBool* aClosed) { return _to GetClosed(aClosed); } \
|
||||
NS_IMETHOD GetFrames(nsIDOMWindowCollection** aFrames) { return _to GetFrames(aFrames); } \
|
||||
NS_IMETHOD GetControllers(nsIControllers** aControllers) { return _to GetControllers(aControllers); } \
|
||||
NS_IMETHOD GetOpener(nsIDOMWindow** aOpener) { return _to GetOpener(aOpener); } \
|
||||
NS_IMETHOD SetOpener(nsIDOMWindow* aOpener) { return _to SetOpener(aOpener); } \
|
||||
NS_IMETHOD GetStatus(nsString& aStatus) { return _to GetStatus(aStatus); } \
|
||||
NS_IMETHOD SetStatus(const nsString& aStatus) { return _to SetStatus(aStatus); } \
|
||||
NS_IMETHOD GetDefaultStatus(nsString& aDefaultStatus) { return _to GetDefaultStatus(aDefaultStatus); } \
|
||||
NS_IMETHOD SetDefaultStatus(const nsString& aDefaultStatus) { return _to SetDefaultStatus(aDefaultStatus); } \
|
||||
NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \
|
||||
NS_IMETHOD SetName(const nsString& aName) { return _to SetName(aName); } \
|
||||
NS_IMETHOD GetInnerWidth(PRInt32* aInnerWidth) { return _to GetInnerWidth(aInnerWidth); } \
|
||||
NS_IMETHOD SetInnerWidth(PRInt32 aInnerWidth) { return _to SetInnerWidth(aInnerWidth); } \
|
||||
NS_IMETHOD GetInnerHeight(PRInt32* aInnerHeight) { return _to GetInnerHeight(aInnerHeight); } \
|
||||
NS_IMETHOD SetInnerHeight(PRInt32 aInnerHeight) { return _to SetInnerHeight(aInnerHeight); } \
|
||||
NS_IMETHOD GetOuterWidth(PRInt32* aOuterWidth) { return _to GetOuterWidth(aOuterWidth); } \
|
||||
NS_IMETHOD SetOuterWidth(PRInt32 aOuterWidth) { return _to SetOuterWidth(aOuterWidth); } \
|
||||
NS_IMETHOD GetOuterHeight(PRInt32* aOuterHeight) { return _to GetOuterHeight(aOuterHeight); } \
|
||||
NS_IMETHOD SetOuterHeight(PRInt32 aOuterHeight) { return _to SetOuterHeight(aOuterHeight); } \
|
||||
NS_IMETHOD GetScreenX(PRInt32* aScreenX) { return _to GetScreenX(aScreenX); } \
|
||||
NS_IMETHOD SetScreenX(PRInt32 aScreenX) { return _to SetScreenX(aScreenX); } \
|
||||
NS_IMETHOD GetScreenY(PRInt32* aScreenY) { return _to GetScreenY(aScreenY); } \
|
||||
NS_IMETHOD SetScreenY(PRInt32 aScreenY) { return _to SetScreenY(aScreenY); } \
|
||||
NS_IMETHOD GetPageXOffset(PRInt32* aPageXOffset) { return _to GetPageXOffset(aPageXOffset); } \
|
||||
NS_IMETHOD SetPageXOffset(PRInt32 aPageXOffset) { return _to SetPageXOffset(aPageXOffset); } \
|
||||
NS_IMETHOD GetPageYOffset(PRInt32* aPageYOffset) { return _to GetPageYOffset(aPageYOffset); } \
|
||||
NS_IMETHOD SetPageYOffset(PRInt32 aPageYOffset) { return _to SetPageYOffset(aPageYOffset); } \
|
||||
NS_IMETHOD GetScrollX(PRInt32* aScrollX) { return _to GetScrollX(aScrollX); } \
|
||||
NS_IMETHOD GetScrollY(PRInt32* aScrollY) { return _to GetScrollY(aScrollY); } \
|
||||
NS_IMETHOD Dump(const nsString& aStr) { return _to Dump(aStr); } \
|
||||
NS_IMETHOD Alert(JSContext* cx, jsval* argv, PRUint32 argc) { return _to Alert(cx, argv, argc); } \
|
||||
NS_IMETHOD Confirm(JSContext* cx, jsval* argv, PRUint32 argc, PRBool* aReturn) { return _to Confirm(cx, argv, argc, aReturn); } \
|
||||
NS_IMETHOD Prompt(JSContext* cx, jsval* argv, PRUint32 argc, nsString& aReturn) { return _to Prompt(cx, argv, argc, aReturn); } \
|
||||
NS_IMETHOD Focus() { return _to Focus(); } \
|
||||
NS_IMETHOD Blur() { return _to Blur(); } \
|
||||
NS_IMETHOD Back() { return _to Back(); } \
|
||||
NS_IMETHOD Forward() { return _to Forward(); } \
|
||||
NS_IMETHOD Home() { return _to Home(); } \
|
||||
NS_IMETHOD Stop() { return _to Stop(); } \
|
||||
NS_IMETHOD Print() { return _to Print(); } \
|
||||
NS_IMETHOD MoveTo(PRInt32 aXPos, PRInt32 aYPos) { return _to MoveTo(aXPos, aYPos); } \
|
||||
NS_IMETHOD MoveBy(PRInt32 aXDif, PRInt32 aYDif) { return _to MoveBy(aXDif, aYDif); } \
|
||||
NS_IMETHOD ResizeTo(PRInt32 aWidth, PRInt32 aHeight) { return _to ResizeTo(aWidth, aHeight); } \
|
||||
NS_IMETHOD ResizeBy(PRInt32 aWidthDif, PRInt32 aHeightDif) { return _to ResizeBy(aWidthDif, aHeightDif); } \
|
||||
NS_IMETHOD SizeToContent() { return _to SizeToContent(); } \
|
||||
NS_IMETHOD ScrollTo(PRInt32 aXScroll, PRInt32 aYScroll) { return _to ScrollTo(aXScroll, aYScroll); } \
|
||||
NS_IMETHOD ScrollBy(PRInt32 aXScrollDif, PRInt32 aYScrollDif) { return _to ScrollBy(aXScrollDif, aYScrollDif); } \
|
||||
NS_IMETHOD ClearTimeout(PRInt32 aTimerID) { return _to ClearTimeout(aTimerID); } \
|
||||
NS_IMETHOD ClearInterval(PRInt32 aTimerID) { return _to ClearInterval(aTimerID); } \
|
||||
NS_IMETHOD SetTimeout(JSContext* cx, jsval* argv, PRUint32 argc, PRInt32* aReturn) { return _to SetTimeout(cx, argv, argc, aReturn); } \
|
||||
NS_IMETHOD SetInterval(JSContext* cx, jsval* argv, PRUint32 argc, PRInt32* aReturn) { return _to SetInterval(cx, argv, argc, aReturn); } \
|
||||
NS_IMETHOD CaptureEvents(PRInt32 aEventFlags) { return _to CaptureEvents(aEventFlags); } \
|
||||
NS_IMETHOD ReleaseEvents(PRInt32 aEventFlags) { return _to ReleaseEvents(aEventFlags); } \
|
||||
NS_IMETHOD RouteEvent(nsIDOMEvent* aEvt) { return _to RouteEvent(aEvt); } \
|
||||
NS_IMETHOD EnableExternalCapture() { return _to EnableExternalCapture(); } \
|
||||
NS_IMETHOD DisableExternalCapture() { return _to DisableExternalCapture(); } \
|
||||
NS_IMETHOD CreatePopup(nsIDOMElement* aElement, nsIDOMElement* aPopupContent, PRInt32 aXPos, PRInt32 aYPos, const nsString& aPopupType, const nsString& aAnchorAlignment, const nsString& aPopupAlignment, nsIDOMWindow** aReturn) { return _to CreatePopup(aElement, aPopupContent, aXPos, aYPos, aPopupType, aAnchorAlignment, aPopupAlignment, aReturn); } \
|
||||
NS_IMETHOD Open(JSContext* cx, jsval* argv, PRUint32 argc, nsIDOMWindow** aReturn) { return _to Open(cx, argv, argc, aReturn); } \
|
||||
NS_IMETHOD OpenDialog(JSContext* cx, jsval* argv, PRUint32 argc, nsIDOMWindow** aReturn) { return _to OpenDialog(cx, argv, argc, aReturn); } \
|
||||
NS_IMETHOD Close() { return _to Close(); } \
|
||||
NS_IMETHOD Close(JSContext* cx, jsval* argv, PRUint32 argc) { return _to Close(cx, argv, argc); } \
|
||||
|
||||
|
||||
extern nsresult NS_InitWindowClass(nsIScriptContext *aContext, nsIScriptGlobalObject *aGlobal);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptWindow(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMWindow_h__
|
||||
66
mozilla/dom/public/base/nsIDOMWindowCollection.h
Normal file
66
mozilla/dom/public/base/nsIDOMWindowCollection.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMWindowCollection_h__
|
||||
#define nsIDOMWindowCollection_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
class nsIDOMWindow;
|
||||
|
||||
#define NS_IDOMWINDOWCOLLECTION_IID \
|
||||
{ 0xa6cf906f, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMWindowCollection : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMWINDOWCOLLECTION_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetLength(PRUint32* aLength)=0;
|
||||
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMWindow** aReturn)=0;
|
||||
|
||||
NS_IMETHOD NamedItem(const nsString& aName, nsIDOMWindow** aReturn)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMWINDOWCOLLECTION \
|
||||
NS_IMETHOD GetLength(PRUint32* aLength); \
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMWindow** aReturn); \
|
||||
NS_IMETHOD NamedItem(const nsString& aName, nsIDOMWindow** aReturn); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMWINDOWCOLLECTION(_to) \
|
||||
NS_IMETHOD GetLength(PRUint32* aLength) { return _to GetLength(aLength); } \
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMWindow** aReturn) { return _to Item(aIndex, aReturn); } \
|
||||
NS_IMETHOD NamedItem(const nsString& aName, nsIDOMWindow** aReturn) { return _to NamedItem(aName, aReturn); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitWindowCollectionClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptWindowCollection(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMWindowCollection_h__
|
||||
43
mozilla/dom/public/base/nsPIDOMWindow.h
Normal file
43
mozilla/dom/public/base/nsPIDOMWindow.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsPIDOMWindow_h__
|
||||
#define nsPIDOMWindow_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
|
||||
#define NS_PIDOMWINDOW_IID \
|
||||
{ 0x3aa80781, 0x7e6a, 0x11d3, { 0xbf, 0x87, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27 } }
|
||||
|
||||
|
||||
class nsPIDOMWindow : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_PIDOMWINDOW_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetPrivateParent(nsPIDOMWindow** aResult)=0;
|
||||
};
|
||||
|
||||
#endif // nsPIDOMWindow_h__
|
||||
42
mozilla/dom/public/coreDom/MANIFEST
Normal file
42
mozilla/dom/public/coreDom/MANIFEST
Normal file
@@ -0,0 +1,42 @@
|
||||
# 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):
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist:dom directory
|
||||
#
|
||||
|
||||
nsIDOMAttr.h
|
||||
nsIDOMCDATASection.h
|
||||
nsIDOMCharacterData.h
|
||||
nsIDOMComment.h
|
||||
nsIDOMDOMImplementation.h
|
||||
nsIDOMDocument.h
|
||||
nsIDOMDocumentType.h
|
||||
nsIDOMDocumentFragment.h
|
||||
nsIDOMElement.h
|
||||
nsIDOMEntity.h
|
||||
nsIDOMNotation.h
|
||||
nsIDOMEntityReference.h
|
||||
nsIDOMNode.h
|
||||
nsIDOMNamedNodeMap.h
|
||||
nsIDOMNodeList.h
|
||||
nsIDOMProcessingInstruction.h
|
||||
nsIDOMText.h
|
||||
nsIDOMStyleSheet.h
|
||||
nsIDOMStyleSheetCollection.h
|
||||
nsIDOMNSDocument.h
|
||||
57
mozilla/dom/public/coreDom/Makefile.in
Normal file
57
mozilla/dom/public/coreDom/Makefile.in
Normal file
@@ -0,0 +1,57 @@
|
||||
#
|
||||
# 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 = dom
|
||||
|
||||
EXPORTS = \
|
||||
nsIDOMAttr.h \
|
||||
nsIDOMCDATASection.h \
|
||||
nsIDOMCharacterData.h \
|
||||
nsIDOMComment.h \
|
||||
nsIDOMDOMImplementation.h \
|
||||
nsIDOMDocument.h \
|
||||
nsIDOMDocumentType.h \
|
||||
nsIDOMDocumentFragment.h \
|
||||
nsIDOMElement.h \
|
||||
nsIDOMEntity.h \
|
||||
nsIDOMNotation.h \
|
||||
nsIDOMEntityReference.h \
|
||||
nsIDOMNode.h \
|
||||
nsIDOMNamedNodeMap.h \
|
||||
nsIDOMNodeList.h \
|
||||
nsIDOMProcessingInstruction.h \
|
||||
nsIDOMText.h \
|
||||
nsIDOMStyleSheet.h \
|
||||
nsIDOMStyleSheetCollection.h \
|
||||
nsIDOMNSDocument.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
53
mozilla/dom/public/coreDom/makefile.win
Normal file
53
mozilla/dom/public/coreDom/makefile.win
Normal file
@@ -0,0 +1,53 @@
|
||||
#!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=..\..\..
|
||||
|
||||
|
||||
DEFINES=-D_IMPL_NS_DOM
|
||||
EXPORTS = \
|
||||
nsIDOMAttr.h \
|
||||
nsIDOMCDATASection.h \
|
||||
nsIDOMCharacterData.h \
|
||||
nsIDOMComment.h \
|
||||
nsIDOMDOMImplementation.h \
|
||||
nsIDOMDocument.h \
|
||||
nsIDOMDocumentType.h \
|
||||
nsIDOMDocumentFragment.h \
|
||||
nsIDOMElement.h \
|
||||
nsIDOMEntity.h \
|
||||
nsIDOMNotation.h \
|
||||
nsIDOMEntityReference.h \
|
||||
nsIDOMNode.h \
|
||||
nsIDOMNamedNodeMap.h \
|
||||
nsIDOMNodeList.h \
|
||||
nsIDOMProcessingInstruction.h \
|
||||
nsIDOMText.h \
|
||||
nsIDOMStyleSheet.h \
|
||||
nsIDOMStyleSheetCollection.h \
|
||||
nsIDOMNSDocument.h \
|
||||
$(NULL)
|
||||
|
||||
|
||||
MODULE=dom
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
69
mozilla/dom/public/coreDom/nsIDOMAttr.h
Normal file
69
mozilla/dom/public/coreDom/nsIDOMAttr.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMAttr_h__
|
||||
#define nsIDOMAttr_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIDOMNode.h"
|
||||
|
||||
|
||||
#define NS_IDOMATTR_IID \
|
||||
{ 0xa6cf9070, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMAttr : public nsIDOMNode {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMATTR_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetName(nsString& aName)=0;
|
||||
|
||||
NS_IMETHOD GetSpecified(PRBool* aSpecified)=0;
|
||||
|
||||
NS_IMETHOD GetValue(nsString& aValue)=0;
|
||||
NS_IMETHOD SetValue(const nsString& aValue)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMATTR \
|
||||
NS_IMETHOD GetName(nsString& aName); \
|
||||
NS_IMETHOD GetSpecified(PRBool* aSpecified); \
|
||||
NS_IMETHOD GetValue(nsString& aValue); \
|
||||
NS_IMETHOD SetValue(const nsString& aValue); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMATTR(_to) \
|
||||
NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \
|
||||
NS_IMETHOD GetSpecified(PRBool* aSpecified) { return _to GetSpecified(aSpecified); } \
|
||||
NS_IMETHOD GetValue(nsString& aValue) { return _to GetValue(aValue); } \
|
||||
NS_IMETHOD SetValue(const nsString& aValue) { return _to SetValue(aValue); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitAttrClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptAttr(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMAttr_h__
|
||||
54
mozilla/dom/public/coreDom/nsIDOMCDATASection.h
Normal file
54
mozilla/dom/public/coreDom/nsIDOMCDATASection.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMCDATASection_h__
|
||||
#define nsIDOMCDATASection_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIDOMText.h"
|
||||
|
||||
|
||||
#define NS_IDOMCDATASECTION_IID \
|
||||
{ 0xa6cf9071, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMCDATASection : public nsIDOMText {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMCDATASECTION_IID; return iid; }
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMCDATASECTION \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMCDATASECTION(_to) \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitCDATASectionClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptCDATASection(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMCDATASection_h__
|
||||
85
mozilla/dom/public/coreDom/nsIDOMCharacterData.h
Normal file
85
mozilla/dom/public/coreDom/nsIDOMCharacterData.h
Normal file
@@ -0,0 +1,85 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMCharacterData_h__
|
||||
#define nsIDOMCharacterData_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIDOMNode.h"
|
||||
|
||||
|
||||
#define NS_IDOMCHARACTERDATA_IID \
|
||||
{ 0xa6cf9072, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMCharacterData : public nsIDOMNode {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMCHARACTERDATA_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetData(nsString& aData)=0;
|
||||
NS_IMETHOD SetData(const nsString& aData)=0;
|
||||
|
||||
NS_IMETHOD GetLength(PRUint32* aLength)=0;
|
||||
|
||||
NS_IMETHOD SubstringData(PRUint32 aOffset, PRUint32 aCount, nsString& aReturn)=0;
|
||||
|
||||
NS_IMETHOD AppendData(const nsString& aArg)=0;
|
||||
|
||||
NS_IMETHOD InsertData(PRUint32 aOffset, const nsString& aArg)=0;
|
||||
|
||||
NS_IMETHOD DeleteData(PRUint32 aOffset, PRUint32 aCount)=0;
|
||||
|
||||
NS_IMETHOD ReplaceData(PRUint32 aOffset, PRUint32 aCount, const nsString& aArg)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMCHARACTERDATA \
|
||||
NS_IMETHOD GetData(nsString& aData); \
|
||||
NS_IMETHOD SetData(const nsString& aData); \
|
||||
NS_IMETHOD GetLength(PRUint32* aLength); \
|
||||
NS_IMETHOD SubstringData(PRUint32 aOffset, PRUint32 aCount, nsString& aReturn); \
|
||||
NS_IMETHOD AppendData(const nsString& aArg); \
|
||||
NS_IMETHOD InsertData(PRUint32 aOffset, const nsString& aArg); \
|
||||
NS_IMETHOD DeleteData(PRUint32 aOffset, PRUint32 aCount); \
|
||||
NS_IMETHOD ReplaceData(PRUint32 aOffset, PRUint32 aCount, const nsString& aArg); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMCHARACTERDATA(_to) \
|
||||
NS_IMETHOD GetData(nsString& aData) { return _to GetData(aData); } \
|
||||
NS_IMETHOD SetData(const nsString& aData) { return _to SetData(aData); } \
|
||||
NS_IMETHOD GetLength(PRUint32* aLength) { return _to GetLength(aLength); } \
|
||||
NS_IMETHOD SubstringData(PRUint32 aOffset, PRUint32 aCount, nsString& aReturn) { return _to SubstringData(aOffset, aCount, aReturn); } \
|
||||
NS_IMETHOD AppendData(const nsString& aArg) { return _to AppendData(aArg); } \
|
||||
NS_IMETHOD InsertData(PRUint32 aOffset, const nsString& aArg) { return _to InsertData(aOffset, aArg); } \
|
||||
NS_IMETHOD DeleteData(PRUint32 aOffset, PRUint32 aCount) { return _to DeleteData(aOffset, aCount); } \
|
||||
NS_IMETHOD ReplaceData(PRUint32 aOffset, PRUint32 aCount, const nsString& aArg) { return _to ReplaceData(aOffset, aCount, aArg); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitCharacterDataClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptCharacterData(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMCharacterData_h__
|
||||
54
mozilla/dom/public/coreDom/nsIDOMComment.h
Normal file
54
mozilla/dom/public/coreDom/nsIDOMComment.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMComment_h__
|
||||
#define nsIDOMComment_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIDOMCharacterData.h"
|
||||
|
||||
|
||||
#define NS_IDOMCOMMENT_IID \
|
||||
{ 0xa6cf9073, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMComment : public nsIDOMCharacterData {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMCOMMENT_IID; return iid; }
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMCOMMENT \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMCOMMENT(_to) \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitCommentClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptComment(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMComment_h__
|
||||
57
mozilla/dom/public/coreDom/nsIDOMDOMImplementation.h
Normal file
57
mozilla/dom/public/coreDom/nsIDOMDOMImplementation.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMDOMImplementation_h__
|
||||
#define nsIDOMDOMImplementation_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
|
||||
#define NS_IDOMDOMIMPLEMENTATION_IID \
|
||||
{ 0xa6cf9074, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMDOMImplementation : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMDOMIMPLEMENTATION_IID; return iid; }
|
||||
|
||||
NS_IMETHOD HasFeature(const nsString& aFeature, const nsString& aVersion, PRBool* aReturn)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMDOMIMPLEMENTATION \
|
||||
NS_IMETHOD HasFeature(const nsString& aFeature, const nsString& aVersion, PRBool* aReturn); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMDOMIMPLEMENTATION(_to) \
|
||||
NS_IMETHOD HasFeature(const nsString& aFeature, const nsString& aVersion, PRBool* aReturn) { return _to HasFeature(aFeature, aVersion, aReturn); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitDOMImplementationClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptDOMImplementation(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMDOMImplementation_h__
|
||||
113
mozilla/dom/public/coreDom/nsIDOMDocument.h
Normal file
113
mozilla/dom/public/coreDom/nsIDOMDocument.h
Normal file
@@ -0,0 +1,113 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMDocument_h__
|
||||
#define nsIDOMDocument_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIDOMNode.h"
|
||||
|
||||
class nsIDOMElement;
|
||||
class nsIDOMProcessingInstruction;
|
||||
class nsIDOMAttr;
|
||||
class nsIDOMCDATASection;
|
||||
class nsIDOMText;
|
||||
class nsIDOMDOMImplementation;
|
||||
class nsIDOMDocumentType;
|
||||
class nsIDOMEntityReference;
|
||||
class nsIDOMDocumentFragment;
|
||||
class nsIDOMComment;
|
||||
class nsIDOMNodeList;
|
||||
|
||||
#define NS_IDOMDOCUMENT_IID \
|
||||
{ 0xa6cf9075, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMDocument : public nsIDOMNode {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMDOCUMENT_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetDoctype(nsIDOMDocumentType** aDoctype)=0;
|
||||
|
||||
NS_IMETHOD GetImplementation(nsIDOMDOMImplementation** aImplementation)=0;
|
||||
|
||||
NS_IMETHOD GetDocumentElement(nsIDOMElement** aDocumentElement)=0;
|
||||
|
||||
NS_IMETHOD CreateElement(const nsString& aTagName, nsIDOMElement** aReturn)=0;
|
||||
|
||||
NS_IMETHOD CreateDocumentFragment(nsIDOMDocumentFragment** aReturn)=0;
|
||||
|
||||
NS_IMETHOD CreateTextNode(const nsString& aData, nsIDOMText** aReturn)=0;
|
||||
|
||||
NS_IMETHOD CreateComment(const nsString& aData, nsIDOMComment** aReturn)=0;
|
||||
|
||||
NS_IMETHOD CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aReturn)=0;
|
||||
|
||||
NS_IMETHOD CreateProcessingInstruction(const nsString& aTarget, const nsString& aData, nsIDOMProcessingInstruction** aReturn)=0;
|
||||
|
||||
NS_IMETHOD CreateAttribute(const nsString& aName, nsIDOMAttr** aReturn)=0;
|
||||
|
||||
NS_IMETHOD CreateEntityReference(const nsString& aName, nsIDOMEntityReference** aReturn)=0;
|
||||
|
||||
NS_IMETHOD GetElementsByTagName(const nsString& aTagname, nsIDOMNodeList** aReturn)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMDOCUMENT \
|
||||
NS_IMETHOD GetDoctype(nsIDOMDocumentType** aDoctype); \
|
||||
NS_IMETHOD GetImplementation(nsIDOMDOMImplementation** aImplementation); \
|
||||
NS_IMETHOD GetDocumentElement(nsIDOMElement** aDocumentElement); \
|
||||
NS_IMETHOD CreateElement(const nsString& aTagName, nsIDOMElement** aReturn); \
|
||||
NS_IMETHOD CreateDocumentFragment(nsIDOMDocumentFragment** aReturn); \
|
||||
NS_IMETHOD CreateTextNode(const nsString& aData, nsIDOMText** aReturn); \
|
||||
NS_IMETHOD CreateComment(const nsString& aData, nsIDOMComment** aReturn); \
|
||||
NS_IMETHOD CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aReturn); \
|
||||
NS_IMETHOD CreateProcessingInstruction(const nsString& aTarget, const nsString& aData, nsIDOMProcessingInstruction** aReturn); \
|
||||
NS_IMETHOD CreateAttribute(const nsString& aName, nsIDOMAttr** aReturn); \
|
||||
NS_IMETHOD CreateEntityReference(const nsString& aName, nsIDOMEntityReference** aReturn); \
|
||||
NS_IMETHOD GetElementsByTagName(const nsString& aTagname, nsIDOMNodeList** aReturn); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMDOCUMENT(_to) \
|
||||
NS_IMETHOD GetDoctype(nsIDOMDocumentType** aDoctype) { return _to GetDoctype(aDoctype); } \
|
||||
NS_IMETHOD GetImplementation(nsIDOMDOMImplementation** aImplementation) { return _to GetImplementation(aImplementation); } \
|
||||
NS_IMETHOD GetDocumentElement(nsIDOMElement** aDocumentElement) { return _to GetDocumentElement(aDocumentElement); } \
|
||||
NS_IMETHOD CreateElement(const nsString& aTagName, nsIDOMElement** aReturn) { return _to CreateElement(aTagName, aReturn); } \
|
||||
NS_IMETHOD CreateDocumentFragment(nsIDOMDocumentFragment** aReturn) { return _to CreateDocumentFragment(aReturn); } \
|
||||
NS_IMETHOD CreateTextNode(const nsString& aData, nsIDOMText** aReturn) { return _to CreateTextNode(aData, aReturn); } \
|
||||
NS_IMETHOD CreateComment(const nsString& aData, nsIDOMComment** aReturn) { return _to CreateComment(aData, aReturn); } \
|
||||
NS_IMETHOD CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aReturn) { return _to CreateCDATASection(aData, aReturn); } \
|
||||
NS_IMETHOD CreateProcessingInstruction(const nsString& aTarget, const nsString& aData, nsIDOMProcessingInstruction** aReturn) { return _to CreateProcessingInstruction(aTarget, aData, aReturn); } \
|
||||
NS_IMETHOD CreateAttribute(const nsString& aName, nsIDOMAttr** aReturn) { return _to CreateAttribute(aName, aReturn); } \
|
||||
NS_IMETHOD CreateEntityReference(const nsString& aName, nsIDOMEntityReference** aReturn) { return _to CreateEntityReference(aName, aReturn); } \
|
||||
NS_IMETHOD GetElementsByTagName(const nsString& aTagname, nsIDOMNodeList** aReturn) { return _to GetElementsByTagName(aTagname, aReturn); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitDocumentClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptDocument(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMDocument_h__
|
||||
54
mozilla/dom/public/coreDom/nsIDOMDocumentFragment.h
Normal file
54
mozilla/dom/public/coreDom/nsIDOMDocumentFragment.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMDocumentFragment_h__
|
||||
#define nsIDOMDocumentFragment_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIDOMNode.h"
|
||||
|
||||
|
||||
#define NS_IDOMDOCUMENTFRAGMENT_IID \
|
||||
{ 0xa6cf9076, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMDocumentFragment : public nsIDOMNode {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMDOCUMENTFRAGMENT_IID; return iid; }
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMDOCUMENTFRAGMENT \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMDOCUMENTFRAGMENT(_to) \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitDocumentFragmentClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptDocumentFragment(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMDocumentFragment_h__
|
||||
67
mozilla/dom/public/coreDom/nsIDOMDocumentType.h
Normal file
67
mozilla/dom/public/coreDom/nsIDOMDocumentType.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMDocumentType_h__
|
||||
#define nsIDOMDocumentType_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIDOMNode.h"
|
||||
|
||||
class nsIDOMNamedNodeMap;
|
||||
|
||||
#define NS_IDOMDOCUMENTTYPE_IID \
|
||||
{ 0xa6cf9077, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMDocumentType : public nsIDOMNode {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMDOCUMENTTYPE_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetName(nsString& aName)=0;
|
||||
|
||||
NS_IMETHOD GetEntities(nsIDOMNamedNodeMap** aEntities)=0;
|
||||
|
||||
NS_IMETHOD GetNotations(nsIDOMNamedNodeMap** aNotations)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMDOCUMENTTYPE \
|
||||
NS_IMETHOD GetName(nsString& aName); \
|
||||
NS_IMETHOD GetEntities(nsIDOMNamedNodeMap** aEntities); \
|
||||
NS_IMETHOD GetNotations(nsIDOMNamedNodeMap** aNotations); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMDOCUMENTTYPE(_to) \
|
||||
NS_IMETHOD GetName(nsString& aName) { return _to GetName(aName); } \
|
||||
NS_IMETHOD GetEntities(nsIDOMNamedNodeMap** aEntities) { return _to GetEntities(aEntities); } \
|
||||
NS_IMETHOD GetNotations(nsIDOMNamedNodeMap** aNotations) { return _to GetNotations(aNotations); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitDocumentTypeClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptDocumentType(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMDocumentType_h__
|
||||
92
mozilla/dom/public/coreDom/nsIDOMElement.h
Normal file
92
mozilla/dom/public/coreDom/nsIDOMElement.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMElement_h__
|
||||
#define nsIDOMElement_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIDOMNode.h"
|
||||
|
||||
class nsIDOMAttr;
|
||||
class nsIDOMNodeList;
|
||||
|
||||
#define NS_IDOMELEMENT_IID \
|
||||
{ 0xa6cf9078, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMElement : public nsIDOMNode {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMELEMENT_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetTagName(nsString& aTagName)=0;
|
||||
|
||||
NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn)=0;
|
||||
|
||||
NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue)=0;
|
||||
|
||||
NS_IMETHOD RemoveAttribute(const nsString& aName)=0;
|
||||
|
||||
NS_IMETHOD GetAttributeNode(const nsString& aName, nsIDOMAttr** aReturn)=0;
|
||||
|
||||
NS_IMETHOD SetAttributeNode(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn)=0;
|
||||
|
||||
NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn)=0;
|
||||
|
||||
NS_IMETHOD GetElementsByTagName(const nsString& aName, nsIDOMNodeList** aReturn)=0;
|
||||
|
||||
NS_IMETHOD Normalize()=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMELEMENT \
|
||||
NS_IMETHOD GetTagName(nsString& aTagName); \
|
||||
NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn); \
|
||||
NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue); \
|
||||
NS_IMETHOD RemoveAttribute(const nsString& aName); \
|
||||
NS_IMETHOD GetAttributeNode(const nsString& aName, nsIDOMAttr** aReturn); \
|
||||
NS_IMETHOD SetAttributeNode(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn); \
|
||||
NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn); \
|
||||
NS_IMETHOD GetElementsByTagName(const nsString& aName, nsIDOMNodeList** aReturn); \
|
||||
NS_IMETHOD Normalize(); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMELEMENT(_to) \
|
||||
NS_IMETHOD GetTagName(nsString& aTagName) { return _to GetTagName(aTagName); } \
|
||||
NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn) { return _to GetAttribute(aName, aReturn); } \
|
||||
NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue) { return _to SetAttribute(aName, aValue); } \
|
||||
NS_IMETHOD RemoveAttribute(const nsString& aName) { return _to RemoveAttribute(aName); } \
|
||||
NS_IMETHOD GetAttributeNode(const nsString& aName, nsIDOMAttr** aReturn) { return _to GetAttributeNode(aName, aReturn); } \
|
||||
NS_IMETHOD SetAttributeNode(nsIDOMAttr* aNewAttr, nsIDOMAttr** aReturn) { return _to SetAttributeNode(aNewAttr, aReturn); } \
|
||||
NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* aOldAttr, nsIDOMAttr** aReturn) { return _to RemoveAttributeNode(aOldAttr, aReturn); } \
|
||||
NS_IMETHOD GetElementsByTagName(const nsString& aName, nsIDOMNodeList** aReturn) { return _to GetElementsByTagName(aName, aReturn); } \
|
||||
NS_IMETHOD Normalize() { return _to Normalize(); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitElementClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptElement(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMElement_h__
|
||||
66
mozilla/dom/public/coreDom/nsIDOMEntity.h
Normal file
66
mozilla/dom/public/coreDom/nsIDOMEntity.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMEntity_h__
|
||||
#define nsIDOMEntity_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIDOMNode.h"
|
||||
|
||||
|
||||
#define NS_IDOMENTITY_IID \
|
||||
{ 0xa6cf9079, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMEntity : public nsIDOMNode {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMENTITY_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetPublicId(nsString& aPublicId)=0;
|
||||
|
||||
NS_IMETHOD GetSystemId(nsString& aSystemId)=0;
|
||||
|
||||
NS_IMETHOD GetNotationName(nsString& aNotationName)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMENTITY \
|
||||
NS_IMETHOD GetPublicId(nsString& aPublicId); \
|
||||
NS_IMETHOD GetSystemId(nsString& aSystemId); \
|
||||
NS_IMETHOD GetNotationName(nsString& aNotationName); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMENTITY(_to) \
|
||||
NS_IMETHOD GetPublicId(nsString& aPublicId) { return _to GetPublicId(aPublicId); } \
|
||||
NS_IMETHOD GetSystemId(nsString& aSystemId) { return _to GetSystemId(aSystemId); } \
|
||||
NS_IMETHOD GetNotationName(nsString& aNotationName) { return _to GetNotationName(aNotationName); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitEntityClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptEntity(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMEntity_h__
|
||||
54
mozilla/dom/public/coreDom/nsIDOMEntityReference.h
Normal file
54
mozilla/dom/public/coreDom/nsIDOMEntityReference.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMEntityReference_h__
|
||||
#define nsIDOMEntityReference_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIDOMNode.h"
|
||||
|
||||
|
||||
#define NS_IDOMENTITYREFERENCE_IID \
|
||||
{ 0xa6cf907a, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMEntityReference : public nsIDOMNode {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMENTITYREFERENCE_IID; return iid; }
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMENTITYREFERENCE \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMENTITYREFERENCE(_to) \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitEntityReferenceClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptEntityReference(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMEntityReference_h__
|
||||
72
mozilla/dom/public/coreDom/nsIDOMNSDocument.h
Normal file
72
mozilla/dom/public/coreDom/nsIDOMNSDocument.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMNSDocument_h__
|
||||
#define nsIDOMNSDocument_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
class nsIDOMElement;
|
||||
class nsIDOMStyleSheetCollection;
|
||||
class nsIDOMRange;
|
||||
|
||||
#define NS_IDOMNSDOCUMENT_IID \
|
||||
{ 0xa6cf90cd, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
||||
|
||||
class nsIDOMNSDocument : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMNSDOCUMENT_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetWidth(PRInt32* aWidth)=0;
|
||||
|
||||
NS_IMETHOD GetHeight(PRInt32* aHeight)=0;
|
||||
|
||||
NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetCollection** aStyleSheets)=0;
|
||||
|
||||
NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName, const nsString& aNameSpace, nsIDOMElement** aReturn)=0;
|
||||
|
||||
NS_IMETHOD CreateRange(nsIDOMRange** aReturn)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMNSDOCUMENT \
|
||||
NS_IMETHOD GetWidth(PRInt32* aWidth); \
|
||||
NS_IMETHOD GetHeight(PRInt32* aHeight); \
|
||||
NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetCollection** aStyleSheets); \
|
||||
NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName, const nsString& aNameSpace, nsIDOMElement** aReturn); \
|
||||
NS_IMETHOD CreateRange(nsIDOMRange** aReturn); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMNSDOCUMENT(_to) \
|
||||
NS_IMETHOD GetWidth(PRInt32* aWidth) { return _to GetWidth(aWidth); } \
|
||||
NS_IMETHOD GetHeight(PRInt32* aHeight) { return _to GetHeight(aHeight); } \
|
||||
NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetCollection** aStyleSheets) { return _to GetStyleSheets(aStyleSheets); } \
|
||||
NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName, const nsString& aNameSpace, nsIDOMElement** aReturn) { return _to CreateElementWithNameSpace(aTagName, aNameSpace, aReturn); } \
|
||||
NS_IMETHOD CreateRange(nsIDOMRange** aReturn) { return _to CreateRange(aReturn); } \
|
||||
|
||||
|
||||
#endif // nsIDOMNSDocument_h__
|
||||
74
mozilla/dom/public/coreDom/nsIDOMNamedNodeMap.h
Normal file
74
mozilla/dom/public/coreDom/nsIDOMNamedNodeMap.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMNamedNodeMap_h__
|
||||
#define nsIDOMNamedNodeMap_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
class nsIDOMNode;
|
||||
|
||||
#define NS_IDOMNAMEDNODEMAP_IID \
|
||||
{ 0xa6cf907b, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMNamedNodeMap : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMNAMEDNODEMAP_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetLength(PRUint32* aLength)=0;
|
||||
|
||||
NS_IMETHOD GetNamedItem(const nsString& aName, nsIDOMNode** aReturn)=0;
|
||||
|
||||
NS_IMETHOD SetNamedItem(nsIDOMNode* aArg, nsIDOMNode** aReturn)=0;
|
||||
|
||||
NS_IMETHOD RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn)=0;
|
||||
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMNAMEDNODEMAP \
|
||||
NS_IMETHOD GetLength(PRUint32* aLength); \
|
||||
NS_IMETHOD GetNamedItem(const nsString& aName, nsIDOMNode** aReturn); \
|
||||
NS_IMETHOD SetNamedItem(nsIDOMNode* aArg, nsIDOMNode** aReturn); \
|
||||
NS_IMETHOD RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn); \
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMNAMEDNODEMAP(_to) \
|
||||
NS_IMETHOD GetLength(PRUint32* aLength) { return _to GetLength(aLength); } \
|
||||
NS_IMETHOD GetNamedItem(const nsString& aName, nsIDOMNode** aReturn) { return _to GetNamedItem(aName, aReturn); } \
|
||||
NS_IMETHOD SetNamedItem(nsIDOMNode* aArg, nsIDOMNode** aReturn) { return _to SetNamedItem(aArg, aReturn); } \
|
||||
NS_IMETHOD RemoveNamedItem(const nsString& aName, nsIDOMNode** aReturn) { return _to RemoveNamedItem(aName, aReturn); } \
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn) { return _to Item(aIndex, aReturn); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitNamedNodeMapClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptNamedNodeMap(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMNamedNodeMap_h__
|
||||
142
mozilla/dom/public/coreDom/nsIDOMNode.h
Normal file
142
mozilla/dom/public/coreDom/nsIDOMNode.h
Normal file
@@ -0,0 +1,142 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMNode_h__
|
||||
#define nsIDOMNode_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
class nsIDOMDocument;
|
||||
class nsIDOMNamedNodeMap;
|
||||
class nsIDOMNode;
|
||||
class nsIDOMNodeList;
|
||||
|
||||
#define NS_IDOMNODE_IID \
|
||||
{ 0xa6cf907c, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMNode : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMNODE_IID; return iid; }
|
||||
enum {
|
||||
ELEMENT_NODE = 1,
|
||||
ATTRIBUTE_NODE = 2,
|
||||
TEXT_NODE = 3,
|
||||
CDATA_SECTION_NODE = 4,
|
||||
ENTITY_REFERENCE_NODE = 5,
|
||||
ENTITY_NODE = 6,
|
||||
PROCESSING_INSTRUCTION_NODE = 7,
|
||||
COMMENT_NODE = 8,
|
||||
DOCUMENT_NODE = 9,
|
||||
DOCUMENT_TYPE_NODE = 10,
|
||||
DOCUMENT_FRAGMENT_NODE = 11,
|
||||
NOTATION_NODE = 12
|
||||
};
|
||||
|
||||
NS_IMETHOD GetNodeName(nsString& aNodeName)=0;
|
||||
|
||||
NS_IMETHOD GetNodeValue(nsString& aNodeValue)=0;
|
||||
NS_IMETHOD SetNodeValue(const nsString& aNodeValue)=0;
|
||||
|
||||
NS_IMETHOD GetNodeType(PRUint16* aNodeType)=0;
|
||||
|
||||
NS_IMETHOD GetParentNode(nsIDOMNode** aParentNode)=0;
|
||||
|
||||
NS_IMETHOD GetChildNodes(nsIDOMNodeList** aChildNodes)=0;
|
||||
|
||||
NS_IMETHOD GetFirstChild(nsIDOMNode** aFirstChild)=0;
|
||||
|
||||
NS_IMETHOD GetLastChild(nsIDOMNode** aLastChild)=0;
|
||||
|
||||
NS_IMETHOD GetPreviousSibling(nsIDOMNode** aPreviousSibling)=0;
|
||||
|
||||
NS_IMETHOD GetNextSibling(nsIDOMNode** aNextSibling)=0;
|
||||
|
||||
NS_IMETHOD GetAttributes(nsIDOMNamedNodeMap** aAttributes)=0;
|
||||
|
||||
NS_IMETHOD GetOwnerDocument(nsIDOMDocument** aOwnerDocument)=0;
|
||||
|
||||
NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn)=0;
|
||||
|
||||
NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn)=0;
|
||||
|
||||
NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn)=0;
|
||||
|
||||
NS_IMETHOD AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn)=0;
|
||||
|
||||
NS_IMETHOD HasChildNodes(PRBool* aReturn)=0;
|
||||
|
||||
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMNODE \
|
||||
NS_IMETHOD GetNodeName(nsString& aNodeName); \
|
||||
NS_IMETHOD GetNodeValue(nsString& aNodeValue); \
|
||||
NS_IMETHOD SetNodeValue(const nsString& aNodeValue); \
|
||||
NS_IMETHOD GetNodeType(PRUint16* aNodeType); \
|
||||
NS_IMETHOD GetParentNode(nsIDOMNode** aParentNode); \
|
||||
NS_IMETHOD GetChildNodes(nsIDOMNodeList** aChildNodes); \
|
||||
NS_IMETHOD GetFirstChild(nsIDOMNode** aFirstChild); \
|
||||
NS_IMETHOD GetLastChild(nsIDOMNode** aLastChild); \
|
||||
NS_IMETHOD GetPreviousSibling(nsIDOMNode** aPreviousSibling); \
|
||||
NS_IMETHOD GetNextSibling(nsIDOMNode** aNextSibling); \
|
||||
NS_IMETHOD GetAttributes(nsIDOMNamedNodeMap** aAttributes); \
|
||||
NS_IMETHOD GetOwnerDocument(nsIDOMDocument** aOwnerDocument); \
|
||||
NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn); \
|
||||
NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn); \
|
||||
NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn); \
|
||||
NS_IMETHOD AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn); \
|
||||
NS_IMETHOD HasChildNodes(PRBool* aReturn); \
|
||||
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMNODE(_to) \
|
||||
NS_IMETHOD GetNodeName(nsString& aNodeName) { return _to GetNodeName(aNodeName); } \
|
||||
NS_IMETHOD GetNodeValue(nsString& aNodeValue) { return _to GetNodeValue(aNodeValue); } \
|
||||
NS_IMETHOD SetNodeValue(const nsString& aNodeValue) { return _to SetNodeValue(aNodeValue); } \
|
||||
NS_IMETHOD GetNodeType(PRUint16* aNodeType) { return _to GetNodeType(aNodeType); } \
|
||||
NS_IMETHOD GetParentNode(nsIDOMNode** aParentNode) { return _to GetParentNode(aParentNode); } \
|
||||
NS_IMETHOD GetChildNodes(nsIDOMNodeList** aChildNodes) { return _to GetChildNodes(aChildNodes); } \
|
||||
NS_IMETHOD GetFirstChild(nsIDOMNode** aFirstChild) { return _to GetFirstChild(aFirstChild); } \
|
||||
NS_IMETHOD GetLastChild(nsIDOMNode** aLastChild) { return _to GetLastChild(aLastChild); } \
|
||||
NS_IMETHOD GetPreviousSibling(nsIDOMNode** aPreviousSibling) { return _to GetPreviousSibling(aPreviousSibling); } \
|
||||
NS_IMETHOD GetNextSibling(nsIDOMNode** aNextSibling) { return _to GetNextSibling(aNextSibling); } \
|
||||
NS_IMETHOD GetAttributes(nsIDOMNamedNodeMap** aAttributes) { return _to GetAttributes(aAttributes); } \
|
||||
NS_IMETHOD GetOwnerDocument(nsIDOMDocument** aOwnerDocument) { return _to GetOwnerDocument(aOwnerDocument); } \
|
||||
NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn) { return _to InsertBefore(aNewChild, aRefChild, aReturn); } \
|
||||
NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn) { return _to ReplaceChild(aNewChild, aOldChild, aReturn); } \
|
||||
NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn) { return _to RemoveChild(aOldChild, aReturn); } \
|
||||
NS_IMETHOD AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn) { return _to AppendChild(aNewChild, aReturn); } \
|
||||
NS_IMETHOD HasChildNodes(PRBool* aReturn) { return _to HasChildNodes(aReturn); } \
|
||||
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn) { return _to CloneNode(aDeep, aReturn); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitNodeClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptNode(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMNode_h__
|
||||
62
mozilla/dom/public/coreDom/nsIDOMNodeList.h
Normal file
62
mozilla/dom/public/coreDom/nsIDOMNodeList.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMNodeList_h__
|
||||
#define nsIDOMNodeList_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
class nsIDOMNode;
|
||||
|
||||
#define NS_IDOMNODELIST_IID \
|
||||
{ 0xa6cf907d, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMNodeList : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMNODELIST_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetLength(PRUint32* aLength)=0;
|
||||
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMNODELIST \
|
||||
NS_IMETHOD GetLength(PRUint32* aLength); \
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMNODELIST(_to) \
|
||||
NS_IMETHOD GetLength(PRUint32* aLength) { return _to GetLength(aLength); } \
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn) { return _to Item(aIndex, aReturn); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitNodeListClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptNodeList(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMNodeList_h__
|
||||
62
mozilla/dom/public/coreDom/nsIDOMNotation.h
Normal file
62
mozilla/dom/public/coreDom/nsIDOMNotation.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMNotation_h__
|
||||
#define nsIDOMNotation_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIDOMNode.h"
|
||||
|
||||
|
||||
#define NS_IDOMNOTATION_IID \
|
||||
{ 0xa6cf907e, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMNotation : public nsIDOMNode {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMNOTATION_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetPublicId(nsString& aPublicId)=0;
|
||||
|
||||
NS_IMETHOD GetSystemId(nsString& aSystemId)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMNOTATION \
|
||||
NS_IMETHOD GetPublicId(nsString& aPublicId); \
|
||||
NS_IMETHOD GetSystemId(nsString& aSystemId); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMNOTATION(_to) \
|
||||
NS_IMETHOD GetPublicId(nsString& aPublicId) { return _to GetPublicId(aPublicId); } \
|
||||
NS_IMETHOD GetSystemId(nsString& aSystemId) { return _to GetSystemId(aSystemId); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitNotationClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptNotation(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMNotation_h__
|
||||
65
mozilla/dom/public/coreDom/nsIDOMProcessingInstruction.h
Normal file
65
mozilla/dom/public/coreDom/nsIDOMProcessingInstruction.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMProcessingInstruction_h__
|
||||
#define nsIDOMProcessingInstruction_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIDOMNode.h"
|
||||
|
||||
|
||||
#define NS_IDOMPROCESSINGINSTRUCTION_IID \
|
||||
{ 0xa6cf907f, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMProcessingInstruction : public nsIDOMNode {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMPROCESSINGINSTRUCTION_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetTarget(nsString& aTarget)=0;
|
||||
|
||||
NS_IMETHOD GetData(nsString& aData)=0;
|
||||
NS_IMETHOD SetData(const nsString& aData)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMPROCESSINGINSTRUCTION \
|
||||
NS_IMETHOD GetTarget(nsString& aTarget); \
|
||||
NS_IMETHOD GetData(nsString& aData); \
|
||||
NS_IMETHOD SetData(const nsString& aData); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMPROCESSINGINSTRUCTION(_to) \
|
||||
NS_IMETHOD GetTarget(nsString& aTarget) { return _to GetTarget(aTarget); } \
|
||||
NS_IMETHOD GetData(nsString& aData) { return _to GetData(aData); } \
|
||||
NS_IMETHOD SetData(const nsString& aData) { return _to SetData(aData); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitProcessingInstructionClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptProcessingInstruction(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMProcessingInstruction_h__
|
||||
68
mozilla/dom/public/coreDom/nsIDOMStyleSheet.h
Normal file
68
mozilla/dom/public/coreDom/nsIDOMStyleSheet.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMStyleSheet_h__
|
||||
#define nsIDOMStyleSheet_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
|
||||
#define NS_IDOMSTYLESHEET_IID \
|
||||
{ 0xa6cf9080, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMStyleSheet : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMSTYLESHEET_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetType(nsString& aType)=0;
|
||||
|
||||
NS_IMETHOD GetDisabled(PRBool* aDisabled)=0;
|
||||
NS_IMETHOD SetDisabled(PRBool aDisabled)=0;
|
||||
|
||||
NS_IMETHOD GetReadOnly(PRBool* aReadOnly)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMSTYLESHEET \
|
||||
NS_IMETHOD GetType(nsString& aType); \
|
||||
NS_IMETHOD GetDisabled(PRBool* aDisabled); \
|
||||
NS_IMETHOD SetDisabled(PRBool aDisabled); \
|
||||
NS_IMETHOD GetReadOnly(PRBool* aReadOnly); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMSTYLESHEET(_to) \
|
||||
NS_IMETHOD GetType(nsString& aType) { return _to GetType(aType); } \
|
||||
NS_IMETHOD GetDisabled(PRBool* aDisabled) { return _to GetDisabled(aDisabled); } \
|
||||
NS_IMETHOD SetDisabled(PRBool aDisabled) { return _to SetDisabled(aDisabled); } \
|
||||
NS_IMETHOD GetReadOnly(PRBool* aReadOnly) { return _to GetReadOnly(aReadOnly); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitStyleSheetClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptStyleSheet(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMStyleSheet_h__
|
||||
62
mozilla/dom/public/coreDom/nsIDOMStyleSheetCollection.h
Normal file
62
mozilla/dom/public/coreDom/nsIDOMStyleSheetCollection.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMStyleSheetCollection_h__
|
||||
#define nsIDOMStyleSheetCollection_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
class nsIDOMStyleSheet;
|
||||
|
||||
#define NS_IDOMSTYLESHEETCOLLECTION_IID \
|
||||
{ 0xa6cf9081, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMStyleSheetCollection : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMSTYLESHEETCOLLECTION_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetLength(PRUint32* aLength)=0;
|
||||
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMStyleSheet** aReturn)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMSTYLESHEETCOLLECTION \
|
||||
NS_IMETHOD GetLength(PRUint32* aLength); \
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMStyleSheet** aReturn); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMSTYLESHEETCOLLECTION(_to) \
|
||||
NS_IMETHOD GetLength(PRUint32* aLength) { return _to GetLength(aLength); } \
|
||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMStyleSheet** aReturn) { return _to Item(aIndex, aReturn); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitStyleSheetCollectionClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptStyleSheetCollection(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMStyleSheetCollection_h__
|
||||
59
mozilla/dom/public/coreDom/nsIDOMText.h
Normal file
59
mozilla/dom/public/coreDom/nsIDOMText.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMText_h__
|
||||
#define nsIDOMText_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIDOMCharacterData.h"
|
||||
|
||||
class nsIDOMText;
|
||||
|
||||
#define NS_IDOMTEXT_IID \
|
||||
{ 0xa6cf9082, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMText : public nsIDOMCharacterData {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMTEXT_IID; return iid; }
|
||||
|
||||
NS_IMETHOD SplitText(PRUint32 aOffset, nsIDOMText** aReturn)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMTEXT \
|
||||
NS_IMETHOD SplitText(PRUint32 aOffset, nsIDOMText** aReturn); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMTEXT(_to) \
|
||||
NS_IMETHOD SplitText(PRUint32 aOffset, nsIDOMText** aReturn) { return _to SplitText(aOffset, aReturn); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitTextClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptText(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMText_h__
|
||||
26
mozilla/dom/public/coreEvents/MANIFEST
Normal file
26
mozilla/dom/public/coreEvents/MANIFEST
Normal file
@@ -0,0 +1,26 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist:dom directory
|
||||
#
|
||||
|
||||
nsIDOMEvent.h
|
||||
nsIDOMUIEvent.h
|
||||
nsIDOMKeyEvent.h
|
||||
nsIDOMMouseEvent.h
|
||||
nsIDOMNSUIEvent.h
|
||||
nsIDOMEventListener.h
|
||||
nsIDOMEventCapturer.h
|
||||
nsIDOMEventReceiver.h
|
||||
nsIDOMFocusListener.h
|
||||
nsIDOMFormListener.h
|
||||
nsIDOMKeyListener.h
|
||||
nsIDOMLoadListener.h
|
||||
nsIDOMMouseListener.h
|
||||
nsIDOMMouseMotionListener.h
|
||||
nsIDOMDragListener.h
|
||||
nsIDOMPaintListener.h
|
||||
nsIDOMEventTarget.h
|
||||
nsIDOMTextListener.h
|
||||
nsIDOMCompositionListener.h
|
||||
nsIDOMMenuListener.h
|
||||
|
||||
|
||||
57
mozilla/dom/public/coreEvents/Makefile.in
Normal file
57
mozilla/dom/public/coreEvents/Makefile.in
Normal file
@@ -0,0 +1,57 @@
|
||||
#
|
||||
# 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 = dom
|
||||
|
||||
EXPORTS = \
|
||||
nsIDOMEvent.h \
|
||||
nsIDOMUIEvent.h \
|
||||
nsIDOMKeyEvent.h \
|
||||
nsIDOMMouseEvent.h \
|
||||
nsIDOMEventListener.h \
|
||||
nsIDOMEventCapturer.h \
|
||||
nsIDOMEventReceiver.h \
|
||||
nsIDOMFocusListener.h \
|
||||
nsIDOMFormListener.h \
|
||||
nsIDOMKeyListener.h \
|
||||
nsIDOMLoadListener.h \
|
||||
nsIDOMMouseListener.h \
|
||||
nsIDOMMouseMotionListener.h \
|
||||
nsIDOMPaintListener.h \
|
||||
nsIDOMDragListener.h \
|
||||
nsIDOMNSUIEvent.h \
|
||||
nsIDOMEventTarget.h \
|
||||
nsIDOMTextListener.h \
|
||||
nsIDOMCompositionListener.h \
|
||||
nsIDOMMenuListener.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
53
mozilla/dom/public/coreEvents/makefile.win
Normal file
53
mozilla/dom/public/coreEvents/makefile.win
Normal file
@@ -0,0 +1,53 @@
|
||||
#!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=..\..\..
|
||||
|
||||
|
||||
DEFINES=-D_IMPL_NS_DOM
|
||||
|
||||
EXPORTS = \
|
||||
nsIDOMEvent.h \
|
||||
nsIDOMUIEvent.h \
|
||||
nsIDOMKeyEvent.h \
|
||||
nsIDOMMouseEvent.h \
|
||||
nsIDOMEventListener.h \
|
||||
nsIDOMEventCapturer.h \
|
||||
nsIDOMEventReceiver.h \
|
||||
nsIDOMFocusListener.h \
|
||||
nsIDOMFormListener.h \
|
||||
nsIDOMKeyListener.h \
|
||||
nsIDOMLoadListener.h \
|
||||
nsIDOMMouseListener.h \
|
||||
nsIDOMMouseMotionListener.h \
|
||||
nsIDOMPaintListener.h \
|
||||
nsIDOMDragListener.h \
|
||||
nsIDOMNSUIEvent.h \
|
||||
nsIDOMEventTarget.h \
|
||||
nsIDOMTextListener.h \
|
||||
nsIDOMCompositionListener.h \
|
||||
nsIDOMMenuListener.h \
|
||||
$(NULL)
|
||||
|
||||
MODULE=dom
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
48
mozilla/dom/public/coreEvents/nsIDOMCompositionListener.h
Normal file
48
mozilla/dom/public/coreEvents/nsIDOMCompositionListener.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
|
||||
#ifndef nsIDOMCompositionListener_h__
|
||||
#define nsIDOMCompositionListener_h__
|
||||
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
|
||||
/*
|
||||
* Key pressed / released / typed listener interface.
|
||||
*/
|
||||
// {F14B6491-E95B-11d2-9E85-0060089FE59B}
|
||||
#define NS_IDOMCOMPOSITIONLISTENER_IID \
|
||||
{ 0xf14b6491, 0xe95b, 0x11d2, \
|
||||
{ 0x9e, 0x85, 0x0, 0x60, 0x8, 0x9f, 0xe5, 0x9b } }
|
||||
|
||||
|
||||
class nsIDOMCompositionListener : public nsIDOMEventListener {
|
||||
|
||||
public:
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMCOMPOSITIONLISTENER_IID)
|
||||
|
||||
virtual nsresult HandleStartComposition(nsIDOMEvent* aCompositionEvent) = 0;
|
||||
virtual nsresult HandleEndComposition(nsIDOMEvent* aCompositionEvent) = 0;
|
||||
|
||||
};
|
||||
#endif // nsIDOMCompositionListener_h__
|
||||
82
mozilla/dom/public/coreEvents/nsIDOMDragListener.h
Normal file
82
mozilla/dom/public/coreEvents/nsIDOMDragListener.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
|
||||
|
||||
#ifndef nsIDOMDragListener_h__
|
||||
#define nsIDOMDragListener_h__
|
||||
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
|
||||
/*
|
||||
* Mouse up/down/move event listener
|
||||
*
|
||||
*/
|
||||
#define NS_IDOMDRAGLISTENER_IID \
|
||||
{ /* 6b8b25d0-ded5-11d1-bd85-00805f8ae3f4 */ \
|
||||
0x6b8b25d0, 0xded5, 0x11d1, \
|
||||
{0xbd, 0x85, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4} }
|
||||
|
||||
class nsIDOMDragListener : public nsIDOMEventListener {
|
||||
|
||||
public:
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMDRAGLISTENER_IID)
|
||||
|
||||
/**
|
||||
* Processes a drag enter event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
virtual nsresult DragEnter(nsIDOMEvent* aMouseEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a drag over event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
virtual nsresult DragOver(nsIDOMEvent* aMouseEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a drag Exit event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
virtual nsresult DragExit(nsIDOMEvent* aMouseEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a drag drop event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
virtual nsresult DragDrop(nsIDOMEvent* aMouseEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a drag gesture event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
virtual nsresult DragGesture(nsIDOMEvent* aMouseEvent) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIDOMDragListener_h__
|
||||
99
mozilla/dom/public/coreEvents/nsIDOMEvent.h
Normal file
99
mozilla/dom/public/coreEvents/nsIDOMEvent.h
Normal file
@@ -0,0 +1,99 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMEvent_h__
|
||||
#define nsIDOMEvent_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
class nsIDOMNode;
|
||||
|
||||
#define NS_IDOMEVENT_IID \
|
||||
{ 0xa66b7b80, 0xff46, 0xbd97, \
|
||||
{ 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMEvent : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMEVENT_IID; return iid; }
|
||||
enum {
|
||||
BUBBLING_PHASE = 1,
|
||||
CAPTURING_PHASE = 2,
|
||||
AT_TARGET = 3
|
||||
};
|
||||
|
||||
NS_IMETHOD GetType(nsString& aType)=0;
|
||||
|
||||
NS_IMETHOD GetTarget(nsIDOMNode** aTarget)=0;
|
||||
|
||||
NS_IMETHOD GetCurrentNode(nsIDOMNode** aCurrentNode)=0;
|
||||
|
||||
NS_IMETHOD GetEventPhase(PRUint16* aEventPhase)=0;
|
||||
|
||||
NS_IMETHOD GetBubbles(PRBool* aBubbles)=0;
|
||||
|
||||
NS_IMETHOD GetCancelable(PRBool* aCancelable)=0;
|
||||
|
||||
NS_IMETHOD PreventBubble()=0;
|
||||
|
||||
NS_IMETHOD PreventCapture()=0;
|
||||
|
||||
NS_IMETHOD PreventDefault()=0;
|
||||
|
||||
NS_IMETHOD InitEvent(const nsString& aEventTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMEVENT \
|
||||
NS_IMETHOD GetType(nsString& aType); \
|
||||
NS_IMETHOD GetTarget(nsIDOMNode** aTarget); \
|
||||
NS_IMETHOD GetCurrentNode(nsIDOMNode** aCurrentNode); \
|
||||
NS_IMETHOD GetEventPhase(PRUint16* aEventPhase); \
|
||||
NS_IMETHOD GetBubbles(PRBool* aBubbles); \
|
||||
NS_IMETHOD GetCancelable(PRBool* aCancelable); \
|
||||
NS_IMETHOD PreventBubble(); \
|
||||
NS_IMETHOD PreventCapture(); \
|
||||
NS_IMETHOD PreventDefault(); \
|
||||
NS_IMETHOD InitEvent(const nsString& aEventTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMEVENT(_to) \
|
||||
NS_IMETHOD GetType(nsString& aType) { return _to GetType(aType); } \
|
||||
NS_IMETHOD GetTarget(nsIDOMNode** aTarget) { return _to GetTarget(aTarget); } \
|
||||
NS_IMETHOD GetCurrentNode(nsIDOMNode** aCurrentNode) { return _to GetCurrentNode(aCurrentNode); } \
|
||||
NS_IMETHOD GetEventPhase(PRUint16* aEventPhase) { return _to GetEventPhase(aEventPhase); } \
|
||||
NS_IMETHOD GetBubbles(PRBool* aBubbles) { return _to GetBubbles(aBubbles); } \
|
||||
NS_IMETHOD GetCancelable(PRBool* aCancelable) { return _to GetCancelable(aCancelable); } \
|
||||
NS_IMETHOD PreventBubble() { return _to PreventBubble(); } \
|
||||
NS_IMETHOD PreventCapture() { return _to PreventCapture(); } \
|
||||
NS_IMETHOD PreventDefault() { return _to PreventDefault(); } \
|
||||
NS_IMETHOD InitEvent(const nsString& aEventTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg) { return _to InitEvent(aEventTypeArg, aCanBubbleArg, aCancelableArg); } \
|
||||
|
||||
|
||||
extern "C" NS_DOM nsresult NS_InitEventClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptEvent(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
#endif // nsIDOMEvent_h__
|
||||
58
mozilla/dom/public/coreEvents/nsIDOMEventCapturer.h
Normal file
58
mozilla/dom/public/coreEvents/nsIDOMEventCapturer.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMEventCapturer_h__
|
||||
#define nsIDOMEventCapturer_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
|
||||
|
||||
#define NS_IDOMEVENTCAPTURER_IID \
|
||||
{ 0xa6cf906c, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class nsIDOMEventCapturer : public nsIDOMEventReceiver {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMEVENTCAPTURER_IID; return iid; }
|
||||
|
||||
NS_IMETHOD CaptureEvent(const nsString& aType)=0;
|
||||
|
||||
NS_IMETHOD ReleaseEvent(const nsString& aType)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMEVENTCAPTURER \
|
||||
NS_IMETHOD CaptureEvent(const nsString& aType); \
|
||||
NS_IMETHOD ReleaseEvent(const nsString& aType); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMEVENTCAPTURER(_to) \
|
||||
NS_IMETHOD CaptureEvent(const nsString& aType) { return _to CaptureEvent(aType); } \
|
||||
NS_IMETHOD ReleaseEvent(const nsString& aType) { return _to ReleaseEvent(aType); } \
|
||||
|
||||
|
||||
#endif // nsIDOMEventCapturer_h__
|
||||
53
mozilla/dom/public/coreEvents/nsIDOMEventListener.h
Normal file
53
mozilla/dom/public/coreEvents/nsIDOMEventListener.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
|
||||
#ifndef nsIDOMEventListener_h__
|
||||
#define nsIDOMEventListener_h__
|
||||
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
/*
|
||||
* Event listener interface.
|
||||
*/
|
||||
|
||||
#define NS_IDOMEVENTLISTENER_IID \
|
||||
{ /* df31c120-ded6-11d1-bd85-00805f8ae3f4 */ \
|
||||
0xdf31c120, 0xded6, 0x11d1, \
|
||||
{0xbd, 0x85, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4} }
|
||||
|
||||
class nsIDOMEventListener : public nsISupports {
|
||||
|
||||
public:
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMEVENTLISTENER_IID)
|
||||
|
||||
/**
|
||||
* Processes all events excepting mouse and key events.
|
||||
* @param anEvent the event to process. @see nsIDOMEvent.h for event types.
|
||||
*/
|
||||
|
||||
virtual nsresult HandleEvent(nsIDOMEvent* aEvent) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIDOMEventListener_h__
|
||||
57
mozilla/dom/public/coreEvents/nsIDOMEventReceiver.h
Normal file
57
mozilla/dom/public/coreEvents/nsIDOMEventReceiver.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
|
||||
#ifndef nsIDOMEventReceiver_h__
|
||||
#define nsIDOMEventReceiver_h__
|
||||
|
||||
#include "nsIDOMEventTarget.h"
|
||||
|
||||
class nsIDOMEventListener;
|
||||
class nsIDOMMouseListener;
|
||||
class nsIDOMMouseMotionListener;
|
||||
class nsIDOMKeyListener;
|
||||
class nsIDOMFocusListener;
|
||||
class nsIDOMLoadListener;
|
||||
class nsIDOMDragListener;
|
||||
class nsIEventListenerManager;
|
||||
|
||||
/*
|
||||
* DOM event source class. Object that allow event registration and distribution
|
||||
* from themselves implement this interface.
|
||||
*/
|
||||
#define NS_IDOMEVENTRECEIVER_IID \
|
||||
{ /* e1dbcba0-fb38-11d1-bd87-00805f8ae3f4 */ \
|
||||
0xe1dbcba0, 0xfb38, 0x11d1, \
|
||||
{0xbd, 0x87, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4} }
|
||||
|
||||
class nsIDOMEventReceiver : public nsIDOMEventTarget {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMEVENTRECEIVER_IID)
|
||||
|
||||
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID) = 0;
|
||||
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID) = 0;
|
||||
NS_IMETHOD GetListenerManager(nsIEventListenerManager** aInstancePtrResult) = 0;
|
||||
NS_IMETHOD GetNewListenerManager(nsIEventListenerManager **aInstancePtrResult) = 0;
|
||||
|
||||
};
|
||||
#endif // nsIDOMEventReceiver_h__
|
||||
58
mozilla/dom/public/coreEvents/nsIDOMEventTarget.h
Normal file
58
mozilla/dom/public/coreEvents/nsIDOMEventTarget.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMEventTarget_h__
|
||||
#define nsIDOMEventTarget_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
class nsIDOMEventListener;
|
||||
|
||||
#define NS_IDOMEVENTTARGET_IID \
|
||||
{ 0x1c773b30, 0xd1cf, 0x11d2, \
|
||||
{ 0xbd, 0x95, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4 } }
|
||||
|
||||
class nsIDOMEventTarget : public nsISupports {
|
||||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMEVENTTARGET_IID; return iid; }
|
||||
|
||||
NS_IMETHOD AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture)=0;
|
||||
|
||||
NS_IMETHOD RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMEVENTTARGET \
|
||||
NS_IMETHOD AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture); \
|
||||
NS_IMETHOD RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMEVENTTARGET(_to) \
|
||||
NS_IMETHOD AddEventListener(const nsString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture) { return _to AddEventListener(aType, aListener, aUseCapture); } \
|
||||
NS_IMETHOD RemoveEventListener(const nsString& aType, nsIDOMEventListener* aListener, PRBool aUseCapture) { return _to RemoveEventListener(aType, aListener, aUseCapture); } \
|
||||
|
||||
|
||||
#endif // nsIDOMEventTarget_h__
|
||||
61
mozilla/dom/public/coreEvents/nsIDOMFocusListener.h
Normal file
61
mozilla/dom/public/coreEvents/nsIDOMFocusListener.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
|
||||
|
||||
#ifndef nsIDOMFocusListener_h__
|
||||
#define nsIDOMFocusListener_h__
|
||||
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
|
||||
/*
|
||||
* Mouse up/down/move event listener
|
||||
*
|
||||
*/
|
||||
#define NS_IDOMFOCUSLISTENER_IID \
|
||||
{ /* 80974670-ded6-11d1-bd85-00805f8ae3f4 */ \
|
||||
0x80974670, 0xded6, 0x11d1, \
|
||||
{0xbd, 0x85, 0x00, 0x80, 0x5f, 0x8a, 0xe3, 0xf4} }
|
||||
|
||||
class nsIDOMFocusListener : public nsIDOMEventListener {
|
||||
|
||||
public:
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMFOCUSLISTENER_IID)
|
||||
|
||||
/**
|
||||
* Processes a focus event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
virtual nsresult Focus(nsIDOMEvent* aEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a blur event
|
||||
* @param aMouseEvent @see nsIDOMEvent.h
|
||||
* @returns whether the event was consumed or ignored. @see nsresult
|
||||
*/
|
||||
virtual nsresult Blur(nsIDOMEvent* aEvent) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIDOMFocusListener_h__
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user