Merge cedar into mozilla-central

This commit is contained in:
Ehsan Akhgari 2011-03-25 23:55:33 -04:00
commit a2f674fb10
71 changed files with 899 additions and 1105 deletions

View File

@ -1822,9 +1822,12 @@
<parameter name="aListener"/>
<body>
<![CDATA[
NS_ASSERT(arguments.length == 1,
"gBrowser.addProgressListener was called with a second argument, " +
"which is not supported. See bug 608628.");
if (arguments.length != 1) {
Components.utils.reportError("gBrowser.addProgressListener was " +
"called with a second argument, " +
"which is not supported. See bug " +
"608628.");
}
if (!this.mAddProgressListenerWasCalled) {
this.mAddProgressListenerWasCalled = true;

View File

@ -171,9 +171,11 @@ CONFIGURES += $(TOPSRCDIR)/js/src/configure
# The default rule is build
build::
$(MAKE) -f $(TOPSRCDIR)/client.mk $(if $(MOZ_PGO),profiledbuild,realbuild)
# Print out any options loaded from mozconfig.
all build clean depend distclean export libs install realclean::
all realbuild clean depend distclean export libs install realclean::
@if test -f .mozconfig.out; then \
cat .mozconfig.out; \
rm -f .mozconfig.out; \
@ -207,11 +209,11 @@ else
endif
profiledbuild::
$(MAKE) -f $(TOPSRCDIR)/client.mk build MOZ_PROFILE_GENERATE=1
$(MAKE) -f $(TOPSRCDIR)/client.mk realbuild MOZ_PROFILE_GENERATE=1
$(MAKE) -C $(PGO_OBJDIR) package
OBJDIR=${PGO_OBJDIR} $(PROFILE_GEN_SCRIPT)
$(MAKE) -f $(TOPSRCDIR)/client.mk maybe_clobber_profiledbuild
$(MAKE) -f $(TOPSRCDIR)/client.mk build MOZ_PROFILE_USE=1
$(MAKE) -f $(TOPSRCDIR)/client.mk realbuild MOZ_PROFILE_USE=1
#####################################################
# Build date unification
@ -228,7 +230,7 @@ endif
#####################################################
# Preflight, before building any project
build alldep preflight_all::
realbuild alldep preflight_all::
ifeq (,$(MOZ_CURRENT_PROJECT)$(if $(MOZ_PREFLIGHT_ALL),,1))
# Don't run preflight_all for individual projects in multi-project builds
# (when MOZ_CURRENT_PROJECT is set.)
@ -252,7 +254,7 @@ endif
# loop through them.
ifeq (,$(MOZ_CURRENT_PROJECT)$(if $(MOZ_BUILD_PROJECTS),,1))
configure depend build install export libs clean realclean distclean alldep preflight postflight maybe_clobber_profiledbuild upload sdk::
configure depend realbuild install export libs clean realclean distclean alldep preflight postflight maybe_clobber_profiledbuild upload sdk::
set -e; \
for app in $(MOZ_BUILD_PROJECTS); do \
$(MAKE) -f $(TOPSRCDIR)/client.mk $@ MOZ_CURRENT_PROJECT=$$app; \
@ -332,7 +334,7 @@ depend:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
####################################
# Preflight
build alldep preflight::
realbuild alldep preflight::
ifdef MOZ_PREFLIGHT
set -e; \
for mkfile in $(MOZ_PREFLIGHT); do \
@ -343,7 +345,7 @@ endif
####################################
# Build it
build:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
realbuild:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
$(MOZ_MAKE)
####################################
@ -356,7 +358,7 @@ install export libs clean realclean distclean alldep maybe_clobber_profiledbuild
####################################
# Postflight
build alldep postflight::
realbuild alldep postflight::
ifdef MOZ_POSTFLIGHT
set -e; \
for mkfile in $(MOZ_POSTFLIGHT); do \
@ -369,7 +371,7 @@ endif # MOZ_CURRENT_PROJECT
####################################
# Postflight, after building all projects
build alldep postflight_all::
realbuild alldep postflight_all::
ifeq (,$(MOZ_CURRENT_PROJECT)$(if $(MOZ_POSTFLIGHT_ALL),,1))
# Don't run postflight_all for individual projects in multi-project builds
# (when MOZ_CURRENT_PROJECT is set.)
@ -409,4 +411,4 @@ echo-variable-%:
# in parallel.
.NOTPARALLEL:
.PHONY: checkout real_checkout depend build profiledbuild maybe_clobber_profiledbuild export libs alldep install clean realclean distclean cleansrcdir pull_all build_all clobber clobber_all pull_and_build_all everything configure preflight_all preflight postflight postflight_all upload sdk
.PHONY: checkout real_checkout depend realbuild build profiledbuild maybe_clobber_profiledbuild export libs alldep install clean realclean distclean cleansrcdir pull_all build_all clobber clobber_all pull_and_build_all everything configure preflight_all preflight postflight postflight_all upload sdk

View File

@ -63,6 +63,29 @@ from __future__ import with_statement
import sys, os
import expandlibs_config as conf
def relativize(path):
'''Returns a path relative to the current working directory, if it is
shorter than the given path'''
def splitpath(path):
dir, file = os.path.split(path)
if os.path.splitdrive(dir)[1] == os.sep:
return [file]
return splitpath(dir) + [file]
if not os.path.exists(path):
return path
curdir = splitpath(os.path.abspath(os.curdir))
abspath = splitpath(os.path.abspath(path))
while curdir and abspath and curdir[0] == abspath[0]:
del curdir[0]
del abspath[0]
if not curdir and not abspath:
return '.'
relpath = os.path.join(*[os.pardir for i in curdir] + abspath)
if len(path) > len(relpath):
return relpath
return path
class LibDescriptor(dict):
KEYS = ['OBJS', 'LIBS']
@ -99,15 +122,15 @@ class ExpandArgs(list):
'''Internal function doing the actual work'''
(root, ext) = os.path.splitext(arg)
if ext != conf.LIB_SUFFIX or not os.path.basename(root).startswith(conf.LIB_PREFIX):
return [arg]
return [relativize(arg)]
if len(conf.IMPORT_LIB_SUFFIX):
dll = root + conf.IMPORT_LIB_SUFFIX
else:
dll = root.replace(conf.LIB_PREFIX, conf.DLL_PREFIX, 1) + conf.DLL_SUFFIX
if os.path.exists(dll):
return [dll]
return [relativize(dll)]
if os.path.exists(arg):
return [arg]
return [relativize(arg)]
return self._expand_desc(arg)
def _expand_desc(self, arg):
@ -115,7 +138,7 @@ class ExpandArgs(list):
if os.path.exists(arg + conf.LIBS_DESC_SUFFIX):
with open(arg + conf.LIBS_DESC_SUFFIX, 'r') as f:
desc = LibDescriptor(f.readlines())
objs = desc['OBJS']
objs = [relativize(o) for o in desc['OBJS']]
for lib in desc['LIBS']:
objs += self._expand(lib)
return objs

View File

@ -52,7 +52,7 @@ See https://bugzilla.mozilla.org/show_bug.cgi?id=584474#c59 for more details.
from __future__ import with_statement
import sys
import os
from expandlibs import ExpandArgs
from expandlibs import ExpandArgs, relativize
import expandlibs_config as conf
from optparse import OptionParser
import subprocess
@ -93,7 +93,7 @@ class ExpandArgsMore(ExpandArgs):
subprocess.call(ar_extract + [os.path.abspath(arg)], cwd=tmp)
objs = []
for root, dirs, files in os.walk(tmp):
objs += [os.path.join(root, f) for f in files if os.path.splitext(f)[1] == conf.OBJ_SUFFIX]
objs += [relativize(os.path.join(root, f)) for f in files if os.path.splitext(f)[1] == conf.OBJ_SUFFIX]
newlist += objs
else:
newlist += [arg]

View File

@ -7,6 +7,7 @@ import imp
from tempfile import mkdtemp
from shutil import rmtree
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from mozunit import MozTestRunner
from UserString import UserString
# Create a controlled configuration for use by expandlibs
@ -35,7 +36,7 @@ config_unix = {
config = sys.modules['expandlibs_config'] = imp.new_module('expandlibs_config')
from expandlibs import LibDescriptor, ExpandArgs
from expandlibs import LibDescriptor, ExpandArgs, relativize
from expandlibs_gen import generate
from expandlibs_exec import ExpandArgsMore
@ -52,6 +53,21 @@ def ImportLib(name):
if not len(config.IMPORT_LIB_SUFFIX): return Dll(name)
return config.LIB_PREFIX + name + config.IMPORT_LIB_SUFFIX
class TestRelativize(unittest.TestCase):
def test_relativize(self):
'''Test relativize()'''
os_path_exists = os.path.exists
def exists(path):
return True
os.path.exists = exists
self.assertEqual(relativize(os.path.abspath(os.curdir)), os.curdir)
self.assertEqual(relativize(os.path.abspath(os.pardir)), os.pardir)
self.assertEqual(relativize(os.path.join(os.curdir, 'a')), 'a')
self.assertEqual(relativize(os.path.join(os.path.abspath(os.curdir), 'a')), 'a')
# relativize is expected to return the absolute path if it is shorter
self.assertEqual(relativize(os.sep), os.sep)
os.path.exists = os.path.exists
class TestLibDescriptor(unittest.TestCase):
def test_serialize(self):
'''Test LibDescriptor's serialization'''
@ -83,8 +99,12 @@ def wrap_method(conf, wrapped_method):
for key in conf:
setattr(config, key, conf[key])
self.init()
wrapped_method(self)
self.cleanup()
try:
wrapped_method(self)
except:
raise
finally:
self.cleanup()
return _method
class ReplicateTests(type):
@ -101,7 +121,7 @@ class ReplicateTests(type):
class TestCaseWithTmpDir(unittest.TestCase):
__metaclass__ = ReplicateTests
def init(self):
self.tmpdir = mkdtemp()
self.tmpdir = os.path.abspath(mkdtemp(dir=os.curdir))
def cleanup(self):
rmtree(self.tmpdir)
@ -149,6 +169,9 @@ class TestExpandInit(TestCaseWithTmpDir):
self.arg_files += [self.tmpfile(Lib('f'))]
self.touch(self.files)
def assertRelEqual(self, args1, args2):
self.assertEqual(args1, [relativize(a) for a in args2])
class TestExpandArgs(TestExpandInit):
def test_expand(self):
'''Test library expansion'''
@ -156,44 +179,45 @@ class TestExpandArgs(TestExpandInit):
# with the descriptor content, and import libraries are used when
# a library doesn't exist
args = ExpandArgs(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))])
self.assertEqual(args, ['foo', '-bar'] + self.files + self.liby_files + self.libx_files)
self.assertRelEqual(args, ['foo', '-bar'] + self.files + self.liby_files + self.libx_files)
# When a library exists at the same time as a descriptor, we just use
# the library
self.touch([self.tmpfile('libx', Lib('x'))])
args = ExpandArgs(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))])
self.assertEqual(args, ['foo', '-bar'] + self.files + self.liby_files + [self.tmpfile('libx', Lib('x'))])
self.assertRelEqual(args, ['foo', '-bar'] + self.files + self.liby_files + [self.tmpfile('libx', Lib('x'))])
self.touch([self.tmpfile('liby', Lib('y'))])
args = ExpandArgs(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))])
self.assertEqual(args, ['foo', '-bar'] + self.files + [self.tmpfile('liby', Lib('y'))])
self.assertRelEqual(args, ['foo', '-bar'] + self.files + [self.tmpfile('liby', Lib('y'))])
class TestExpandArgsMore(TestExpandInit):
def test_makelist(self):
'''Test grouping object files in lists'''
# ExpandArgsMore does the same as ExpandArgs
with ExpandArgsMore(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))]) as args:
self.assertEqual(args, ['foo', '-bar'] + self.files + self.liby_files + self.libx_files)
self.assertRelEqual(args, ['foo', '-bar'] + self.files + self.liby_files + self.libx_files)
# But also has an extra method replacing object files with a list
args.makelist()
# self.files has objects at #1, #2, #4
self.assertEqual(args[:3], ['foo', '-bar'] + self.files[:1])
self.assertEqual(args[4:], [self.files[3]] + self.files[5:] + [self.tmpfile('liby', Lib('z'))])
self.assertRelEqual(args[:3], ['foo', '-bar'] + self.files[:1])
self.assertRelEqual(args[4:], [self.files[3]] + self.files[5:] + [self.tmpfile('liby', Lib('z'))])
# Check the list file content
objs = [f for f in self.files + self.liby_files + self.libx_files if f.endswith(config.OBJ_SUFFIX)]
if config.EXPAND_LIBS_LIST_STYLE == "linkerscript":
self.assertNotEqual(args[3][0], '@')
filename = args[3]
content = ["INPUT(%s)" % f for f in objs]
content = ["INPUT(%s)" % relativize(f) for f in objs]
with open(filename, 'r') as f:
self.assertEqual([l.strip() for l in f.readlines() if len(l.strip())], content)
elif config.EXPAND_LIBS_LIST_STYLE == "list":
self.assertEqual(args[3][0], '@')
filename = args[3][1:]
content = objs
with open(filename, 'r') as f:
self.assertEqual([l.strip() for l in f.readlines() if len(l.strip())], content)
with open(filename, 'r') as f:
self.assertRelEqual([l.strip() for l in f.readlines() if len(l.strip())], content)
tmp = args.tmp
# Check that all temporary files are properly removed
@ -207,9 +231,9 @@ class TestExpandArgsMore(TestExpandInit):
def call(args, **kargs):
# The command called is always AR_EXTRACT
ar_extract = config.AR_EXTRACT.split()
self.assertEqual(args[:len(ar_extract)], ar_extract)
self.assertRelEqual(args[:len(ar_extract)], ar_extract)
# Remaining argument is always one library
self.assertEqual([os.path.splitext(arg)[1] for arg in args[len(ar_extract):]], [config.LIB_SUFFIX])
self.assertRelEqual([os.path.splitext(arg)[1] for arg in args[len(ar_extract):]], [config.LIB_SUFFIX])
# Simulate AR_EXTRACT extracting one object file for the library
lib = os.path.splitext(os.path.basename(args[len(ar_extract)]))[0]
extracted[lib] = os.path.join(kargs['cwd'], "%s" % Obj(lib))
@ -219,7 +243,7 @@ class TestExpandArgsMore(TestExpandInit):
# ExpandArgsMore does the same as ExpandArgs
self.touch([self.tmpfile('liby', Lib('y'))])
with ExpandArgsMore(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))]) as args:
self.assertEqual(args, ['foo', '-bar'] + self.files + [self.tmpfile('liby', Lib('y'))])
self.assertRelEqual(args, ['foo', '-bar'] + self.files + [self.tmpfile('liby', Lib('y'))])
# ExpandArgsMore also has an extra method extracting static libraries
# when possible
@ -230,11 +254,11 @@ class TestExpandArgsMore(TestExpandInit):
# If we don't have an AR_EXTRACT, extract() expands libraries with a
# descriptor when the corresponding library exists (which ExpandArgs
# alone doesn't)
self.assertEqual(args, ['foo', '-bar'] + files)
self.assertRelEqual(args, ['foo', '-bar'] + files)
else:
# With AR_EXTRACT, it uses the descriptors when there are, and actually
# extracts the remaining libraries
self.assertEqual(args, ['foo', '-bar'] + [extracted[os.path.splitext(os.path.basename(f))[0]] if f.endswith(config.LIB_SUFFIX) else f for f in files])
self.assertRelEqual(args, ['foo', '-bar'] + [extracted[os.path.splitext(os.path.basename(f))[0]] if f.endswith(config.LIB_SUFFIX) else f for f in files])
tmp = args.tmp
# Check that all temporary files are properly removed
@ -244,4 +268,4 @@ class TestExpandArgsMore(TestExpandInit):
subprocess.call = subprocess_call
if __name__ == '__main__':
unittest.main()
unittest.main(testRunner=MozTestRunner())

View File

@ -3238,6 +3238,18 @@ nsDocument::doCreateShell(nsPresContext* aContext,
mExternalResourceMap.ShowViewers();
if (mScriptGlobalObject) {
RescheduleAnimationFrameNotifications();
}
shell.swap(*aInstancePtrResult);
return NS_OK;
}
void
nsDocument::RescheduleAnimationFrameNotifications()
{
nsRefreshDriver* rd = mPresShell->GetPresContext()->RefreshDriver();
if (mHavePendingPaint) {
rd->ScheduleBeforePaintEvent(this);
@ -3245,10 +3257,6 @@ nsDocument::doCreateShell(nsPresContext* aContext,
if (!mAnimationFrameListeners.IsEmpty()) {
rd->ScheduleAnimationFrameListeners(this);
}
shell.swap(*aInstancePtrResult);
return NS_OK;
}
void
@ -3262,6 +3270,15 @@ void
nsDocument::DeleteShell()
{
mExternalResourceMap.HideViewers();
if (mScriptGlobalObject) {
RevokeAnimationFrameNotifications();
}
mPresShell = nsnull;
}
void
nsDocument::RevokeAnimationFrameNotifications()
{
if (mHavePendingPaint) {
mPresShell->GetPresContext()->RefreshDriver()->RevokeBeforePaintEvent(this);
}
@ -3269,7 +3286,6 @@ nsDocument::DeleteShell()
mPresShell->GetPresContext()->RefreshDriver()->
RevokeAnimationFrameListeners(this);
}
mPresShell = nsnull;
}
static void
@ -3791,6 +3807,10 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
// our layout history state now.
mLayoutHistoryState = GetLayoutHistoryState();
if (mPresShell) {
RevokeAnimationFrameNotifications();
}
// Also make sure to remove our onload blocker now if we haven't done it yet
if (mOnloadBlockCount != 0) {
nsCOMPtr<nsILoadGroup> loadGroup = GetDocumentLoadGroup();
@ -3847,6 +3867,10 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
mAllowDNSPrefetch = allowDNSPrefetch;
}
}
if (mPresShell) {
RescheduleAnimationFrameNotifications();
}
}
// Remember the pointer to our window (or lack there of), to avoid

View File

@ -1207,6 +1207,11 @@ private:
void EnableStyleSheetsForSetInternal(const nsAString& aSheetSet,
PRBool aUpdateCSSLoader);
// Revoke any pending notifications due to mozRequestAnimationFrame calls
void RevokeAnimationFrameNotifications();
// Reschedule any notifications we need to handle mozRequestAnimationFrame
void RescheduleAnimationFrameNotifications();
// These are not implemented and not supported.
nsDocument(const nsDocument& aOther);
nsDocument& operator=(const nsDocument& aOther);

View File

@ -627,10 +627,9 @@ nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL)
JSObject* global = nsnull;
mGlobal->GetJSObject(&global);
if (global) {
jsval val;
JS_ExecuteScript(mCx, global,
(JSScript*)JS_GetPrivate(mCx, holder->mObject),
&val);
nsnull);
}
}
JSContext* unused;
@ -682,12 +681,18 @@ nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL)
JSPrincipals* jsprin = nsnull;
mPrincipal->GetJSPrincipals(mCx, &jsprin);
nsContentUtils::XPConnect()->FlagSystemFilenamePrefix(url.get(), PR_TRUE);
uint32 oldopts = JS_GetOptions(mCx);
JS_SetOptions(mCx, oldopts | JSOPTION_NO_SCRIPT_RVAL);
JSScript* script =
JS_CompileUCScriptForPrincipals(mCx, nsnull, jsprin,
(jschar*)dataString.get(),
dataString.Length(),
url.get(), 1);
JS_SetOptions(mCx, oldopts);
if (script) {
JSObject* scriptObj = JS_NewScriptObject(mCx, script);
JS_AddObjectRoot(mCx, &scriptObj);
@ -702,9 +707,8 @@ nsFrameScriptExecutor::LoadFrameScriptInternal(const nsAString& aURL)
"Cached message manager script");
sCachedScripts->Put(aURL, holder);
}
jsval val;
JS_ExecuteScript(mCx, global,
(JSScript*)JS_GetPrivate(mCx, scriptObj), &val);
(JSScript*)JS_GetPrivate(mCx, scriptObj), nsnull);
JS_RemoveObjectRoot(mCx, &scriptObj);
}
//XXX Argh, JSPrincipals are manually refcounted!

View File

@ -1611,6 +1611,7 @@ GK_ATOM(columnSetFrame, "ColumnSetFrame")
GK_ATOM(comboboxControlFrame, "ComboboxControlFrame")
GK_ATOM(comboboxDisplayFrame, "ComboboxDisplayFrame")
GK_ATOM(deckFrame, "DeckFrame")
GK_ATOM(directionalFrame, "DirectionalFrame")
GK_ATOM(fieldSetFrame, "FieldSetFrame")
GK_ATOM(frameSetFrame, "FrameSetFrame")
GK_ATOM(gfxButtonControlFrame, "gfxButtonControlFrame")

View File

@ -126,19 +126,16 @@
#define XML_HTTP_REQUEST_ABORTED (1 << 7) // Internal
#define XML_HTTP_REQUEST_ASYNC (1 << 8) // Internal
#define XML_HTTP_REQUEST_PARSEBODY (1 << 9) // Internal
#define XML_HTTP_REQUEST_XSITEENABLED (1 << 10) // Internal, Is any cross-site request allowed?
// Even if this is false the
// access-control spec is supported
#define XML_HTTP_REQUEST_SYNCLOOPING (1 << 11) // Internal
#define XML_HTTP_REQUEST_MULTIPART (1 << 12) // Internal
#define XML_HTTP_REQUEST_GOT_FINAL_STOP (1 << 13) // Internal
#define XML_HTTP_REQUEST_BACKGROUND (1 << 14) // Internal
#define XML_HTTP_REQUEST_SYNCLOOPING (1 << 10) // Internal
#define XML_HTTP_REQUEST_MULTIPART (1 << 11) // Internal
#define XML_HTTP_REQUEST_GOT_FINAL_STOP (1 << 12) // Internal
#define XML_HTTP_REQUEST_BACKGROUND (1 << 13) // Internal
// This is set when we've got the headers for a multipart XMLHttpRequest,
// but haven't yet started to process the first part.
#define XML_HTTP_REQUEST_MPART_HEADERS (1 << 15) // Internal
#define XML_HTTP_REQUEST_USE_XSITE_AC (1 << 16) // Internal
#define XML_HTTP_REQUEST_NEED_AC_PREFLIGHT (1 << 17) // Internal
#define XML_HTTP_REQUEST_AC_WITH_CREDENTIALS (1 << 18) // Internal
#define XML_HTTP_REQUEST_MPART_HEADERS (1 << 14) // Internal
#define XML_HTTP_REQUEST_USE_XSITE_AC (1 << 15) // Internal
#define XML_HTTP_REQUEST_NEED_AC_PREFLIGHT (1 << 16) // Internal
#define XML_HTTP_REQUEST_AC_WITH_CREDENTIALS (1 << 17) // Internal
#define XML_HTTP_REQUEST_LOADSTATES \
(XML_HTTP_REQUEST_UNINITIALIZED | \
@ -1639,14 +1636,12 @@ nsXMLHttpRequest::GetCurrentHttpChannel()
nsresult
nsXMLHttpRequest::CheckChannelForCrossSiteRequest(nsIChannel* aChannel)
{
// First check if cross-site requests are enabled
if ((mState & XML_HTTP_REQUEST_XSITEENABLED)) {
// First check if cross-site requests are enabled...
if (IsSystemXHR()) {
return NS_OK;
}
// or if this is a same-origin request.
NS_ASSERTION(!nsContentUtils::IsSystemPrincipal(mPrincipal),
"Shouldn't get here!");
// ...or if this is a same-origin request.
if (nsContentUtils::CheckMayLoad(mPrincipal, aChannel)) {
return NS_OK;
}
@ -1797,12 +1792,6 @@ nsXMLHttpRequest::OpenRequest(const nsACString& method,
channelPolicy);
if (NS_FAILED(rv)) return rv;
// Check if we're doing a cross-origin request.
if (nsContentUtils::IsSystemPrincipal(mPrincipal)) {
// Chrome callers are always allowed to read from different origins.
mState |= XML_HTTP_REQUEST_XSITEENABLED;
}
mState &= ~(XML_HTTP_REQUEST_USE_XSITE_AC |
XML_HTTP_REQUEST_NEED_AC_PREFLIGHT);
@ -1823,17 +1812,6 @@ nsXMLHttpRequest::Open(const nsACString& method, const nsACString& url,
PRBool async, const nsAString& user,
const nsAString& password, PRUint8 optional_argc)
{
if (nsContentUtils::GetCurrentJSContext()) {
// We're (likely) called from JS
// Find out if UniversalBrowserRead privileges are enabled
if (nsContentUtils::IsCallerTrustedForRead()) {
mState |= XML_HTTP_REQUEST_XSITEENABLED;
} else {
mState &= ~XML_HTTP_REQUEST_XSITEENABLED;
}
}
if (!optional_argc) {
// No optional arguments were passed in. Default async to true.
async = PR_TRUE;
@ -1954,8 +1932,8 @@ nsXMLHttpRequest::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
nsCOMPtr<nsIChannel> channel(do_QueryInterface(request));
NS_ENSURE_TRUE(channel, NS_ERROR_UNEXPECTED);
nsCOMPtr<nsIPrincipal> documentPrincipal = mPrincipal;
if (nsContentUtils::IsSystemPrincipal(documentPrincipal)) {
nsCOMPtr<nsIPrincipal> documentPrincipal;
if (IsSystemXHR()) {
// Don't give this document the system principal. We need to keep track of
// mPrincipal being system because we use it for various security checks
// that should be passing, but the document data shouldn't get a system
@ -1963,6 +1941,8 @@ nsXMLHttpRequest::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
nsresult rv;
documentPrincipal = do_CreateInstance("@mozilla.org/nullprincipal;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
} else {
documentPrincipal = mPrincipal;
}
channel->SetOwner(documentPrincipal);
@ -2040,7 +2020,7 @@ nsXMLHttpRequest::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
nsCOMPtr<nsIDocument> responseDoc = do_QueryInterface(mResponseXML);
responseDoc->SetPrincipal(documentPrincipal);
if (nsContentUtils::IsSystemPrincipal(mPrincipal)) {
if (IsSystemXHR()) {
responseDoc->ForceEnableXULXBL();
}
@ -2420,7 +2400,7 @@ nsXMLHttpRequest::Send(nsIVariant *aBody)
if (httpChannel) {
httpChannel->GetRequestMethod(method); // If GET, method name will be uppercase
if (!nsContentUtils::IsSystemPrincipal(mPrincipal)) {
if (!IsSystemXHR()) {
// Get the referrer for the request.
//
// If it weren't for history.push/replaceState, we could just use the
@ -2656,7 +2636,7 @@ nsXMLHttpRequest::Send(nsIVariant *aBody)
}
}
if (!(mState & XML_HTTP_REQUEST_XSITEENABLED)) {
if (!IsSystemXHR()) {
// Always create a nsCrossSiteListenerProxy here even if it's
// a same-origin request right now, since it could be redirected.
listener = new nsCrossSiteListenerProxy(listener, mPrincipal, mChannel,
@ -2853,7 +2833,7 @@ nsXMLHttpRequest::SetRequestHeader(const nsACString& header,
}
// Check for dangerous cross-site headers
PRBool safeHeader = !!(mState & XML_HTTP_REQUEST_XSITEENABLED);
bool safeHeader = IsSystemXHR();
if (!safeHeader) {
// Content-Type isn't always safe, but we'll deal with it in Send()
const char *kCrossOriginSafeHeaders[] = {
@ -2862,7 +2842,7 @@ nsXMLHttpRequest::SetRequestHeader(const nsACString& header,
};
for (i = 0; i < NS_ARRAY_LENGTH(kCrossOriginSafeHeaders); ++i) {
if (header.LowerCaseEqualsASCII(kCrossOriginSafeHeaders[i])) {
safeHeader = PR_TRUE;
safeHeader = true;
break;
}
}

View File

@ -69,6 +69,7 @@
#include "nsIPrivateDOMEvent.h"
#include "nsDOMProgressEvent.h"
#include "nsDOMEventTargetWrapperCache.h"
#include "nsContentUtils.h"
class nsILoadGroup;
class AsyncVerifyRedirectCallbackForwarder;
@ -333,6 +334,10 @@ protected:
already_AddRefed<nsIHttpChannel> GetCurrentHttpChannel();
bool IsSystemXHR() {
return !!nsContentUtils::IsSystemPrincipal(mPrincipal);
}
/**
* Check if aChannel is ok for a cross-site request by making sure no
* inappropriate headers are set, and no username/password is set.

View File

@ -22,9 +22,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=426308
const SJS_URL = "http://example.org:80/tests/content/base/test/bug426308-redirect.sjs";
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
var req = new XMLHttpRequest();
var req = SpecialPowers.createSystemXHR();
req.open("GET", SJS_URL + "?" + window.location.href, false);
req.send(null);

View File

@ -52,8 +52,7 @@ function createDoc() {
function xhrDoc(idx) {
return function() {
// Defy same-origin restrictions!
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var xhr = new XMLHttpRequest();
var xhr = SpecialPowers.createSystemXHR();
xhr.open("GET", docSources[idx], false);
xhr.send();
return xhr.responseXML;

View File

@ -4843,6 +4843,12 @@ nsDocShell::SetIsActive(PRBool aIsActive)
if (pshell)
pshell->SetIsActive(aIsActive);
// Tell the window about it
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(mScriptGlobal);
if (win) {
win->SetIsBackground(!aIsActive);
}
// Recursively tell all of our children
PRInt32 n = mChildList.Count();
for (PRInt32 i = 0; i < n; ++i) {

View File

@ -272,9 +272,14 @@ static PRBool gDOMWindowDumpEnabled = PR_FALSE;
// The default shortest interval/timeout we permit
#define DEFAULT_MIN_TIMEOUT_VALUE 10 // 10ms
#define DEFAULT_MIN_BACKGROUND_TIMEOUT_VALUE 1000 // 1000ms
static PRInt32 gMinTimeoutValue;
static inline PRInt32 DOMMinTimeoutValue() {
return NS_MAX(gMinTimeoutValue, 0);
static PRInt32 gMinBackgroundTimeoutValue;
inline PRInt32
nsGlobalWindow::DOMMinTimeoutValue() const {
PRBool isBackground = !mOuterWindow || mOuterWindow->IsBackground();
return
NS_MAX(isBackground ? gMinBackgroundTimeoutValue : gMinTimeoutValue, 0);
}
// The number of nested timeouts before we start clamping. HTML5 says 1, WebKit
@ -746,7 +751,8 @@ nsPIDOMWindow::nsPIDOMWindow(nsPIDOMWindow *aOuterWindow)
mIsHandlingResizeEvent(PR_FALSE), mIsInnerWindow(aOuterWindow != nsnull),
mMayHavePaintEventListener(PR_FALSE), mMayHaveTouchEventListener(PR_FALSE),
mMayHaveAudioAvailableEventListener(PR_FALSE), mIsModalContentWindow(PR_FALSE),
mIsActive(PR_FALSE), mInnerWindow(nsnull), mOuterWindow(aOuterWindow),
mIsActive(PR_FALSE), mIsBackground(PR_FALSE),
mInnerWindow(nsnull), mOuterWindow(aOuterWindow),
// Make sure no actual window ends up with mWindowID == 0
mWindowID(++gNextWindowID), mHasNotifiedGlobalCreated(PR_FALSE)
{}
@ -895,6 +901,9 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
nsContentUtils::AddIntPrefVarCache("dom.min_timeout_value",
&gMinTimeoutValue,
DEFAULT_MIN_TIMEOUT_VALUE);
nsContentUtils::AddIntPrefVarCache("dom.min_background_timeout_value",
&gMinBackgroundTimeoutValue,
DEFAULT_MIN_BACKGROUND_TIMEOUT_VALUE);
}
if (gDumpFile == nsnull) {
@ -2458,6 +2467,10 @@ nsGlobalWindow::SetDocShell(nsIDocShell* aDocShell)
}
else NS_NewWindowRoot(this, getter_AddRefs(mChromeEventHandler));
}
PRBool docShellActive;
mDocShell->GetIsActive(&docShellActive);
mIsBackground = !docShellActive;
}
}
@ -8731,18 +8744,14 @@ nsGlobalWindow::SetTimeoutOrInterval(nsIScriptTimeoutHandler *aHandler,
}
PRUint32 nestingLevel = sNestingLevel + 1;
if (interval < DOMMinTimeoutValue()) {
if (aIsInterval || nestingLevel >= DOM_CLAMP_TIMEOUT_NESTING_LEVEL) {
// Don't allow timeouts less than DOMMinTimeoutValue() from
// now...
interval = DOMMinTimeoutValue();;
}
else if (interval < 0) {
// Clamp negative intervals to 0.
interval = 0;
}
if (aIsInterval || nestingLevel >= DOM_CLAMP_TIMEOUT_NESTING_LEVEL) {
// Don't allow timeouts less than DOMMinTimeoutValue() from
// now...
interval = NS_MAX(interval, DOMMinTimeoutValue());
}
else if (interval < 0) {
// Clamp negative intervals to 0.
interval = 0;
}
NS_ASSERTION(interval >= 0, "DOMMinTimeoutValue() lies");

View File

@ -822,6 +822,8 @@ protected:
PRBool GetIsTabModalPromptAllowed();
inline PRInt32 DOMMinTimeoutValue() const;
// When adding new member variables, be careful not to create cycles
// through JavaScript. If there is any chance that a member variable
// could own objects that are implemented in JavaScript, then those

View File

@ -102,6 +102,16 @@ public:
return mIsActive;
}
void SetIsBackground(PRBool aIsBackground)
{
mIsBackground = aIsBackground;
}
PRBool IsBackground()
{
return mIsBackground;
}
nsPIDOMEventTarget* GetChromeEventHandler() const
{
return mChromeEventHandler;
@ -608,8 +618,14 @@ protected:
PRPackedBool mIsModalContentWindow;
// Tracks activation state that's used for :-moz-window-inactive.
// Only used on outer windows.
PRPackedBool mIsActive;
// Tracks whether our docshell is active. If it is, mIsBackground
// is false. Too bad we have so many different concepts of
// "active". Only used on outer windows.
PRPackedBool mIsBackground;
// And these are the references between inner and outer windows.
nsPIDOMWindow *mInnerWindow;
nsCOMPtr<nsPIDOMWindow> mOuterWindow;

View File

@ -269,8 +269,7 @@ nsDOMWorkerScriptLoader::ExecuteScripts(JSContext* aCx)
uint32 oldOpts =
JS_SetOptions(aCx, JS_GetOptions(aCx) | JSOPTION_DONT_REPORT_UNCAUGHT);
jsval val;
PRBool success = JS_ExecuteScript(aCx, global, script, &val);
PRBool success = JS_ExecuteScript(aCx, global, script, NULL);
JS_SetOptions(aCx, oldOpts);
@ -823,7 +822,8 @@ nsDOMWorkerScriptLoader::ScriptCompiler::Run()
// Because we may have nested calls to this function we don't want the
// execution to automatically report errors. We let them propagate instead.
uint32 oldOpts =
JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_DONT_REPORT_UNCAUGHT);
JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_DONT_REPORT_UNCAUGHT |
JSOPTION_NO_SCRIPT_RVAL);
JSPrincipals* principal = nsDOMWorkerSecurityManager::WorkerPrincipal();

View File

@ -200,11 +200,10 @@ nsDOMWorkerTimeout::ExpressionCallback::Run(nsDOMWorkerTimeout* aTimeout,
const jschar* string = JS_GetStringCharsAndLength(aCx, expression, &stringLength);
NS_ENSURE_TRUE(string, NS_ERROR_FAILURE);
jsval rval;
PRBool success = JS_EvaluateUCScriptForPrincipals(aCx, global, principal,
string, stringLength,
mFileName.get(),
mLineNumber, &rval);
mLineNumber, nsnull);
if (!success) {
return NS_ERROR_FAILURE;
}

View File

@ -191,7 +191,6 @@ nsresult EvaluateAdminConfigScript(const char *js_buffer, size_t length,
PRBool bCallbacks, PRBool skipFirstLine)
{
JSBool ok;
jsval result;
if (skipFirstLine) {
/* In order to protect the privacy of the JavaScript preferences file
@ -226,7 +225,7 @@ nsresult EvaluateAdminConfigScript(const char *js_buffer, size_t length,
JS_BeginRequest(autoconfig_cx);
ok = JS_EvaluateScript(autoconfig_cx, autoconfig_glob,
js_buffer, length, filename, 0, &result);
js_buffer, length, filename, 0, nsnull);
JS_EndRequest(autoconfig_cx);
JS_MaybeGC(autoconfig_cx);

View File

@ -102,6 +102,9 @@ using namespace mozilla::ipc::windows;
* these in-calls are blocked.
*/
// pulled from widget's nsAppShell
extern const PRUnichar* kAppShellEventId;
namespace {
const wchar_t kOldWndProcProp[] = L"MozillaIPCOldWndProc";
@ -122,6 +125,7 @@ HHOOK gDeferredCallWndProcHook = NULL;
DWORD gUIThreadId = 0;
int gEventLoopDepth = 0;
static UINT sAppShellGeckoMsgId;
LRESULT CALLBACK
DeferredMessageHook(int nCode,
@ -299,26 +303,31 @@ ProcessOrDeferMessage(HWND hwnd,
case WM_SYNCPAINT:
return 0;
// Unknown messages only.
default: {
if (uMsg && uMsg == sAppShellGeckoMsgId) {
// Widget's registered native event callback
deferred = new DeferredSendMessage(hwnd, uMsg, wParam, lParam);
} else {
// Unknown messages only
#ifdef DEBUG
nsCAutoString log("Received \"nonqueued\" message ");
log.AppendInt(uMsg);
log.AppendLiteral(" during a synchronous IPC message for window ");
log.AppendInt((PRInt64)hwnd);
nsCAutoString log("Received \"nonqueued\" message ");
log.AppendInt(uMsg);
log.AppendLiteral(" during a synchronous IPC message for window ");
log.AppendInt((PRInt64)hwnd);
wchar_t className[256] = { 0 };
if (GetClassNameW(hwnd, className, sizeof(className) - 1) > 0) {
log.AppendLiteral(" (\"");
log.Append(NS_ConvertUTF16toUTF8((PRUnichar*)className));
log.AppendLiteral("\")");
}
wchar_t className[256] = { 0 };
if (GetClassNameW(hwnd, className, sizeof(className) - 1) > 0) {
log.AppendLiteral(" (\"");
log.Append(NS_ConvertUTF16toUTF8((PRUnichar*)className));
log.AppendLiteral("\")");
}
log.AppendLiteral(", sending it to DefWindowProc instead of the normal "
"window procedure.");
NS_ERROR(log.get());
log.AppendLiteral(", sending it to DefWindowProc instead of the normal "
"window procedure.");
NS_ERROR(log.get());
#endif
return DefWindowProc(hwnd, uMsg, wParam, lParam);
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
}
}
@ -531,6 +540,7 @@ Init()
NS_ASSERTION(gUIThreadId, "ThreadId should not be 0!");
NS_ASSERTION(gUIThreadId == GetCurrentThreadId(),
"Running on different threads!");
sAppShellGeckoMsgId = RegisterWindowMessageW(kAppShellEventId);
}
// This timeout stuff assumes a sane value of mTimeoutMs (less than the overflow

View File

@ -63,6 +63,29 @@ from __future__ import with_statement
import sys, os
import expandlibs_config as conf
def relativize(path):
'''Returns a path relative to the current working directory, if it is
shorter than the given path'''
def splitpath(path):
dir, file = os.path.split(path)
if os.path.splitdrive(dir)[1] == os.sep:
return [file]
return splitpath(dir) + [file]
if not os.path.exists(path):
return path
curdir = splitpath(os.path.abspath(os.curdir))
abspath = splitpath(os.path.abspath(path))
while curdir and abspath and curdir[0] == abspath[0]:
del curdir[0]
del abspath[0]
if not curdir and not abspath:
return '.'
relpath = os.path.join(*[os.pardir for i in curdir] + abspath)
if len(path) > len(relpath):
return relpath
return path
class LibDescriptor(dict):
KEYS = ['OBJS', 'LIBS']
@ -99,15 +122,15 @@ class ExpandArgs(list):
'''Internal function doing the actual work'''
(root, ext) = os.path.splitext(arg)
if ext != conf.LIB_SUFFIX or not os.path.basename(root).startswith(conf.LIB_PREFIX):
return [arg]
return [relativize(arg)]
if len(conf.IMPORT_LIB_SUFFIX):
dll = root + conf.IMPORT_LIB_SUFFIX
else:
dll = root.replace(conf.LIB_PREFIX, conf.DLL_PREFIX, 1) + conf.DLL_SUFFIX
if os.path.exists(dll):
return [dll]
return [relativize(dll)]
if os.path.exists(arg):
return [arg]
return [relativize(arg)]
return self._expand_desc(arg)
def _expand_desc(self, arg):
@ -115,7 +138,7 @@ class ExpandArgs(list):
if os.path.exists(arg + conf.LIBS_DESC_SUFFIX):
with open(arg + conf.LIBS_DESC_SUFFIX, 'r') as f:
desc = LibDescriptor(f.readlines())
objs = desc['OBJS']
objs = [relativize(o) for o in desc['OBJS']]
for lib in desc['LIBS']:
objs += self._expand(lib)
return objs

View File

@ -52,7 +52,7 @@ See https://bugzilla.mozilla.org/show_bug.cgi?id=584474#c59 for more details.
from __future__ import with_statement
import sys
import os
from expandlibs import ExpandArgs
from expandlibs import ExpandArgs, relativize
import expandlibs_config as conf
from optparse import OptionParser
import subprocess
@ -93,7 +93,7 @@ class ExpandArgsMore(ExpandArgs):
subprocess.call(ar_extract + [os.path.abspath(arg)], cwd=tmp)
objs = []
for root, dirs, files in os.walk(tmp):
objs += [os.path.join(root, f) for f in files if os.path.splitext(f)[1] == conf.OBJ_SUFFIX]
objs += [relativize(os.path.join(root, f)) for f in files if os.path.splitext(f)[1] == conf.OBJ_SUFFIX]
newlist += objs
else:
newlist += [arg]

View File

@ -296,6 +296,8 @@ InitExnPrivate(JSContext *cx, JSObject *exnObject, JSString *message,
stackDepth = 0;
valueCount = 0;
for (fp = js_GetTopStackFrame(cx); fp; fp = fp->prev()) {
if (fp->scopeChain().compartment() != cx->compartment)
break;
if (fp->isFunctionFrame() && !fp->isEvalFrame()) {
Value v = NullValue();
if (checkAccess &&
@ -337,6 +339,8 @@ InitExnPrivate(JSContext *cx, JSObject *exnObject, JSString *message,
values = GetStackTraceValueBuffer(priv);
elem = priv->stackElems;
for (fp = js_GetTopStackFrame(cx); fp != fpstop; fp = fp->prev()) {
if (fp->scopeChain().compartment() != cx->compartment)
break;
if (!fp->isFunctionFrame() || fp->isEvalFrame()) {
elem->funName = NULL;
elem->argc = 0;

View File

@ -1071,11 +1071,9 @@ mozJSComponentLoader::GlobalForLocation(nsILocalFile *aComponentFile,
// If |exception| is non-null, then our caller wants us to propagate
// any exceptions out to our caller. Ensure that the engine doesn't
// eagerly report the exception.
uint32 oldopts = 0;
if (exception) {
oldopts = JS_GetOptions(cx);
JS_SetOptions(cx, oldopts | JSOPTION_DONT_REPORT_UNCAUGHT);
}
uint32 oldopts = JS_GetOptions(cx);
JS_SetOptions(cx, oldopts | JSOPTION_NO_SCRIPT_RVAL |
(exception ? JSOPTION_DONT_REPORT_UNCAUGHT : 0));
if (realFile) {
#ifdef HAVE_PR_MEMMAP
@ -1189,12 +1187,10 @@ mozJSComponentLoader::GlobalForLocation(nsILocalFile *aComponentFile,
// exception on this context.
// NB: The caller must stick exception into a rooted slot (probably on
// its context) as soon as possible to avoid GC hazards.
if (exception) {
JS_SetOptions(cx, oldopts);
if (!script) {
JS_GetPendingException(cx, exception);
JS_ClearPendingException(cx);
}
JS_SetOptions(cx, oldopts);
if (!script && exception) {
JS_GetPendingException(cx, exception);
JS_ClearPendingException(cx);
}
}
@ -1241,8 +1237,7 @@ mozJSComponentLoader::GlobalForLocation(nsILocalFile *aComponentFile,
// See bug 384168.
*aGlobal = global;
jsval retval;
if (!JS_ExecuteScriptVersion(cx, global, script, &retval, JSVERSION_LATEST)) {
if (!JS_ExecuteScriptVersion(cx, global, script, NULL, JSVERSION_LATEST)) {
#ifdef DEBUG_shaver_off
fprintf(stderr, "mJCL: failed to execute %s\n", nativePath.get());
#endif

View File

@ -47,6 +47,7 @@
#include "nsIRenderingContext.h"
#include "nsIServiceManager.h"
#include "nsFrameManager.h"
#include "nsBidiFrames.h"
#include "nsBidiUtils.h"
#include "nsCSSFrameConstructor.h"
#include "nsHTMLContainerFrame.h"
@ -56,10 +57,6 @@
#include "nsFirstLetterFrame.h"
#include "gfxUnicodeProperties.h"
#include "nsIThebesFontMetrics.h"
#include "nsTextFrame.h"
#undef NOISY_BIDI
#undef REALLY_NOISY_BIDI
using namespace mozilla;
@ -71,8 +68,13 @@ static const PRUnichar kRLE = 0x202B;
static const PRUnichar kLRO = 0x202D;
static const PRUnichar kRLO = 0x202E;
static const PRUnichar kPDF = 0x202C;
static const PRUnichar ALEF = 0x05D0;
#define NS_BIDI_CONTROL_FRAME ((nsIFrame*)0xfffb1d1)
#define CHAR_IS_HEBREW(c) ((0x0590 <= (c)) && ((c)<= 0x05FF))
// Note: The above code are moved from gfx/src/windows/nsRenderingContextWin.cpp
nsIFrame*
NS_NewDirectionalFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUnichar aChar);
nsBidiPresUtils::nsBidiPresUtils() : mArraySize(8),
mIndexMap(nsnull),
@ -162,31 +164,22 @@ SplitInlineAncestors(nsIFrame* aFrame)
return NS_OK;
}
static void
MakeContinuationFluid(nsIFrame* aFrame, nsIFrame* aNext)
{
NS_ASSERTION (!aFrame->GetNextInFlow() || aFrame->GetNextInFlow() == aNext,
"next-in-flow is not next continuation!");
aFrame->SetNextInFlow(aNext);
NS_ASSERTION (!aNext->GetPrevInFlow() || aNext->GetPrevInFlow() == aFrame,
"prev-in-flow is not prev continuation!");
aNext->SetPrevInFlow(aFrame);
}
// If aFrame is the last child of its parent, convert bidi continuations to
// fluid continuations for all of its inline ancestors.
// Convert bidi continuations to fluid continuations for a frame and all of its
// inline ancestors.
static void
JoinInlineAncestors(nsIFrame* aFrame)
{
if (aFrame->GetNextSibling()) {
return;
}
nsIFrame* frame = aFrame->GetParent();
nsIFrame* frame = aFrame;
while (frame && IsBidiSplittable(frame)) {
nsIFrame* next = frame->GetNextContinuation();
if (next) {
MakeContinuationFluid(frame, next);
NS_ASSERTION (!frame->GetNextInFlow() || frame->GetNextInFlow() == next,
"next-in-flow is not next continuation!");
frame->SetNextInFlow(next);
NS_ASSERTION (!next->GetPrevInFlow() || next->GetPrevInFlow() == frame,
"prev-in-flow is not prev continuation!");
next->SetPrevInFlow(frame);
}
// Join the parent only as long as we're its last child.
if (frame->GetNextSibling())
@ -196,9 +189,8 @@ JoinInlineAncestors(nsIFrame* aFrame)
}
static nsresult
CreateContinuation(nsIFrame* aFrame,
nsIFrame** aNewFrame,
PRBool aIsFluid)
CreateBidiContinuation(nsIFrame* aFrame,
nsIFrame** aNewFrame)
{
NS_PRECONDITION(aNewFrame, "null OUT ptr");
NS_PRECONDITION(aFrame, "null ptr");
@ -207,10 +199,10 @@ CreateContinuation(nsIFrame* aFrame,
nsPresContext *presContext = aFrame->PresContext();
nsIPresShell *presShell = presContext->PresShell();
NS_ASSERTION(presShell, "PresShell must be set on PresContext before calling nsBidiPresUtils::CreateContinuation");
NS_ASSERTION(presShell, "PresShell must be set on PresContext before calling nsBidiPresUtils::CreateBidiContinuation");
nsIFrame* parent = aFrame->GetParent();
NS_ASSERTION(parent, "Couldn't get frame parent in nsBidiPresUtils::CreateContinuation");
NS_ASSERTION(parent, "Couldn't get frame parent in nsBidiPresUtils::CreateBidiContinuation");
nsresult rv = NS_OK;
@ -221,12 +213,12 @@ CreateContinuation(nsIFrame* aFrame,
parent->GetStyleDisplay()->IsFloating()) {
nsFirstLetterFrame* letterFrame = do_QueryFrame(parent);
rv = letterFrame->CreateContinuationForFloatingParent(presContext, aFrame,
aNewFrame, aIsFluid);
aNewFrame, PR_FALSE);
return rv;
}
rv = presShell->FrameConstructor()->
CreateContinuingFrame(presContext, aFrame, parent, aNewFrame, aIsFluid);
CreateContinuingFrame(presContext, aFrame, parent, aNewFrame, PR_FALSE);
if (NS_FAILED(rv)) {
return rv;
}
@ -239,12 +231,10 @@ CreateContinuation(nsIFrame* aFrame,
return rv;
}
if (!aIsFluid) {
// Split inline ancestor frames
rv = SplitInlineAncestors(aFrame);
if (NS_FAILED(rv)) {
return rv;
}
// Split inline ancestor frames
rv = SplitInlineAncestors(aFrame);
if (NS_FAILED(rv)) {
return rv;
}
return NS_OK;
@ -295,7 +285,7 @@ AdvanceLineIteratorToFrame(nsIFrame* aFrame,
*
* Walk through the descendants of aBlockFrame and build:
* * mLogicalFrames: an nsTArray of nsIFrame* pointers in logical order
* * mBuffer: an nsString containing a representation of
* * mBuffer: an nsAutoString containing a representation of
* the content of the frames.
* In the case of text frames, this is the actual text context of the
* frames, but some other elements are represented in a symbolic form which
@ -325,26 +315,93 @@ nsBidiPresUtils::Resolve(nsBlockFrame* aBlockFrame)
{
mLogicalFrames.Clear();
mContentToFrameIndex.Clear();
mBuffer.SetLength(0);
mEmbeddingStack.Clear();
nsPresContext *presContext = aBlockFrame->PresContext();
nsIPresShell* shell = presContext->PresShell();
nsStyleContext* styleContext = aBlockFrame->GetStyleContext();
// handle bidi-override being set on the block itself before calling
// InitLogicalArray.
const nsStyleVisibility* vis = aBlockFrame->GetStyleVisibility();
const nsStyleTextReset* text = aBlockFrame->GetStyleTextReset();
mParaLevel = (NS_STYLE_DIRECTION_RTL == vis->mDirection) ?
NSBIDI_RTL : NSBIDI_LTR;
if (text->mUnicodeBidi == NS_STYLE_UNICODE_BIDI_OVERRIDE) {
nsIFrame *directionalFrame = nsnull;
mLineIter = new nsBlockInFlowLineIterator(aBlockFrame,
aBlockFrame->begin_lines(),
PR_FALSE);
if (mLineIter->GetLine() == aBlockFrame->end_lines()) {
// Advance to first valid line (might be in a next-continuation)
mLineIter->Next();
if (NS_STYLE_DIRECTION_RTL == vis->mDirection) {
directionalFrame = NS_NewDirectionalFrame(shell, styleContext, kRLO);
}
else if (NS_STYLE_DIRECTION_LTR == vis->mDirection) {
directionalFrame = NS_NewDirectionalFrame(shell, styleContext, kLRO);
}
if (directionalFrame) {
mLogicalFrames.AppendElement(directionalFrame);
}
}
for (nsBlockFrame* block = aBlockFrame; block;
block = static_cast<nsBlockFrame*>(block->GetNextContinuation())) {
block->RemoveStateBits(NS_BLOCK_NEEDS_BIDI_RESOLUTION);
InitLogicalArray(block->GetFirstChild(nsnull));
}
mIsVisual = presContext->IsVisualMode();
if (mIsVisual) {
if (text->mUnicodeBidi == NS_STYLE_UNICODE_BIDI_OVERRIDE) {
nsIFrame* directionalFrame = NS_NewDirectionalFrame(shell, styleContext, kPDF);
if (directionalFrame) {
mLogicalFrames.AppendElement(directionalFrame);
}
}
CreateBlockBuffer();
PRInt32 bufferLength = mBuffer.Length();
if (bufferLength < 1) {
mSuccess = NS_OK;
return mSuccess;
}
PRInt32 runCount;
PRUint8 embeddingLevel;
nsBidiLevel paraLevel = embeddingLevel =
(NS_STYLE_DIRECTION_RTL == vis->mDirection)
? NSBIDI_RTL : NSBIDI_LTR;
mSuccess = mBidiEngine->SetPara(mBuffer.get(), bufferLength, paraLevel, nsnull);
if (NS_FAILED(mSuccess) ) {
return mSuccess;
}
mSuccess = mBidiEngine->CountRuns(&runCount);
if (NS_FAILED(mSuccess) ) {
return mSuccess;
}
PRInt32 runLength = 0; // the length of the current run of text
PRInt32 lineOffset = 0; // the start of the current run
PRInt32 logicalLimit = 0; // the end of the current run + 1
PRInt32 numRun = -1;
PRInt32 fragmentLength = 0; // the length of the current text frame
PRInt32 frameIndex = -1; // index to the frames in mLogicalFrames
PRInt32 frameCount = mLogicalFrames.Length();
PRInt32 contentOffset = 0; // offset of current frame in its content node
PRBool isTextFrame = PR_FALSE;
nsIFrame* frame = nsnull;
nsIContent* content = nsnull;
PRInt32 contentTextLength;
nsIAtom* frameType = nsnull;
FramePropertyTable *propTable = presContext->PropertyTable();
nsBlockInFlowLineIterator lineIter(aBlockFrame, aBlockFrame->begin_lines(), PR_FALSE);
if (lineIter.GetLine() == aBlockFrame->end_lines()) {
// Advance to first valid line (might be in a next-continuation)
lineIter.Next();
}
nsIFrame* prevFrame = nsnull;
PRBool lineNeedsUpdate = PR_FALSE;
PRBool isVisual = presContext->IsVisualMode();
if (isVisual) {
/**
* Drill up in content to detect whether this is an element that needs to be
* rendered with logical order even on visual pages.
@ -359,134 +416,14 @@ nsBidiPresUtils::Resolve(nsBlockFrame* aBlockFrame)
* element appears in a visual page, it will be generated by an XBL binding
* and contain localized text which will be in logical order.
*/
for (nsIContent* content = aBlockFrame->GetContent() ; content;
content = content->GetParent()) {
if (content->IsNodeOfType(nsINode::eHTML_FORM_CONTROL) ||
content->IsXUL()) {
mIsVisual = PR_FALSE;
for (content = aBlockFrame->GetContent() ; content; content = content->GetParent()) {
if (content->IsNodeOfType(nsINode::eHTML_FORM_CONTROL) || content->IsXUL()) {
isVisual = PR_FALSE;
break;
}
}
}
mPrevFrame = nsnull;
// handle bidi-override being set on the block itself before calling
// TraverseFrames.
const nsStyleTextReset* text = aBlockFrame->GetStyleTextReset();
PRUnichar ch = 0;
if (text->mUnicodeBidi == NS_STYLE_UNICODE_BIDI_OVERRIDE) {
if (NS_STYLE_DIRECTION_RTL == vis->mDirection) {
ch = kRLO;
}
else if (NS_STYLE_DIRECTION_LTR == vis->mDirection) {
ch = kLRO;
}
if (ch != 0) {
mLogicalFrames.AppendElement(NS_BIDI_CONTROL_FRAME);
mBuffer.Append(ch);
mEmbeddingStack.AppendElement(ch);
}
}
mPrevContent = nsnull;
for (nsBlockFrame* block = aBlockFrame; block;
block = static_cast<nsBlockFrame*>(block->GetNextContinuation())) {
block->RemoveStateBits(NS_BLOCK_NEEDS_BIDI_RESOLUTION);
TraverseFrames(aBlockFrame, block->GetFirstChild(nsnull));
}
if (ch != 0) {
mLogicalFrames.AppendElement(NS_BIDI_CONTROL_FRAME);
mBuffer.Append(kPDF);
NS_ASSERTION(mEmbeddingStack.Length(), "embedding/override underflow");
mEmbeddingStack.TruncateLength(mEmbeddingStack.Length() - 1);
}
// Resolve final paragraph
ResolveParagraph(aBlockFrame);
return mSuccess;
}
void
nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame)
{
nsPresContext *presContext = aBlockFrame->PresContext();
PRInt32 bufferLength = mBuffer.Length();
if (bufferLength < 1) {
mSuccess = NS_OK;
return;
}
mBuffer.ReplaceChar("\t\r\n", kSpace);
PRInt32 runCount;
PRUint8 embeddingLevel = mParaLevel;
mSuccess = mBidiEngine->SetPara(mBuffer.get(), bufferLength, mParaLevel, nsnull);
if (NS_FAILED(mSuccess) ) {
return;
}
mSuccess = mBidiEngine->CountRuns(&runCount);
if (NS_FAILED(mSuccess) ) {
return;
}
PRInt32 runLength = 0; // the length of the current run of text
PRInt32 lineOffset = 0; // the start of the current run
PRInt32 logicalLimit = 0; // the end of the current run + 1
PRInt32 numRun = -1;
PRInt32 fragmentLength = 0; // the length of the current text frame
PRInt32 frameIndex = -1; // index to the frames in mLogicalFrames
PRInt32 frameCount = mLogicalFrames.Length();
PRInt32 contentOffset = 0; // offset of current frame in its content node
PRBool isTextFrame = PR_FALSE;
nsIFrame* frame = nsnull;
nsIContent* content = nsnull;
PRInt32 contentTextLength;
FramePropertyTable *propTable = presContext->PropertyTable();
if (frameCount == 1 && runCount == 1) {
// Nothing more to do, just make sure that the frame has the right
// embedding level.
if (mIsVisual ||
NS_FAILED(mBidiEngine->GetLogicalRun(lineOffset, &logicalLimit,
&embeddingLevel))) {
embeddingLevel = mParaLevel;
}
frame = mLogicalFrames[0];
nsBidiLevel oldEmbeddingLevel = NS_GET_EMBEDDING_LEVEL(frame);
nsBidiLevel oldBaseLevel = NS_GET_BASE_LEVEL(frame);
if (oldEmbeddingLevel != embeddingLevel ||
oldBaseLevel != mParaLevel) {
frame->Properties().Set(nsIFrame::EmbeddingLevelProperty(),
NS_INT32_TO_PTR(embeddingLevel));
frame->Properties().Set(nsIFrame::BaseLevelProperty(),
NS_INT32_TO_PTR(mParaLevel));
AdvanceLineIteratorToFrame(frame, mLineIter, mPrevFrame);
mLineIter->GetLine()->MarkDirty();
if (frame->GetType() == nsGkAtoms::textFrame) {
frame->AddStateBits(NS_FRAME_IS_BIDI);
}
}
mSuccess = NS_OK;
return;
}
PRBool lineNeedsUpdate = PR_FALSE;
#ifdef NOISY_BIDI
if (mBuffer[0] != kObjectSubstitute) {
printf("Before Resolve(), aBlockFrame=0x%p, mBuffer='%s', frameCount=%d\n",
(void*)aBlockFrame, NS_ConvertUTF16toUTF8(mBuffer).get(), frameCount);
#ifdef REALLY_NOISY_BIDI
printf(" frameTree=:\n");
nsFrame::DumpFrameTree(aBlockFrame);
#endif
}
#endif
for (; ;) {
if (fragmentLength <= 0) {
// Get the next frame from mLogicalFrames
@ -494,17 +431,9 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame)
break;
}
frame = mLogicalFrames[frameIndex];
frameType = frame->GetType();
lineNeedsUpdate = PR_TRUE;
if (frame == NS_BIDI_CONTROL_FRAME ||
nsGkAtoms::textFrame != frame->GetType()) {
/*
* Any non-text frame corresponds to a single character in the text buffer
* (a bidi control character, LINE SEPARATOR, or OBJECT SUBSTITUTE)
*/
isTextFrame = PR_FALSE;
fragmentLength = 1;
}
else {
if (nsGkAtoms::textFrame == frameType) {
content = frame->GetContent();
if (!content) {
mSuccess = NS_OK;
@ -518,7 +447,7 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame)
propTable->Set(frame, nsIFrame::EmbeddingLevelProperty(),
NS_INT32_TO_PTR(embeddingLevel));
propTable->Set(frame, nsIFrame::BaseLevelProperty(),
NS_INT32_TO_PTR(mParaLevel));
NS_INT32_TO_PTR(paraLevel));
continue;
}
PRInt32 start, end;
@ -529,6 +458,14 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame)
contentOffset = start;
isTextFrame = PR_TRUE;
}
else {
/*
* Any non-text frame corresponds to a single character in the text buffer
* (a bidi control character, LINE SEPARATOR, or OBJECT SUBSTITUTE)
*/
isTextFrame = PR_FALSE;
fragmentLength = 1;
}
} // if (fragmentLength <= 0)
if (runLength <= 0) {
@ -542,12 +479,13 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame)
break;
}
runLength = logicalLimit - lineOffset;
if (mIsVisual) {
embeddingLevel = mParaLevel;
if (isVisual) {
embeddingLevel = paraLevel;
}
} // if (runLength <= 0)
if (frame == NS_BIDI_CONTROL_FRAME) {
if (nsGkAtoms::directionalFrame == frameType) {
frame->Destroy();
frame = nsnull;
++lineOffset;
}
@ -555,7 +493,7 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame)
propTable->Set(frame, nsIFrame::EmbeddingLevelProperty(),
NS_INT32_TO_PTR(embeddingLevel));
propTable->Set(frame, nsIFrame::BaseLevelProperty(),
NS_INT32_TO_PTR(mParaLevel));
NS_INT32_TO_PTR(paraLevel));
if (isTextFrame) {
if ( (runLength > 0) && (runLength < fragmentLength) ) {
/*
@ -563,10 +501,10 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame)
* Create a non-fluid continuation frame for the next directional run.
*/
if (lineNeedsUpdate) {
AdvanceLineIteratorToFrame(frame, mLineIter, mPrevFrame);
AdvanceLineIteratorToFrame(frame, &lineIter, prevFrame);
lineNeedsUpdate = PR_FALSE;
}
mLineIter->GetLine()->MarkDirty();
lineIter.GetLine()->MarkDirty();
nsIFrame* nextBidi;
PRInt32 runEnd = contentOffset + runLength;
EnsureBidiContinuation(frame, &nextBidi, frameIndex,
@ -602,17 +540,12 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame)
*/
PRInt32 newIndex = frameIndex;
do {
} while (++newIndex < frameCount &&
mLogicalFrames[newIndex] == NS_BIDI_CONTROL_FRAME);
if (newIndex < frameCount) {
RemoveBidiContinuation(frame, frameIndex, newIndex, lineOffset);
}
} else if (runLength == fragmentLength &&
numRun + 1 < runCount) {
} while (mLogicalFrames[++newIndex]->GetType() == nsGkAtoms::directionalFrame);
RemoveBidiContinuation(frame, frameIndex, newIndex, lineOffset);
} else if (runLength == fragmentLength) {
/*
* If the directional run ends at the end of the frame, and this is
* not the end of our paragraph, make sure that the next frame is a
* non-fluid continuation
* The directional run ends at the end of the frame. Make sure that
* the next frame is a non-fluid continuation
*/
nsIFrame* next = frame->GetNextInFlow();
if (next) {
@ -622,28 +555,28 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame)
}
frame->AdjustOffsetsForBidi(contentOffset, contentOffset + fragmentLength);
if (lineNeedsUpdate) {
AdvanceLineIteratorToFrame(frame, mLineIter, mPrevFrame);
AdvanceLineIteratorToFrame(frame, &lineIter, prevFrame);
lineNeedsUpdate = PR_FALSE;
}
mLineIter->GetLine()->MarkDirty();
lineIter.GetLine()->MarkDirty();
}
} // isTextFrame
else {
++lineOffset;
}
} // not bidi control frame
} // not directionalFrame
PRInt32 temp = runLength;
runLength -= fragmentLength;
fragmentLength -= temp;
if (frame && fragmentLength <= 0) {
// If the frame is at the end of a run, and this is not the end of our
// paragrah, split all ancestor inlines that need splitting.
// If the frame is at the end of a run, split all ancestor inlines that
// need splitting.
// To determine whether we're at the end of the run, we check that we've
// finished processing the current run, and that the current frame
// doesn't have a fluid continuation (it could have a fluid continuation
// of zero length, so testing runLength alone is not sufficient).
if (numRun + 1 < runCount && runLength <= 0 && !frame->GetNextInFlow()) {
if (runLength <= 0 && !frame->GetNextInFlow()) {
nsIFrame* child = frame;
nsIFrame* parent = frame->GetParent();
// As long as we're on the last sibling, the parent doesn't have to be split.
@ -665,21 +598,16 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame)
if (parent && IsBidiSplittable(parent))
SplitInlineAncestors(child);
}
else {
// We're not at an end of a run. If |frame| is the last child of its
// parent, and its ancestors happen to have bidi continuations, convert
// them into fluid continuations.
JoinInlineAncestors(frame);
else if (!frame->GetNextSibling()) {
// We're not at an end of a run, and |frame| is the last child of its parent.
// If its ancestors happen to have bidi continuations, convert them into
// fluid continuations.
nsIFrame* parent = frame->GetParent();
JoinInlineAncestors(parent);
}
}
} // for
#ifdef REALLY_NOISY_BIDI
if (mBuffer[0] != kObjectSubstitute) {
printf("---\nAfter Resolve(), frameTree =:\n");
nsFrame::DumpFrameTree(aBlockFrame);
printf("===\n");
}
#endif
return mSuccess;
}
// Should this frame be treated as a leaf (e.g. when building mLogicalFrames)?
@ -690,24 +618,16 @@ PRBool IsBidiLeaf(nsIFrame* aFrame) {
}
void
nsBidiPresUtils::TraverseFrames(nsBlockFrame* aBlockFrame,
nsIFrame* aCurrentFrame)
nsBidiPresUtils::InitLogicalArray(nsIFrame* aCurrentFrame)
{
if (!aCurrentFrame)
return;
nsIFrame* childFrame = aCurrentFrame;
do {
/*
* It's important to get the next sibling and next continuation *before*
* handling the frame: If we encounter a forced paragraph break and call
* ResolveParagraph within this loop, doing GetNextSibling and
* GetNextContinuation after that could return a bidi continuation that had
* just been split from the original childFrame and we would process it
* twice.
*/
nsIFrame* nextSibling = childFrame->GetNextSibling();
PRBool isLastFrame = !childFrame->GetNextContinuation();
nsIPresShell* shell = aCurrentFrame->PresContext()->PresShell();
nsStyleContext* styleContext;
for (nsIFrame* childFrame = aCurrentFrame; childFrame;
childFrame = childFrame->GetNextSibling()) {
// If the real frame for a placeholder is a first letter frame, we need to
// drill down into it and include its contents in Bidi resolution.
@ -729,6 +649,8 @@ nsBidiPresUtils::TraverseFrames(nsBlockFrame* aBlockFrame,
case NS_STYLE_UNICODE_BIDI_NORMAL:
break;
case NS_STYLE_UNICODE_BIDI_EMBED:
styleContext = frame->GetStyleContext();
if (NS_STYLE_DIRECTION_RTL == vis->mDirection) {
ch = kRLE;
}
@ -737,6 +659,8 @@ nsBidiPresUtils::TraverseFrames(nsBlockFrame* aBlockFrame,
}
break;
case NS_STYLE_UNICODE_BIDI_OVERRIDE:
styleContext = frame->GetStyleContext();
if (NS_STYLE_DIRECTION_RTL == vis->mDirection) {
ch = kRLO;
}
@ -746,12 +670,13 @@ nsBidiPresUtils::TraverseFrames(nsBlockFrame* aBlockFrame,
break;
}
// Add a dummy frame pointer representing a bidi control code before the
// first frame of an element specifying embedding or override
// Create a directional frame before the first frame of an
// element specifying embedding or override
if (ch != 0 && !frame->GetPrevContinuation()) {
mLogicalFrames.AppendElement(NS_BIDI_CONTROL_FRAME);
mBuffer.Append(ch);
mEmbeddingStack.AppendElement(ch);
nsIFrame* dirFrame = NS_NewDirectionalFrame(shell, styleContext, ch);
if (dirFrame) {
mLogicalFrames.AppendElement(dirFrame);
}
}
}
@ -766,165 +691,66 @@ nsBidiPresUtils::TraverseFrames(nsBlockFrame* aBlockFrame,
mContentToFrameIndex.Put(content, mLogicalFrames.Length());
}
mLogicalFrames.AppendElement(frame);
// Append the content of the frame to the paragraph buffer
nsIAtom* frameType = frame->GetType();
if (nsGkAtoms::textFrame == frameType) {
if (content != mPrevContent) {
mPrevContent = content;
if (!frame->GetStyleContext()->GetStyleText()->NewlineIsSignificant()) {
content->AppendTextTo(mBuffer);
} else {
/*
* For preformatted text we have to do bidi resolution on each line
* separately.
*/
nsAutoString text;
content->AppendTextTo(text);
nsIFrame* next;
do {
next = nsnull;
PRInt32 start, end;
frame->GetOffsets(start, end);
PRInt32 endLine = text.FindCharInSet(NS_LITERAL_STRING("\n\r"),
start);
if (endLine == -1) {
/*
* If there is no newline in the frame, just save the text and
* do bidi resolution later
*/
mBuffer.Append(Substring(text, start));
break;
}
/*
* If there is a newline in the frame, break the frame after the
* newline, do bidi resolution and repeat until the end of the
* element.
*/
++endLine;
/*
* If the frame ends before the new line, save the text and move
* into the next continuation
*/
while (end < endLine) {
mBuffer.Append(Substring(text, start, end - start));
frame = frame->GetNextContinuation();
NS_ASSERTION(frame, "Premature end of continuation chain");
frame->GetOffsets(start, end);
mLogicalFrames.AppendElement(frame);
/*
* If we have already overshot the saved next-sibling while
* scanning the frame's continuations, advance it.
*/
if (frame == nextSibling) {
nextSibling = frame->GetNextSibling();
}
}
mBuffer.Append(Substring(text, start, endLine - start));
if (PRUint32(endLine) < text.Length()) {
nsTextFrame* textFrame = static_cast<nsTextFrame*>(frame);
textFrame->SetLength(endLine - start, nsnull);
next = frame->GetNextInFlow();
if (!next) {
// If the frame already has a bidi continuation, make it fluid
next = frame->GetNextContinuation();
if (next) {
MakeContinuationFluid(frame, next);
JoinInlineAncestors(frame);
} else {
// If the frame has no next in flow, create one
CreateContinuation(frame, &next, PR_TRUE);
}
}
}
ResolveParagraphWithinBlock(aBlockFrame);
if (next) {
frame = next;
mLogicalFrames.AppendElement(frame);
}
/*
* If we have already overshot the saved next-sibling while
* scanning the frame's continuations, advance it.
*/
if (frame && frame == nextSibling) {
nextSibling = frame->GetNextSibling();
}
} while (next);
}
}
} else if (nsGkAtoms::brFrame == frameType) {
// break frame -- append line separator
mBuffer.Append(kLineSeparator);
ResolveParagraphWithinBlock(aBlockFrame);
} else {
// other frame type -- see the Unicode Bidi Algorithm:
// "...inline objects (such as graphics) are treated as if they are ...
// U+FFFC"
mBuffer.Append(kObjectSubstitute);
if (!frame->GetStyleContext()->GetStyleDisplay()->IsInlineOutside()) {
// if it is not inline, end the paragraph
ResolveParagraphWithinBlock(aBlockFrame);
}
}
}
else {
// For a non-leaf frame, recurse into TraverseFrames
nsIFrame* kid = frame->GetFirstChild(nsnull);
TraverseFrames(aBlockFrame, kid);
InitLogicalArray(kid);
}
// If the element is attributed by dir, indicate direction pop (add PDF frame)
if (ch != 0 && isLastFrame) {
// Add a dummy frame pointer representing a bidi control code after the
// last frame of an element specifying embedding or override
mLogicalFrames.AppendElement(NS_BIDI_CONTROL_FRAME);
mBuffer.Append(kPDF);
NS_ASSERTION(mEmbeddingStack.Length(), "embedding/override underflow");
mEmbeddingStack.TruncateLength(mEmbeddingStack.Length() - 1);
if (ch != 0 && !frame->GetNextContinuation()) {
// Create a directional frame after the last frame of an
// element specifying embedding or override
nsIFrame* dirFrame = NS_NewDirectionalFrame(shell, styleContext, kPDF);
if (dirFrame) {
mLogicalFrames.AppendElement(dirFrame);
}
}
childFrame = nextSibling;
} while (childFrame);
} // for
}
void
nsBidiPresUtils::ResolveParagraphWithinBlock(nsBlockFrame* aBlockFrame)
nsBidiPresUtils::CreateBlockBuffer()
{
nsIPresShell* shell;
nsStyleContext* styleContext;
mBuffer.SetLength(0);
if (mEmbeddingStack.Length() > 0) {
shell = aBlockFrame->PresContext()->PresShell();
styleContext = aBlockFrame->GetStyleContext();
nsIFrame* frame;
nsIContent* prevContent = nsnull;
PRUint32 i;
PRUint32 count = mLogicalFrames.Length();
// pop all embeddings and overrides
for (PRUint32 i = 0; i < mEmbeddingStack.Length(); ++i) {
mBuffer.Append(kPDF);
mLogicalFrames.AppendElement(NS_BIDI_CONTROL_FRAME);
for (i = 0; i < count; i++) {
frame = mLogicalFrames[i];
nsIAtom* frameType = frame->GetType();
if (nsGkAtoms::textFrame == frameType) {
nsIContent* content = frame->GetContent();
if (!content) {
mSuccess = NS_OK;
break;
}
if (content == prevContent) {
continue;
}
prevContent = content;
content->AppendTextTo(mBuffer);
}
else if (nsGkAtoms::brFrame == frameType) { // break frame
// Append line separator
mBuffer.Append(kLineSeparator);
}
else if (nsGkAtoms::directionalFrame == frameType) {
nsDirectionalFrame* dirFrame = static_cast<nsDirectionalFrame*>(frame);
mBuffer.Append(dirFrame->GetChar());
}
else { // not text frame
// See the Unicode Bidi Algorithm:
// "...inline objects (such as graphics) are treated as if they are ... U+FFFC"
mBuffer.Append(kObjectSubstitute);
}
}
ResolveParagraph(aBlockFrame);
// Clear the frame array and paragraph buffer, and restore the stored
// embeddings and overrides
mLogicalFrames.Clear();
mContentToFrameIndex.Clear();
mBuffer.SetLength(0);
if (mEmbeddingStack.Length() > 0) {
for (PRUint32 i = 0; i < mEmbeddingStack.Length(); ++i) {
mBuffer.Append(mEmbeddingStack[i]);
mLogicalFrames.AppendElement(NS_BIDI_CONTROL_FRAME);
}
}
// XXX: TODO: Handle preformatted text ('\n')
mBuffer.ReplaceChar("\t\r\n", kSpace);
}
void
@ -1371,7 +1197,7 @@ nsBidiPresUtils::EnsureBidiContinuation(nsIFrame* aFrame,
NS_PRECONDITION(aFrame, "aFrame is null");
aFrame->AdjustOffsetsForBidi(aStart, aEnd);
mSuccess = CreateContinuation(aFrame, aNewFrame, PR_FALSE);
mSuccess = CreateBidiContinuation(aFrame, aNewFrame);
}
void
@ -1388,7 +1214,8 @@ nsBidiPresUtils::RemoveBidiContinuation(nsIFrame* aFrame,
for (PRInt32 index = aFirstIndex + 1; index <= aLastIndex; index++) {
nsIFrame* frame = mLogicalFrames[index];
if (frame == NS_BIDI_CONTROL_FRAME) {
if (nsGkAtoms::directionalFrame == frame->GetType()) {
frame->Destroy();
++aOffset;
}
else {
@ -1403,7 +1230,14 @@ nsBidiPresUtils::RemoveBidiContinuation(nsIFrame* aFrame,
while (frame) {
nsIFrame* prev = frame->GetPrevContinuation();
if (prev) {
MakeContinuationFluid(prev, frame);
NS_ASSERTION (!frame->GetPrevInFlow() || frame->GetPrevInFlow() == prev,
"prev-in-flow is not prev continuation!");
frame->SetPrevInFlow(prev);
NS_ASSERTION (!prev->GetNextInFlow() || prev->GetNextInFlow() == frame,
"next-in-flow is not next continuation!");
prev->SetNextInFlow(frame);
frame = frame->GetParent();
} else {
break;

View File

@ -175,8 +175,6 @@ public:
* @lina 06/18/2000
*/
nsresult Resolve(nsBlockFrame* aBlockFrame);
void ResolveParagraph(nsBlockFrame* aBlockFrame);
void ResolveParagraphWithinBlock(nsBlockFrame* aBlockFrame);
/**
* Reorder this line using Bidi engine.
@ -364,14 +362,18 @@ private:
nscoord* aWidth /* may be null */);
/**
* Traverse the child frames of the block element and:
* Set up an array of the frames in logical order
* Create a string containing the text content of all the frames
* If we encounter content that requires us to split the element into more
* than one paragraph for bidi resolution, resolve the paragraph up to that
* point.
* Create a string containing entire text content of this block.
*
* @lina 05/02/2000
*/
void TraverseFrames(nsBlockFrame* aBlockFrame, nsIFrame* aCurrentFrame);
void CreateBlockBuffer();
/**
* Set up an array of the frames after splitting frames so that each frame has
* consistent directionality. At this point the frames are still in logical
* order
*/
void InitLogicalArray(nsIFrame* aCurrentFrame);
/**
* Initialize the logically-ordered array of frames
@ -511,8 +513,7 @@ private:
PRUint32 aSrcLength,
PRUnichar* aDest);
nsString mBuffer;
nsTArray<PRUnichar> mEmbeddingStack;
nsAutoString mBuffer;
nsTArray<nsIFrame*> mLogicalFrames;
nsTArray<nsIFrame*> mVisualFrames;
nsDataHashtable<nsISupportsHashKey, PRInt32> mContentToFrameIndex;
@ -520,12 +521,7 @@ private:
PRInt32* mIndexMap;
PRUint8* mLevels;
nsresult mSuccess;
PRPackedBool mIsVisual;
nsBidiLevel mParaLevel;
nsIFrame* mPrevFrame;
nsIContent* mPrevContent;
nsAutoPtr<nsBlockInFlowLineIterator> mLineIter;
nsBidi* mBidiEngine;
};

View File

@ -323,6 +323,8 @@ _TEST_FILES += \
bug570378-persian-5.html \
bug570378-persian-5-ref.html \
test_bug588174.html \
test_bug607529.html \
file_bug607529.html \
$(NULL)
endif

View File

@ -0,0 +1,49 @@
<!DOCTYPE html>
<script>
window.onerror = function(msg, url, line) {
var myMsg = JSON.stringify({msg: msg, url: url, line: line, error: true});
opener.postMessage(myMsg, "*");
}
var report = false;
function f() {
if (report) {
opener.postMessage("eventHappened", "*");
}
window.mozRequestAnimationFrame();
}
document.addEventListener("MozBeforePaint", f, false);
f();
function g() {
if (report) {
opener.postMessage("callbackHappened", "*");
}
window.mozRequestAnimationFrame(g);
}
g();
window.onload = function() {
opener.postMessage("loaded", "*");
}
addEventListener("pagehide", function f(e) {
if (!e.persisted && !report) {
opener.postMessage("notcached", "*");
}
}, false);
addEventListener("pageshow", function f(e) {
if (e.persisted) {
opener.postMessage("revived", "*");
}
}, false);
window.onmessage = function (e) {
if (e.data == "report") {
report = true;
}
};
</script>

View File

@ -0,0 +1,71 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=607529
-->
<head>
<title>Test for Bug 607529</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=607529">Mozilla Bug 607529</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
/* General idea: Open a new window (needed because we don't bfcache
subframes) that uses mozRequestAnimationFrame, navigate it, navigate it
back, and verify that the animations are still running. */
var doneOneLoad = false;
var eventsHappening = false;
var callbacksHappening = false;
function tryFinishTest() {
if (eventsHappening && callbacksHappening) {
w.close();
SimpleTest.finish();
}
}
/** Test for Bug 607529 **/
window.onmessage = function(e) {
isnot(e.data, "notcached", "Should never end up not being cached");
if (e.data == "loaded" && !doneOneLoad) {
doneOneLoad = true;
w.location = "data:text/html,<script>window.onload = function() { opener.postMessage('goback', '*'); }</" + "script>";
}
else if (e.data == "goback") {
w.history.back();
}
else if (e.data == "revived") {
w.postMessage("report", "*");
}
else if (e.data == "eventHappened") {
eventsHappening = true;
tryFinishTest();
}
else if (e.data == "callbackHappened") {
callbacksHappening = true;
tryFinishTest();
} else {
var msg = JSON.parse(e.data);
if (msg.error) {
window.onerror(msg.msg, msg.url, msg.line);
}
}
};
var w = window.open("file_bug607529.html");
</script>
</pre>
</body>
</html>

View File

@ -1029,7 +1029,7 @@ nsComboboxControlFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsINodeInfo> nodeInfo;
nodeInfo = nimgr->GetNodeInfo(nsGkAtoms::input, nsnull, kNameSpaceID_XHTML);
nodeInfo = nimgr->GetNodeInfo(nsGkAtoms::button, nsnull, kNameSpaceID_XHTML);
// create button which drops the list down
NS_NewHTMLElement(getter_AddRefs(mButtonContent), nodeInfo.forget(),
@ -1265,7 +1265,7 @@ nsComboboxControlFrame::SetInitialChildList(nsIAtom* aListName,
for (nsFrameList::Enumerator e(aChildList); !e.AtEnd(); e.Next()) {
nsCOMPtr<nsIFormControl> formControl =
do_QueryInterface(e.get()->GetContent());
if (formControl && formControl->GetType() == NS_FORM_INPUT_BUTTON) {
if (formControl && formControl->GetType() == NS_FORM_BUTTON_BUTTON) {
mButtonFrame = e.get();
break;
}

View File

@ -71,6 +71,13 @@ EXPORTS = \
nsSubDocumentFrame.h \
$(NULL)
ifdef IBMBIDI
EXPORTS += \
nsBidiFrames.h \
$(NULL)
endif
CPPSRCS = \
nsAbsoluteContainingBlock.cpp \
nsBRFrame.cpp \
@ -119,6 +126,12 @@ CPPSRCS += \
$(NULL)
endif
ifdef IBMBIDI
CPPSRCS += \
nsBidiFrames.cpp \
$(NULL)
endif
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
CMMSRCS += \
nsPluginUtilsOSX.mm \

View File

@ -0,0 +1,16 @@
<!DOCTYPE HTML>
<html lang=ru>
<head>
<meta charset=windows-1251>
<title>Testcase, bug 645072</title>
</head>
<body>
<table cellspacing=0 cellpadding=0 border=0>
<tr valign=top><td>Ðàçìûòûå,çåëåíûå,íî&shy;<wbr> êëàññíûå)<br>&shy;<wbr><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAABpJREFUWMPtwQEBAAAAgiD/r25IQAEAAADvBhAgAAGX91fXAAAAAElFTkSuQmCC" alt="">&shy;<wbr>
</table>
<script>
// simulate image loading
document.body.offsetWidth;
document.getElementsByTagName("img")[0].style.width = "604px";
document.getElementsByTagName("img")[0].style.height = "405px";
</script>

View File

@ -353,3 +353,4 @@ load 604314-1.html
load 604843.html
load 605340.html
load 621841-1.html
load 645072-1.html

View File

@ -0,0 +1,76 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* IBM Corporation.
* Portions created by the Initial Developer are Copyright (C) 2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifdef IBMBIDI
#include "nsBidiFrames.h"
#include "nsGkAtoms.h"
nsDirectionalFrame::nsDirectionalFrame(nsStyleContext* aContext, PRUnichar aChar)
: nsFrame(aContext), mChar(aChar)
{
}
nsDirectionalFrame::~nsDirectionalFrame()
{
}
nsIAtom*
nsDirectionalFrame::GetType() const
{
return nsGkAtoms::directionalFrame;
}
#ifdef NS_DEBUG
NS_IMETHODIMP
nsDirectionalFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("Directional"), aResult);
}
#endif
nsIFrame*
NS_NewDirectionalFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUnichar aChar)
{
return new (aPresShell) nsDirectionalFrame(aContext, aChar);
}
NS_IMPL_FRAMEARENA_HELPERS(nsDirectionalFrame)
#endif /* IBMBIDI */

View File

@ -0,0 +1,76 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* IBM Corporation.
* Portions created by the Initial Developer are Copyright (C) 2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifdef IBMBIDI
#ifndef nsBidiFrames_h___
#define nsBidiFrames_h___
#include "nsFrame.h"
class nsDirectionalFrame : public nsFrame
{
protected:
virtual ~nsDirectionalFrame();
public:
NS_DECL_FRAMEARENA_HELPERS
nsDirectionalFrame(nsStyleContext* aContext, PRUnichar aChar);
/**
* Get the "type" of the frame
*
* @see nsGkAtoms::directionalFrame
*/
virtual nsIAtom* GetType() const;
PRUnichar GetChar() const { return mChar; }
#ifdef NS_DEBUG
NS_IMETHOD GetFrameName(nsAString& aResult) const;
#endif
private:
PRUnichar mChar;
};
#endif /* nsBidiFrames_h___ */
#endif /* IBMBIDI */

View File

@ -3184,8 +3184,7 @@ nsIFrame::InlineMinWidthData::ForceBreak(nsIRenderingContext *aRenderingContext)
}
void
nsIFrame::InlineMinWidthData::OptionallyBreak(nsIRenderingContext *aRenderingContext,
nscoord aHyphenWidth)
nsIFrame::InlineMinWidthData::OptionallyBreak(nsIRenderingContext *aRenderingContext)
{
trailingTextFrame = nsnull;
@ -3194,9 +3193,8 @@ nsIFrame::InlineMinWidthData::OptionallyBreak(nsIRenderingContext *aRenderingCon
// text-indent or negative margin), don't break. Otherwise, do the
// same as ForceBreak. it doesn't really matter when we accumulate
// floats.
if (currentLine + aHyphenWidth < 0 || atStartOfLine)
if (currentLine < 0 || atStartOfLine)
return;
currentLine += aHyphenWidth;
ForceBreak(aRenderingContext);
}

View File

@ -1465,11 +1465,7 @@ public:
// optional breaks to prevent min-width from ending up bigger than
// pref-width.
void ForceBreak(nsIRenderingContext *aRenderingContext);
// If the break here is actually taken, aHyphenWidth must be added to the
// width of the current line.
void OptionallyBreak(nsIRenderingContext *aRenderingContext,
nscoord aHyphenWidth = 0);
void OptionallyBreak(nsIRenderingContext *aRenderingContext);
// The last text frame processed so far in the current line, when
// the last characters in that text frame are relevant for line

View File

@ -88,6 +88,7 @@ public:
nsContainerFrame_id,
nsContinuingTextFrame_id,
nsDeckFrame_id,
nsDirectionalFrame_id,
nsDocElementBoxFrame_id,
nsFieldSetFrame_id,
nsFileControlFrame_id,

View File

@ -108,6 +108,7 @@
#endif
#include "nsAutoPtr.h"
#include "nsBidiFrames.h"
#include "nsBidiPresUtils.h"
#include "nsBidiUtils.h"
@ -560,9 +561,6 @@ MakeTextRun(const PRUnichar *aText, PRUint32 aLength,
gTextRuns->RemoveFromCache(textRun);
return nsnull;
}
#ifdef NOISY_BIDI
printf("Created textrun\n");
#endif
return textRun.forget();
}
@ -587,9 +585,6 @@ MakeTextRun(const PRUint8 *aText, PRUint32 aLength,
gTextRuns->RemoveFromCache(textRun);
return nsnull;
}
#ifdef NOISY_BIDI
printf("Created textrun\n");
#endif
return textRun.forget();
}
@ -6072,19 +6067,8 @@ nsTextFrame::AddInlineMinWidthForFlow(nsIRenderingContext *aRenderingContext,
// OK since we can't really handle tabs for intrinsic sizing anyway.
const nsStyleText* textStyle = GetStyleText();
const nsTextFragment* frag = mContent->GetText();
// If we're hyphenating, the PropertyProvider needs the actual length;
// otherwise we can just pass PR_INT32_MAX to mean "all the text"
PRInt32 len = PR_INT32_MAX;
PRBool hyphenating =
(mTextRun->GetFlags() & gfxTextRunFactory::TEXT_ENABLE_HYPHEN_BREAKS) != 0;
if (hyphenating) {
gfxSkipCharsIterator tmp(iter);
len =
tmp.ConvertSkippedToOriginal(flowEndInTextRun) - iter.GetOriginalOffset();
}
PropertyProvider provider(mTextRun, textStyle, frag, this,
iter, len, nsnull, 0);
iter, PR_INT32_MAX, nsnull, 0);
PRBool collapseWhitespace = !textStyle->WhiteSpaceIsSignificant();
PRBool preformatNewlines = textStyle->NewlineIsSignificant();
@ -6093,16 +6077,7 @@ nsTextFrame::AddInlineMinWidthForFlow(nsIRenderingContext *aRenderingContext,
PRUint32 start =
FindStartAfterSkippingWhitespace(&provider, aData, textStyle, &iter, flowEndInTextRun);
nsAutoTArray<PRPackedBool,BIG_TEXT_NODE_SIZE> hyphBuffer;
PRPackedBool *hyphBreakBefore = nsnull;
if (hyphenating) {
hyphBreakBefore = hyphBuffer.AppendElements(flowEndInTextRun - start);
if (hyphBreakBefore) {
provider.GetHyphenationBreaks(start, flowEndInTextRun - start,
hyphBreakBefore);
}
}
// XXX Should we consider hyphenation here?
for (PRUint32 i = start, wordStart = start; i <= flowEndInTextRun; ++i) {
PRBool preformattedNewline = PR_FALSE;
PRBool preformattedTab = PR_FALSE;
@ -6112,11 +6087,8 @@ nsTextFrame::AddInlineMinWidthForFlow(nsIRenderingContext *aRenderingContext,
// starts?
preformattedNewline = preformatNewlines && mTextRun->GetChar(i) == '\n';
preformattedTab = preformatTabs && mTextRun->GetChar(i) == '\t';
if (!mTextRun->CanBreakLineBefore(i) &&
!preformattedNewline &&
!preformattedTab &&
(!hyphBreakBefore || !hyphBreakBefore[i - start]))
{
if (!mTextRun->CanBreakLineBefore(i) && !preformattedNewline &&
!preformattedTab) {
// we can't break here (and it's not the end of the flow)
continue;
}
@ -6158,8 +6130,6 @@ nsTextFrame::AddInlineMinWidthForFlow(nsIRenderingContext *aRenderingContext,
(mTextRun->GetFlags() & nsTextFrameUtils::TEXT_HAS_TRAILING_BREAK))) {
if (preformattedNewline) {
aData->ForceBreak(aRenderingContext);
} else if (hyphBreakBefore && hyphBreakBefore[i - start]) {
aData->OptionallyBreak(aRenderingContext, provider.GetHyphenWidth());
} else {
aData->OptionallyBreak(aRenderingContext);
}
@ -6606,10 +6576,6 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
}
}
#ifdef NOISY_BIDI
printf("Reflowed textframe\n");
#endif
const nsStyleText* textStyle = GetStyleText();
PRBool atStartOfLine = aLineLayout.LineAtStart();

View File

@ -1,10 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>br-as-bidi-paragraph-break</title>
<meta charset="UTF-8">
</head>
<body>
<p>&#x05D0; --&gt;&lrm;<br>--&gt; &#x05D1;</p>
</body>
</html>

View File

@ -1,10 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>br-as-bidi-paragraph-break</title>
<meta charset="UTF-8">
</head>
<body>
<p>&#x05D0; --&gt;<br>--&gt; &#x05D1;</p>
</body>
</html>

View File

@ -1,43 +0,0 @@
<DOCTYPE html>
<html DIR=RTL>
<head>
<meta charset=UTF-8>
<title>BIDI Layout Testing</title>
</head>
<body>
<h2>This is a testing for BiDi layout issues.</h2>
<br>
1 - No tag<br>
2 - SPAN<br>
3 - P<br>
4 - DIV<br>
<br>
<b>Test1: No space</b><br>
This is a testing for BiDi layout issues.&rlm;<br>
<span>This is a testing for BiDi layout issues.&rlm;<br></span>
<p>This is a testing for BiDi layout issues.&rlm;<br></p>
<div>This is a testing for BiDi layout issues.&rlm;<br></div>
<br><br>
<b>Test2: 3 spaces at the end</b><br>
This is a testing for BiDi layout issues.&rlm;&nbsp;&nbsp;&nbsp;<br>
<span>This is a testing for BiDi layout issues.&rlm;&nbsp;&nbsp;&nbsp;<br></span>
<p>This is a testing for BiDi layout issues.&rlm;&nbsp;&nbsp;&nbsp;<br></p>
<div>This is a testing for BiDi layout issues.&rlm;&nbsp;&nbsp;&nbsp;<br></div>
<br><br>
<b>Test3: 3 spaces at the beginning</b><br>
&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.&rlm;<br>
<span>&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.&rlm;<br></span>
<p>&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.&rlm;<br></p>
<div>&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.&rlm;<br></div>
<br><br>
<b>Test4: 3 spaces at the end and the beginning</b><br>
&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.&rlm;&nbsp;&nbsp;&nbsp;<br>
<span>&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.&rlm;&nbsp;&nbsp;&nbsp;<br></span>
<p>&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.&rlm;&nbsp;&nbsp;&nbsp;<br></p>
<div>&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.&rlm;&nbsp;&nbsp;&nbsp;<br></div>
</body>
</html>

View File

@ -1,43 +0,0 @@
<DOCTYPE html>
<html DIR=RTL>
<head>
<meta charset=UTF-8>
<title>BIDI Layout Testing</title>
</head>
<body>
<h2>This is a testing for BiDi layout issues.</h2>
<br>
1 - No tag<br>
2 - SPAN<br>
3 - P<br>
4 - DIV<br>
<br>
<b>Test1: No space</b><br>
This is a testing for BiDi layout issues.<br>
<span>This is a testing for BiDi layout issues.<br></span>
<p>This is a testing for BiDi layout issues.<br></p>
<div>This is a testing for BiDi layout issues.<br></div>
<br><br>
<b>Test2: 3 spaces at the end</b><br>
This is a testing for BiDi layout issues.&nbsp;&nbsp;&nbsp;<br>
<span>This is a testing for BiDi layout issues.&nbsp;&nbsp;&nbsp;<br></span>
<p>This is a testing for BiDi layout issues.&nbsp;&nbsp;&nbsp;<br></p>
<div>This is a testing for BiDi layout issues.&nbsp;&nbsp;&nbsp;<br></div>
<br><br>
<b>Test3: 3 spaces at the beginning</b><br>
&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.<br>
<span>&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.<br></span>
<p>&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.<br></p>
<div>&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.<br></div>
<br><br>
<b>Test4: 3 spaces at the end and the beginning</b><br>
&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.&nbsp;&nbsp;&nbsp;<br>
<span>&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.&nbsp;&nbsp;&nbsp;<br></span>
<p>&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.&nbsp;&nbsp;&nbsp;<br></p>
<div>&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.&nbsp;&nbsp;&nbsp;<br></div>
</body>
</html>

View File

@ -1,35 +0,0 @@
<DOCTYPE html>
<!-- This tests that embeddings and overrides are preserved after <br> -->
<html>
<head>
<meta charset=UTF-8>
<title>Bug 229367</title>
<style type="text/css">
p { margin: 0; text-align: left; }
p.er { unicode-bidi: embed; direction: rtl; }
p.ol { unicode-bidi: bidi-override; direction: ltr; }
p.or { unicode-bidi: bidi-override; direction: rtl; }
</style>
</head>
<body>
<p>במה מדליקין,</p>
<p>ובמה אין מדליקין?</p>
<p class="er">אין מדליקין לא בלכש, </p>
<p class="er">ולא בחוסן, </p>
<p class="er">ולא בכלך, </p>
<p class="er">ולא בפתילת האידן, </p>
<p class="ol">ולא בפתילת המדבר, </p>
<p class="ol">ולא בירוקה שעל פני המים. </p>
<p class="ol">לא בזפת, </p>
<p class="or">ולא בשעווה, </p>
<p class="or">ולא בשמן קיק, </p>
<p class="or">ולא בשמן שריפה, </p>
<p class="or">ולא באליה, </p>
<p class="ol">ולא בחלב. </p>
<p class="ol">נחום המדי אומר, </p>
<p class="er">מדליקין בחלב מבושל;</p>
<p class="er">וחכמים אומרים, </p>
<p>אחד מבושל ואחד שאינו מבושל,</p>
<p>אין מדליקין בו.</p>
</body>
</html>

View File

@ -1,30 +0,0 @@
<DOCTYPE html>
<!-- This tests that embeddings and overrides are preserved after <br> -->
<html>
<head>
<meta charset=UTF-8>
<title>Bug 229367</title>
</head>
<body>
<div>במה מדליקין,<br>
ובמה אין מדליקין?<br>
<span style="unicode-bidi: embed; direction: rtl">אין מדליקין לא בלכש, <br>
ולא בחוסן, <br>
ולא בכלך, <br>
ולא בפתילת האידן, <br>
<span style="unicode-bidi: bidi-override; direction: ltr">ולא בפתילת המדבר, <br>
ולא בירוקה שעל פני המים. <br>
לא בזפת, <br>
<span style="unicode-bidi: bidi-override; direction: rtl">ולא בשעווה, <br>
ולא בשמן קיק, <br>
ולא בשמן שריפה, <br>
ולא באליה, <br></span>
ולא בחלב. <br>
נחום המדי אומר, <br></span>
מדליקין בחלב מבושל; <br>
וחכמים אומרים, <br></span>
אחד מבושל ואחד שאינו מבושל,<br>
אין מדליקין בו.
</div>
</body>
</html>

View File

@ -1,11 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>preformatted-paragraph-break-as-bidi-paragraph-break</title>
<meta charset="UTF-8">
</head>
<body>
<pre>&#x05D0; --&gt;&lrm;
--&gt; &#x05D1;</pre>
</body>
</html>

View File

@ -1,12 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>preformatted-paragraph-break-as-bidi-paragraph-break</title>
<meta charset="UTF-8">
</head>
<body>
<pre>&#x05D0; --&gt;
--&gt; &#x05D1;</pre>
</body>
</html>

View File

@ -1,20 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>preformatted-paragraph-break-as-bidi-paragraph-break</title>
<meta charset="UTF-8">
<script type="text/javascript">
function boom()
{
document.getElementById("w").style.whiteSpace="pre";
}
</script>
</head>
<body onload="boom();">
<pre id="w" style="white-space: normal">&#x05D0; --&gt;
--&gt; &#x05D1;</pre>
</body>
</html>

View File

@ -1,20 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>preformatted-paragraph-break-as-bidi-paragraph-break</title>
<meta charset="UTF-8">
<script type="text/javascript">
function boom()
{
document.getElementById("w").style.whiteSpace="normal";
}
</script>
</head>
<body onload="boom();">
<pre id="w">&#x05D0; --&gt;
--&gt; &#x05D1;</pre>
</body>
</html>

View File

@ -1,47 +0,0 @@
<DOCTYPE html>
<html DIR=RTL>
<head>
<meta charset=UTF-8>
<title>BIDI Layout Testing</title>
</head>
<body>
<div style="white-space: pre">
<b>Test1: No space</b>
This is a testing for BiDi layout issues. &rlm;
<span>This is a testing for BiDi layout issues.&rlm;
</span>
<p>This is a testing for BiDi layout issues.&rlm;
</p>
<div>This is a testing for BiDi layout issues.&rlm;
</div>
<b>Test2: 3 spaces at the end</b>
This is a testing for BiDi layout issues.&rlm;&nbsp;&nbsp;&nbsp;
<span>This is a testing for BiDi layout issues.&rlm;&nbsp;&nbsp;&nbsp;
</span>
<p>This is a testing for BiDi layout issues.&rlm;&nbsp;&nbsp;&nbsp;
</p>
<div>This is a testing for BiDi layout issues.&rlm;&nbsp;&nbsp;&nbsp;
</div>
<b>Test3: 3 spaces at the beginning</b>
&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.&rlm;
<span>&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.&rlm;
</span>
<p>&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.&rlm;
</p>
<div>&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.&rlm;
</div>
<b>Test4: 3 spaces at the end and the beginning</b>
&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.&rlm;&nbsp;&nbsp;&nbsp;
<span>&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.&rlm;&nbsp;&nbsp;&nbsp;
</span>
<p>&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.&rlm;&nbsp;&nbsp;&nbsp;
</p>
<div>&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.&rlm;&nbsp;&nbsp;&nbsp;
</div>
</div>
</body>
</html>

View File

@ -1,46 +0,0 @@
<DOCTYPE html>
<html DIR=RTL>
<head>
<meta charset=UTF-8>
<title>BIDI Layout Testing</title>
</head>
<body>
<div style="white-space: pre">
<b>Test1: No space</b>
This is a testing for BiDi layout issues.
<span>This is a testing for BiDi layout issues.
</span>
<p>This is a testing for BiDi layout issues.
</p>
<div>This is a testing for BiDi layout issues.</div>
<b>Test2: 3 spaces at the end</b>
This is a testing for BiDi layout issues.&nbsp;&nbsp;&nbsp;
<span>This is a testing for BiDi layout issues.&nbsp;&nbsp;&nbsp;
</span>
<p>This is a testing for BiDi layout issues.&nbsp;&nbsp;&nbsp;
</p>
<div>This is a testing for BiDi layout issues.&nbsp;&nbsp;&nbsp;
</div>
<b>Test3: 3 spaces at the beginning</b>
&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.
<span>&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.
</span>
<p>&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.
</p>
<div>&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.
</div>
<b>Test4: 3 spaces at the end and the beginning</b>
&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.&nbsp;&nbsp;&nbsp;
<span>&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.&nbsp;&nbsp;&nbsp;
</span>
<p>&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.&nbsp;&nbsp;&nbsp;
</p>
<div>&nbsp;&nbsp;&nbsp;This is a testing for BiDi layout issues.&nbsp;&nbsp;&nbsp;
</div>
</div>
</body>
</html>

View File

@ -1,35 +0,0 @@
<DOCTYPE html>
<!-- This tests that embeddings and overrides are preserved after <br> -->
<html>
<head>
<meta charset=UTF-8>
<title>Bug 263359</title>
<style type="text/css">
p { margin: 0; text-align: left; white-space: pre }
p.er { direction: rtl; }
p.ol { unicode-bidi: bidi-override; direction: ltr; }
p.or { unicode-bidi: bidi-override; direction: rtl; }
</style>
</head>
<body>
<p>במה מדליקין,</p>
<p>ובמה אין מדליקין?</p>
<p class="er">אין מדליקין לא בלכש,</p>
<p class="er">ולא בחוסן,</p>
<p class="er">ולא בכלך,</p>
<p class="er">ולא בפתילת האידן,</p>
<p class="ol">ולא בפתילת המדבר,</p>
<p class="ol">ולא בירוקה שעל פני המים.</p>
<p class="ol">לא בזפת,</p>
<p class="or">ולא בשעווה,</p>
<p class="or">ולא בשמן קיק,</p>
<p class="or">ולא בשמן שריפה,</p>
<p class="or">ולא באליה,</p>
<p class="ol">ולא בחלב.</p>
<p class="ol">נחום המדי אומר,</p>
<p class="er">מדליקין בחלב מבושל;</p>
<p class="er">וחכמים אומרים,</p>
<p>אחד מבושל ואחד שאינו מבושל,</p>
<p>אין מדליקין בו.</p>
</body>
</html>

View File

@ -1,36 +0,0 @@
<DOCTYPE html>
<!-- This tests that embeddings and overrides are preserved in <pre> -->
<html>
<head>
<meta charset=UTF-8>
<title>Bug 263359</title>
<style type="text/css">
p {
white-space: pre;
margin: 0;
}
</style>
</head>
<body>
<p style="">במה מדליקין,
ובמה אין מדליקין?
<span dir="rtl">אין מדליקין לא בלכש,
ולא בחוסן,
ולא בכלך,
ולא בפתילת האידן,
<span style="unicode-bidi: bidi-override; direction: ltr">ולא בפתילת המדבר,
ולא בירוקה שעל פני המים.
לא בזפת,
<span style="unicode-bidi: bidi-override; direction: rtl">ולא בשעווה,
ולא בשמן קיק,
ולא בשמן שריפה,
ולא באליה, </span>
ולא בחלב.
נחום המדי אומר, </span>
מדליקין בחלב מבושל;
וחכמים אומרים, </span>
אחד מבושל ואחד שאינו מבושל,
אין מדליקין בו.
</pre>
</body>
</html>

View File

@ -1,16 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>change direction of pre with bidi text</title>
<meta charset="UTF-8">
</head>
<body>
<pre dir="rtl"> can_be_executable=TRUE
[he]description=סוג לא ידוע
description=Unknown type
[ar]description=نوع غير معروف
[az]description=Namə'lum növ
</pre>
</body>
</html>

View File

@ -1,24 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>change direction of pre with bidi text</title>
<meta charset="UTF-8">
<script type="text/javascript">
function boom()
{
document.getElementById("w").style.direction="rtl";
}
</script>
</head>
<body onload="boom();">
<pre id="w"> can_be_executable=TRUE
[he]description=סוג לא ידוע
description=Unknown type
[ar]description=نوع غير معروف
[az]description=Namə'lum növ
</pre>
</body>
</html>

View File

@ -1,10 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>block-element-as-bidi-paragraph-break</title>
<meta charset="UTF-8">
</head>
<body>
<div>&#x05D0; --&gt;&lrm;<hr>--&gt; &#x05D1;</div>
</body>
</html>

View File

@ -1,10 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>block-element-as-bidi-paragraph-break</title>
<meta charset="UTF-8">
</head>
<body>
<div>&#x05D0; --&gt;<hr>--&gt; &#x05D1;</div>
</body>
</html>

View File

@ -1,10 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Inline blocks shouldn't end the paragraph</title>
</head>
<body>
<p>&#x202e;אני אוהב--&gt; 4 xoferiF--&gt;8 ימים בשבוע</p>
</body>
</html>

View File

@ -1,11 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Inline blocks shouldn't end the paragraph</title>
</head>
<body>
<p><span dir="rtl">אני אוהב</span>--&gt;<span style="display: inline-block">Firefox 4&nbsp;</span>--&gt;8 ימים בשבוע
</p>
</body>
</html>

View File

@ -35,16 +35,7 @@ random-if(cocoaWidget) == mirroring-02.html mirroring-02-ref.html
== with-first-letter-2b.html with-first-letter-2-ref.html
== 115921-1.html 115921-1-ref.html
== 115921-2.html 115921-2-ref.html
== 229367-1.html 229367-1-ref.html
== 229367-2.html 229367-2-ref.html
== 229367-3.html 229367-3-ref.html
== 258928-1.html 258928-1-ref.html
== 263359-1.html 263359-1-ref.html
== 263359-1a.html 263359-1-ref.html
!= 263359-1b.html 263359-1-ref.html
== 263359-2.html 263359-2-ref.html
== 263359-3.html 263359-3-ref.html
== 263359-4.html 263359-4-ref.html
random-if(winWidget) == 267459-1.html 267459-1-ref.html # depends on windows version, see bug 590101
== 267459-2.html 267459-2-ref.html
== 299065-1.html 299065-1-ref.html
@ -72,5 +63,3 @@ fails-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 413928-2.html 413928-2-re
== 588739-2.html 588739-ref.html
== 588739-3.html 588739-ref.html
== 612843-1.html 612843-1-ref.html
== 613157-1.html 613157-1-ref.html
== 613157-2.html 613157-2-ref.html

View File

@ -30,9 +30,9 @@ load ligature-with-space-1.html
== soft-hyphens-1b.html soft-hyphens-1-ref.html
== soft-hyphens-1c.html soft-hyphens-1-ref.html
# Tests for soft hyphens in table cells, bug 418975
!= soft-hyphen-in-table-1.html soft-hyphen-in-table-1-notref.html
== soft-hyphen-in-table-1.html soft-hyphen-in-table-1-ref.html
== soft-hyphen-in-table-2.html soft-hyphen-in-table-2-ref.html
fails != soft-hyphen-in-table-1.html soft-hyphen-in-table-1-notref.html # bug 418975
fails == soft-hyphen-in-table-1.html soft-hyphen-in-table-1-ref.html # bug 418975
fails == soft-hyphen-in-table-2.html soft-hyphen-in-table-2-ref.html # bug 418975
# Cairo's FreeType and GDI backends snap glyphs to pixels, while Mac (usually)
# and D2D have subpixel positioning. The tests for pixel-snapping assume that
# 1 CSS pixel == 1 device pixel

View File

@ -249,7 +249,7 @@ select[size="1"] {
-moz-appearance: menulist;
}
select > input[type="button"] {
select > button {
width: 12px;
height: 12px;
white-space: nowrap;
@ -271,7 +271,7 @@ select > input[type="button"] {
vertical-align: top !important;
}
select > input[type="button"]:active {
select > button:active {
background-image: url("arrowd.gif") !important;
}
@ -588,8 +588,8 @@ input[type="reset"]:disabled:active,
input[type="reset"]:disabled,
input[type="button"]:disabled:active,
input[type="button"]:disabled,
select:disabled > input[type="button"],
select:disabled > input[type="button"]:active,
select:disabled > button,
select:disabled > button,
input[type="submit"]:disabled:active,
input[type="submit"]:disabled {
/* The sum of border-top, border-bottom, padding-top, padding-bottom

View File

@ -575,6 +575,8 @@ pref("dom.send_after_paint_to_content", false);
// Timeout clamp in ms for timeouts we clamp
pref("dom.min_timeout_value", 10);
// And for background windows
pref("dom.min_background_timeout_value", 1000);
// Parsing perf prefs. For now just mimic what the old code did.
#ifndef XP_WIN

View File

@ -37,13 +37,18 @@
/* This code is loaded in every child process that is started by mochitest in
* order to be used as a replacement for UniversalXPConnect
*/
var Ci = Components.interfaces;
var Cc = Components.classes;
function SpecialPowers(window) {
this.window = window;
bindDOMWindowUtils(this, window);
}
function bindDOMWindowUtils(sp, window) {
var util = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils);
var util = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
// This bit of magic brought to you by the letters
// B Z, and E, S and the number 5.
//
@ -135,7 +140,6 @@ SpecialPowers.prototype = {
//XXX: these APIs really ought to be removed, they're not e10s-safe.
// (also they're pretty Firefox-specific)
_getTopChromeWindow: function(window) {
var Ci = Components.interfaces;
return window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem)
@ -169,6 +173,11 @@ SpecialPowers.prototype = {
},
removeChromeEventListener: function(type, listener, capture) {
removeEventListener(type, listener, capture);
},
createSystemXHR: function() {
return Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Ci.nsIXMLHttpRequest);
}
};

View File

@ -77,11 +77,9 @@ ifeq ($(OS_ARCH),Darwin)
CPPSRCS += crashreporter_unix_common.cpp
CMMSRCS += crashreporter_osx.mm
OS_LIBS += -framework Cocoa
ifdef MOZ_DEBUG
OS_LIBS += -lcrypto
LIBS += $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/$(LIB_PREFIX)breakpad_common_s.$(LIB_SUFFIX)
endif
LIBS += \
$(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/$(LIB_PREFIX)breakpad_common_s.$(LIB_SUFFIX) \
$(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/mac/$(LIB_PREFIX)breakpad_mac_common_s.$(LIB_SUFFIX) \
$(NULL)

View File

@ -207,7 +207,10 @@ EXTRA_DSO_LDOPTS += $(LIBCONIC_LIBS)
endif
ifdef MOZ_ENABLE_DBUS
EXTRA_DSO_LDOPTS += $(MOZ_DBUS_LIBS) $(MOZ_DBUS_GLIB_LIBS)
EXTRA_DSO_LDOPTS += $(MOZ_DBUS_LIBS)
ifdef MOZ_PLATFORM_MAEMO
EXTRA_DSO_LDOPTS += $(MOZ_DBUS_GLIB_LIBS)
endif
endif
ifeq (gtk2,$(MOZ_WIDGET_TOOLKIT))

View File

@ -59,4 +59,8 @@ CPPSRCS = \
include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES = \
-I$(srcdir)/../../content/events/src/ \
$(NULL)
CXXFLAGS += $(MOZ_CAIRO_CFLAGS)

View File

@ -62,6 +62,7 @@
#include "nsXULPopupManager.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsEventStateManager.h"
static NS_DEFINE_IID(kRegionCID, NS_REGION_CID);
@ -813,6 +814,20 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent,
break;
}
case NS_DONESIZEMOVE:
{
nsCOMPtr<nsIPresShell> shell = do_QueryInterface(mObserver);
if (shell) {
nsPresContext* presContext = shell->GetPresContext();
if (presContext) {
nsEventStateManager::ClearGlobalActiveContent(nsnull);
}
mObserver->ClearMouseCapture(aView);
}
}
break;
case NS_XUL_CLOSE:
{
// if this is a popup, make a request to hide it. Note that a popuphidden

View File

@ -227,6 +227,9 @@ class nsHashKey;
// keyboard accelerator indicators has changed.
#define NS_UISTATECHANGED (NS_WINDOW_START + 43)
// Done sizing or moving a window, so ensure that the mousedown state was cleared.
#define NS_DONESIZEMOVE (NS_WINDOW_START + 44)
#define NS_RESIZE_EVENT (NS_WINDOW_START + 60)
#define NS_SCROLL_EVENT (NS_WINDOW_START + 61)

View File

@ -2640,7 +2640,7 @@ void nsWindow::UpdateTransparentRegion(const nsIntRegion &aTransparentRegion)
// all values must be set to -1 to get a full sheet of glass.
MARGINS margins = { -1, -1, -1, -1 };
bool visiblePlugin = false;
if (!opaqueRegion.IsEmpty() && !mHideChrome) {
if (!opaqueRegion.IsEmpty()) {
nsIntRect pluginBounds;
for (nsIWidget* child = GetFirstChild(); child; child = child->GetNextSibling()) {
nsWindowType type;
@ -4465,8 +4465,22 @@ nsWindow::IPCWindowProcHandler(UINT& msg, WPARAM& wParam, LPARAM& lParam)
// via calls to ShowWindow.
case WM_ACTIVATE:
if (lParam != 0 && LOWORD(wParam) == WA_ACTIVE &&
IsWindow((HWND)lParam))
IsWindow((HWND)lParam)) {
// Check for Adobe Reader X sync activate message from their
// helper window and ignore. Fixes an annoying focus problem.
if ((InSendMessageEx(NULL)&(ISMEX_REPLIED|ISMEX_SEND)) == ISMEX_SEND) {
PRUnichar szClass[10];
HWND focusWnd = (HWND)lParam;
if (IsWindowVisible(focusWnd) &&
GetClassNameW(focusWnd, szClass,
sizeof(szClass)/sizeof(PRUnichar)) &&
!wcscmp(szClass, L"Edit") &&
!IsOurProcessWindow(focusWnd)) {
break;
}
}
handled = PR_TRUE;
}
break;
// Wheel events forwarded from the child.
case WM_MOUSEWHEEL:
@ -4519,10 +4533,14 @@ nsWindow::IPCWindowProcHandler(UINT& msg, WPARAM& wParam, LPARAM& lParam)
static PRBool
DisplaySystemMenu(HWND hWnd, nsSizeMode sizeMode, PRBool isRtl, PRInt32 x, PRInt32 y)
{
GetSystemMenu(hWnd, TRUE); // reset the system menu
HMENU hMenu = GetSystemMenu(hWnd, FALSE);
if (hMenu) {
// update the options
EnableMenuItem(hMenu, SC_RESTORE, MF_BYCOMMAND | MF_ENABLED);
EnableMenuItem(hMenu, SC_SIZE, MF_BYCOMMAND | MF_ENABLED);
EnableMenuItem(hMenu, SC_MOVE, MF_BYCOMMAND | MF_ENABLED);
EnableMenuItem(hMenu, SC_MAXIMIZE, MF_BYCOMMAND | MF_ENABLED);
EnableMenuItem(hMenu, SC_MINIMIZE, MF_BYCOMMAND | MF_ENABLED);
switch(sizeMode) {
case nsSizeMode_Fullscreen:
EnableMenuItem(hMenu, SC_RESTORE, MF_BYCOMMAND | MF_GRAYED);
@ -5292,6 +5310,12 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
DispatchPendingEvents();
break;
case WM_EXITSIZEMOVE:
if (!sIsInMouseCapture) {
DispatchStandardEvent(NS_DONESIZEMOVE);
}
break;
case WM_APPCOMMAND:
{
PRUint32 appCommand = GET_APPCOMMAND_LPARAM(lParam);