From a6223e7bd0caa0bafcd133cace1980a7434e211b Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Wed, 24 Jun 2009 16:21:14 -0400 Subject: [PATCH 01/70] bug 50070 - mozconfig2configure can't handle paths with parenthesis r=ted --- build/autoconf/mozconfig2configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/autoconf/mozconfig2configure b/build/autoconf/mozconfig2configure index 18dbdc14ee45..40c2a3b8ab71 100755 --- a/build/autoconf/mozconfig2configure +++ b/build/autoconf/mozconfig2configure @@ -62,8 +62,8 @@ ac_add_options() { for _opt do - # Escape shell characters, space, tab, dollar, quote, backslash. - _opt=`echo $_opt | sed -e 's/\([\ \ \$\"\\]\)/\\\\\1/g;s/@\([^@]*\)@/\$\1/g;'` + # Escape shell characters, space, tab, dollar, quote, backslash, parentheses. + _opt=`echo $_opt | sed -e 's/\([\ \ \$\"\\\(\)]\)/\\\\\1/g;s/@\([^@]*\)@/\$\1/g;'` _opt=`echo $_opt | sed -e 's/@\([^@]*\)@/\$(\1)/g'` # Avoid adding duplicates From 7dd12cd149f21d88a70ac515ba186251ba122768 Mon Sep 17 00:00:00 2001 From: Jesse Ruderman Date: Wed, 24 Jun 2009 14:19:02 -0700 Subject: [PATCH 02/70] Instrument nsSVGRenderingObserverList for trace-refcnt (bug 499613). r=roc --- layout/svg/base/src/nsSVGEffects.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/layout/svg/base/src/nsSVGEffects.h b/layout/svg/base/src/nsSVGEffects.h index 794e97f3c2a1..7bfcb1100bec 100644 --- a/layout/svg/base/src/nsSVGEffects.h +++ b/layout/svg/base/src/nsSVGEffects.h @@ -188,8 +188,15 @@ protected: */ class nsSVGRenderingObserverList { public: - nsSVGRenderingObserverList() { mObservers.Init(5); } - ~nsSVGRenderingObserverList() { InvalidateAll(); } + nsSVGRenderingObserverList() { + MOZ_COUNT_CTOR(nsSVGRenderingObserverList); + mObservers.Init(5); + } + + ~nsSVGRenderingObserverList() { + InvalidateAll(); + MOZ_COUNT_DTOR(nsSVGRenderingObserverList); + } void Add(nsSVGRenderingObserver* aObserver) { mObservers.PutEntry(aObserver); } From 4717a0be0334eef453736bd475feb227feabf6b9 Mon Sep 17 00:00:00 2001 From: Serge Gautherie Date: Wed, 24 Jun 2009 23:31:22 +0200 Subject: [PATCH 03/70] Bug 495730 - xpcshell-tests: each test leaks 3 nsStringBuffer, after (harness) bug 483062 landing; (Cv1) test_crashreporter.js: synchronize from TestCrashReporterAPI.cpp; r=ted.mielczarek --- .../test/unit/test_crashreporter.js | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/toolkit/crashreporter/test/unit/test_crashreporter.js b/toolkit/crashreporter/test/unit/test_crashreporter.js index 375b5af7381f..8694bc9518af 100644 --- a/toolkit/crashreporter/test/unit/test_crashreporter.js +++ b/toolkit/crashreporter/test/unit/test_crashreporter.js @@ -101,36 +101,40 @@ function run_test() do_check_eq(cr.minidumpPath.path, cwd.path); try { - cr.annotateCrashReport("=", ""); - do_throw("Calling annotateCrashReport() with an '=' key should have thrown!"); + cr.annotateCrashReport("equal=equal", ""); + do_throw("Calling annotateCrashReport() with an '=' in key should have thrown!"); } catch (ex) { do_check_eq(ex.result, Components.results.NS_ERROR_INVALID_ARG); } try { - cr.annotateCrashReport("\n", ""); - do_throw("Calling annotateCrashReport() with a '\\n' key should have thrown!"); + cr.annotateCrashReport("new\nline", ""); + do_throw("Calling annotateCrashReport() with a '\\n' in key should have thrown!"); } catch (ex) { do_check_eq(ex.result, Components.results.NS_ERROR_INVALID_ARG); } try { - cr.annotateCrashReport("", "\0"); - do_throw("Calling annotateCrashReport() with a '\\0' data should have thrown!"); + cr.annotateCrashReport("", "da\0ta"); + do_throw("Calling annotateCrashReport() with a '\\0' in data should have thrown!"); } catch (ex) { do_check_eq(ex.result, Components.results.NS_ERROR_INVALID_ARG); } - cr.annotateCrashReport("testKey", "testData"); + cr.annotateCrashReport("testKey", "testData1"); + // Replace previous data. + cr.annotateCrashReport("testKey", "testData2"); try { - cr.appendAppNotesToCrashReport("\0"); - do_throw("Calling appendAppNotesToCrashReport() with a '\\0' data should have thrown!"); + cr.appendAppNotesToCrashReport("da\0ta"); + do_throw("Calling appendAppNotesToCrashReport() with a '\\0' in data should have thrown!"); } catch (ex) { do_check_eq(ex.result, Components.results.NS_ERROR_INVALID_ARG); } - cr.appendAppNotesToCrashReport("additional testData"); + cr.appendAppNotesToCrashReport("additional testData3"); + // Add more data. + cr.appendAppNotesToCrashReport("additional testData4"); // check that we can disable the crashreporter cr.enabled = false; From 87b588f1b3cfd678d2c0e0ced638016184545bc0 Mon Sep 17 00:00:00 2001 From: Serge Gautherie Date: Wed, 24 Jun 2009 23:31:23 +0200 Subject: [PATCH 04/70] Bug 474688 - TUnit check: TestCrashReporterAPI.cpp fails on Windows, around shutdown; (Bv1a) Delete this (superseded) test; r=ted.mielczarek --- toolkit/crashreporter/test/Makefile.in | 69 ------ .../test/TestCrashReporterAPI.cpp | 223 ------------------ 2 files changed, 292 deletions(-) delete mode 100644 toolkit/crashreporter/test/TestCrashReporterAPI.cpp diff --git a/toolkit/crashreporter/test/Makefile.in b/toolkit/crashreporter/test/Makefile.in index a17084c0549b..246059b7c6c1 100644 --- a/toolkit/crashreporter/test/Makefile.in +++ b/toolkit/crashreporter/test/Makefile.in @@ -46,82 +46,13 @@ include $(DEPTH)/config/autoconf.mk MODULE = crashreporter XPCSHELL_TESTS = unit -ifndef MOZ_ENABLE_LIBXUL -PROGRAM = TestCrashReporterAPI$(BIN_SUFFIX) - -CPPSRCS = TestCrashReporterAPI.cpp -endif - -REQUIRES = \ - xpcom \ - string \ - crashreporter \ - $(NULL) - -LIBS = \ - $(EXTRA_DSO_LIBS) \ - $(XPCOM_GLUE_LDOPTS) \ - $(XPCOM_LIBS) \ - $(NSPR_LIBS) \ - $(DEPTH)/toolkit/crashreporter/$(LIB_PREFIX)exception_handler_s.$(LIB_SUFFIX) \ - $(NULL) - -MOZILLA_INTERNAL_API = 1 - include $(topsrcdir)/config/rules.mk -ifeq ($(OS_ARCH),WINNT) -LIBS += \ - $(DEPTH)/toolkit/crashreporter/google-breakpad/src/client/windows/handler/$(LIB_PREFIX)exception_handler_s.$(LIB_SUFFIX) \ - $(DEPTH)/toolkit/crashreporter/google-breakpad/src/client/windows/crash_generation/$(LIB_PREFIX)crash_generation_s.$(LIB_SUFFIX) \ - $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/windows/$(LIB_PREFIX)breakpad_windows_common_s.$(LIB_SUFFIX) -LIBS += $(call expand_libname shell32) -OS_LIBS += $(call EXPAND_LIBNAME,ole32) -endif - -ifeq ($(OS_ARCH),Darwin) -OS_LIBS += -framework Cocoa -lcrypto -LIBS += \ - $(DEPTH)/toolkit/crashreporter/google-breakpad/src/client/$(LIB_PREFIX)minidump_file_writer_s.$(LIB_SUFFIX) \ - $(DEPTH)/toolkit/crashreporter/google-breakpad/src/client/mac/handler/$(LIB_PREFIX)exception_handler_s.$(LIB_SUFFIX) \ - $(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) -LOCAL_INCLUDES += -I$(srcdir) -I$(srcdir)/../google-breakpad/src/common/mac/ -endif - -ifeq ($(OS_ARCH),Linux) -LIBS += \ - $(DEPTH)/toolkit/crashreporter/google-breakpad/src/client/linux/handler/$(LIB_PREFIX)exception_handler_s.$(LIB_SUFFIX) \ - $(DEPTH)/toolkit/crashreporter/google-breakpad/src/client/$(LIB_PREFIX)minidump_file_writer_s.$(LIB_SUFFIX) \ - $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/linux/$(LIB_PREFIX)breakpad_linux_common_s.$(LIB_SUFFIX) \ - $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/$(LIB_PREFIX)breakpad_common_s.$(LIB_SUFFIX) \ - $(NULL) -endif - -ifeq ($(OS_ARCH),SunOS) -OS_LIBS += -lelf -LIBS += \ - $(DEPTH)/toolkit/crashreporter/google-breakpad/src/client/solaris/handler/$(LIB_PREFIX)exception_handler_s.$(LIB_SUFFIX) \ - $(DEPTH)/toolkit/crashreporter/google-breakpad/src/client/$(LIB_PREFIX)minidump_file_writer_s.$(LIB_SUFFIX) \ - $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/solaris/$(LIB_PREFIX)breakpad_solaris_common_s.$(LIB_SUFFIX) \ - $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/$(LIB_PREFIX)breakpad_common_s.$(LIB_SUFFIX) \ - $(NULL) -endif - -ifndef MOZ_ENABLE_LIBXUL -# XXX TestCrashReporterAPI gives random failures on exit for unexplained reason -# therefore it is disabled. See Bug 474688. -#check:: $(PROGRAM) -# $(RUN_TEST_PROGRAM) $(DIST)/bin/TestCrashReporterAPI -endif - _BROWSER_FILES = \ browser/aboutcrashes_utils.js \ browser/browser_aboutCrashes.js \ browser/browser_bug471404.js \ $(NULL) - libs:: $(_BROWSER_FILES) $(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)/browser diff --git a/toolkit/crashreporter/test/TestCrashReporterAPI.cpp b/toolkit/crashreporter/test/TestCrashReporterAPI.cpp deleted file mode 100644 index 84c4d52629f2..000000000000 --- a/toolkit/crashreporter/test/TestCrashReporterAPI.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Breakpad integration - * - * The Initial Developer of the Original Code is - * Ted Mielczarek - * Portions created by the Initial Developer are Copyright (C) 2007 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include -#include - -#include "prenv.h" -#include "nsIComponentManager.h" -#include "nsISimpleEnumerator.h" -#include "nsIServiceManager.h" -#include "nsServiceManagerUtils.h" -#include "nsDirectoryServiceDefs.h" -#include "nsIProperties.h" -#include "nsCOMPtr.h" -#include "nsILocalFile.h" - -#include "nsExceptionHandler.h" - -// Defined in nsExceptionHandler.cpp, but not normally exposed -namespace CrashReporter { - bool GetAnnotation(const nsACString& key, nsACString& data); -} - -#define ok(message, test) do { \ - if (!(test)) \ - return message; \ - } while (0) -#define equals(message, a, b) ok(message, a == b) -#define ok_nsresult(message, rv) ok(message, NS_SUCCEEDED(rv)) -#define fail_nsresult(message, rv) ok(message, NS_FAILED(rv)) -#define run_test(test) do { char *message = test(); tests_run++; \ - if (message) return message; } while (0) -int tests_run; - - - -char * -test_init_exception_handler() -{ - nsCOMPtr lf; - // we don't plan on launching the crash reporter in this app anyway, - // so it's ok to pass a bogus nsILocalFile - ok_nsresult("NS_NewNativeLocalFile", NS_NewNativeLocalFile(EmptyCString(), - PR_TRUE, - getter_AddRefs(lf))); - - ok_nsresult("CrashReporter::SetExceptionHandler", - CrashReporter::SetExceptionHandler(lf, nsnull)); - return 0; -} - -char * -test_set_minidump_path() -{ - nsresult rv; - nsCOMPtr directoryService = - do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv); - - ok_nsresult("do_GetService", rv); - - nsCOMPtr currentDirectory; - rv = directoryService->Get(NS_XPCOM_CURRENT_PROCESS_DIR, - NS_GET_IID(nsILocalFile), - getter_AddRefs(currentDirectory)); - ok_nsresult("directoryService->Get", rv); - - nsAutoString currentDirectoryPath; - rv = currentDirectory->GetPath(currentDirectoryPath); - ok_nsresult("currentDirectory->GetPath", rv); - - ok_nsresult("CrashReporter::SetMinidumpPath", - CrashReporter::SetMinidumpPath(currentDirectoryPath)); - - return 0; -} - -char * -test_annotate_crash_report_basic() -{ - ok_nsresult("CrashReporter::AnnotateCrashReport: basic 1", - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("test"), - NS_LITERAL_CSTRING("some data"))); - - - nsCAutoString result; - ok("CrashReporter::GetAnnotation", CrashReporter::GetAnnotation(NS_LITERAL_CSTRING("test"), - result)); - nsCString msg = result + NS_LITERAL_CSTRING(" == ") + - NS_LITERAL_CSTRING("some data"); - equals((char*)PromiseFlatCString(msg).get(), result, - NS_LITERAL_CSTRING("some data")); - - // now replace it with something else - ok_nsresult("CrashReporter::AnnotateCrashReport: basic 2", - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("test"), - NS_LITERAL_CSTRING("some other data"))); - - - ok("CrashReporter::GetAnnotation", CrashReporter::GetAnnotation(NS_LITERAL_CSTRING("test"), - result)); - msg = result + NS_LITERAL_CSTRING(" == ") + - NS_LITERAL_CSTRING("some other data"); - equals((char*)PromiseFlatCString(msg).get(), result, - NS_LITERAL_CSTRING("some other data")); - return 0; -} - -char * -test_appendnotes_crash_report() -{ - // Append two notes - ok_nsresult("CrashReporter::AppendAppNotesToCrashReport: 1", - CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("some data"))); - - - ok_nsresult("CrashReporter::AppendAppNotesToCrashReport: 2", - CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("some other data"))); - - // ensure that the result is correct - nsCAutoString result; - ok("CrashReporter::GetAnnotation", - CrashReporter::GetAnnotation(NS_LITERAL_CSTRING("Notes"), - result)); - - nsCString msg = result + NS_LITERAL_CSTRING(" == ") + - NS_LITERAL_CSTRING("some datasome other data"); - equals((char*)PromiseFlatCString(msg).get(), result, - NS_LITERAL_CSTRING("some datasome other data")); - return 0; -} - -char * -test_annotate_crash_report_invalid_equals() -{ - fail_nsresult("CrashReporter::AnnotateCrashReport: invalid = in key", - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("test=something"), - NS_LITERAL_CSTRING("some data"))); - return 0; -} - -char * -test_annotate_crash_report_invalid_cr() -{ - fail_nsresult("CrashReporter::AnnotateCrashReport: invalid \n in key", - CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("test\nsomething"), - NS_LITERAL_CSTRING("some data"))); - return 0; -} - -char * -test_unset_exception_handler() -{ - ok_nsresult("CrashReporter::UnsetExceptionHandler", - CrashReporter::UnsetExceptionHandler()); - return 0; -} - -static char* all_tests() -{ - run_test(test_init_exception_handler); - run_test(test_set_minidump_path); - run_test(test_annotate_crash_report_basic); - run_test(test_annotate_crash_report_invalid_equals); - run_test(test_annotate_crash_report_invalid_cr); - run_test(test_appendnotes_crash_report); - run_test(test_unset_exception_handler); - return 0; -} - -int -main (int argc, char **argv) -{ - NS_InitXPCOM2(nsnull, nsnull, nsnull); - - PR_SetEnv("MOZ_CRASHREPORTER=1"); - - char* result = all_tests(); - if (result != 0) { - printf("TEST-UNEXPECTED-FAIL | %s | %s\n", __FILE__, result); - } - else { - printf("TEST-PASS | %s | all tests passed\n", __FILE__); - } - printf("Tests run: %d\n", tests_run); - - NS_ShutdownXPCOM(nsnull); - - return result != 0; -} From 1a5bd9e19a37ae996f42277af8a61ecb528ff316 Mon Sep 17 00:00:00 2001 From: Jonathan Griffin Date: Wed, 24 Jun 2009 23:31:25 +0200 Subject: [PATCH 05/70] Bug 424766 - Left part of the page isn't repainted properly; invalidate reftest; r=roc --- layout/reftests/bugs/424766-1-ref.html | 29 +++++++++++++++++ layout/reftests/bugs/424766-1.html | 45 ++++++++++++++++++++++++++ layout/reftests/bugs/reftest.list | 1 + 3 files changed, 75 insertions(+) create mode 100644 layout/reftests/bugs/424766-1-ref.html create mode 100644 layout/reftests/bugs/424766-1.html diff --git a/layout/reftests/bugs/424766-1-ref.html b/layout/reftests/bugs/424766-1-ref.html new file mode 100644 index 000000000000..d22022f716ea --- /dev/null +++ b/layout/reftests/bugs/424766-1-ref.html @@ -0,0 +1,29 @@ + + + + + + + + + + + + +
+
+
+ +
+
+ +
+ +
+
+ +
+
+ + + diff --git a/layout/reftests/bugs/424766-1.html b/layout/reftests/bugs/424766-1.html new file mode 100644 index 000000000000..9e9435603073 --- /dev/null +++ b/layout/reftests/bugs/424766-1.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + +
+
+
+ +
+
+ +
+ +
+
+ +
+
+ + + diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index 8a3ab577c092..466fbb8257e7 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -949,6 +949,7 @@ fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 424074-1-ref2.xul 424074-1-ref3.xul == 424434-1.html 424434-1-ref.html == 424631-1.html 424631-1-ref.html == 424710-1.html 424710-1-ref.html +== 424766-1.html 424766-1-ref.html == 425972-1.html 425972-1-ref.html == 425972-2.html 425972-2-ref.html != 425972-1.html 425972-2.html From 4739734af29e1b08a0850311410403e91ca0f231 Mon Sep 17 00:00:00 2001 From: Walter Meinl Date: Wed, 24 Jun 2009 23:31:27 +0200 Subject: [PATCH 06/70] Bug 494490 - make install on linux installs the system_wrappers{_js} in includedir; r=benjamin --- config/Makefile.in | 2 +- configure.in | 2 +- js/src/config/Makefile.in | 2 +- js/src/configure.in | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/Makefile.in b/config/Makefile.in index b2710f3a6a0d..2ddbf6072db6 100644 --- a/config/Makefile.in +++ b/config/Makefile.in @@ -129,7 +129,7 @@ export:: -DMOZ_NATIVE_PNG=$(MOZ_NATIVE_PNG) \ -DMOZ_NATIVE_JPEG=$(MOZ_NATIVE_JPEG) \ $(srcdir)/system-headers | $(PERL) $(topsrcdir)/nsprpub/config/make-system-wrappers.pl system_wrappers - $(INSTALL) system_wrappers $(DIST)/include + $(INSTALL) system_wrappers $(DIST) GARBAGE_DIRS += system_wrappers endif diff --git a/configure.in b/configure.in index f288e4661ad9..87e2281b0484 100644 --- a/configure.in +++ b/configure.in @@ -3032,7 +3032,7 @@ EOF ]) if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \ "$ac_cv_have_visibility_class_bug" = "no"; then - VISIBILITY_FLAGS='-I$(DIST)/include/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h' + VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h' WRAP_SYSTEM_INCLUDES=1 else VISIBILITY_FLAGS='-fvisibility=hidden' diff --git a/js/src/config/Makefile.in b/js/src/config/Makefile.in index 77a1983b12ad..19ff44c7e79a 100644 --- a/js/src/config/Makefile.in +++ b/js/src/config/Makefile.in @@ -93,7 +93,7 @@ export:: $(PERL) $(srcdir)/preprocessor.pl $(DEFINES) $(ACDEFINES) \ -DBUILD_STATIC_LIBS=$(BUILD_STATIC_LIBS) \ $(srcdir)/system-headers | $(PERL) $(srcdir)/make-system-wrappers.pl system_wrappers_js - $(INSTALL) system_wrappers_js $(DIST)/include + $(INSTALL) system_wrappers_js $(DIST) GARBAGE_DIRS += system_wrappers_js endif diff --git a/js/src/configure.in b/js/src/configure.in index e74940c6d786..4cde3dac935f 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -2878,7 +2878,7 @@ EOF ]) if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \ "$ac_cv_have_visibility_class_bug" = "no"; then - VISIBILITY_FLAGS='-I$(DIST)/include/system_wrappers_js -include $(topsrcdir)/config/gcc_hidden.h' + VISIBILITY_FLAGS='-I$(DIST)/system_wrappers_js -include $(topsrcdir)/config/gcc_hidden.h' WRAP_SYSTEM_INCLUDES=1 else VISIBILITY_FLAGS='-fvisibility=hidden' From e1c90d23a91350c89d8ef1eaf65966f129ec22ca Mon Sep 17 00:00:00 2001 From: Marco Bonardo Date: Thu, 25 Jun 2009 00:15:25 +0200 Subject: [PATCH 07/70] Bug 495675 - 500 ms delay when holding mouse down on folders on bookmarks toolbar before they open, r=dietrich --- browser/components/places/content/toolbar.xml | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/browser/components/places/content/toolbar.xml b/browser/components/places/content/toolbar.xml index 1618941337e0..7638d6baa656 100644 --- a/browser/components/places/content/toolbar.xml +++ b/browser/components/places/content/toolbar.xml @@ -129,8 +129,10 @@ document.getAnonymousElementByAttribute(this, "class", "chevron") null + true null + null @@ -559,7 +561,7 @@ this._self.insertBefore(button, children[aNewIndex]); if (chevronPopup) { // Maintain chevron in sync - menuitem = chevronPopup.childNodes[i]; + var menuitem = chevronPopup.childNodes[i]; chevronPopup.removeChild(menuitem); chevronPopup.insertBefore(menuitem, chevronPopup.childNodes[aNewIndex]); @@ -950,7 +952,7 @@ // * Timer to turn off indicator bar. if (aTimer == this._ibTimer) { - ib = this._dropIndicatorBar.removeAttribute('dragging'); + this._dropIndicatorBar.removeAttribute('dragging'); this._ibTimer = null; } @@ -1195,14 +1197,17 @@ } ]]> +#ifdef XP_UNIX +#ifndef XP_MACOSX - +#endif +#endif Date: Wed, 24 Jun 2009 19:18:46 -0400 Subject: [PATCH 08/70] Bug 500202 - Unused variable build warnings; r=MarcoZ --- accessible/src/base/nsAccessible.cpp | 2 +- accessible/src/html/nsHTMLFormControlAccessible.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/accessible/src/base/nsAccessible.cpp b/accessible/src/base/nsAccessible.cpp index a593327f0e41..8b91e7f92484 100644 --- a/accessible/src/base/nsAccessible.cpp +++ b/accessible/src/base/nsAccessible.cpp @@ -281,7 +281,7 @@ nsAccessible::GetName(nsAString& aName) nsCOMPtr xblAccessible(do_QueryInterface(mDOMNode)); if (xblAccessible) { - nsresult rv = xblAccessible->GetAccessibleName(aName); + xblAccessible->GetAccessibleName(aName); if (!aName.IsEmpty()) return NS_OK; } diff --git a/accessible/src/html/nsHTMLFormControlAccessible.cpp b/accessible/src/html/nsHTMLFormControlAccessible.cpp index c69f8c97132b..d0bda883e9a8 100644 --- a/accessible/src/html/nsHTMLFormControlAccessible.cpp +++ b/accessible/src/html/nsHTMLFormControlAccessible.cpp @@ -296,7 +296,7 @@ nsHTMLButtonAccessible::GetRoleInternal(PRUint32 *aRole) nsresult nsHTMLButtonAccessible::GetNameInternal(nsAString& aName) { - nsresult rv = nsAccessible::GetNameInternal(aName); + nsAccessible::GetNameInternal(aName); if (!aName.IsEmpty()) return NS_OK; From 8480e3e6ae84be22014d7873f952f01611fa645c Mon Sep 17 00:00:00 2001 From: David Bolter Date: Wed, 24 Jun 2009 19:18:46 -0400 Subject: [PATCH 09/70] Bug 500210 - comparison of unsigned and signed integer warnings; r=MarcoZ --- accessible/src/base/nsCoreUtils.cpp | 2 +- accessible/src/html/nsHTMLTableAccessible.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/accessible/src/base/nsCoreUtils.cpp b/accessible/src/base/nsCoreUtils.cpp index e8224b93b72c..0d392ef2e02e 100644 --- a/accessible/src/base/nsCoreUtils.cpp +++ b/accessible/src/base/nsCoreUtils.cpp @@ -201,7 +201,7 @@ nsCoreUtils::GetDOMNodeFromDOMPoint(nsIDOMNode *aNode, PRUint32 aOffset) nsCOMPtr content(do_QueryInterface(aNode)); if (content && content->IsNodeOfType(nsINode::eELEMENT)) { - PRInt32 childCount = static_cast(content->GetChildCount()); + PRUint32 childCount = content->GetChildCount(); NS_ASSERTION(aOffset >= 0 && aOffset <= childCount, "Wrong offset of the DOM point!"); diff --git a/accessible/src/html/nsHTMLTableAccessible.cpp b/accessible/src/html/nsHTMLTableAccessible.cpp index a1e5acfa3c90..a83d3200b2c3 100644 --- a/accessible/src/html/nsHTMLTableAccessible.cpp +++ b/accessible/src/html/nsHTMLTableAccessible.cpp @@ -1389,7 +1389,7 @@ NS_IMETHODIMP nsHTMLTableAccessible::IsProbablyForLayout(PRBool *aIsProbablyForL PRUint32 length; nodeList->GetLength(&length); nsAutoString color, lastRowColor; - for (PRInt32 rowCount = 0; rowCount < length; rowCount ++) { + for (PRUint32 rowCount = 0; rowCount < length; rowCount ++) { nsCOMPtr rowNode; nodeList->Item(rowCount, getter_AddRefs(rowNode)); From fc066fd601c0984a592ce67cd6f3d7f8a9dd7350 Mon Sep 17 00:00:00 2001 From: David Bolter Date: Wed, 24 Jun 2009 19:18:46 -0400 Subject: [PATCH 10/70] Bug 500213 - compiler warns about unused enums in switch; r=MarcoZ --- accessible/src/base/nsAccessibleEventData.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/accessible/src/base/nsAccessibleEventData.cpp b/accessible/src/base/nsAccessibleEventData.cpp index b8ca9962d562..cc0ec7c9e588 100644 --- a/accessible/src/base/nsAccessibleEventData.cpp +++ b/accessible/src/base/nsAccessibleEventData.cpp @@ -385,6 +385,9 @@ nsAccEvent::ApplyEventRules(nsCOMArray &aEventsToFire) } } } break; // case eRemoveDupes + + default: + break; // case eAllowDupes, eDoNotEmit } // switch } // for (tail) } From 3ba6c93aaca5e813165f956e6643b58cb5543019 Mon Sep 17 00:00:00 2001 From: Gavin Sharp Date: Wed, 24 Jun 2009 19:20:31 -0400 Subject: [PATCH 11/70] Add Mohammad Reza Haghighat to credits, r=mconnor --- browser/base/content/credits.xhtml | 1 + 1 file changed, 1 insertion(+) diff --git a/browser/base/content/credits.xhtml b/browser/base/content/credits.xhtml index b8925ce37266..d43d07b60f28 100644 --- a/browser/base/content/credits.xhtml +++ b/browser/base/content/credits.xhtml @@ -337,6 +337,7 @@
  • Matthew Gregan
  • Will Guaraldi
  • Adam Guthrie
  • +
  • Mohammad Reza Haghighat
  • Andrei Hajdukewycz
  • Trevor Hardcastle
  • Basil Hashem
  • From a9bdf35f9169884eb32996290949fa4cec52118f Mon Sep 17 00:00:00 2001 From: Jesse Ruderman Date: Wed, 24 Jun 2009 16:32:46 -0700 Subject: [PATCH 12/70] Fix allocator mismatch in nsSVGFEConvolveMatrixElement::Filter (bug 500273). r=roc --- content/svg/content/src/nsSVGFilters.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/svg/content/src/nsSVGFilters.cpp b/content/svg/content/src/nsSVGFilters.cpp index e7b2f3b104a7..13ebad923501 100644 --- a/content/svg/content/src/nsSVGFilters.cpp +++ b/content/svg/content/src/nsSVGFilters.cpp @@ -4107,7 +4107,7 @@ nsSVGFEConvolveMatrixElement::Filter(nsSVGFilterInstance *instance, if (orderX > NS_SVG_OFFSCREEN_MAX_DIMENSION || orderY > NS_SVG_OFFSCREEN_MAX_DIMENSION) return NS_ERROR_FAILURE; - nsAutoPtr kernel(new float[orderX * orderY]); + nsAutoArrayPtr kernel(new float[orderX * orderY]); if (!kernel) return NS_ERROR_FAILURE; for (PRUint32 i = 0; i < num; i++) { From e270dfb4116a7b0294284071428d0edfd90529b0 Mon Sep 17 00:00:00 2001 From: Alexander Surkov Date: Thu, 25 Jun 2009 10:08:53 +0800 Subject: [PATCH 13/70] Bug 461922 - remove nsPIAccessibleDocument, r=marcoz, davidb, sr=neil --- accessible/public/Makefile.in | 1 - accessible/public/nsPIAccessibleDocument.idl | 67 -------- accessible/src/base/nsAccUtils.cpp | 21 +++ accessible/src/base/nsAccUtils.h | 15 +- accessible/src/base/nsAccessNode.cpp | 9 +- accessible/src/base/nsAccessibilityAtoms.h | 3 +- .../src/base/nsAccessibilityService.cpp | 32 ++-- accessible/src/base/nsDocAccessible.cpp | 105 +++++++----- accessible/src/base/nsDocAccessible.h | 161 ++++++++++++------ accessible/src/base/nsRootAccessible.cpp | 19 +-- accessible/src/base/nsRootAccessible.h | 41 +++-- accessible/src/msaa/nsDocAccessibleWrap.cpp | 19 +-- accessible/src/msaa/nsDocAccessibleWrap.h | 2 +- 13 files changed, 267 insertions(+), 228 deletions(-) delete mode 100644 accessible/public/nsPIAccessibleDocument.idl diff --git a/accessible/public/Makefile.in b/accessible/public/Makefile.in index 166fee90fb2e..39c68e01f625 100644 --- a/accessible/public/Makefile.in +++ b/accessible/public/Makefile.in @@ -59,7 +59,6 @@ XPIDLSRCS = \ nsIAccessibleRole.idl \ nsIAccessibleStates.idl \ nsIAccessibleDocument.idl \ - nsPIAccessibleDocument.idl \ nsIAccessibleProvider.idl \ nsIAccessibleSelectable.idl \ nsIAccessNode.idl \ diff --git a/accessible/public/nsPIAccessibleDocument.idl b/accessible/public/nsPIAccessibleDocument.idl deleted file mode 100644 index b94ed7c65fea..000000000000 --- a/accessible/public/nsPIAccessibleDocument.idl +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2003 - * the Initial Developer. All Rights Reserved. - * - * Original Author: Aaron Leventhal (aaronl@netscape.com) - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nsISupports.idl" - -interface nsIAccessNode; -interface nsIContent; - -[uuid(fa9cafac-9562-49ad-afcf-911ab1e4e4fb)] - -interface nsPIAccessibleDocument : nsISupports -{ - /** - * Find the accessible object in the accessibility cache that - * corresponds to aStartNode or the first ancestor of aStartNode - * that has an accessible object associated with it. - * Clear that accessible object's parent's cache of accessible children and - * and remove the accessible object and any decendents from the accessible cache. - * New accessible objects will be created and cached again on demand. - * @param aChangeContent The child that is changing - * @param aEvent The event from nsIAccessibleEvent that caused the change: - * Must be one of: EVENT_REORDER (change), - * EVENT_SHOW (make visible or create) or - * EVENT_HIDE (destroy or hide) - */ - void invalidateCacheSubtree(in nsIContent aChangeContent, - in PRUint32 aChangeEvent); - void cacheAccessNode(in voidPtr aUniqueID, in nsIAccessNode aAccessNode); - void flushPendingEvents(); - void fireDocLoadEvents(in PRUint32 aEventType); - void fireAnchorJumpEvent(); -}; diff --git a/accessible/src/base/nsAccUtils.cpp b/accessible/src/base/nsAccUtils.cpp index f00ad4674acd..15eb09e95c76 100644 --- a/accessible/src/base/nsAccUtils.cpp +++ b/accessible/src/base/nsAccUtils.cpp @@ -45,6 +45,7 @@ #include "nsAccessibleEventData.h" #include "nsHyperTextAccessible.h" #include "nsHTMLTableAccessible.h" +#include "nsDocAccessible.h" #include "nsAccessibilityAtoms.h" #include "nsAccessibleTreeWalker.h" #include "nsAccessible.h" @@ -747,6 +748,26 @@ nsAccUtils::QueryAccessibleTable(nsIAccessibleTable *aAccessibleTable) return accessible; } +already_AddRefed +nsAccUtils::QueryAccessibleDocument(nsIAccessible *aAccessible) +{ + nsDocAccessible* accessible = nsnull; + if (aAccessible) + CallQueryInterface(aAccessible, &accessible); + + return accessible; +} + +already_AddRefed +nsAccUtils::QueryAccessibleDocument(nsIAccessibleDocument *aAccessibleDocument) +{ + nsDocAccessible* accessible = nsnull; + if (aAccessibleDocument) + CallQueryInterface(aAccessibleDocument, &accessible); + + return accessible; +} + #ifdef DEBUG_A11Y PRBool diff --git a/accessible/src/base/nsAccUtils.h b/accessible/src/base/nsAccUtils.h index 96bcb6236df9..31e7b528ec5d 100644 --- a/accessible/src/base/nsAccUtils.h +++ b/accessible/src/base/nsAccUtils.h @@ -55,6 +55,7 @@ class nsAccessNode; class nsAccessible; class nsHTMLTableAccessible; +class nsDocAccessible; class nsAccUtils { @@ -340,7 +341,19 @@ public: */ static already_AddRefed QueryAccessibleTable(nsIAccessibleTable *aAccessibleTable); - + + /** + * Query nsDocAccessible from the given nsIAccessible. + */ + static already_AddRefed + QueryAccessibleDocument(nsIAccessible *aAccessible); + + /** + * Query nsDocAccessible from the given nsIAccessibleDocument. + */ + static already_AddRefed + QueryAccessibleDocument(nsIAccessibleDocument *aAccessibleDocument); + #ifdef DEBUG_A11Y /** * Detect whether the given accessible object implements nsIAccessibleText, diff --git a/accessible/src/base/nsAccessNode.cpp b/accessible/src/base/nsAccessNode.cpp index 5afe85fe49ff..e8d3c59f0691 100644 --- a/accessible/src/base/nsAccessNode.cpp +++ b/accessible/src/base/nsAccessNode.cpp @@ -42,7 +42,6 @@ #include "nsHashtable.h" #include "nsIAccessibilityService.h" #include "nsIAccessibleDocument.h" -#include "nsPIAccessibleDocument.h" #include "nsIDocShell.h" #include "nsIDocShellTreeItem.h" #include "nsIDocument.h" @@ -192,10 +191,10 @@ nsAccessNode::Init() void* uniqueID; GetUniqueID(&uniqueID); - nsCOMPtr privateDocAccessible = - do_QueryInterface(docAccessible); - NS_ASSERTION(privateDocAccessible, "No private docaccessible for docaccessible"); - privateDocAccessible->CacheAccessNode(uniqueID, this); + nsRefPtr docAcc = + nsAccUtils::QueryAccessibleDocument(docAccessible); + NS_ASSERTION(docAcc, "No nsDocAccessible for document accessible!"); + docAcc->CacheAccessNode(uniqueID, this); // Make sure an ancestor in real content is cached // so that nsDocAccessible::RefreshNodes() can find the anonymous subtree to release when diff --git a/accessible/src/base/nsAccessibilityAtoms.h b/accessible/src/base/nsAccessibilityAtoms.h index ae5b93d53932..8dacce2aadfe 100644 --- a/accessible/src/base/nsAccessibilityAtoms.h +++ b/accessible/src/base/nsAccessibilityAtoms.h @@ -43,8 +43,7 @@ * This class wraps up the creation (and destruction) of the standard * set of atoms used in the accessibility module. These objects * are created when the are needed by accessibility is being used and they - * are destroyed when the last nsRootAccessible is destroyed via - * nsRootAccessible::ShutdownAll() + * are destroyed when the last nsRootAccessible is destroyed. */ class nsAccessibilityAtoms { diff --git a/accessible/src/base/nsAccessibilityService.cpp b/accessible/src/base/nsAccessibilityService.cpp index 516bb5f58882..4cebad4ac760 100644 --- a/accessible/src/base/nsAccessibilityService.cpp +++ b/accessible/src/base/nsAccessibilityService.cpp @@ -242,9 +242,11 @@ NS_IMETHODIMP nsAccessibilityService::ProcessDocLoadEvent(nsITimer *aTimer, void nsCOMPtr accessible; GetAccessibleFor(docNode, getter_AddRefs(accessible)); - nsCOMPtr privDocAccessible = do_QueryInterface(accessible); - NS_ENSURE_STATE(privDocAccessible); - privDocAccessible->FireDocLoadEvents(aEventType); + nsRefPtr docAcc = + nsAccUtils::QueryAccessibleDocument(accessible); + NS_ENSURE_STATE(docAcc); + + docAcc->FireDocLoadEvents(aEventType); return NS_OK; } @@ -307,12 +309,12 @@ NS_IMETHODIMP nsAccessibilityService::OnLocationChange(nsIWebProgress *aWebProgr nsCOMPtr accessibleDoc = nsAccessNode::GetDocAccessibleFor(domDocRootNode); - nsCOMPtr privateAccessibleDoc = - do_QueryInterface(accessibleDoc); - if (!privateAccessibleDoc) { - return NS_OK; - } - return privateAccessibleDoc->FireAnchorJumpEvent(); + nsRefPtr docAcc = + nsAccUtils::QueryAccessibleDocument(accessibleDoc); + if (docAcc) + docAcc->FireAnchorJumpEvent(); + + return NS_OK; } /* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ @@ -2040,12 +2042,12 @@ NS_IMETHODIMP nsAccessibilityService::InvalidateSubtreeFor(nsIPresShell *aShell, NS_ENSURE_ARG_POINTER(aShell); nsCOMPtr accessibleDoc = nsAccessNode::GetDocAccessibleFor(aShell->GetDocument()); - nsCOMPtr privateAccessibleDoc = - do_QueryInterface(accessibleDoc); - if (!privateAccessibleDoc) { - return NS_OK; - } - return privateAccessibleDoc->InvalidateCacheSubtree(aChangeContent, aEvent); + nsRefPtr docAcc = + nsAccUtils::QueryAccessibleDocument(accessibleDoc); + if (docAcc) + docAcc->InvalidateCacheSubtree(aChangeContent, aEvent); + + return NS_OK; } ////////////////////////////////////////////////////////////////////// diff --git a/accessible/src/base/nsDocAccessible.cpp b/accessible/src/base/nsDocAccessible.cpp index 14833d161490..a98bc055d50f 100644 --- a/accessible/src/base/nsDocAccessible.cpp +++ b/accessible/src/base/nsDocAccessible.cpp @@ -150,6 +150,18 @@ ElementTraverser(const void *aKey, nsIAccessNode *aAccessNode, return PL_DHASH_NEXT; } +// What we want is: NS_INTERFACE_MAP_ENTRY(self) for static IID accessors, +// but some of our classes have an ambiguous base class of nsISupports which +// prevents this from working (the default macro converts it to nsISupports, +// then addrefs it, then returns it). Therefore, we expand the macro here and +// change it so that it works. Yuck. +#define NS_INTERFACE_MAP_STATIC_AMBIGUOUS(_class) \ + if (aIID.Equals(NS_GET_IID(_class))) { \ + NS_ADDREF(this); \ + *aInstancePtr = this; \ + return NS_OK; \ + } else + NS_IMPL_CYCLE_COLLECTION_CLASS(nsDocAccessible) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDocAccessible, nsAccessible) @@ -163,14 +175,14 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDocAccessible, nsAccessible) NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDocAccessible) + NS_INTERFACE_MAP_STATIC_AMBIGUOUS(nsDocAccessible) NS_INTERFACE_MAP_ENTRY(nsIAccessibleDocument) - NS_INTERFACE_MAP_ENTRY(nsPIAccessibleDocument) NS_INTERFACE_MAP_ENTRY(nsIDocumentObserver) NS_INTERFACE_MAP_ENTRY(nsIMutationObserver) NS_INTERFACE_MAP_ENTRY(nsIScrollPositionListener) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAccessibleDocument) NS_INTERFACE_MAP_ENTRY(nsIObserver) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAccessibleDocument) NS_INTERFACE_MAP_END_INHERITING(nsHyperTextAccessible) NS_IMPL_ADDREF_INHERITED(nsDocAccessible, nsHyperTextAccessible) @@ -553,7 +565,7 @@ NS_IMETHODIMP nsDocAccessible::GetCachedAccessNode(void *aUniqueID, nsIAccessNod return NS_OK; } -NS_IMETHODIMP +void nsDocAccessible::CacheAccessNode(void *aUniqueID, nsIAccessNode *aAccessNode) { // If there is an access node for the given unique ID then let's shutdown it. @@ -568,7 +580,6 @@ nsDocAccessible::CacheAccessNode(void *aUniqueID, nsIAccessNode *aAccessNode) } PutCacheEntry(mAccessNodeCache, aUniqueID, aAccessNode); - return NS_OK; } NS_IMETHODIMP nsDocAccessible::GetParent(nsIAccessible **aParent) @@ -692,6 +703,15 @@ nsDocAccessible::GetFrame() return root; } +PRBool +nsDocAccessible::IsDefunct() +{ + if (nsHyperTextAccessibleWrap::IsDefunct()) + return PR_TRUE; + + return !mDocument; +} + void nsDocAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aRelativeFrame) { *aRelativeFrame = GetFrame(); @@ -822,11 +842,12 @@ nsresult nsDocAccessible::RemoveEventListeners() return NS_OK; } -NS_IMETHODIMP nsDocAccessible::FireAnchorJumpEvent() +void +nsDocAccessible::FireAnchorJumpEvent() { - if (!mIsContentLoaded || !mDocument) { - return NS_OK; - } + if (!mIsContentLoaded || !mDocument) + return; + nsCOMPtr container = mDocument->GetContainer(); nsCOMPtr webNav(do_GetInterface(container)); nsCAutoString theURL; @@ -854,15 +875,13 @@ NS_IMETHODIMP nsDocAccessible::FireAnchorJumpEvent() mIsAnchorJumped = PR_TRUE; lastAnchor.Assign(currentAnchor); } - - return NS_OK; } -NS_IMETHODIMP nsDocAccessible::FireDocLoadEvents(PRUint32 aEventType) +void +nsDocAccessible::FireDocLoadEvents(PRUint32 aEventType) { - if (!mDocument || !mWeakShell) { - return NS_OK; // Document has been shut down - } + if (IsDefunct()) + return; PRBool isFinished = (aEventType == nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE || @@ -871,15 +890,16 @@ NS_IMETHODIMP nsDocAccessible::FireDocLoadEvents(PRUint32 aEventType) mIsContentLoaded = isFinished; if (isFinished) { if (mIsLoadCompleteFired) - return NS_OK; + return; + mIsLoadCompleteFired = PR_TRUE; } nsCOMPtr treeItem = nsCoreUtils::GetDocShellTreeItemFor(mDOMNode); - if (!treeItem) { - return NS_OK; - } + if (!treeItem) + return; + nsCOMPtr sameTypeRoot; treeItem->GetSameTypeRootTreeItem(getter_AddRefs(sameTypeRoot)); @@ -928,7 +948,6 @@ NS_IMETHODIMP nsDocAccessible::FireDocLoadEvents(PRUint32 aEventType) nsAccUtils::FireAccEvent(aEventType, this); } - return NS_OK; } void nsDocAccessible::ScrollTimerCallback(nsITimer *aTimer, void *aClosure) @@ -1569,14 +1588,14 @@ nsDocAccessible::FireDelayedAccessibleEvent(nsIAccessibleEvent *aEvent) // so that event gets fired via FlushEventsCallback NS_ADDREF_THIS(); // Kung fu death grip to prevent crash in callback mFireEventTimer->InitWithFuncCallback(FlushEventsCallback, - static_cast(this), - 0, nsITimer::TYPE_ONE_SHOT); + this, 0, nsITimer::TYPE_ONE_SHOT); } return NS_OK; } -NS_IMETHODIMP nsDocAccessible::FlushPendingEvents() +void +nsDocAccessible::FlushPendingEvents() { mInFlushPendingEvents = PR_TRUE; PRUint32 length = mEventsToFire.Count(); @@ -1685,12 +1704,12 @@ NS_IMETHODIMP nsDocAccessible::FlushPendingEvents() if (accessible) { if (eventType == nsIAccessibleEvent::EVENT_INTERNAL_LOAD) { - nsCOMPtr docAccessible = - do_QueryInterface(accessible); - NS_ASSERTION(docAccessible, "No doc accessible for doc load event"); - if (docAccessible) { - docAccessible->FireDocLoadEvents(nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE); - } + nsRefPtr docAcc = + nsAccUtils::QueryAccessibleDocument(accessible); + NS_ASSERTION(docAcc, "No doc accessible for doc load event"); + + if (docAcc) + docAcc->FireDocLoadEvents(nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE); } else if (eventType == nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED) { nsCOMPtr accessibleText = do_QueryInterface(accessible); @@ -1759,12 +1778,11 @@ NS_IMETHODIMP nsDocAccessible::FlushPendingEvents() nsAccEvent::ResetLastInputState(); mInFlushPendingEvents = PR_FALSE; - return NS_OK; } void nsDocAccessible::FlushEventsCallback(nsITimer *aTimer, void *aClosure) { - nsPIAccessibleDocument *accessibleDoc = static_cast(aClosure); + nsDocAccessible *accessibleDoc = static_cast(aClosure); NS_ASSERTION(accessibleDoc, "How did we get here without an accessible document?"); if (accessibleDoc) { // A lot of crashes were happening here, so now we're reffing the doc @@ -1880,8 +1898,9 @@ void nsDocAccessible::RefreshNodes(nsIDOMNode *aStartNode) mAccessNodeCache.Remove(uniqueID); } -NS_IMETHODIMP nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild, - PRUint32 aChangeEventType) +void +nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild, + PRUint32 aChangeEventType) { PRBool isHiding = aChangeEventType == nsIAccessibleEvent::EVENT_ASYNCH_HIDE || @@ -1908,11 +1927,12 @@ NS_IMETHODIMP nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild, // instead of just the accessible tree, although that would be faster // Otherwise we might miss the nsAccessNode's that are not nsAccessible's. - NS_ENSURE_TRUE(mDOMNode, NS_ERROR_FAILURE); + NS_ENSURE_TRUE(mDOMNode,); + nsCOMPtr childNode = aChild ? do_QueryInterface(aChild) : mDOMNode; nsCOMPtr presShell = GetPresShell(); - NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE); + NS_ENSURE_TRUE(presShell,); if (!mIsContentLoaded) { // Still loading document @@ -1925,10 +1945,12 @@ NS_IMETHODIMP nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild, // Leave early, and ensure mAccChildCount stays uninitialized instead of 0, // which it is if anyone asks for its children right now. InvalidateChildren(); - return NS_OK; + return; } + nsIEventStateManager *esm = presShell->GetPresContext()->EventStateManager(); - NS_ENSURE_TRUE(esm, NS_ERROR_FAILURE); + NS_ENSURE_TRUE(esm,); + if (!esm->IsHandlingUserInputExternal()) { // Changes during page load, but not caused by user input // Just invalidate accessible hierarchy and return, @@ -1942,7 +1964,7 @@ NS_IMETHODIMP nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild, nsRefPtr containerAcc = nsAccUtils::QueryAccessible(containerAccessible); containerAcc->InvalidateChildren(); - return NS_OK; + return; } // else: user input, so we must fall through and for full handling, // e.g. fire the mutation events. Note: user input could cause DOM_CREATE @@ -1998,7 +2020,7 @@ NS_IMETHODIMP nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild, // This often happens when visibility is cleared for node, // which hides an entire subtree -- we get notified for each // node in the subtree and need to collate the hide events ourselves. - return NS_OK; + return; } } } @@ -2010,7 +2032,8 @@ NS_IMETHODIMP nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild, // Fire an event if the accessible existed for node being hidden, otherwise // for the first line accessible descendants. Fire before the accessible(s) away. nsresult rv = FireShowHideEvents(childNode, PR_FALSE, removalEventType, PR_TRUE, PR_FALSE); - NS_ENSURE_SUCCESS(rv, rv); + NS_ENSURE_SUCCESS(rv,); + if (childNode != mDOMNode) { // Fire text change unless the node being removed is for this doc // When a node is hidden or removed, the text in an ancestor hyper text will lose characters // At this point we still have the frame and accessible for this node if there was one @@ -2102,11 +2125,9 @@ NS_IMETHODIMP nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild, new nsAccReorderEvent(containerAccessible, isAsynch, isUnconditionalEvent, aChild ? childNode.get() : nsnull); - NS_ENSURE_TRUE(reorderEvent, NS_ERROR_OUT_OF_MEMORY); + NS_ENSURE_TRUE(reorderEvent,); FireDelayedAccessibleEvent(reorderEvent); - - return NS_OK; } NS_IMETHODIMP diff --git a/accessible/src/base/nsDocAccessible.h b/accessible/src/base/nsDocAccessible.h index 40d82055931c..a2b9154d9bc2 100644 --- a/accessible/src/base/nsDocAccessible.h +++ b/accessible/src/base/nsDocAccessible.h @@ -41,7 +41,6 @@ #include "nsHyperTextAccessibleWrap.h" #include "nsIAccessibleDocument.h" -#include "nsPIAccessibleDocument.h" #include "nsIDocument.h" #include "nsIDocumentObserver.h" #include "nsIEditor.h" @@ -56,9 +55,16 @@ class nsIScrollableView; const PRUint32 kDefaultCacheSize = 256; +#define NS_DOCACCESSIBLE_IMPL_CID \ +{ /* 0ed1be1d-52a7-4bfd-b4f5-0de7caed4617 */ \ + 0x0ed1be1d, \ + 0x52a7, \ + 0x4bfd, \ + { 0xb4, 0xf5, 0x0d, 0xe7, 0xca, 0xed, 0x46, 0x17 } \ +} + class nsDocAccessible : public nsHyperTextAccessibleWrap, public nsIAccessibleDocument, - public nsPIAccessibleDocument, public nsIDocumentObserver, public nsIObserver, public nsIScrollPositionListener, @@ -68,73 +74,119 @@ class nsDocAccessible : public nsHyperTextAccessibleWrap, NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDocAccessible, nsAccessible) NS_DECL_NSIACCESSIBLEDOCUMENT - NS_DECL_NSPIACCESSIBLEDOCUMENT + NS_DECLARE_STATIC_IID_ACCESSOR(NS_DOCACCESSIBLE_IMPL_CID) + NS_DECL_NSIOBSERVER - public: - nsDocAccessible(nsIDOMNode *aNode, nsIWeakReference* aShell); - virtual ~nsDocAccessible(); +public: + nsDocAccessible(nsIDOMNode *aNode, nsIWeakReference* aShell); + virtual ~nsDocAccessible(); - // nsIAccessible - NS_IMETHOD GetName(nsAString& aName); - NS_IMETHOD GetDescription(nsAString& aDescription); - NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes); - NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild); - NS_IMETHOD GetParent(nsIAccessible **aParent); - NS_IMETHOD TakeFocus(void); + // nsIAccessible + NS_IMETHOD GetName(nsAString& aName); + NS_IMETHOD GetDescription(nsAString& aDescription); + NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes); + NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild); + NS_IMETHOD GetParent(nsIAccessible **aParent); + NS_IMETHOD TakeFocus(void); - // ----- nsIScrollPositionListener --------------------------- - NS_IMETHOD ScrollPositionWillChange(nsIScrollableView *aView, nscoord aX, nscoord aY); - virtual void ViewPositionDidChange(nsIScrollableView* aScrollable) {} - NS_IMETHOD ScrollPositionDidChange(nsIScrollableView *aView, nscoord aX, nscoord aY); + // nsIScrollPositionListener + NS_IMETHOD ScrollPositionWillChange(nsIScrollableView *aView, + nscoord aX, nscoord aY); + virtual void ViewPositionDidChange(nsIScrollableView* aScrollable) {} + NS_IMETHOD ScrollPositionDidChange(nsIScrollableView *aView, + nscoord aX, nscoord aY); - // nsIDocumentObserver - NS_DECL_NSIDOCUMENTOBSERVER + // nsIDocumentObserver + NS_DECL_NSIDOCUMENTOBSERVER - static void FlushEventsCallback(nsITimer *aTimer, void *aClosure); + // nsAccessNode + virtual nsresult Init(); + virtual nsresult Shutdown(); + virtual nsIFrame* GetFrame(); + virtual PRBool IsDefunct(); - // nsAccessNode - virtual nsresult Init(); - virtual nsresult Shutdown(); - virtual nsIFrame* GetFrame(); - - // nsAccessible + // nsAccessible virtual nsresult GetRoleInternal(PRUint32 *aRole); virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState); virtual nsresult GetARIAState(PRUint32 *aState); virtual void SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry); - // nsIAccessibleText - NS_IMETHOD GetAssociatedEditor(nsIEditor **aEditor); + // nsIAccessibleText + NS_IMETHOD GetAssociatedEditor(nsIEditor **aEditor); - /** - * Non-virtual method to fire a delayed event after a 0 length timeout - * - * @param aEvent - the nsIAccessibleEvent event type - * @param aDOMNode - DOM node the accesible event should be fired for - * @param aAllowDupes - eAllowDupes: more than one event of the same type is allowed. - * eCoalesceFromSameSubtree: if two events are in the same subtree, - * only the event on ancestor is used - * eRemoveDupes (default): events of the same type are discarded - * (the last one is used) - * - * @param aIsAsynch - set to PR_TRUE if this is not being called from code - * synchronous with a DOM event - */ - nsresult FireDelayedToolkitEvent(PRUint32 aEvent, nsIDOMNode *aDOMNode, - nsAccEvent::EEventRule aAllowDupes = nsAccEvent::eRemoveDupes, - PRBool aIsAsynch = PR_FALSE); + // nsDocAccessible - /** - * Fire accessible event in timeout. - * - * @param aEvent - the event to fire - */ - nsresult FireDelayedAccessibleEvent(nsIAccessibleEvent *aEvent); + /** + * Non-virtual method to fire a delayed event after a 0 length timeout. + * + * @param aEvent [in] the nsIAccessibleEvent event type + * @param aDOMNode [in] DOM node the accesible event should be fired for + * @param aAllowDupes [in] rule to process an event (see EEventRule constants) + * @param aIsAsynch [in] set to PR_TRUE if this is not being called from + * code synchronous with a DOM event + */ + nsresult FireDelayedToolkitEvent(PRUint32 aEvent, nsIDOMNode *aDOMNode, + nsAccEvent::EEventRule aAllowDupes = nsAccEvent::eRemoveDupes, + PRBool aIsAsynch = PR_FALSE); - void ShutdownChildDocuments(nsIDocShellTreeItem *aStart); + /** + * Fire accessible event after timeout. + * + * @param aEvent [in] the event to fire + */ + nsresult FireDelayedAccessibleEvent(nsIAccessibleEvent *aEvent); + + /** + * Find the accessible object in the accessibility cache that corresponds to + * the given node or the first ancestor of it that has an accessible object + * associated with it. Clear that accessible object's parent's cache of + * accessible children and remove the accessible object and any descendants + * from the accessible cache. Fires proper events. New accessible objects will + * be created and cached again on demand. + * + * @param aContent [in] the child that is changing + * @param aEvent [in] the event from nsIAccessibleEvent that caused + * the change. + */ + void InvalidateCacheSubtree(nsIContent *aContent, PRUint32 aEvent); + + /** + * Cache access node. + * + * @param aUniquID [in] the unique identifier of accessible + * @param aAccessNode [in] accessible to cache + */ + void CacheAccessNode(void *aUniqueID, nsIAccessNode *aAccessNode); + + /** + * Fires pending events. + */ + void FlushPendingEvents(); + + /** + * Fire document load events. + * + * @param aEventType [in] nsIAccessibleEvent constant + */ + virtual void FireDocLoadEvents(PRUint32 aEventType); + + /** + * Process the case when anchor was clicked. + */ + virtual void FireAnchorJumpEvent(); + + /** + * Used to flush pending events, called after timeout. See FlushPendingEvents. + */ + static void FlushEventsCallback(nsITimer *aTimer, void *aClosure); + +protected: + /** + * Iterates through sub documents and shut them down. + */ + void ShutdownChildDocuments(nsIDocShellTreeItem *aStart); - protected: virtual void GetBoundsRect(nsRect& aRect, nsIFrame** aRelativeFrame); virtual nsresult AddEventListeners(); virtual nsresult RemoveEventListeners(); @@ -230,4 +282,7 @@ protected: static nsIAtom *gLastFocusedFrameType; }; +NS_DEFINE_STATIC_IID_ACCESSOR(nsDocAccessible, + NS_DOCACCESSIBLE_IMPL_CID) + #endif diff --git a/accessible/src/base/nsRootAccessible.cpp b/accessible/src/base/nsRootAccessible.cpp index e591b785620e..f2b51bb76011 100644 --- a/accessible/src/base/nsRootAccessible.cpp +++ b/accessible/src/base/nsRootAccessible.cpp @@ -1070,27 +1070,26 @@ nsRootAccessible::GetRelationByType(PRUint32 aRelationType, return NS_OK; } -NS_IMETHODIMP nsRootAccessible::FireDocLoadEvents(PRUint32 aEventType) +void +nsRootAccessible::FireDocLoadEvents(PRUint32 aEventType) { - if (!mDocument || !mWeakShell) { - return NS_OK; // Document has been shut down - } + if (IsDefunct()) + return; nsCOMPtr docShellTreeItem = nsCoreUtils::GetDocShellTreeItemFor(mDOMNode); NS_ASSERTION(docShellTreeItem, "No doc shell tree item for document"); - NS_ENSURE_TRUE(docShellTreeItem, NS_ERROR_FAILURE); + if (!docShellTreeItem) + return; + PRInt32 contentType; docShellTreeItem->GetItemType(&contentType); - if (contentType == nsIDocShellTreeItem::typeContent) { - return nsDocAccessibleWrap::FireDocLoadEvents(aEventType); // Content might need to fire event - } + if (contentType == nsIDocShellTreeItem::typeContent) + nsDocAccessibleWrap::FireDocLoadEvents(aEventType); // Content might need to fire event // Root chrome: don't fire event mIsContentLoaded = (aEventType == nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE || aEventType == nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_STOPPED); - - return NS_OK; } nsresult diff --git a/accessible/src/base/nsRootAccessible.h b/accessible/src/base/nsRootAccessible.h index 89f924f9aaff..d5e79a95048a 100644 --- a/accessible/src/base/nsRootAccessible.h +++ b/accessible/src/base/nsRootAccessible.h @@ -69,33 +69,32 @@ class nsRootAccessible : public nsDocAccessibleWrap, { NS_DECL_ISUPPORTS_INHERITED - public: - nsRootAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell); - virtual ~nsRootAccessible(); +public: + nsRootAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell); + virtual ~nsRootAccessible(); - // nsIAccessible - NS_IMETHOD GetName(nsAString& aName); - NS_IMETHOD GetParent(nsIAccessible * *aParent); - NS_IMETHOD GetRelationByType(PRUint32 aRelationType, - nsIAccessibleRelation **aRelation); + // nsIAccessible + NS_IMETHOD GetName(nsAString& aName); + NS_IMETHOD GetParent(nsIAccessible * *aParent); + NS_IMETHOD GetRelationByType(PRUint32 aRelationType, + nsIAccessibleRelation **aRelation); - // ----- nsPIAccessibleDocument ----------------------- - NS_IMETHOD FireDocLoadEvents(PRUint32 aEventType); + // nsIDOMEventListener + NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent); - // ----- nsIDOMEventListener -------------------------- - NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent); + // nsAccessNode + virtual nsresult Init(); + virtual nsresult Shutdown(); - // nsAccessNode - virtual nsresult Init(); - virtual nsresult Shutdown(); + // nsAccessible + virtual nsresult GetRoleInternal(PRUint32 *aRole); + virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState); - // nsAccessible - virtual nsresult GetRoleInternal(PRUint32 *aRole); - virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState); + // nsDocAccessible + virtual void FireDocLoadEvents(PRUint32 aEventType); - void ShutdownAll(); - - NS_DECLARE_STATIC_IID_ACCESSOR(NS_ROOTACCESSIBLE_IMPL_CID) + // nsRootAccessible + NS_DECLARE_STATIC_IID_ACCESSOR(NS_ROOTACCESSIBLE_IMPL_CID) /** * Fire an accessible focus event for the current focusAccssible diff --git a/accessible/src/msaa/nsDocAccessibleWrap.cpp b/accessible/src/msaa/nsDocAccessibleWrap.cpp index 9efd1e0128fa..01efb9f1e1d8 100644 --- a/accessible/src/msaa/nsDocAccessibleWrap.cpp +++ b/accessible/src/msaa/nsDocAccessibleWrap.cpp @@ -161,7 +161,8 @@ __try { return E_FAIL; } -NS_IMETHODIMP nsDocAccessibleWrap::FireAnchorJumpEvent() +void +nsDocAccessibleWrap::FireAnchorJumpEvent() { // Staying on the same page, jumping to a named anchor // Fire EVENT_SCROLLING_START on first leaf accessible -- because some @@ -171,19 +172,19 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireAnchorJumpEvent() // we have to move forward in the document to get one nsDocAccessible::FireAnchorJumpEvent(); if (!mIsAnchorJumped) - return NS_OK; + return; nsCOMPtr focusNode; if (mIsAnchor) { nsCOMPtr selCon(do_QueryReferent(mWeakShell)); - if (!selCon) { - return NS_OK; - } + if (!selCon) + return; + nsCOMPtr domSel; selCon->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(domSel)); - if (!domSel) { - return NS_OK; - } + if (!domSel) + return; + domSel->GetFocusNode(getter_AddRefs(focusNode)); } else { @@ -193,8 +194,6 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireAnchorJumpEvent() nsCOMPtr accessible = GetFirstAvailableAccessible(focusNode, PR_TRUE); nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_SCROLLING_START, accessible); - - return NS_OK; } STDMETHODIMP nsDocAccessibleWrap::get_URL(/* [out] */ BSTR __RPC_FAR *aURL) diff --git a/accessible/src/msaa/nsDocAccessibleWrap.h b/accessible/src/msaa/nsDocAccessibleWrap.h index 8f61878fa706..6eb658cf8266 100644 --- a/accessible/src/msaa/nsDocAccessibleWrap.h +++ b/accessible/src/msaa/nsDocAccessibleWrap.h @@ -92,7 +92,7 @@ public: /* [optional][in] */ VARIANT varChild, /* [retval][out] */ BSTR __RPC_FAR *pszValue); - NS_IMETHOD FireAnchorJumpEvent(); + virtual void FireAnchorJumpEvent(); }; #endif From a54cd9869db3193c65b1cace80fe2bc51fccc809 Mon Sep 17 00:00:00 2001 From: Alexander Surkov Date: Thu, 25 Jun 2009 10:12:38 +0800 Subject: [PATCH 14/70] Bug 499653 - unify ARIA state attributes mapping rules, r=marcoz, davidb --- accessible/src/base/nsARIAMap.cpp | 460 ++++++++++++------ accessible/src/base/nsARIAMap.h | 209 ++++++-- accessible/src/base/nsAccessible.cpp | 87 +--- accessible/src/base/nsAccessible.h | 4 +- accessible/src/base/nsDocAccessible.cpp | 6 +- accessible/src/base/nsDocAccessible.h | 2 +- .../src/xul/nsXULFormControlAccessible.cpp | 12 + .../src/xul/nsXULFormControlAccessible.h | 1 + accessible/tests/mochitest/common.js | 13 +- accessible/tests/mochitest/states.js | 102 +++- .../mochitest/test_aria_token_attrs.html | 302 ++++++++++-- accessible/tests/mochitest/test_states.html | 34 +- 12 files changed, 881 insertions(+), 351 deletions(-) diff --git a/accessible/src/base/nsARIAMap.cpp b/accessible/src/base/nsARIAMap.cpp index 9aef8ad07d0d..69579d8c50c1 100644 --- a/accessible/src/base/nsARIAMap.cpp +++ b/accessible/src/base/nsARIAMap.cpp @@ -54,9 +54,7 @@ * * There are no nsIAccessibleRole enums for the following landmark roles: * banner, contentinfo, main, navigation, note, search, secondary, seealso, breadcrumbs - */ - -static const nsStateMapEntry kEndEntry = {nsnull, 0, 0}; // To fill in array of state mappings + */ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = { @@ -67,8 +65,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eNoAction, eNoLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }, { "alertdialog", @@ -77,8 +74,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eNoAction, eNoLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }, { "application", @@ -87,8 +83,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eNoAction, eNoLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }, { "article", @@ -97,8 +92,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eNoAction, eNoLiveAttr, - nsIAccessibleStates::STATE_READONLY, - kEndEntry + nsIAccessibleStates::STATE_READONLY }, { "button", @@ -108,9 +102,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eClickAction, eNoLiveAttr, kNoReqStates, - {&nsAccessibilityAtoms::aria_pressed, kBoolState, nsIAccessibleStates::STATE_PRESSED | nsIAccessibleStates::STATE_CHECKABLE}, - {&nsAccessibilityAtoms::aria_pressed, "mixed", nsIAccessibleStates::STATE_MIXED | nsIAccessibleStates::STATE_CHECKABLE}, - kEndEntry + eARIAPressed }, { "checkbox", @@ -119,11 +111,9 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eCheckUncheckAction, eNoLiveAttr, - nsIAccessibleStates::STATE_CHECKABLE, - {&nsAccessibilityAtoms::aria_checked, kBoolState, nsIAccessibleStates::STATE_CHECKED}, - {&nsAccessibilityAtoms::aria_checked, "mixed", nsIAccessibleStates::STATE_MIXED}, - {&nsAccessibilityAtoms::aria_readonly, kBoolState, nsIAccessibleStates::STATE_READONLY}, - kEndEntry + kNoReqStates, + eARIACheckableMixed, + eARIAReadonly }, { "columnheader", @@ -133,10 +123,8 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eSortAction, eNoLiveAttr, kNoReqStates, - {&nsAccessibilityAtoms::aria_selected, kBoolState, nsIAccessibleStates::STATE_SELECTED | nsIAccessibleStates::STATE_SELECTABLE}, - {&nsAccessibilityAtoms::aria_selected, "false", nsIAccessibleStates::STATE_SELECTABLE}, - {&nsAccessibilityAtoms::aria_readonly, kBoolState, nsIAccessibleStates::STATE_READONLY}, - kEndEntry + eARIASelected, + eARIAReadonly }, { "combobox", @@ -146,9 +134,8 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eOpenCloseAction, eNoLiveAttr, nsIAccessibleStates::STATE_COLLAPSED | nsIAccessibleStates::STATE_HASPOPUP, - // Manually map EXT_STATE_SUPPORTS_AUTOCOMPLETION aria-autocomplete - {&nsAccessibilityAtoms::aria_readonly, kBoolState, nsIAccessibleStates::STATE_READONLY}, - kEndEntry + eARIAAutoComplete, + eARIAReadonly }, { "dialog", @@ -157,8 +144,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eNoAction, eNoLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }, { "document", @@ -167,8 +153,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eNoAction, eNoLiveAttr, - nsIAccessibleStates::STATE_READONLY, - kEndEntry + nsIAccessibleStates::STATE_READONLY }, { "grid", @@ -178,9 +163,8 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoAction, eNoLiveAttr, nsIAccessibleStates::STATE_FOCUSABLE, - {&nsAccessibilityAtoms::aria_multiselectable, kBoolState, nsIAccessibleStates::STATE_MULTISELECTABLE | nsIAccessibleStates::STATE_EXTSELECTABLE}, - {&nsAccessibilityAtoms::aria_readonly, kBoolState, nsIAccessibleStates::STATE_READONLY}, - kEndEntry + eARIAMultiSelectable, + eARIAReadonly }, { "gridcell", @@ -190,10 +174,8 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoAction, eNoLiveAttr, kNoReqStates, - {&nsAccessibilityAtoms::aria_selected, kBoolState, nsIAccessibleStates::STATE_SELECTED | nsIAccessibleStates::STATE_SELECTABLE}, - {&nsAccessibilityAtoms::aria_selected, "false", nsIAccessibleStates::STATE_SELECTABLE}, - {&nsAccessibilityAtoms::aria_readonly, kBoolState, nsIAccessibleStates::STATE_READONLY}, - kEndEntry + eARIASelected, + eARIAReadonly }, { "group", @@ -202,8 +184,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eNoAction, eNoLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }, { "heading", @@ -212,8 +193,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eNoAction, eNoLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }, { "img", @@ -222,8 +202,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eNoAction, eNoLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }, { "label", @@ -232,8 +211,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eNoAction, eNoLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }, { "link", @@ -242,8 +220,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eJumpAction, eNoLiveAttr, - nsIAccessibleStates::STATE_LINKED, - kEndEntry + nsIAccessibleStates::STATE_LINKED }, { "list", @@ -253,8 +230,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoAction, eNoLiveAttr, nsIAccessibleStates::STATE_READONLY, - {&nsAccessibilityAtoms::aria_multiselectable, kBoolState, nsIAccessibleStates::STATE_MULTISELECTABLE | nsIAccessibleStates::STATE_EXTSELECTABLE}, - kEndEntry + eARIAMultiSelectable }, { "listbox", @@ -264,9 +240,8 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoAction, eNoLiveAttr, kNoReqStates, - {&nsAccessibilityAtoms::aria_readonly, kBoolState, nsIAccessibleStates::STATE_READONLY}, - {&nsAccessibilityAtoms::aria_multiselectable, kBoolState, nsIAccessibleStates::STATE_MULTISELECTABLE | nsIAccessibleStates::STATE_EXTSELECTABLE}, - kEndEntry + eARIAMultiSelectable, + eARIAReadonly }, { "listitem", @@ -276,12 +251,8 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoAction, // XXX: should depend on state, parent accessible eNoLiveAttr, nsIAccessibleStates::STATE_READONLY, - {&nsAccessibilityAtoms::aria_selected, kBoolState, nsIAccessibleStates::STATE_SELECTED | nsIAccessibleStates::STATE_SELECTABLE}, - {&nsAccessibilityAtoms::aria_selected, "false", nsIAccessibleStates::STATE_SELECTABLE}, - {&nsAccessibilityAtoms::aria_checked, kBoolState, nsIAccessibleStates::STATE_CHECKED | nsIAccessibleStates::STATE_CHECKABLE}, - {&nsAccessibilityAtoms::aria_checked, "mixed", nsIAccessibleStates::STATE_MIXED | nsIAccessibleStates::STATE_CHECKABLE}, - {&nsAccessibilityAtoms::aria_checked, "false", nsIAccessibleStates::STATE_CHECKABLE}, - kEndEntry + eARIASelected, + eARIACheckedMixed }, { "log", @@ -290,8 +261,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eNoAction, ePoliteLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }, { "marquee", @@ -300,8 +270,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eNoAction, eOffLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }, { "math", @@ -310,8 +279,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eNoAction, eNoLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }, { "menu", @@ -321,8 +289,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoAction, // XXX: technically accessibles of menupopup role haven't // any action, but menu can be open or close. eNoLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }, { "menubar", @@ -331,8 +298,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eNoAction, eNoLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }, { "menuitem", @@ -342,10 +308,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eClickAction, eNoLiveAttr, kNoReqStates, - {&nsAccessibilityAtoms::aria_checked, kBoolState, nsIAccessibleStates::STATE_CHECKED | nsIAccessibleStates::STATE_CHECKABLE}, - {&nsAccessibilityAtoms::aria_checked, "mixed", nsIAccessibleStates::STATE_MIXED | nsIAccessibleStates::STATE_CHECKABLE}, - {&nsAccessibilityAtoms::aria_checked, "false", nsIAccessibleStates::STATE_CHECKABLE}, - kEndEntry + eARIACheckedMixed }, { "menuitemcheckbox", @@ -354,10 +317,8 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eClickAction, eNoLiveAttr, - nsIAccessibleStates::STATE_CHECKABLE, - {&nsAccessibilityAtoms::aria_checked, kBoolState, nsIAccessibleStates::STATE_CHECKED }, - {&nsAccessibilityAtoms::aria_checked, "mixed", nsIAccessibleStates::STATE_MIXED}, - kEndEntry + kNoReqStates, + eARIACheckableMixed }, { "menuitemradio", @@ -366,9 +327,8 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eClickAction, eNoLiveAttr, - nsIAccessibleStates::STATE_CHECKABLE, - {&nsAccessibilityAtoms::aria_checked, kBoolState, nsIAccessibleStates::STATE_CHECKED }, - kEndEntry + kNoReqStates, + eARIACheckableBool }, { "option", @@ -378,12 +338,8 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eSelectAction, eNoLiveAttr, kNoReqStates, - {&nsAccessibilityAtoms::aria_selected, kBoolState, nsIAccessibleStates::STATE_SELECTED | nsIAccessibleStates::STATE_SELECTABLE}, - {&nsAccessibilityAtoms::aria_selected, "false", nsIAccessibleStates::STATE_SELECTABLE}, - {&nsAccessibilityAtoms::aria_checked, kBoolState, nsIAccessibleStates::STATE_CHECKED | nsIAccessibleStates::STATE_CHECKABLE}, - {&nsAccessibilityAtoms::aria_checked, "mixed", nsIAccessibleStates::STATE_MIXED | nsIAccessibleStates::STATE_CHECKABLE}, - {&nsAccessibilityAtoms::aria_checked, "false", nsIAccessibleStates::STATE_CHECKABLE}, - kEndEntry + eARIASelected, + eARIACheckedMixed }, { "presentation", @@ -392,8 +348,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eNoAction, eNoLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }, { "progressbar", @@ -402,8 +357,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eHasValueMinMax, eNoAction, eNoLiveAttr, - nsIAccessibleStates::STATE_READONLY, - kEndEntry + nsIAccessibleStates::STATE_READONLY }, { "radio", @@ -412,9 +366,8 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eSelectAction, eNoLiveAttr, - nsIAccessibleStates::STATE_CHECKABLE, - {&nsAccessibilityAtoms::aria_checked, kBoolState, nsIAccessibleStates::STATE_CHECKED}, - kEndEntry + kNoReqStates, + eARIACheckableBool }, { "radiogroup", @@ -423,8 +376,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eNoAction, eNoLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }, { "region", @@ -433,8 +385,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eNoAction, eNoLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }, { "row", @@ -444,9 +395,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoAction, eNoLiveAttr, kNoReqStates, - {&nsAccessibilityAtoms::aria_selected, kBoolState, nsIAccessibleStates::STATE_SELECTED | nsIAccessibleStates::STATE_SELECTABLE}, - {&nsAccessibilityAtoms::aria_selected, "false", nsIAccessibleStates::STATE_SELECTABLE}, - kEndEntry + eARIASelected }, { "rowheader", @@ -456,10 +405,8 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eSortAction, eNoLiveAttr, kNoReqStates, - {&nsAccessibilityAtoms::aria_selected, kBoolState, nsIAccessibleStates::STATE_SELECTED | nsIAccessibleStates::STATE_SELECTABLE}, - {&nsAccessibilityAtoms::aria_selected, "false", nsIAccessibleStates::STATE_SELECTABLE}, - {&nsAccessibilityAtoms::aria_readonly, kBoolState, nsIAccessibleStates::STATE_READONLY}, - kEndEntry + eARIASelected, + eARIAReadonly }, { "section", @@ -468,8 +415,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eNoAction, eNoLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }, { "separator", @@ -478,8 +424,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eNoAction, eNoLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }, { "slider", @@ -489,8 +434,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoAction, eNoLiveAttr, kNoReqStates, - {&nsAccessibilityAtoms::aria_readonly, kBoolState, nsIAccessibleStates::STATE_READONLY}, - kEndEntry + eARIAReadonly }, { "spinbutton", @@ -500,8 +444,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoAction, eNoLiveAttr, kNoReqStates, - {&nsAccessibilityAtoms::aria_readonly, kBoolState, nsIAccessibleStates::STATE_READONLY}, - kEndEntry + eARIAReadonly }, { "status", @@ -510,8 +453,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eNoAction, ePoliteLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }, { "tab", @@ -520,8 +462,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eSwitchAction, eNoLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }, { "tablist", @@ -530,8 +471,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eNoAction, ePoliteLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }, { "tabpanel", @@ -540,8 +480,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eNoAction, eNoLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }, { "textbox", @@ -551,12 +490,9 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eActivateAction, eNoLiveAttr, kNoReqStates, - // Manually map EXT_STATE_SINGLE_LINE and EXT_STATE_MULTI_LINE FROM aria-multiline - // Manually map EXT_STATE_SUPPORTS_AUTOCOMPLETION aria-autocomplete - {&nsAccessibilityAtoms::aria_autocomplete, "list", nsIAccessibleStates::STATE_HASPOPUP}, - {&nsAccessibilityAtoms::aria_autocomplete, "both", nsIAccessibleStates::STATE_HASPOPUP}, - {&nsAccessibilityAtoms::aria_readonly, kBoolState, nsIAccessibleStates::STATE_READONLY}, - kEndEntry + eARIAAutoComplete, + eARIAMultiline, + eARIAReadonlyOrEditable }, { "timer", @@ -565,8 +501,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eNoAction, eOffLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }, { "toolbar", @@ -575,8 +510,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eNoAction, eNoLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }, { "tooltip", @@ -585,8 +519,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoValue, eNoAction, eNoLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }, { "tree", @@ -596,9 +529,8 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoAction, eNoLiveAttr, kNoReqStates, - {&nsAccessibilityAtoms::aria_readonly, kBoolState, nsIAccessibleStates::STATE_READONLY}, - {&nsAccessibilityAtoms::aria_multiselectable, kBoolState, nsIAccessibleStates::STATE_MULTISELECTABLE | nsIAccessibleStates::STATE_EXTSELECTABLE}, - kEndEntry + eARIAReadonly, + eARIAMultiSelectable }, { "treegrid", @@ -608,9 +540,8 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = eNoAction, eNoLiveAttr, kNoReqStates, - {&nsAccessibilityAtoms::aria_readonly, kBoolState, nsIAccessibleStates::STATE_READONLY}, - {&nsAccessibilityAtoms::aria_multiselectable, kBoolState, nsIAccessibleStates::STATE_MULTISELECTABLE | nsIAccessibleStates::STATE_EXTSELECTABLE}, - kEndEntry + eARIAReadonly, + eARIAMultiSelectable }, { "treeitem", @@ -621,12 +552,8 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = // on states eNoLiveAttr, kNoReqStates, - {&nsAccessibilityAtoms::aria_selected, kBoolState, nsIAccessibleStates::STATE_SELECTED | nsIAccessibleStates::STATE_SELECTABLE}, - {&nsAccessibilityAtoms::aria_selected, "false", nsIAccessibleStates::STATE_SELECTABLE}, - {&nsAccessibilityAtoms::aria_checked, kBoolState, nsIAccessibleStates::STATE_CHECKED | nsIAccessibleStates::STATE_CHECKABLE}, - {&nsAccessibilityAtoms::aria_checked, "mixed", nsIAccessibleStates::STATE_MIXED | nsIAccessibleStates::STATE_CHECKABLE}, - {&nsAccessibilityAtoms::aria_checked, "false", nsIAccessibleStates::STATE_CHECKABLE}, - kEndEntry + eARIASelected, + eARIACheckedMixed } }; @@ -639,8 +566,7 @@ nsRoleMapEntry nsARIAMap::gLandmarkRoleMap = { eNoValue, eNoAction, eNoLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates }; nsRoleMapEntry nsARIAMap::gEmptyRoleMap = { @@ -650,8 +576,89 @@ nsRoleMapEntry nsARIAMap::gEmptyRoleMap = { eNoValue, eNoAction, eNoLiveAttr, - kNoReqStates, - kEndEntry + kNoReqStates +}; + +nsStateMapEntry nsARIAMap::gWAIStateMap[] = { + // eARIANone + nsStateMapEntry(), + + // eARIAAutoComplete + nsStateMapEntry(&nsAccessibilityAtoms::aria_autocomplete, + "inline", 0, nsIAccessibleStates::EXT_STATE_SUPPORTS_AUTOCOMPLETION, + "list", nsIAccessibleStates::STATE_HASPOPUP, nsIAccessibleStates::EXT_STATE_SUPPORTS_AUTOCOMPLETION, + "both", nsIAccessibleStates::STATE_HASPOPUP, nsIAccessibleStates::EXT_STATE_SUPPORTS_AUTOCOMPLETION), + + // eARIABusy + nsStateMapEntry(&nsAccessibilityAtoms::aria_busy, + "true", nsIAccessibleStates::STATE_BUSY, 0, + "error", nsIAccessibleStates::STATE_INVALID, 0), + + // eARIACheckableBool + nsStateMapEntry(&nsAccessibilityAtoms::aria_checked, kBoolType, + nsIAccessibleStates::STATE_CHECKABLE, + nsIAccessibleStates::STATE_CHECKED, 0, + 0, 0, PR_TRUE), + + // eARIACheckableMixed + nsStateMapEntry(&nsAccessibilityAtoms::aria_checked, kMixedType, + nsIAccessibleStates::STATE_CHECKABLE, + nsIAccessibleStates::STATE_CHECKED, 0, + 0, 0, PR_TRUE), + + // eARIACheckedMixed + nsStateMapEntry(&nsAccessibilityAtoms::aria_checked, kMixedType, + nsIAccessibleStates::STATE_CHECKABLE, + nsIAccessibleStates::STATE_CHECKED, 0), + + // eARIADisabled + nsStateMapEntry(&nsAccessibilityAtoms::aria_disabled, kBoolType, 0, + nsIAccessibleStates::STATE_UNAVAILABLE, 0), + + // eARIAExpanded + nsStateMapEntry(&nsAccessibilityAtoms::aria_expanded, kBoolType, 0, + nsIAccessibleStates::STATE_EXPANDED, 0, + nsIAccessibleStates::STATE_COLLAPSED, 0), + + // eARIAHasPopup + nsStateMapEntry(&nsAccessibilityAtoms::aria_haspopup, kBoolType, 0, + nsIAccessibleStates::STATE_HASPOPUP, 0), + + // eARIAInvalid + nsStateMapEntry(&nsAccessibilityAtoms::aria_invalid, kBoolType, 0, + nsIAccessibleStates::STATE_INVALID, 0), + + // eARIAMultiline + nsStateMapEntry(&nsAccessibilityAtoms::aria_multiline, kBoolType, 0, + 0, nsIAccessibleStates::EXT_STATE_MULTI_LINE, + 0, nsIAccessibleStates::EXT_STATE_SINGLE_LINE, PR_TRUE), + + // eARIAMultiSelectable + nsStateMapEntry(&nsAccessibilityAtoms::aria_multiselectable, kBoolType, 0, + nsIAccessibleStates::STATE_MULTISELECTABLE | nsIAccessibleStates::STATE_EXTSELECTABLE, 0), + + // eARIAPressed + nsStateMapEntry(&nsAccessibilityAtoms::aria_pressed, kMixedType, + nsIAccessibleStates::STATE_CHECKABLE, + nsIAccessibleStates::STATE_PRESSED, 0), + + // eARIAReadonly + nsStateMapEntry(&nsAccessibilityAtoms::aria_readonly, kBoolType, 0, + nsIAccessibleStates::STATE_READONLY, 0), + + // eARIAReadonlyOrEditable + nsStateMapEntry(&nsAccessibilityAtoms::aria_readonly, kBoolType, 0, + nsIAccessibleStates::STATE_READONLY, 0, + 0, nsIAccessibleStates::EXT_STATE_EDITABLE, PR_TRUE), + + // eARIARequired + nsStateMapEntry(&nsAccessibilityAtoms::aria_required, kBoolType, 0, + nsIAccessibleStates::STATE_REQUIRED, 0), + + // eARIASelected + nsStateMapEntry(&nsAccessibilityAtoms::aria_selected, kBoolType, + nsIAccessibleStates::STATE_SELECTABLE, + nsIAccessibleStates::STATE_SELECTED, 0) }; /** @@ -659,16 +666,14 @@ nsRoleMapEntry nsARIAMap::gEmptyRoleMap = { * The following state rules are applied to any accessible element, * whether there is an ARIA role or not: */ -nsStateMapEntry nsARIAMap::gWAIUnivStateMap[] = { - {&nsAccessibilityAtoms::aria_required, kBoolState, nsIAccessibleStates::STATE_REQUIRED}, - {&nsAccessibilityAtoms::aria_invalid, kBoolState, nsIAccessibleStates::STATE_INVALID}, - {&nsAccessibilityAtoms::aria_haspopup, kBoolState, nsIAccessibleStates::STATE_HASPOPUP}, - {&nsAccessibilityAtoms::aria_busy, "true", nsIAccessibleStates::STATE_BUSY}, - {&nsAccessibilityAtoms::aria_busy, "error", nsIAccessibleStates::STATE_INVALID}, - {&nsAccessibilityAtoms::aria_disabled, kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE}, - {&nsAccessibilityAtoms::aria_expanded, kBoolState, nsIAccessibleStates::STATE_EXPANDED}, - {&nsAccessibilityAtoms::aria_expanded, "false", nsIAccessibleStates::STATE_COLLAPSED}, - kEndEntry +eStateMapEntryID nsARIAMap::gWAIUnivStateMap[] = { + eARIARequired, + eARIAInvalid, + eARIAHasPopup, + eARIABusy, + eARIADisabled, + eARIAExpanded, + eARIANone }; @@ -709,3 +714,144 @@ nsAttributeCharacteristics nsARIAMap::gWAIUnivAttrMap[] = { }; PRUint32 nsARIAMap::gWAIUnivAttrMapLength = NS_ARRAY_LENGTH(nsARIAMap::gWAIUnivAttrMap); + + +//////////////////////////////////////////////////////////////////////////////// +// nsStateMapEntry + +nsStateMapEntry:: nsStateMapEntry(nsIAtom **aAttrName, eStateValueType aType, + PRUint32 aPermanentState, + PRUint32 aTrueState, PRUint32 aTrueExtraState, + PRUint32 aFalseState, PRUint32 aFalseExtraState, + PRBool aDefinedIfAbsent) : + attributeName(aAttrName), isToken(PR_TRUE), permanentState(aPermanentState) +{ + value1 = "false"; + state1 = aFalseState; + extraState1 = aFalseExtraState; + + if (aType == kMixedType) { + value2 = "mixed"; + state2 = nsIAccessibleStates::STATE_MIXED; + extraState2 = 0; + } + + defaultState = aTrueState; + defaultExtraState = aTrueExtraState; + + definedIfAbsent = aDefinedIfAbsent; +} + +nsStateMapEntry::nsStateMapEntry(nsIAtom **aAttrName, + const char *aValue1, + PRUint32 aState1, PRUint32 aExtraState1, + const char *aValue2, + PRUint32 aState2, PRUint32 aExtraState2, + const char *aValue3, + PRUint32 aState3, PRUint32 aExtraState3) : + attributeName(aAttrName), isToken(PR_FALSE), permanentState(0), + value1(aValue1), state1(aState1), extraState1(aExtraState1), + value2(aValue2), state2(aState2), extraState2(aExtraState2), + value3(aValue3), state3(aState3), extraState3(aExtraState3), + defaultState(0), defaultExtraState(0), definedIfAbsent(PR_FALSE) +{ +} + +PRBool +nsStateMapEntry::MapToStates(nsIContent *aContent, + PRUint32 *aState, PRUint32 *aExtraState, + eStateMapEntryID aStateMapEntryID) +{ + // Return true if we should continue. + if (aStateMapEntryID == eARIANone) + return PR_FALSE; + + const nsStateMapEntry& entry = nsARIAMap::gWAIStateMap[aStateMapEntryID]; + + if (entry.isToken) { + // If attribute is considered as defined when it's absent then let's act + // attribute value is "false" supposedly. + PRBool hasAttr = aContent->HasAttr(kNameSpaceID_None, *entry.attributeName); + if (entry.definedIfAbsent && !hasAttr) { + if (entry.permanentState) + *aState |= entry.permanentState; + if (entry.state1) + *aState |= entry.state1; + if (aExtraState && entry.extraState1) + *aExtraState |= entry.extraState1; + + return PR_TRUE; + } + + // We only have attribute state mappings for NMTOKEN (and boolean) based + // ARIA attributes. According to spec, a value of "undefined" is to be + // treated equivalent to "", or the absence of the attribute. We bail out + // for this case here. + // Note: If this method happens to be called with a non-token based + // attribute, for example: aria-label="" or aria-label="undefined", we will + // bail out and not explore a state mapping, which is safe. + if (!hasAttr || + aContent->AttrValueIs(kNameSpaceID_None, *entry.attributeName, + nsAccessibilityAtoms::_empty, eCaseMatters) || + aContent->AttrValueIs(kNameSpaceID_None, *entry.attributeName, + nsAccessibilityAtoms::_undefined, eCaseMatters)) { + + if (entry.permanentState) + *aState &= ~entry.permanentState; + return PR_TRUE; + } + + if (entry.permanentState) + *aState |= entry.permanentState; + } + + nsAutoString attrValue; + if (!aContent->GetAttr(kNameSpaceID_None, *entry.attributeName, attrValue)) + return PR_TRUE; + + // Apply states for matched value. If no values was matched then apply default + // states. + PRBool applyDefaultStates = PR_TRUE; + if (entry.value1) { + if (attrValue.EqualsASCII(entry.value1)) { + applyDefaultStates = PR_FALSE; + + if (entry.state1) + *aState |= entry.state1; + + if (aExtraState && entry.extraState1) + *aExtraState |= entry.extraState1; + + } else if (entry.value2) { + if (attrValue.EqualsASCII(entry.value2)) { + applyDefaultStates = PR_FALSE; + + if (entry.state2) + *aState |= entry.state2; + + if (aExtraState && entry.extraState2) + *aExtraState |= entry.extraState2; + + } else if (entry.value3) { + if (attrValue.EqualsASCII(entry.value3)) { + applyDefaultStates = PR_FALSE; + + if (entry.state3) + *aState |= entry.state3; + + if (aExtraState && entry.extraState3) + *aExtraState |= entry.extraState3; + } + } + } + } + + if (applyDefaultStates) { + if (entry.defaultState) + *aState |= entry.defaultState; + if (entry.defaultExtraState && aExtraState) + *aExtraState |= entry.defaultExtraState; + } + + return PR_TRUE; +} diff --git a/accessible/src/base/nsARIAMap.h b/accessible/src/base/nsARIAMap.h index 45e9ffb1e821..69314f6f663f 100644 --- a/accessible/src/base/nsARIAMap.h +++ b/accessible/src/base/nsARIAMap.h @@ -43,14 +43,35 @@ #include "prtypes.h" #include "nsAccessibilityAtoms.h" -// Is nsIAccessible value supported for this role or not? +#include "nsIContent.h" + +//////////////////////////////////////////////////////////////////////////////// +// Value constants + +/** + * Used to define if role requires to expose nsIAccessibleValue. + */ enum EValueRule { + /** + * nsIAccessibleValue isn't exposed. + */ eNoValue, - eHasValueMinMax // Supports value, min and max from aria-valuenow, aria-valuemin and aria-valuemax + + /** + * nsIAccessibleValue is implemented, supports value, min and max from + * aria-valuenow, aria-valuemin and aria-valuemax. + */ + eHasValueMinMax }; -// Should we expose action based on the ARIA role? + +//////////////////////////////////////////////////////////////////////////////// +// Action constants + +/** + * Used to define if the role requires to expose action. + */ enum EActionRule { eNoAction, @@ -65,6 +86,13 @@ enum EActionRule eSwitchAction }; + +//////////////////////////////////////////////////////////////////////////////// +// Live region constants + +/** + * Used to define if role exposes default value of aria-live attribute. + */ enum ELiveAttrRule { eNoLiveAttr, @@ -72,11 +100,23 @@ enum ELiveAttrRule ePoliteLiveAttr }; -// Role mapping rule + +//////////////////////////////////////////////////////////////////////////////// +// Role constants + +/** + * ARIA role overrides role from native markup. + */ const PRBool kUseMapRole = PR_TRUE; + +/** + * ARIA role doesn't override the role from native markup. + */ const PRBool kUseNativeRole = PR_FALSE; -// ARIA attribute characteristic masks, grow as needed + +//////////////////////////////////////////////////////////////////////////////// +// ARIA attribute characteristic masks /** * This mask indicates the attribute should not be exposed as an object @@ -92,29 +132,132 @@ const PRUint8 ATTR_BYPASSOBJ = 0x0001; */ const PRUint8 ATTR_VALTOKEN = 0x0010; -// Used for an nsStateMapEntry if a given state attribute supports "true" and "false" -#define kBoolState 0 - -// Used in nsRoleMapEntry.state if no nsIAccessibleStates are automatic for a given role -#define kNoReqStates 0 - -// For this name and value pair, what is the nsIAccessibleStates mapping. -// nsStateMapEntry.state -struct nsStateMapEntry -{ - nsIAtom** attributeName; // nsnull indicates last entry in map - const char* attributeValue; // magic value of kBoolState (0) means supports "true" and "false" - PRUint32 state; // If match, this is the nsIAccessibleStates to map to -}; - -// Small footprint storage of persistent aria attribute characteristics +/** + * Small footprint storage of persistent aria attribute characteristics. + */ struct nsAttributeCharacteristics { nsIAtom** attributeName; const PRUint8 characteristics; }; -// For each ARIA role, this maps the nsIAccessible information + +//////////////////////////////////////////////////////////////////////////////// +// State map entry + +/** + * Used in nsRoleMapEntry.state if no nsIAccessibleStates are automatic for + * a given role. + */ +#define kNoReqStates 0 + +enum eStateValueType +{ + kBoolType, + kMixedType +}; + +/** + * ID for state map entry, used in nsRoleMapEntry. + */ +enum eStateMapEntryID +{ + eARIANone, + eARIAAutoComplete, + eARIABusy, + eARIACheckableBool, + eARIACheckableMixed, + eARIACheckedMixed, + eARIADisabled, + eARIAExpanded, + eARIAHasPopup, + eARIAInvalid, + eARIAMultiline, + eARIAMultiSelectable, + eARIAPressed, + eARIAReadonly, + eARIAReadonlyOrEditable, + eARIARequired, + eARIASelected +}; + +class nsStateMapEntry +{ +public: + /** + * Used to create stub. + */ + nsStateMapEntry() {} + + /** + * Used for ARIA attributes having boolean or mixed values. + */ + nsStateMapEntry(nsIAtom **aAttrName, eStateValueType aType, + PRUint32 aPermanentState, + PRUint32 aTrueState, PRUint32 aTrueExtraState, + PRUint32 aFalseState = 0, PRUint32 aFalseExtraState = 0, + PRBool aDefinedIfAbsent = PR_FALSE); + + /** + * Used for ARIA attributes having enumerated values. + */ + nsStateMapEntry(nsIAtom **aAttrName, + const char *aValue1, PRUint32 aState1, PRUint32 aExtraState1, + const char *aValue2, PRUint32 aState2, PRUint32 aExtraState2, + const char *aValue3 = 0, PRUint32 aState3 = 0, + PRUint32 aExtraState3 = 0); + + /** + * Maps ARIA state map pointed by state map entry ID to accessible states. + * + * @param aContent [in] node of the accessible + * @param aState [in/out] accessible states + * @param aExtraState [in/out] accessible extra states + * @param aStateMapEntryID [in] state map entry ID + * @return true if state map entry ID is valid + */ + static PRBool MapToStates(nsIContent *aContent, + PRUint32 *aState, PRUint32 *aExtraState, + eStateMapEntryID aStateMapEntryID); + +private: + // ARIA attribute name + nsIAtom** attributeName; + + // Indicates if attribute is token (can be undefined) + PRBool isToken; + + // State applied always if attribute is defined + PRUint32 permanentState; + + // States applied if attribute value is matched to the stored value + const char* value1; + PRUint32 state1; + PRUint32 extraState1; + + const char* value2; + PRUint32 state2; + PRUint32 extraState2; + + const char* value3; + PRUint32 state3; + PRUint32 extraState3; + + // States applied if no stored values above are matched + PRUint32 defaultState; + PRUint32 defaultExtraState; + + // Permanent and false states are applied if attribute is absent + PRBool definedIfAbsent; +}; + + +//////////////////////////////////////////////////////////////////////////////// +// Role map entry + +/** + * For each ARIA role, this maps the nsIAccessible information. + */ struct nsRoleMapEntry { // ARIA role: string representation such as "button" @@ -144,16 +287,15 @@ struct nsRoleMapEntry // Currently you cannot have unlimited mappings, because // a variable sized array would not allow the use of // C++'s struct initialization feature. - nsStateMapEntry attributeMap1; - nsStateMapEntry attributeMap2; - nsStateMapEntry attributeMap3; - nsStateMapEntry attributeMap4; - nsStateMapEntry attributeMap5; - nsStateMapEntry attributeMap6; - nsStateMapEntry attributeMap7; - nsStateMapEntry attributeMap8; + eStateMapEntryID attributeMap1; + eStateMapEntryID attributeMap2; + eStateMapEntryID attributeMap3; }; + +//////////////////////////////////////////////////////////////////////////////// +// ARIA map + /** * These are currently initialized (hardcoded) in nsARIAMap.cpp, * and provide the mappings for WAI-ARIA roles and properties using the @@ -180,11 +322,16 @@ struct nsARIAMap */ static nsRoleMapEntry gEmptyRoleMap; + /** + * State map of ARIA state attributes. + */ + static nsStateMapEntry nsARIAMap::gWAIStateMap[]; + /** * State map of ARIA states applied to any accessible not depending on * the role. */ - static nsStateMapEntry gWAIUnivStateMap[]; + static eStateMapEntryID gWAIUnivStateMap[]; /** * Map of attribute to attribute characteristics. diff --git a/accessible/src/base/nsAccessible.cpp b/accessible/src/base/nsAccessible.cpp index 8b91e7f92484..200a7ad96984 100644 --- a/accessible/src/base/nsAccessible.cpp +++ b/accessible/src/base/nsAccessible.cpp @@ -1891,45 +1891,6 @@ nsAccessible::GroupPosition(PRInt32 *aGroupLevel, return NS_OK; } -PRBool nsAccessible::MappedAttrState(nsIContent *aContent, PRUint32 *aStateInOut, - nsStateMapEntry *aStateMapEntry) -{ - // Return true if we should continue - if (!aStateMapEntry->attributeName) { - return PR_FALSE; // Stop looking -- no more states - } - - // We only have attribute state mappings for NMTOKEN (and boolean) based - // ARIA attributes. According to spec, a value of "undefined" is to be - // treated equivalent to "", or the absence of the attribute. We bail out - // for this case here. - // Note: If this method happens to be called with a non-token based - // attribute, for example: aria-label="" or aria-label="undefined", we will - // bail out and not explore a state mapping, which is safe. - if (!nsAccUtils::HasDefinedARIAToken(aContent, *aStateMapEntry->attributeName)) { - return PR_TRUE; - } - - nsAutoString attribValue; - if (aContent->GetAttr(kNameSpaceID_None, *aStateMapEntry->attributeName, attribValue)) { - if (aStateMapEntry->attributeValue == kBoolState) { - // No attribute value map specified in state map entry indicates state cleared - if (attribValue.EqualsLiteral("false") || - attribValue.EqualsLiteral("mixed")) { - *aStateInOut &= ~aStateMapEntry->state; - } - else { - *aStateInOut |= aStateMapEntry->state; - } - } - else if (NS_ConvertUTF16toUTF8(attribValue).Equals(aStateMapEntry->attributeValue)) { - *aStateInOut |= aStateMapEntry->state; - } - } - - return PR_TRUE; -} - NS_IMETHODIMP nsAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState) { @@ -1947,7 +1908,7 @@ nsAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState) NS_ENSURE_A11Y_SUCCESS(rv, rv); // Apply ARIA states to be sure accessible states will be overriden. - GetARIAState(aState); + GetARIAState(aState, aExtraState); if (mRoleMapEntry && mRoleMapEntry->role == nsIAccessibleRole::ROLE_PAGETAB) { if (*aState & nsIAccessibleStates::STATE_FOCUSED) { @@ -2019,33 +1980,6 @@ nsAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState) rv = GetRole(&role); NS_ENSURE_SUCCESS(rv, rv); - if (role == nsIAccessibleRole::ROLE_ENTRY || - role == nsIAccessibleRole::ROLE_COMBOBOX) { - - nsCOMPtr content = nsCoreUtils::GetRoleContent(mDOMNode); - NS_ENSURE_STATE(content); - - nsAutoString autocomplete; - if (content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_autocomplete, autocomplete) && - (autocomplete.EqualsIgnoreCase("inline") || - autocomplete.EqualsIgnoreCase("list") || - autocomplete.EqualsIgnoreCase("both"))) { - *aExtraState |= nsIAccessibleStates::EXT_STATE_SUPPORTS_AUTOCOMPLETION; - } - - // XXX We can remove this hack once we support RDF-based role & state maps - if (mRoleMapEntry && mRoleMapEntry->role == nsIAccessibleRole::ROLE_ENTRY) { - PRBool isMultiLine = content->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::aria_multiline, - nsAccessibilityAtoms::_true, eCaseMatters); - *aExtraState |= isMultiLine ? nsIAccessibleStates::EXT_STATE_MULTI_LINE : - nsIAccessibleStates::EXT_STATE_SINGLE_LINE; - if (0 == (*aState & nsIAccessibleStates::STATE_READONLY)) - *aExtraState |= nsIAccessibleStates::EXT_STATE_EDITABLE; // Not readonly - else // We're readonly: make sure editable state wasn't set by impl class - *aExtraState &= ~nsIAccessibleStates::EXT_STATE_EDITABLE; - } - } - // For some reasons DOM node may have not a frame. We tract such accessibles // as invisible. nsIFrame *frame = GetFrame(); @@ -2077,7 +2011,7 @@ nsAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState) } nsresult -nsAccessible::GetARIAState(PRUint32 *aState) +nsAccessible::GetARIAState(PRUint32 *aState, PRUint32 *aExtraState) { // Test for universal states first nsIContent *content = nsCoreUtils::GetRoleContent(mDOMNode); @@ -2086,7 +2020,8 @@ nsAccessible::GetARIAState(PRUint32 *aState) } PRUint32 index = 0; - while (MappedAttrState(content, aState, &nsARIAMap::gWAIUnivStateMap[index])) { + while (nsStateMapEntry::MapToStates(content, aState, aExtraState, + nsARIAMap::gWAIUnivStateMap[index])) { ++ index; } @@ -2126,14 +2061,12 @@ nsAccessible::GetARIAState(PRUint32 *aState) // Note: the readonly bitflag will be overridden later if content is editable *aState |= mRoleMapEntry->state; - if (MappedAttrState(content, aState, &mRoleMapEntry->attributeMap1) && - MappedAttrState(content, aState, &mRoleMapEntry->attributeMap2) && - MappedAttrState(content, aState, &mRoleMapEntry->attributeMap3) && - MappedAttrState(content, aState, &mRoleMapEntry->attributeMap4) && - MappedAttrState(content, aState, &mRoleMapEntry->attributeMap5) && - MappedAttrState(content, aState, &mRoleMapEntry->attributeMap6) && - MappedAttrState(content, aState, &mRoleMapEntry->attributeMap7)) { - MappedAttrState(content, aState, &mRoleMapEntry->attributeMap8); + if (nsStateMapEntry::MapToStates(content, aState, aExtraState, + mRoleMapEntry->attributeMap1) && + nsStateMapEntry::MapToStates(content, aState, aExtraState, + mRoleMapEntry->attributeMap2)) { + nsStateMapEntry::MapToStates(content, aState, aExtraState, + mRoleMapEntry->attributeMap3); } return NS_OK; diff --git a/accessible/src/base/nsAccessible.h b/accessible/src/base/nsAccessible.h index 947b84ded09f..9d9f16d8bfa3 100644 --- a/accessible/src/base/nsAccessible.h +++ b/accessible/src/base/nsAccessible.h @@ -148,8 +148,9 @@ public: * method. * * @param [in/out] where to fill the states into. + * @param [in/out] where to fill the extra states into */ - virtual nsresult GetARIAState(PRUint32 *aState); + virtual nsresult GetARIAState(PRUint32 *aState, PRUint32 *aExtraState); /** * Returns the accessible name provided by native markup. It doesn't take @@ -279,7 +280,6 @@ public: } protected: - PRBool MappedAttrState(nsIContent *aContent, PRUint32 *aStateInOut, nsStateMapEntry *aStateMapEntry); virtual nsIFrame* GetBoundsFrame(); virtual void GetBoundsRect(nsRect& aRect, nsIFrame** aRelativeFrame); PRBool IsVisible(PRBool *aIsOffscreen); diff --git a/accessible/src/base/nsDocAccessible.cpp b/accessible/src/base/nsDocAccessible.cpp index a98bc055d50f..50d5901ef410 100644 --- a/accessible/src/base/nsDocAccessible.cpp +++ b/accessible/src/base/nsDocAccessible.cpp @@ -340,16 +340,16 @@ nsDocAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState) } nsresult -nsDocAccessible::GetARIAState(PRUint32 *aState) +nsDocAccessible::GetARIAState(PRUint32 *aState, PRUint32 *aExtraState) { // Combine with states from outer doc NS_ENSURE_ARG_POINTER(aState); - nsresult rv = nsAccessible::GetARIAState(aState); + nsresult rv = nsAccessible::GetARIAState(aState, aExtraState); NS_ENSURE_SUCCESS(rv, rv); nsRefPtr parent = nsAccUtils::QueryAccessible(mParent); if (parent) // Allow iframe/frame etc. to have final state override via ARIA - return parent->GetARIAState(aState); + return parent->GetARIAState(aState, aExtraState); return rv; } diff --git a/accessible/src/base/nsDocAccessible.h b/accessible/src/base/nsDocAccessible.h index a2b9154d9bc2..e9961d8a3f0b 100644 --- a/accessible/src/base/nsDocAccessible.h +++ b/accessible/src/base/nsDocAccessible.h @@ -109,7 +109,7 @@ public: // nsAccessible virtual nsresult GetRoleInternal(PRUint32 *aRole); virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState); - virtual nsresult GetARIAState(PRUint32 *aState); + virtual nsresult GetARIAState(PRUint32 *aState, PRUint32 *aExtraState); virtual void SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry); // nsIAccessibleText diff --git a/accessible/src/xul/nsXULFormControlAccessible.cpp b/accessible/src/xul/nsXULFormControlAccessible.cpp index 61303c69e11f..d5c437054ad2 100644 --- a/accessible/src/xul/nsXULFormControlAccessible.cpp +++ b/accessible/src/xul/nsXULFormControlAccessible.cpp @@ -872,6 +872,18 @@ already_AddRefed nsXULTextFieldAccessible::GetInputField() return inputField; } +nsresult +nsXULTextFieldAccessible::GetARIAState(PRUint32 *aState, PRUint32 *aExtraState) +{ + nsresult rv = nsHyperTextAccessibleWrap::GetARIAState(aState, aExtraState); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr content(do_QueryInterface(mDOMNode)); + nsStateMapEntry::MapToStates(content, aState, aExtraState, eARIAAutoComplete); + + return NS_OK; +} + nsresult nsXULTextFieldAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState) diff --git a/accessible/src/xul/nsXULFormControlAccessible.h b/accessible/src/xul/nsXULFormControlAccessible.h index 9a8394d36d45..c3e39eddbd7b 100644 --- a/accessible/src/xul/nsXULFormControlAccessible.h +++ b/accessible/src/xul/nsXULFormControlAccessible.h @@ -204,6 +204,7 @@ public: NS_IMETHOD GetAssociatedEditor(nsIEditor **aEditor); // nsAccessible + virtual nsresult GetARIAState(PRUint32 *aState, PRUint32 *aExtraState); virtual nsresult GetRoleInternal(PRUint32 *aRole); virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState); virtual PRBool GetAllowsAnonChildAccessibles(); diff --git a/accessible/tests/mochitest/common.js b/accessible/tests/mochitest/common.js index 59d4f75dd5f0..522827a7cb02 100644 --- a/accessible/tests/mochitest/common.js +++ b/accessible/tests/mochitest/common.js @@ -49,6 +49,7 @@ const nsIPropertyElement = Components.interfaces.nsIPropertyElement; //////////////////////////////////////////////////////////////////////////////// // States +const STATE_BUSY = nsIAccessibleStates.STATE_BUSY; const STATE_CHECKED = nsIAccessibleStates.STATE_CHECKED; const STATE_CHECKABLE = nsIAccessibleStates.STATE_CHECKABLE; const STATE_COLLAPSED = nsIAccessibleStates.STATE_COLLAPSED; @@ -57,12 +58,14 @@ const STATE_EXTSELECTABLE = nsIAccessibleStates.STATE_EXTSELECTABLE; const STATE_FOCUSABLE = nsIAccessibleStates.STATE_FOCUSABLE; const STATE_FOCUSED = nsIAccessibleStates.STATE_FOCUSED; const STATE_HASPOPUP = nsIAccessibleStates.STATE_HASPOPUP; +const STATE_INVALID = nsIAccessibleStates.STATE_INVALID; const STATE_LINKED = nsIAccessibleStates.STATE_LINKED; const STATE_MIXED = nsIAccessibleStates.STATE_MIXED; const STATE_MULTISELECTABLE = nsIAccessibleStates.STATE_MULTISELECTABLE; const STATE_OFFSCREEN = nsIAccessibleStates.STATE_OFFSCREEN; const STATE_PRESSED = nsIAccessibleStates.STATE_PRESSED; const STATE_READONLY = nsIAccessibleStates.STATE_READONLY; +const STATE_REQUIRED = nsIAccessibleStates.STATE_REQUIRED; const STATE_SELECTABLE = nsIAccessibleStates.STATE_SELECTABLE; const STATE_SELECTED = nsIAccessibleStates.STATE_SELECTED; const STATE_TRAVERSED = nsIAccessibleStates.STATE_TRAVERSED; @@ -71,9 +74,8 @@ const STATE_UNAVAILABLE = nsIAccessibleStates.STATE_UNAVAILABLE; const EXT_STATE_EDITABLE = nsIAccessibleStates.EXT_STATE_EDITABLE; const EXT_STATE_EXPANDABLE = nsIAccessibleStates.EXT_STATE_EXPANDABLE; const EXT_STATE_HORIZONTAL = nsIAccessibleStates.EXT_STATE_HORIZONTAL; -const EXT_STATE_INVALID = nsIAccessibleStates.STATE_INVALID; const EXT_STATE_MULTI_LINE = nsIAccessibleStates.EXT_STATE_MULTI_LINE; -const EXT_STATE_REQUIRED = nsIAccessibleStates.STATE_REQUIRED; +const EXT_STATE_SINGLE_LINE = nsIAccessibleStates.EXT_STATE_SINGLE_LINE; const EXT_STATE_SUPPORTS_AUTOCOMPLETION = nsIAccessibleStates.EXT_STATE_SUPPORTS_AUTOCOMPLETION; @@ -108,7 +110,7 @@ function addA11yLoadEvent(aFunc) var accDoc = getAccessible(document); var state = {}; accDoc.getState(state, {}); - if (state.value & nsIAccessibleStates.STATE_BUSY) + if (state.value & STATE_BUSY) return waitForDocLoad(); aFunc.call(); @@ -326,9 +328,12 @@ function statesToString(aStates, aExtraStates) var list = gAccRetrieval.getStringStates(aStates, aExtraStates); var str = ""; - for (var index = 0; index < list.length; index++) + for (var index = 0; index < list.length - 1; index++) str += list.item(index) + ", "; + if (list.length != 0) + str += list.item(index) + return str; } diff --git a/accessible/tests/mochitest/states.js b/accessible/tests/mochitest/states.js index 5a4fbafc5ea5..98401496c2cc 100644 --- a/accessible/tests/mochitest/states.js +++ b/accessible/tests/mochitest/states.js @@ -1,3 +1,11 @@ +//////////////////////////////////////////////////////////////////////////////// +// Helper functions for accessible states testing. +// +// requires: +// common.js +// +//////////////////////////////////////////////////////////////////////////////// + /** * Tests the states and extra states of the given accessible. * Also tests for unwanted states and extra states. @@ -17,55 +25,73 @@ function testStates(aAccOrElmOrID, aState, aExtraState, aAbsentState, var id = prettyName(aAccOrElmOrID); - is(state & aState, aState, - "wrong state bits for " + id + "!"); + // Primary test. + isState(state & aState, aState, false, + "wrong state bits for " + id + "!"); if (aExtraState) - is(extraState & aExtraState, aExtraState, - "wrong extra state bits for " + id + "!"); + isState(extraState & aExtraState, aExtraState, true, + "wrong extra state bits for " + id + "!"); if (aAbsentState) - is(state & aAbsentState, 0, - "state bits should not be present in ID " + id + "!"); + isState(state & aAbsentState, 0, false, + "state bits should not be present in ID " + id + "!"); if (aAbsentExtraState) - is(extraState & aAbsentExtraState, 0, - "extraState bits should not be present in ID " + id + "!"); + isState(extraState & aAbsentExtraState, 0, true, + "extraState bits should not be present in ID " + id + "!"); + // Additional test. + + // readonly/editable if (state & STATE_READONLY) - is(extraState & EXT_STATE_EDITABLE, 0, - "Read-only " + id + " cannot be editable!"); + isState(extraState & EXT_STATE_EDITABLE, 0, true, + "Read-only " + id + " cannot be editable!"); if (extraState & EXT_STATE_EDITABLE) - is(state & STATE_READONLY, 0, - "Editable " + id + " cannot be readonly!"); + isState(state & STATE_READONLY, 0, true, + "Editable " + id + " cannot be readonly!"); + // multiline/singleline + if (extraState & EXT_STATE_MULTI_LINE) + isState(extraState & EXT_STATE_SINGLE_LINE, 0, true, + "Multiline " + id + " cannot be singleline!"); + + if (extraState & EXT_STATE_SINGLE_LINE) + isState(extraState & EXT_STATE_MULTI_LINE, 0, true, + "Singleline " + id + " cannot be multiline!"); + + // expanded/collapsed/expandable if (state & STATE_COLLAPSED || state & STATE_EXPANDED) - is(extraState & EXT_STATE_EXPANDABLE, EXT_STATE_EXPANDABLE, - "Collapsed or expanded " + id + " should be expandable!"); + isState(extraState & EXT_STATE_EXPANDABLE, EXT_STATE_EXPANDABLE, true, + "Collapsed or expanded " + id + " should be expandable!"); if (state & STATE_COLLAPSED) - is(state & STATE_EXPANDED, 0, - "Collapsed " + id + " cannot be expanded!"); + isState(state & STATE_EXPANDED, 0, false, + "Collapsed " + id + " cannot be expanded!"); if (state & STATE_EXPANDED) - is(state & STATE_COLLAPSED, 0, - "Expanded " + id + " cannot be collapsed!"); + isState(state & STATE_COLLAPSED, 0, false, + "Expanded " + id + " cannot be collapsed!"); + // checked/mixed/checkable if (state & STATE_CHECKED || state & STATE_MIXED) - is(state & STATE_CHECKABLE, STATE_CHECKABLE, - "Checked or mixed element must be checkable!"); + isState(state & STATE_CHECKABLE, STATE_CHECKABLE, false, + "Checked or mixed element must be checkable!"); if (state & STATE_CHECKED) - is(state & STATE_MIXED, 0, "Checked element cannot be state mixed!"); + isState(state & STATE_MIXED, 0, false, + "Checked element cannot be state mixed!"); if (state & STATE_MIXED) - is(state & STATE_CHECKED, 0, "Mixed element cannot be state checked!"); + isState(state & STATE_CHECKED, 0, false, + "Mixed element cannot be state checked!"); + // unavailable if ((state & STATE_UNAVAILABLE) && (getRole(aAccOrElmOrID) != ROLE_GROUPING)) - is(state & STATE_FOCUSABLE, STATE_FOCUSABLE, - "Disabled " + id + " must be focusable!"); + isState(state & STATE_FOCUSABLE, STATE_FOCUSABLE, false, + "Disabled " + id + " must be focusable!"); } /** @@ -122,3 +148,31 @@ function getStates(aAccOrElmOrID) return [state.value, extraState.value]; } + +//////////////////////////////////////////////////////////////////////////////// +// Private implementation details + +/** + * Analogy of SimpleTest.is function used to compare states. + */ +function isState(aState1, aState2, aIsExtraStates, aMsg) +{ + if (aState1 == aState2) { + ok(true, aMsg); + return; + } + + var got = "0"; + if (aState1) { + got = statesToString(aIsExtraStates ? 0 : aState1, + aIsExtraStates ? aState1 : 0); + } + + var expected = "0"; + if (aState2) { + expected = statesToString(aIsExtraStates ? 0 : aState2, + aIsExtraStates ? aState2 : 0); + } + + ok(false, aMsg + "got '" + got + "', expected '" + expected + "'"); +} diff --git a/accessible/tests/mochitest/test_aria_token_attrs.html b/accessible/tests/mochitest/test_aria_token_attrs.html index 1627b54fe9f1..b5cb8b2028f4 100644 --- a/accessible/tests/mochitest/test_aria_token_attrs.html +++ b/accessible/tests/mochitest/test_aria_token_attrs.html @@ -22,25 +22,25 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=452388 + + + + + + + + + + + From bb547e940d60b92083450147c65f58a246444d1a Mon Sep 17 00:00:00 2001 From: "armenzg@mozilla.com" Date: Thu, 25 Jun 2009 12:31:06 -0400 Subject: [PATCH 18/70] Bug 496196 - script and make target to generate a snippet for a locale - r=ccooper,l10n,gozer,kairo --- browser/locales/Makefile.in | 7 +- toolkit/locales/l10n.mk | 10 ++ tools/update-packaging/generatesnippet.py | 192 ++++++++++++++++++++++ 3 files changed, 208 insertions(+), 1 deletion(-) create mode 100644 tools/update-packaging/generatesnippet.py diff --git a/browser/locales/Makefile.in b/browser/locales/Makefile.in index 41dde351c8ef..05c866939fad 100644 --- a/browser/locales/Makefile.in +++ b/browser/locales/Makefile.in @@ -284,7 +284,12 @@ endif ident: - @$(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(STAGEDIST)/application.ini App SourceStamp + @printf "fx_revision " + @$(PYTHON) $(topsrcdir)/config/printconfigsetting.py \ + $(STAGEDIST)/application.ini App SourceStamp + @printf "buildid " + @$(PYTHON) $(topsrcdir)/config/printconfigsetting.py \ + $(STAGEDIST)/application.ini App BuildID #These make targets call prepare-repackages by setting different UPLOAD_DIR prepare-upload-latest-%: diff --git a/toolkit/locales/l10n.mk b/toolkit/locales/l10n.mk index 2834ce047c4f..954e7c206e75 100644 --- a/toolkit/locales/l10n.mk +++ b/toolkit/locales/l10n.mk @@ -145,6 +145,7 @@ ifdef MOZ_MAKE_COMPLETE_MAR MOZ_PKG_PRETTYNAMES=$(MOZ_PKG_PRETTYNAMES) \ PACKAGE_BASE_DIR="$(_ABS_DIST)/l10n-stage" \ DIST="$(_ABS_DIST)" + $(MAKE) generate-snippet-$(AB_CD) endif # packaging done, undo l10n stuff ifneq (en,$(AB)) @@ -195,3 +196,12 @@ ifeq ($(OS_ARCH), WINNT) (cd $(_ABS_DIST)/$(PKG_INST_PATH) && $(WGET) -nv -N "$(EN_US_BINARY_URL)/$(PKG_PATH)$(PKG_INST_BASENAME).exe") @echo "Downloaded $(EN_US_BINARY_URL)/$(PKG_PATH)$(PKG_INST_BASENAME).exe to $(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe" endif + +generate-snippet-%: + $(PYTHON) $(topsrcdir)/tools/update-packaging/generatesnippet.py \ + --mar-path=$(_ABS_DIST)/update \ + --application-ini-file=$(STAGEDIST)/application.ini \ + --locale=$* \ + --product=$(MOZ_PKG_APPNAME) \ + --download-base-URL=$(DOWNLOAD_BASE_URL) \ + --verbose diff --git a/tools/update-packaging/generatesnippet.py b/tools/update-packaging/generatesnippet.py new file mode 100644 index 000000000000..6609deb82fb8 --- /dev/null +++ b/tools/update-packaging/generatesnippet.py @@ -0,0 +1,192 @@ +# ***** 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 the Mozilla build system +# +# The Initial Developer of the Original Code is Mozilla. +# Portions created by the Initial Developer are Copyright (C) 2009 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Armen Zambrano Gasparnian +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +""" +This script generates the complete snippet for a given locale or en-US +Most of the parameters received are to generate the MAR's download URL +and determine the MAR's filename +""" +import sys, os, platform, sha +from optparse import OptionParser +from ConfigParser import ConfigParser +from stat import ST_SIZE + +def main(): + error = False + parser = OptionParser( + usage="%prog [options]") + parser.add_option("--mar-path", + action="store", + dest="marPath", + help="[Required] Specify the absolute path where the MAR file is found.") + parser.add_option("--application-ini-file", + action="store", + dest="applicationIniFile", + help="[Required] Specify the absolute path to the application.ini file.") + parser.add_option("-l", + "--locale", + action="store", + dest="locale", + help="[Required] Specify which locale we are generating the snippet for.") + parser.add_option("-p", + "--product", + action="store", + dest="product", + help="[Required] This option is used to generate the URL to download the MAR file.") + parser.add_option("--download-base-URL", + action="store", + dest="downloadBaseURL", + help="This option indicates under which.") + parser.add_option("-v", + "--verbose", + action="store_true", + dest="verbose", + default=False, + help="This option increases the output of the script.") + (options, args) = parser.parse_args() + for req, msg in (('marPath', "the absolute path to the where the MAR file is"), + ('applicationIniFile', "the absolute path to the application.ini file."), + ('locale', "a locale."), + ('product', "specify a product.")): + if not hasattr(options, req): + parser.error('You must specify %s' % msg) + + if not options.downloadBaseURL or options.downloadBaseURL == '': + options.downloadBaseURL = 'http://ftp.mozilla.org/pub/mozilla.org/nightly' + + snippet = generateSnippet(options.marPath, + options.applicationIniFile, + options.locale, + options.downloadBaseURL, + options.product) + f = open(os.path.join(options.marPath, 'complete.update.snippet'), 'wb') + f.write(snippet) + f.close() + + if options.verbose: + # Show in our logs what the contents of the snippet are + print snippet + +def generateSnippet(abstDistDir, applicationIniFile, locale, + downloadBaseURL, product): + # Let's extract information from application.ini + c = ConfigParser() + try: + c.readfp(open(applicationIniFile)) + except IOError, (stderror): + sys.exit(stderror) + buildid = c.get("App", "BuildID") + appVersion = c.get("App", "Version") + branchName = c.get("App", "SourceRepository").split('/')[-1] + + marFileName = '%s-%s.%s.%s.complete.mar' % ( + product, + appVersion, + locale, + getPlatform()) + # Let's determine the hash and the size of the MAR file + # This function exits the script if the file does not exist + (completeMarHash, completeMarSize) = getFileHashAndSize( + os.path.join(abstDistDir, marFileName)) + # Construct the URL to where the MAR file will exist + interfix = '' + if locale == 'en-US': + interfix = '' + else: + interfix = '-l10n' + marDownloadURL = "%s/%s%s/%s" % (downloadBaseURL, + datedDirPath(buildid, branchName), + interfix, + marFileName) + + snippet = """complete +%(marDownloadURL)s +sha1 +%(completeMarHash)s +%(completeMarSize)s +%(buildid)s +%(appVersion)s +%(appVersion)s +""" % dict( marDownloadURL=marDownloadURL, + completeMarHash=completeMarHash, + completeMarSize=completeMarSize, + buildid=buildid, + appVersion=appVersion) + + return snippet + +def getPlatform(): + if platform.system() == "Linux": + return "linux-i686" + elif platform.system() in ("Windows", "Microsoft"): + return "win32" + elif platform.system() == "Darwin": + return "mac" + +def getFileHashAndSize(filepath): + sha1Hash = 'UNKNOWN' + size = 'UNKNOWN' + + try: + # open in binary mode to make sure we get consistent results + # across all platforms + f = open(filepath, "rb") + shaObj = sha.new(f.read()) + sha1Hash = shaObj.hexdigest() + size = os.stat(filepath)[ST_SIZE] + except IOError, (stderror): + sys.exit(stderror) + + return (sha1Hash, size) + +def datedDirPath(buildid, milestone): + """ + Returns a string that will look like: + 2009/12/2009-12-31-09-mozilla-central + """ + year = buildid[0:4] + month = buildid[4:6] + day = buildid[6:8] + hour = buildid[8:10] + datedDir = "%s-%s-%s-%s-%s" % (year, + month, + day, + hour, + milestone) + return "%s/%s/%s" % (year, month, datedDir) + +if __name__ == '__main__': + main() From 650d2e664b8425325db31fb9a22b2f956950996e Mon Sep 17 00:00:00 2001 From: Neil Deakin Date: Thu, 25 Jun 2009 14:09:41 -0400 Subject: [PATCH 19/70] Bug 499912, one more fix needed for the test on linux --- dom/tests/mochitest/chrome/window_focus.xul | 1 + 1 file changed, 1 insertion(+) diff --git a/dom/tests/mochitest/chrome/window_focus.xul b/dom/tests/mochitest/chrome/window_focus.xul index aa472bbd02ba..872fd36b138a 100644 --- a/dom/tests/mochitest/chrome/window_focus.xul +++ b/dom/tests/mochitest/chrome/window_focus.xul @@ -1053,6 +1053,7 @@ function framesetWindowLoaded(framesetWindow) window.openDialog("focus_window2.xul", "_blank", "chrome", switchWindowTest, framesetWindow); } else { + gOldExpectedWindow = null; gNewExpectedWindow = null; gRefocusCallback = doWindowNoRootTest; framesetWindow.close(); From 3398165d3316e9478ea8bc45fba852e91b32c2ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Thu, 25 Jun 2009 21:45:29 +0200 Subject: [PATCH 20/70] Bug 500019 - remove workaround for bug 303428. r=gavin --- browser/themes/gnomestripe/browser/browser.css | 2 +- browser/themes/pinstripe/browser/browser.css | 2 +- browser/themes/winstripe/browser/browser.css | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/browser/themes/gnomestripe/browser/browser.css b/browser/themes/gnomestripe/browser/browser.css index 78f2f31033d8..c85269770e22 100644 --- a/browser/themes/gnomestripe/browser/browser.css +++ b/browser/themes/gnomestripe/browser/browser.css @@ -1214,7 +1214,7 @@ tabpanels { border: 1px dotted transparent; } -.tabbrowser-tab[selected="true"]:focus > .tab-text { +.tabbrowser-tab:focus > .tab-text { border: 1px dotted -moz-DialogText; } diff --git a/browser/themes/pinstripe/browser/browser.css b/browser/themes/pinstripe/browser/browser.css index 78bcb26fe9cc..b8ed6e50736c 100644 --- a/browser/themes/pinstripe/browser/browser.css +++ b/browser/themes/pinstripe/browser/browser.css @@ -1561,7 +1561,7 @@ tabbrowser > tabbox { background-color: -moz-mac-chrome-active; } -.tabbrowser-tab[selected="true"]:focus > .tab-text { +.tabbrowser-tab:focus > .tab-text { -moz-box-shadow: 0 0 4px -moz-mac-focusring, 0 0 4px -moz-mac-focusring, 0 0 3px -moz-mac-focusring, diff --git a/browser/themes/winstripe/browser/browser.css b/browser/themes/winstripe/browser/browser.css index 5dfb004ed5cb..daaab3d84817 100644 --- a/browser/themes/winstripe/browser/browser.css +++ b/browser/themes/winstripe/browser/browser.css @@ -1404,7 +1404,7 @@ tabpanels { border: 1px dotted transparent; } -.tabbrowser-tab[selected="true"]:focus > .tab-text { +.tabbrowser-tab:focus > .tab-text { border: 1px dotted -moz-DialogText; } From 670216332d51e3e192933f5174e4e66e904b0280 Mon Sep 17 00:00:00 2001 From: Vladimir Vukicevic Date: Thu, 25 Jun 2009 13:30:56 -0700 Subject: [PATCH 21/70] b=492724; pull out canvas utility functions into CanvasUtils/LayoutUtils; r+sr=roc --- content/canvas/src/CanvasUtils.cpp | 94 +++++ content/canvas/src/CanvasUtils.h | 76 ++++ content/canvas/src/Makefile.in | 14 +- content/canvas/src/dummy.cpp | 9 - .../canvas/src/nsCanvasRenderingContext2D.cpp | 327 +++--------------- gfx/thebes/public/gfxASurface.h | 2 + layout/base/nsLayoutUtils.cpp | 191 ++++++++++ layout/base/nsLayoutUtils.h | 39 +++ 8 files changed, 449 insertions(+), 303 deletions(-) create mode 100644 content/canvas/src/CanvasUtils.cpp create mode 100644 content/canvas/src/CanvasUtils.h delete mode 100644 content/canvas/src/dummy.cpp diff --git a/content/canvas/src/CanvasUtils.cpp b/content/canvas/src/CanvasUtils.cpp new file mode 100644 index 000000000000..6718bf05ffbb --- /dev/null +++ b/content/canvas/src/CanvasUtils.cpp @@ -0,0 +1,94 @@ +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** 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 + * Vladimir Vukicevic + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "prmem.h" + +#include "nsIServiceManager.h" + +#include "nsIDOMDocument.h" +#include "nsIDocument.h" +#include "nsIDOMCanvasRenderingContext2D.h" +#include "nsICanvasRenderingContextInternal.h" +#include "nsICanvasElement.h" +#include "nsIPrincipal.h" +#include "nsINode.h" + +#include "nsGfxCIID.h" + +#include "nsTArray.h" + +#include "CanvasUtils.h" + +using namespace mozilla; + +void +CanvasUtils::DoDrawImageSecurityCheck(nsICanvasElement *aCanvasElement, + nsIPrincipal *aPrincipal, + PRBool forceWriteOnly) +{ + // Callers should ensure that mCanvasElement is non-null before calling this + if (!aCanvasElement) { + NS_WARNING("DoDrawImageSecurityCheck called without canvas element!"); + return; + } + + if (aCanvasElement->IsWriteOnly()) + return; + + // If we explicitly set WriteOnly just do it and get out + if (forceWriteOnly) { + aCanvasElement->SetWriteOnly(); + return; + } + + if (aPrincipal == nsnull) + return; + + nsCOMPtr elem = do_QueryInterface(aCanvasElement); + if (elem) { // XXXbz How could this actually be null? + PRBool subsumes; + nsresult rv = + elem->NodePrincipal()->Subsumes(aPrincipal, &subsumes); + + if (NS_SUCCEEDED(rv) && subsumes) { + // This canvas has access to that image anyway + return; + } + } + + aCanvasElement->SetWriteOnly(); +} diff --git a/content/canvas/src/CanvasUtils.h b/content/canvas/src/CanvasUtils.h new file mode 100644 index 000000000000..86794193fbe1 --- /dev/null +++ b/content/canvas/src/CanvasUtils.h @@ -0,0 +1,76 @@ +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** 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 + * Vladimir Vukicevic + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef _CANVASUTILS_H_ +#define _CANVASUTILS_H_ + +#include "prtypes.h" +#include "nsContentUtils.h" +#include "nsICanvasElement.h" +#include "nsIPrincipal.h" +#include "nsIDOMElement.h" +#include "nsRect.h" + +#include "gfxASurface.h" + +namespace mozilla { + +class CanvasUtils { +public: + // Check that the rectangle [x,y,w,h] is a subrectangle of [0,0,realWidth,realHeight] + + static PRBool CheckSaneSubrectSize(PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h, + PRInt32 realWidth, PRInt32 realHeight) + { + return nsIntRect(0, 0, realWidth, realHeight).Contains(nsIntRect(x, y, w, h)); + } + + // Flag aCanvasElement as write-only if drawing an image with aPrincipal + // onto it would make it such. + + static void DoDrawImageSecurityCheck(nsICanvasElement *aCanvasElement, + nsIPrincipal *aPrincipal, + PRBool forceWriteOnly); + +private: + // this can't be instantiated + CanvasUtils() { } +}; + +} + +#endif /* _CANVASUTILS_H_ */ diff --git a/content/canvas/src/Makefile.in b/content/canvas/src/Makefile.in index b2581da1df9f..06e2474dd12d 100644 --- a/content/canvas/src/Makefile.in +++ b/content/canvas/src/Makefile.in @@ -68,17 +68,11 @@ REQUIRES = \ qcms \ $(NULL) -# XXX some platforms can't handle building -# an empty .a/lib. Remove this dummy.cpp -# whenever w have a rendering context -# that doesn't depend on any non-default -# libraries. -CPPSRCS = dummy.cpp \ - $(NULL) -ifdef MOZ_ENABLE_CANVAS -CPPSRCS += nsCanvasRenderingContext2D.cpp -endif +CPPSRCS = \ + CanvasUtils.cpp \ + nsCanvasRenderingContext2D.cpp \ + $(NULL) # we don't want the shared lib, but we want to force the creation of a static lib. FORCE_STATIC_LIB = 1 diff --git a/content/canvas/src/dummy.cpp b/content/canvas/src/dummy.cpp deleted file mode 100644 index ca2d4037b956..000000000000 --- a/content/canvas/src/dummy.cpp +++ /dev/null @@ -1,9 +0,0 @@ -/* - * This file only exists because some platforms can't handle building an empty .a - * file, or .lib, or whatever (e.g. OS X, possibly Win32). - * - * Need at least one external symbol for some linkers to create a proper - * archive file: https://bugzilla.mozilla.org/show_bug.cgi?id=311143 - */ -void concvsdummy(void) {} - diff --git a/content/canvas/src/nsCanvasRenderingContext2D.cpp b/content/canvas/src/nsCanvasRenderingContext2D.cpp index 12f1f7ea3a7f..4dcf620df6e1 100644 --- a/content/canvas/src/nsCanvasRenderingContext2D.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp @@ -55,15 +55,9 @@ #include "nsIPresShell.h" #include "nsIVariant.h" -#include "imgIRequest.h" -#include "imgIContainer.h" -#include "gfxIImageFrame.h" #include "nsIDOMHTMLCanvasElement.h" #include "nsICanvasElement.h" -#include "nsIDOMHTMLImageElement.h" -#include "nsIImageLoadingContent.h" #include "nsIInterfaceRequestorUtils.h" -#include "nsIImage.h" #include "nsIFrame.h" #include "nsDOMError.h" #include "nsIScriptError.h" @@ -110,17 +104,15 @@ #include "nsBidiPresUtils.h" -#ifdef MOZ_MEDIA -#include "nsHTMLVideoElement.h" -#endif +#include "CanvasUtils.h" + +using namespace mozilla; #ifndef M_PI #define M_PI 3.14159265358979323846 #define M_PI_2 1.57079632679489661923 #endif -static PRBool CheckSaneSubrectSize (PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h, PRInt32 realWidth, PRInt32 realHeight); - /* Float validation stuff */ #define VALIDATE(_f) if (!JSDOUBLE_IS_FINITE(_f)) return PR_FALSE @@ -360,14 +352,6 @@ protected: */ void ApplyStyle(Style aWhichStyle, PRBool aUseGlobalAlpha = PR_TRUE); - // If aPrincipal is not subsumed by this canvas element, then - // we make the canvas write-only so bad guys can't extract the pixel - // data. If forceWriteOnly is set, we force write only to be set - // and ignore aPrincipal. (This is used for when the original data came - // from a that had write-only set.) - void DoDrawImageSecurityCheck(nsIPrincipal* aPrincipal, - PRBool forceWriteOnly); - // Member vars PRInt32 mWidth, mHeight; PRPackedBool mValid; @@ -614,14 +598,6 @@ protected: static PRBool ConvertJSValToDouble(double* aProp, JSContext* aContext, jsval aValue); - // thebes helpers - nsresult ThebesSurfaceFromElement(nsIDOMElement *imgElt, - PRBool forceCopy, - gfxASurface **aSurface, - PRInt32 *widthOut, PRInt32 *heightOut, - nsIPrincipal **prinOut, - PRBool *forceWriteOnlyOut); - // other helpers void GetAppUnitsValues(PRUint32 *perDevPixel, PRUint32 *perCSSPixel) { // If we don't have a canvas element, we just return something generic. @@ -791,43 +767,6 @@ nsCanvasRenderingContext2D::DirtyAllStyles() } } -void -nsCanvasRenderingContext2D::DoDrawImageSecurityCheck(nsIPrincipal* aPrincipal, - PRBool forceWriteOnly) -{ - // Callers should ensure that mCanvasElement is non-null before calling this - if (!mCanvasElement) { - NS_WARNING("DoDrawImageSecurityCheck called without canvas element!"); - return; - } - - if (mCanvasElement->IsWriteOnly()) - return; - - // If we explicitly set WriteOnly just do it and get out - if (forceWriteOnly) { - mCanvasElement->SetWriteOnly(); - return; - } - - if (aPrincipal == nsnull) - return; - - nsCOMPtr elem = do_QueryInterface(mCanvasElement); - if (elem) { // XXXbz How could this actually be null? - PRBool subsumes; - nsresult rv = - elem->NodePrincipal()->Subsumes(aPrincipal, &subsumes); - - if (NS_SUCCEEDED(rv) && subsumes) { - // This canvas has access to that image anyway - return; - } - } - - mCanvasElement->SetWriteOnly(); -} - void nsCanvasRenderingContext2D::ApplyStyle(Style aWhichStyle, PRBool aUseGlobalAlpha) @@ -850,8 +789,9 @@ nsCanvasRenderingContext2D::ApplyStyle(Style aWhichStyle, if (!mCanvasElement) return; - DoDrawImageSecurityCheck(pattern->Principal(), - pattern->GetForceWriteOnly()); + CanvasUtils::DoDrawImageSecurityCheck(mCanvasElement, + pattern->Principal(), + pattern->GetForceWriteOnly()); gfxPattern* gpat = pattern->GetPattern(); @@ -1333,7 +1273,6 @@ nsCanvasRenderingContext2D::CreatePattern(nsIDOMHTMLElement *image, const nsAString& repeat, nsIDOMCanvasPattern **_retval) { - nsresult rv; gfxPattern::GraphicsExtend extend; if (repeat.IsEmpty() || repeat.EqualsLiteral("repeat")) { @@ -1351,22 +1290,17 @@ nsCanvasRenderingContext2D::CreatePattern(nsIDOMHTMLElement *image, return NS_ERROR_DOM_SYNTAX_ERR; } - PRInt32 imgWidth, imgHeight; - nsCOMPtr principal; - PRBool forceWriteOnly = PR_FALSE; - nsRefPtr imgsurf; - rv = ThebesSurfaceFromElement(image, PR_TRUE, - getter_AddRefs(imgsurf), &imgWidth, &imgHeight, - getter_AddRefs(principal), &forceWriteOnly); - if (NS_FAILED(rv)) - return rv; + nsLayoutUtils::SurfaceFromElementResult res = + nsLayoutUtils::SurfaceFromElement(image, nsLayoutUtils::SFE_WANT_NEW_SURFACE); + if (!res.mSurface) + return NS_ERROR_NOT_AVAILABLE; - nsRefPtr thebespat = new gfxPattern(imgsurf); + nsRefPtr thebespat = new gfxPattern(res.mSurface); thebespat->SetExtend(extend); - nsRefPtr pat = new nsCanvasPattern(thebespat, principal, - forceWriteOnly); + nsRefPtr pat = new nsCanvasPattern(thebespat, res.mPrincipal, + res.mIsWriteOnly); if (!pat) return NS_ERROR_OUT_OF_MEMORY; @@ -2959,22 +2893,33 @@ nsCanvasRenderingContext2D::DrawImage() ctx, argv[0])) return NS_ERROR_DOM_TYPE_MISMATCH_ERR; - PRInt32 imgWidth, imgHeight; - nsCOMPtr principal; - PRBool forceWriteOnly = PR_FALSE; gfxMatrix matrix; nsRefPtr pattern; nsRefPtr path; - nsRefPtr imgsurf; #ifdef WINCE nsRefPtr currentSurface; #endif - rv = ThebesSurfaceFromElement(imgElt, PR_FALSE, - getter_AddRefs(imgsurf), &imgWidth, &imgHeight, - getter_AddRefs(principal), &forceWriteOnly); - if (NS_FAILED(rv)) - return rv; - DoDrawImageSecurityCheck(principal, forceWriteOnly); + nsLayoutUtils::SurfaceFromElementResult res = + nsLayoutUtils::SurfaceFromElement(imgElt); + if (!res.mSurface) + return NS_ERROR_NOT_AVAILABLE; + +#ifndef WINCE + // On non-CE, force a copy if we're using drawImage with our destination + // as a source to work around some Cairo self-copy semantics issues. + if (res.mSurface == mSurface) { + res = nsLayoutUtils::SurfaceFromElement(imgElt, nsLayoutUtils::SFE_WANT_NEW_SURFACE); + if (!res.mSurface) + return NS_ERROR_NOT_AVAILABLE; + } +#endif + + nsRefPtr imgsurf = res.mSurface; + nsCOMPtr principal = res.mPrincipal; + gfxIntSize imgSize = res.mSize; + PRBool forceWriteOnly = res.mIsWriteOnly; + + CanvasUtils::DoDrawImageSecurityCheck(mCanvasElement, principal, forceWriteOnly); gfxContextPathAutoSaveRestore pathSR(mThebes, PR_FALSE); @@ -2987,16 +2932,16 @@ nsCanvasRenderingContext2D::DrawImage() GET_ARG(&dx, argv[1]); GET_ARG(&dy, argv[2]); sx = sy = 0.0; - dw = sw = (double) imgWidth; - dh = sh = (double) imgHeight; + dw = sw = (double) imgSize.width; + dh = sh = (double) imgSize.height; } else if (argc == 5) { GET_ARG(&dx, argv[1]); GET_ARG(&dy, argv[2]); GET_ARG(&dw, argv[3]); GET_ARG(&dh, argv[4]); sx = sy = 0.0; - sw = (double) imgWidth; - sh = (double) imgHeight; + sw = (double) imgSize.width; + sh = (double) imgSize.height; } else if (argc == 9) { GET_ARG(&sx, argv[1]); GET_ARG(&sy, argv[2]); @@ -3027,8 +2972,8 @@ nsCanvasRenderingContext2D::DrawImage() // check args if (sx < 0.0 || sy < 0.0 || - sw < 0.0 || sw > (double) imgWidth || - sh < 0.0 || sh > (double) imgHeight || + sw < 0.0 || sw > (double) imgSize.width || + sh < 0.0 || sh > (double) imgSize.height || dw < 0.0 || dh < 0.0) { // XXX ERRMSG we need to report an error to developers here! (bug 329026) @@ -3258,192 +3203,6 @@ nsCanvasRenderingContext2D::ConvertJSValToXPCObject(nsISupports** aSupports, REF return JS_FALSE; } -/* thebes ARGB32 surfaces are ARGB stored as a packed 32-bit integer; on little-endian - * platforms, they appear as BGRA bytes in the surface data. The color values are also - * stored with premultiplied alpha. - * - * If forceCopy is FALSE, a surface may be returned that's only valid during the current - * operation. If it's TRUE, a copy will always be made that can safely be retained. - */ - -nsresult -nsCanvasRenderingContext2D::ThebesSurfaceFromElement(nsIDOMElement *imgElt, - PRBool forceCopy, - gfxASurface **aSurface, - PRInt32 *widthOut, - PRInt32 *heightOut, - nsIPrincipal **prinOut, - PRBool *forceWriteOnlyOut) -{ - nsresult rv; - - nsCOMPtr node = do_QueryInterface(imgElt); - - /* If it's a Canvas, grab its internal surface as necessary */ - nsCOMPtr canvas = do_QueryInterface(imgElt); - if (node && canvas) { - PRUint32 w, h; - rv = canvas->GetSize(&w, &h); - NS_ENSURE_SUCCESS(rv, rv); - - nsRefPtr sourceSurface; - - if (!forceCopy && canvas->CountContexts() == 1) { - nsICanvasRenderingContextInternal *srcCanvas = canvas->GetContextAtIndex(0); - rv = srcCanvas->GetThebesSurface(getter_AddRefs(sourceSurface)); -#ifndef WINCE - // force a copy if we couldn't get the surface, or if it's - // the same as what we have - if (sourceSurface == mSurface || NS_FAILED(rv)) -#else - // force a copy if we couldn't get the surface - if (NS_FAILED(rv)) -#endif - sourceSurface = nsnull; - } - - if (sourceSurface == nsnull) { - nsRefPtr surf = - gfxPlatform::GetPlatform()->CreateOffscreenSurface - (gfxIntSize(w, h), gfxASurface::ImageFormatARGB32); - nsRefPtr ctx = new gfxContext(surf); - rv = canvas->RenderContexts(ctx, gfxPattern::FILTER_NEAREST); - if (NS_FAILED(rv)) - return rv; - sourceSurface = surf; - } - - *aSurface = sourceSurface.forget().get(); - *widthOut = w; - *heightOut = h; - - NS_ADDREF(*prinOut = node->NodePrincipal()); - *forceWriteOnlyOut = canvas->IsWriteOnly(); - - return NS_OK; - } - -#ifdef MOZ_MEDIA - /* Maybe it's
    + + + + + + @@ -366,26 +381,10 @@ From e2c67bf26b4e3e35c80d4dbc9fd8bf32b1549cff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Fri, 26 Jun 2009 14:49:37 +0200 Subject: [PATCH 45/70] Bug 500633 - remove obsolete ifSetAttribute method. r=neil --- toolkit/content/widgets/autocomplete.xml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/toolkit/content/widgets/autocomplete.xml b/toolkit/content/widgets/autocomplete.xml index 90e72ef7e13a..5532a44810a5 100644 --- a/toolkit/content/widgets/autocomplete.xml +++ b/toolkit/content/widgets/autocomplete.xml @@ -515,15 +515,6 @@ ]]> - - - - - - Date: Fri, 26 Jun 2009 10:32:32 -0400 Subject: [PATCH 46/70] Get rid of nsIPluginInstance::Destroy, it doesn't do anything. b=500593 r/sr=jst --- .../plugin/base/public/nsIPluginInstance.idl | 30 +------------------ .../plugin/base/src/nsNPAPIPluginInstance.cpp | 8 ----- modules/plugin/base/src/nsPluginHostImpl.cpp | 10 ------- 3 files changed, 1 insertion(+), 47 deletions(-) diff --git a/modules/plugin/base/public/nsIPluginInstance.idl b/modules/plugin/base/public/nsIPluginInstance.idl index 36a26bad3357..ae8e8932c193 100644 --- a/modules/plugin/base/public/nsIPluginInstance.idl +++ b/modules/plugin/base/public/nsIPluginInstance.idl @@ -44,24 +44,7 @@ interface nsIPluginInstancePeer; -/** - * The nsIPluginInstance interface is the minimum interface plugin developers - * need to support in order to implement a plugin instance. The plugin manager - * may QueryInterface for more specific types, e.g. nsILiveConnectPluginInstance. - * - * (Corresponds to NPP object.) - * - * The old NPP_Destroy call has been factored into two plugin instance - * methods: - * - * Stop -- called when the plugin instance is to be stopped (e.g. by - * displaying another plugin manager window, causing the page containing - * the plugin to become removed from the display). - * - * Destroy -- called once, before the plugin instance peer is to be - * destroyed. This method is used to destroy the plugin instance. - */ -[uuid(ebe00f40-0199-11d2-815b-006008119d7a)] +[uuid(89DF5288-1EDE-40BD-99CE-87B415DC0FED)] interface nsIPluginInstance : nsISupports { /** @@ -106,17 +89,6 @@ interface nsIPluginInstance : nsISupports */ void stop(); - /** - * Called to instruct the plugin instance to destroy itself. This - * is called when it become no longer possible to return to the - * plugin instance, either because the browser window's history - * list of pages is being trimmed, or because the window - * containing this page in the history is being closed. - * - * @result - NS_OK if this operation was successful - */ - void destroy(); - /** * Called when the window containing the plugin instance changes. * diff --git a/modules/plugin/base/src/nsNPAPIPluginInstance.cpp b/modules/plugin/base/src/nsNPAPIPluginInstance.cpp index ce65dc6c1f3d..8af9b01b672c 100644 --- a/modules/plugin/base/src/nsNPAPIPluginInstance.cpp +++ b/modules/plugin/base/src/nsNPAPIPluginInstance.cpp @@ -1040,14 +1040,6 @@ nsresult nsNPAPIPluginInstance::InitializePlugin(nsIPluginInstancePeer* peer) return NS_OK; } -NS_IMETHODIMP nsNPAPIPluginInstance::Destroy(void) -{ - PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("nsNPAPIPluginInstance::Destroy this=%p\n",this)); - - // destruction is handled in the Stop call - return NS_OK; -} - NS_IMETHODIMP nsNPAPIPluginInstance::SetWindow(nsPluginWindow* window) { // XXX NPAPI plugins don't want a SetWindow(NULL). diff --git a/modules/plugin/base/src/nsPluginHostImpl.cpp b/modules/plugin/base/src/nsPluginHostImpl.cpp index 15736777bbd9..07b74712e9b9 100644 --- a/modules/plugin/base/src/nsPluginHostImpl.cpp +++ b/modules/plugin/base/src/nsPluginHostImpl.cpp @@ -349,14 +349,6 @@ nsPluginInstanceTag::~nsPluginInstanceTag() peer2->InvalidateOwner(); } - // now check for cached plugins because they haven't had nsIPluginInstance::Destroy() - // called yet. For non-cached plugins, nsIPluginInstance::Destroy() is called - // in either nsObjectFrame::Destroy() or nsPluginInstanceTagList::stopRunning() - PRBool doCache = PR_TRUE; - mInstance->GetValue(nsPluginInstanceVariable_DoCacheBool, (void *) &doCache); - if (doCache) - mInstance->Destroy(); - NS_RELEASE(mInstance); NS_IF_RELEASE(mPeer); } @@ -496,13 +488,11 @@ void nsPluginInstanceTagList::stopRunning(nsISupportsArray* aReloadDocs, (void *) &doCallSetWindowAfterDestroy); if (doCallSetWindowAfterDestroy) { p->mInstance->Stop(); - p->mInstance->Destroy(); p->mInstance->SetWindow(nsnull); } else { p->mInstance->SetWindow(nsnull); p->mInstance->Stop(); - p->mInstance->Destroy(); } doCallSetWindowAfterDestroy = PR_FALSE; p->setStopped(PR_TRUE); From da590c4fb4de3bd973fef04bc679fafd5279ba41 Mon Sep 17 00:00:00 2001 From: Josh Aas Date: Fri, 26 Jun 2009 10:33:17 -0400 Subject: [PATCH 47/70] Don't allow access to any XPCOM objects view NPAPI's NPN_GetValue. b=500513 r/sr=jst --- modules/plugin/base/src/nsNPAPIPlugin.cpp | 43 ++--------------------- 1 file changed, 3 insertions(+), 40 deletions(-) diff --git a/modules/plugin/base/src/nsNPAPIPlugin.cpp b/modules/plugin/base/src/nsNPAPIPlugin.cpp index a44116fe4cae..444bdd435019 100644 --- a/modules/plugin/base/src/nsNPAPIPlugin.cpp +++ b/modules/plugin/base/src/nsNPAPIPlugin.cpp @@ -1960,47 +1960,10 @@ _getvalue(NPP npp, NPNVariable variable, void *result) return NPERR_NO_ERROR; } - case NPNVserviceManager: { - nsIServiceManager * sm; - res = NS_GetServiceManager(&sm); - if (NS_SUCCEEDED(res)) { - *(nsIServiceManager**)result = sm; - return NPERR_NO_ERROR; - } else { - return NPERR_GENERIC_ERROR; - } - } - - case NPNVDOMElement: { - nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *) npp->ndata; - NS_ENSURE_TRUE(inst, NPERR_GENERIC_ERROR); - - nsCOMPtr pip; - inst->GetPeer(getter_AddRefs(pip)); - nsCOMPtr pti2 (do_QueryInterface(pip)); - if (pti2) { - nsCOMPtr e; - pti2->GetDOMElement(getter_AddRefs(e)); - if (e) { - NS_ADDREF(*(nsIDOMElement**)result = e.get()); - return NPERR_NO_ERROR; - } - } - return NPERR_GENERIC_ERROR; - } - + case NPNVserviceManager: + case NPNVDOMElement: case NPNVDOMWindow: { - nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)npp->ndata; - NS_ENSURE_TRUE(inst, NPERR_GENERIC_ERROR); - - nsIDOMWindow *domWindow = inst->GetDOMWindow().get(); - - if (domWindow) { - // Pass over ownership of domWindow to the caller. - (*(nsIDOMWindow**)result) = domWindow; - - return NPERR_NO_ERROR; - } + // we no longer hand out any XPCOM objects return NPERR_GENERIC_ERROR; } From c3ab076f1939f094cf897ab59c7e18fe8eb51e6f Mon Sep 17 00:00:00 2001 From: Josh Aas Date: Fri, 26 Jun 2009 10:47:51 -0400 Subject: [PATCH 48/70] Bustage fix for bug 500593. --- dom/base/nsGlobalWindow.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index cc137f543292..c92c463a9f7c 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -437,7 +437,6 @@ nsDummyJavaPluginOwner::Destroy() // If we have a plugin instance, stop it and destroy it now. if (mInstance) { mInstance->Stop(); - mInstance->Destroy(); nsCOMPtr peer; mInstance->GetPeer(getter_AddRefs(peer)); From ba718de566226c4edcd782c824f950088d0be1bd Mon Sep 17 00:00:00 2001 From: Josh Aas Date: Fri, 26 Jun 2009 10:54:51 -0400 Subject: [PATCH 49/70] Bustage fix for bug 500593. --- layout/generic/nsObjectFrame.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index 0cf262333044..76f5a12d2478 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -1906,7 +1906,6 @@ DoStopPlugin(nsPluginInstanceOwner *aInstanceOwner, PRBool aDelayedStop) // XXXjst: ns4xPluginInstance::Destroy() is a no-op, clean // this mess up when there are no other instance types. inst->Stop(); - inst->Destroy(); if (window) window->CallSetWindow(nullinst); @@ -1923,7 +1922,6 @@ DoStopPlugin(nsPluginInstanceOwner *aInstanceOwner, PRBool aDelayedStop) return; inst->Stop(); - inst->Destroy(); } } else { From 51b4b5302488de59de0f3e26c5605e309d2d9cd2 Mon Sep 17 00:00:00 2001 From: Johnny Stenback Date: Fri, 26 Jun 2009 07:57:26 -0700 Subject: [PATCH 50/70] Fixing bug 484744. Revert an IID change that broke the old Java plugin. r+sr=mrbkap@gmail.com --- dom/base/nsGlobalWindow.cpp | 6 +++--- layout/generic/nsObjectFrame.cpp | 6 +++--- modules/plugin/base/public/nsIPluginInstancePeer2.idl | 6 +++++- modules/plugin/base/src/nsPluginHostImpl.cpp | 6 +++--- modules/plugin/base/src/nsPluginInstancePeer.cpp | 3 ++- modules/plugin/base/src/nsPluginInstancePeer.h | 3 ++- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index c92c463a9f7c..bc610e761eb1 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -441,11 +441,11 @@ nsDummyJavaPluginOwner::Destroy() nsCOMPtr peer; mInstance->GetPeer(getter_AddRefs(peer)); - nsCOMPtr peer2(do_QueryInterface(peer)); + nsCOMPtr peer3(do_QueryInterface(peer)); // This plugin owner is going away, tell the peer. - if (peer2) - peer2->InvalidateOwner(); + if (peer3) + peer3->InvalidateOwner(); mInstance = nsnull; } diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index 76f5a12d2478..37943bb08cc6 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -2264,11 +2264,11 @@ nsPluginInstanceOwner::~nsPluginInstanceOwner() nsCOMPtr peer; mInstance->GetPeer(getter_AddRefs(peer)); - nsCOMPtr peer2(do_QueryInterface(peer)); + nsCOMPtr peer3(do_QueryInterface(peer)); - if (peer2) { + if (peer3) { // Tell the peer that its owner is going away. - peer2->InvalidateOwner(); + peer3->InvalidateOwner(); } } } diff --git a/modules/plugin/base/public/nsIPluginInstancePeer2.idl b/modules/plugin/base/public/nsIPluginInstancePeer2.idl index 674fd477630e..9a84f54f2443 100644 --- a/modules/plugin/base/public/nsIPluginInstancePeer2.idl +++ b/modules/plugin/base/public/nsIPluginInstancePeer2.idl @@ -61,7 +61,7 @@ struct JSContext; * All functionality in nsIPluginInstancePeer can be mapped to the 4.X * plugin API. */ -[uuid(79a2d210-55e4-4687-bd87-64b10c2466cc)] +[uuid(e7d48c00-e1f1-11d2-8360-fbc8abc4ae7c)] interface nsIPluginInstancePeer2 : nsIPluginInstancePeer { /** @@ -88,7 +88,11 @@ interface nsIPluginInstancePeer2 : nsIPluginInstancePeer * @result - NS_OK if this operation was successful */ readonly attribute JSContextPtr JSContext; +}; +[uuid(79a2d210-55e4-4687-bd87-64b10c2466cc)] +interface nsIPluginInstancePeer3 : nsIPluginInstancePeer2 +{ /** * Drop our reference to our owner. */ diff --git a/modules/plugin/base/src/nsPluginHostImpl.cpp b/modules/plugin/base/src/nsPluginHostImpl.cpp index 07b74712e9b9..2aed2f1c4f6b 100644 --- a/modules/plugin/base/src/nsPluginHostImpl.cpp +++ b/modules/plugin/base/src/nsPluginHostImpl.cpp @@ -343,10 +343,10 @@ nsPluginInstanceTag::~nsPluginInstanceTag() if (owner) owner->SetInstance(nsnull); - nsCOMPtr peer2(do_QueryInterface(peer)); + nsCOMPtr peer3(do_QueryInterface(peer)); - if (peer2) - peer2->InvalidateOwner(); + if (peer3) + peer3->InvalidateOwner(); } NS_RELEASE(mInstance); diff --git a/modules/plugin/base/src/nsPluginInstancePeer.cpp b/modules/plugin/base/src/nsPluginInstancePeer.cpp index 422c97207937..ca2ef61fd200 100644 --- a/modules/plugin/base/src/nsPluginInstancePeer.cpp +++ b/modules/plugin/base/src/nsPluginInstancePeer.cpp @@ -77,9 +77,10 @@ nsPluginInstancePeerImpl::~nsPluginInstancePeerImpl() static NS_DEFINE_IID(kIPluginTagInfoIID, NS_IPLUGINTAGINFO_IID); static NS_DEFINE_IID(kIPluginTagInfo2IID, NS_IPLUGINTAGINFO2_IID); -NS_IMPL_ISUPPORTS6(nsPluginInstancePeerImpl, +NS_IMPL_ISUPPORTS7(nsPluginInstancePeerImpl, nsIPluginInstancePeer, nsIPluginInstancePeer2, + nsIPluginInstancePeer3, nsIWindowlessPluginInstancePeer, nsIPluginTagInfo, nsIPluginTagInfo2, diff --git a/modules/plugin/base/src/nsPluginInstancePeer.h b/modules/plugin/base/src/nsPluginInstancePeer.h index 3328253bc86c..6c5f377b6231 100644 --- a/modules/plugin/base/src/nsPluginInstancePeer.h +++ b/modules/plugin/base/src/nsPluginInstancePeer.h @@ -46,7 +46,7 @@ #include "nsCOMPtr.h" -class nsPluginInstancePeerImpl : public nsIPluginInstancePeer2, +class nsPluginInstancePeerImpl : public nsIPluginInstancePeer3, public nsIWindowlessPluginInstancePeer, public nsIPluginTagInfo2, public nsPIPluginInstancePeer @@ -60,6 +60,7 @@ public: NS_DECL_NSIPLUGININSTANCEPEER NS_DECL_NSIWINDOWLESSPLUGININSTANCEPEER NS_DECL_NSIPLUGININSTANCEPEER2 + NS_DECL_NSIPLUGININSTANCEPEER3 NS_DECL_NSIPLUGINTAGINFO NS_DECL_NSIPLUGINTAGINFO2 From 3df453a7c5131f32be6a72941edc02276bbe8cf3 Mon Sep 17 00:00:00 2001 From: Josh Aas Date: Fri, 26 Jun 2009 13:30:36 -0400 Subject: [PATCH 51/70] Get rid of nsIWindowlessPluginInstancePeer. b=500672 r/sr=jst --- modules/plugin/base/public/Makefile.in | 1 - .../plugin/base/public/nsIPluginInstance.idl | 15 +++++ .../base/public/nsIWindowlessPlugInstPeer.idl | 62 ------------------- modules/plugin/base/public/nsplugin.h | 8 --- modules/plugin/base/public/nsplugindefs.h | 1 - modules/plugin/base/src/nsNPAPIPlugin.cpp | 26 +------- modules/plugin/base/src/nsNPAPIPlugin.h | 1 - .../plugin/base/src/nsNPAPIPluginInstance.cpp | 45 ++++++++++++++ .../plugin/base/src/nsPluginInstancePeer.cpp | 30 +-------- .../plugin/base/src/nsPluginInstancePeer.h | 3 - .../base/src/nsPluginNativeWindowGtk2.cpp | 13 +--- 11 files changed, 66 insertions(+), 139 deletions(-) delete mode 100644 modules/plugin/base/public/nsIWindowlessPlugInstPeer.idl diff --git a/modules/plugin/base/public/Makefile.in b/modules/plugin/base/public/Makefile.in index e61d8757a264..b9033c45ebe6 100644 --- a/modules/plugin/base/public/Makefile.in +++ b/modules/plugin/base/public/Makefile.in @@ -71,7 +71,6 @@ XPIDLSRCS = \ nsIPluginInstanceOwner.idl \ nsIPlugin.idl \ nsIHTTPHeaderListener.idl \ - nsIWindowlessPlugInstPeer.idl \ nsIPluginTag.idl \ nsIPluginTagInfo.idl \ nsIPluginTagInfo2.idl \ diff --git a/modules/plugin/base/public/nsIPluginInstance.idl b/modules/plugin/base/public/nsIPluginInstance.idl index ae8e8932c193..153fb7f10ec1 100644 --- a/modules/plugin/base/public/nsIPluginInstance.idl +++ b/modules/plugin/base/public/nsIPluginInstance.idl @@ -145,4 +145,19 @@ interface nsIPluginInstance : nsISupports * @result - NS_OK if this operation was successful */ void handleEvent(in nsPluginEventPtr aEvent, out boolean aHandled); + + /** + * Corresponds to NPN_InvalidateRect + */ + void invalidateRect(in nsPluginRectPtr aRect); + + /** + * Corresponds to NPN_InvalidateRegion + */ + void invalidateRegion(in nsPluginRegion aRegion); + + /** + * Corresponds to NPN_ForceRedraw + */ + void forceRedraw(); }; diff --git a/modules/plugin/base/public/nsIWindowlessPlugInstPeer.idl b/modules/plugin/base/public/nsIWindowlessPlugInstPeer.idl deleted file mode 100644 index 7bdd5c71bb7d..000000000000 --- a/modules/plugin/base/public/nsIWindowlessPlugInstPeer.idl +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** 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 - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nsISupports.idl" -#include "nspluginroot.idl" - -%{C++ -#include "nsplugindefs.h" -%} - -[uuid(57b4e2f0-019b-11d2-815b-006008119d7a)] -interface nsIWindowlessPluginInstancePeer : nsISupports -{ - /** - * Corresponds to NPN_InvalidateRect - */ - void invalidateRect(in nsPluginRectPtr aRect); - - /** - * Corresponds to NPN_InvalidateRegion - */ - void invalidateRegion(in nsPluginRegion aRegion); - - /** - * Corresponds to NPN_ForceRedraw - */ - void forceRedraw(); -}; diff --git a/modules/plugin/base/public/nsplugin.h b/modules/plugin/base/public/nsplugin.h index 60d625f381ed..b37c4ec2f8bb 100644 --- a/modules/plugin/base/public/nsplugin.h +++ b/modules/plugin/base/public/nsplugin.h @@ -128,14 +128,6 @@ */ #include "nsIPluginTagInfo.h" -/** - * The nsIWindowlessPluginInstancePeer provides additional operations for - * windowless plugins. - * - * To obtain: QueryInterface on nsIPluginInstancePeer - */ -#include "nsIWindowlessPlugInstPeer.h" - //////////////////////////////////////////////////////////////////////////////// /** * Interfaces implemented by the browser (new for 5.0): diff --git a/modules/plugin/base/public/nsplugindefs.h b/modules/plugin/base/public/nsplugindefs.h index ecb8cf600749..ec09cdacaadf 100644 --- a/modules/plugin/base/public/nsplugindefs.h +++ b/modules/plugin/base/public/nsplugindefs.h @@ -399,7 +399,6 @@ class nsIPluginInstance; // plugin instance // Classes that are implemented by the browser: class nsIPluginInstancePeer; // parts of nsIPluginInstance implemented by the browser -class nsIWindowlessPluginInstancePeer; // subclass of nsIPluginInstancePeer for windowless plugins class nsIPluginTagInfo; // describes html tag (accessible from nsIPluginInstancePeer) //////////////////////////////////////////////////////////////////////////////// diff --git a/modules/plugin/base/src/nsNPAPIPlugin.cpp b/modules/plugin/base/src/nsNPAPIPlugin.cpp index 444bdd435019..16be744d9e2b 100644 --- a/modules/plugin/base/src/nsNPAPIPlugin.cpp +++ b/modules/plugin/base/src/nsNPAPIPlugin.cpp @@ -1070,14 +1070,7 @@ _invalidaterect(NPP npp, NPRect *invalidRect) PluginDestructionGuard guard(inst); - nsCOMPtr peer; - if (NS_SUCCEEDED(inst->GetPeer(getter_AddRefs(peer))) && peer) { - nsCOMPtr wpeer(do_QueryInterface(peer)); - if (wpeer) { - // XXX nsRect & NPRect are structurally equivalent - wpeer->InvalidateRect((nsPluginRect *)invalidRect); - } - } + inst->InvalidateRect((nsPluginRect *)invalidRect); } void NP_CALLBACK @@ -1100,14 +1093,7 @@ _invalidateregion(NPP npp, NPRegion invalidRegion) PluginDestructionGuard guard(inst); - nsCOMPtr peer; - if (NS_SUCCEEDED(inst->GetPeer(getter_AddRefs(peer))) && peer) { - nsCOMPtr wpeer(do_QueryInterface(peer)); - if (wpeer) { - // nsPluginRegion & NPRegion are typedef'd to the same thing - wpeer->InvalidateRegion((nsPluginRegion)invalidRegion); - } - } + inst->InvalidateRegion((nsPluginRegion)invalidRegion); } void NP_CALLBACK @@ -1128,13 +1114,7 @@ _forceredraw(NPP npp) PluginDestructionGuard guard(inst); - nsCOMPtr peer; - if (NS_SUCCEEDED(inst->GetPeer(getter_AddRefs(peer))) && peer) { - nsCOMPtr wpeer(do_QueryInterface(peer)); - if (wpeer) { - wpeer->ForceRedraw(); - } - } + inst->ForceRedraw(); } static nsIDocument * diff --git a/modules/plugin/base/src/nsNPAPIPlugin.h b/modules/plugin/base/src/nsNPAPIPlugin.h index d7e7f9cd7b8d..691e8fd653e5 100644 --- a/modules/plugin/base/src/nsNPAPIPlugin.h +++ b/modules/plugin/base/src/nsNPAPIPlugin.h @@ -41,7 +41,6 @@ #include "nsIFactory.h" #include "nsIPlugin.h" #include "nsIPluginInstancePeer.h" -#include "nsIWindowlessPlugInstPeer.h" #include "prlink.h" #include "npfunctions.h" #include "nsPluginHostImpl.h" diff --git a/modules/plugin/base/src/nsNPAPIPluginInstance.cpp b/modules/plugin/base/src/nsNPAPIPluginInstance.cpp index 8af9b01b672c..1605ad37a7e6 100644 --- a/modules/plugin/base/src/nsNPAPIPluginInstance.cpp +++ b/modules/plugin/base/src/nsNPAPIPluginInstance.cpp @@ -1459,3 +1459,48 @@ nsresult nsNPAPIPluginInstance::PrivateModeStateChanged() } return NS_ERROR_FAILURE; } + +NS_IMETHODIMP +nsNPAPIPluginInstance::InvalidateRect(nsPluginRect *invalidRect) +{ + nsCOMPtr pp (do_QueryInterface(mPeer)); + if (!pp) + return nsnull; + + nsCOMPtr owner; + pp->GetOwner(getter_AddRefs(owner)); + if (!owner) + return NS_ERROR_FAILURE; + + return owner->InvalidateRect(invalidRect); +} + +NS_IMETHODIMP +nsNPAPIPluginInstance::InvalidateRegion(nsPluginRegion invalidRegion) +{ + nsCOMPtr pp (do_QueryInterface(mPeer)); + if (!pp) + return nsnull; + + nsCOMPtr owner; + pp->GetOwner(getter_AddRefs(owner)); + if (!owner) + return NS_ERROR_FAILURE; + + return owner->InvalidateRegion(invalidRegion); +} + +NS_IMETHODIMP +nsNPAPIPluginInstance::ForceRedraw() +{ + nsCOMPtr pp (do_QueryInterface(mPeer)); + if (!pp) + return nsnull; + + nsCOMPtr owner; + pp->GetOwner(getter_AddRefs(owner)); + if (!owner) + return NS_ERROR_FAILURE; + + return owner->ForceRedraw(); +} diff --git a/modules/plugin/base/src/nsPluginInstancePeer.cpp b/modules/plugin/base/src/nsPluginInstancePeer.cpp index ca2ef61fd200..5847c569a714 100644 --- a/modules/plugin/base/src/nsPluginInstancePeer.cpp +++ b/modules/plugin/base/src/nsPluginInstancePeer.cpp @@ -77,11 +77,10 @@ nsPluginInstancePeerImpl::~nsPluginInstancePeerImpl() static NS_DEFINE_IID(kIPluginTagInfoIID, NS_IPLUGINTAGINFO_IID); static NS_DEFINE_IID(kIPluginTagInfo2IID, NS_IPLUGINTAGINFO2_IID); -NS_IMPL_ISUPPORTS7(nsPluginInstancePeerImpl, +NS_IMPL_ISUPPORTS6(nsPluginInstancePeerImpl, nsIPluginInstancePeer, nsIPluginInstancePeer2, nsIPluginInstancePeer3, - nsIWindowlessPluginInstancePeer, nsIPluginTagInfo, nsIPluginTagInfo2, nsPIPluginInstancePeer) @@ -751,30 +750,3 @@ nsPluginInstancePeerImpl::GetOwner(nsIPluginInstanceOwner **aOwner) NS_IF_ADDREF(mOwner); return (mOwner) ? NS_OK : NS_ERROR_FAILURE; } - -NS_IMETHODIMP -nsPluginInstancePeerImpl::InvalidateRect(nsPluginRect *invalidRect) -{ - if(!mOwner) - return NS_ERROR_FAILURE; - - return mOwner->InvalidateRect(invalidRect); -} - -NS_IMETHODIMP -nsPluginInstancePeerImpl::InvalidateRegion(nsPluginRegion invalidRegion) -{ - if(!mOwner) - return NS_ERROR_FAILURE; - - return mOwner->InvalidateRegion(invalidRegion); -} - -NS_IMETHODIMP -nsPluginInstancePeerImpl::ForceRedraw(void) -{ - if(!mOwner) - return NS_ERROR_FAILURE; - - return mOwner->ForceRedraw(); -} diff --git a/modules/plugin/base/src/nsPluginInstancePeer.h b/modules/plugin/base/src/nsPluginInstancePeer.h index 6c5f377b6231..633f167cd43d 100644 --- a/modules/plugin/base/src/nsPluginInstancePeer.h +++ b/modules/plugin/base/src/nsPluginInstancePeer.h @@ -39,7 +39,6 @@ #define nsPluginInstancePeer_h_ #include "nsIPluginInstancePeer2.h" -#include "nsIWindowlessPlugInstPeer.h" #include "nsIPluginTagInfo2.h" #include "nsIPluginInstanceOwner.h" #include "nsPIPluginInstancePeer.h" @@ -47,7 +46,6 @@ #include "nsCOMPtr.h" class nsPluginInstancePeerImpl : public nsIPluginInstancePeer3, - public nsIWindowlessPluginInstancePeer, public nsIPluginTagInfo2, public nsPIPluginInstancePeer @@ -58,7 +56,6 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSIPLUGININSTANCEPEER - NS_DECL_NSIWINDOWLESSPLUGININSTANCEPEER NS_DECL_NSIPLUGININSTANCEPEER2 NS_DECL_NSIPLUGININSTANCEPEER3 NS_DECL_NSIPLUGINTAGINFO diff --git a/modules/plugin/base/src/nsPluginNativeWindowGtk2.cpp b/modules/plugin/base/src/nsPluginNativeWindowGtk2.cpp index 58d2ea8f8aee..85b91551f1bd 100644 --- a/modules/plugin/base/src/nsPluginNativeWindowGtk2.cpp +++ b/modules/plugin/base/src/nsPluginNativeWindowGtk2.cpp @@ -174,17 +174,8 @@ nsPluginNativeWindowGtk2::plugin_composite_filter_func (GdkXEvent *xevent, rect.right = ev->area.x + ev->area.width; rect.bottom = ev->area.y + ev->area.height; - /* There might be a better way to do this? */ - if (native_window->mPluginInstance) { - nsCOMPtr peer; - if (NS_SUCCEEDED(native_window->mPluginInstance->GetPeer(getter_AddRefs(peer))) && peer) { - nsCOMPtr wpeer(do_QueryInterface(peer)); - if (wpeer) { - // XXX nsRect & NPRect are structurally equivalent - wpeer->InvalidateRect(&rect); - } - } - } + if (native_window->mPluginInstance) + native_window->mPluginInstance->InvalidateRect(&rect); return GDK_FILTER_REMOVE; } From d86ad9d5a520e1add74e4b8ed9c34bc7cce5621a Mon Sep 17 00:00:00 2001 From: Shawn Wilsher Date: Fri, 26 Jun 2009 11:09:13 -0700 Subject: [PATCH 52/70] Bug 498722 - nsIFaviconService.getFaviconLinkForIcon error on null argument Updates the IDL to indicate that it is not OK to pass null as the URI. r=mak --- toolkit/components/places/public/nsIFaviconService.idl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/toolkit/components/places/public/nsIFaviconService.idl b/toolkit/components/places/public/nsIFaviconService.idl index 865069a9301a..91015ebb0922 100644 --- a/toolkit/components/places/public/nsIFaviconService.idl +++ b/toolkit/components/places/public/nsIFaviconService.idl @@ -260,11 +260,10 @@ interface nsIFaviconService : nsISupports /** * For a given icon URI, this will return a URI that will result in the image. * In most cases, this is an annotation URI. For chrome, this will do nothing - * and return the input URI. For NULL input, this will return the URI of - * the default favicon. + * and return the input URI. * * @param aFaviconURI - * The URI of an icon in the favicon service. Can be NULL. + * The URI of an icon in the favicon service. * @returns A URI that will load the desired icon. This is NOT the URI of the * icon as set on the page, but a URI that will give you the data * out of the favicon service. For a normal page with a favicon @@ -272,8 +271,7 @@ interface nsIFaviconService : nsISupports * cause the corresponding favicon data to be loaded from this * service. For pages where we don't have a favicon, this will be a * chrome URI of the default icon for a web page. For chrome, the - * output will be the same as the input. For NULL input, this will - * be the URI of the default favicon. + * output will be the same as the input. * * No validity checking is done. If you pass an icon URI that we've * never seen, you'll get back a URI that references an invalid From 3e203adfc26e7ec1451e5d3389152f07870a14c7 Mon Sep 17 00:00:00 2001 From: Drew Willcoxon Date: Wed, 24 Jun 2009 15:04:49 -0700 Subject: [PATCH 53/70] Bug 490867 - Variant fixes: coerce null to empty string, GetIsNull should check correct type, variant base type should be void, r=sdwilsh Adds a NullVariant derived class of Variant_base. --- storage/src/Variant.h | 33 ++++++++++++++++++- storage/src/Variant_inl.h | 3 +- storage/src/mozStorageRow.cpp | 3 +- .../test/unit/test_statement_executeAsync.js | 5 +++ 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/storage/src/Variant.h b/storage/src/Variant.h index 831ae00e4fb0..58d3929e81ed 100644 --- a/storage/src/Variant.h +++ b/storage/src/Variant.h @@ -22,6 +22,7 @@ * * Contributor(s): * Shawn Wilsher (Original Author) + * Drew Willcoxon * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or @@ -299,6 +300,37 @@ struct variant_blob_traits } }; +/** + * NULL type + */ + +class NullVariant : public Variant_base +{ +public: + NS_IMETHOD GetDataType(PRUint16 *_type) + { + NS_ENSURE_ARG_POINTER(_type); + *_type = nsIDataType::VTYPE_EMPTY; + return NS_OK; + } + + NS_IMETHOD GetAsAUTF8String(nsACString &_str) + { + // Return a void string. + _str.Truncate(0); + _str.SetIsVoid(PR_TRUE); + return NS_OK; + } + + NS_IMETHOD GetAsAString(nsAString &_str) + { + // Return a void string. + _str.Truncate(0); + _str.SetIsVoid(PR_TRUE); + return NS_OK; + } +}; + //////////////////////////////////////////////////////////////////////////////// //// Template Implementation @@ -361,7 +393,6 @@ typedef Variant FloatVariant; typedef Variant TextVariant; typedef Variant UTF8TextVariant; typedef Variant BlobVariant; -typedef Variant_base NullVariant; } // namespace storage } // namespace mozilla diff --git a/storage/src/Variant_inl.h b/storage/src/Variant_inl.h index bacc27e18a4b..f043f3637b8a 100644 --- a/storage/src/Variant_inl.h +++ b/storage/src/Variant_inl.h @@ -65,7 +65,8 @@ inline NS_IMETHODIMP Variant_base::GetDataType(PRUint16 *_type) { - *_type = nsIDataType::VTYPE_EMPTY; + NS_ENSURE_ARG_POINTER(_type); + *_type = nsIDataType::VTYPE_VOID; return NS_OK; } diff --git a/storage/src/mozStorageRow.cpp b/storage/src/mozStorageRow.cpp index 0ebea49520c1..ff0135d05dd8 100644 --- a/storage/src/mozStorageRow.cpp +++ b/storage/src/mozStorageRow.cpp @@ -235,10 +235,11 @@ Row::GetIsNull(PRUint32 aIndex, PRBool *_isNull) { ENSURE_INDEX_VALUE(aIndex, mNumCols); + NS_ENSURE_ARG_POINTER(_isNull); PRUint16 type; (void)mData.ObjectAt(aIndex)->GetDataType(&type); - *_isNull = type == nsIDataType::VTYPE_VOID; + *_isNull = type == nsIDataType::VTYPE_EMPTY; return NS_OK; } diff --git a/storage/test/unit/test_statement_executeAsync.js b/storage/test/unit/test_statement_executeAsync.js index 2f644ea25d80..64aad197ef55 100644 --- a/storage/test/unit/test_statement_executeAsync.js +++ b/storage/test/unit/test_statement_executeAsync.js @@ -167,21 +167,25 @@ function test_get_data() do_check_neq(null, tuple); // Check that it's what we expect + do_check_false(tuple.getIsNull(0)); do_check_eq(tuple.getResultByName("string"), tuple.getResultByIndex(0)); do_check_eq(TEXT, tuple.getResultByName("string")); do_check_eq(Ci.mozIStorageValueArray.VALUE_TYPE_TEXT, tuple.getTypeOfIndex(0)); + do_check_false(tuple.getIsNull(1)); do_check_eq(tuple.getResultByName("number"), tuple.getResultByIndex(1)); do_check_eq(REAL, tuple.getResultByName("number")); do_check_eq(Ci.mozIStorageValueArray.VALUE_TYPE_FLOAT, tuple.getTypeOfIndex(1)); + do_check_true(tuple.getIsNull(2)); do_check_eq(tuple.getResultByName("nuller"), tuple.getResultByIndex(2)); do_check_eq(null, tuple.getResultByName("nuller")); do_check_eq(Ci.mozIStorageValueArray.VALUE_TYPE_NULL, tuple.getTypeOfIndex(2)); + do_check_false(tuple.getIsNull(3)); var blobByName = tuple.getResultByName("blober"); do_check_eq(BLOB.length, blobByName.length); var blobByIndex = tuple.getResultByIndex(3); @@ -199,6 +203,7 @@ function test_get_data() do_check_eq(Ci.mozIStorageValueArray.VALUE_TYPE_BLOB, tuple.getTypeOfIndex(3)); + do_check_false(tuple.getIsNull(4)); do_check_eq(tuple.getResultByName("id"), tuple.getResultByIndex(4)); do_check_eq(INTEGER, tuple.getResultByName("id")); do_check_eq(Ci.mozIStorageValueArray.VALUE_TYPE_INTEGER, From 0041e1e2e50efcbb461e8cbede94a2c2644c97c8 Mon Sep 17 00:00:00 2001 From: Andrew Shilliday Date: Fri, 26 Jun 2009 14:52:24 -0400 Subject: [PATCH 54/70] Respect system-wide SOCKS proxy settings. b=457377 r=josh r=roc --- .../osxproxy/nsOSXSystemProxySettings.mm | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/toolkit/system/osxproxy/nsOSXSystemProxySettings.mm b/toolkit/system/osxproxy/nsOSXSystemProxySettings.mm index 9a8abefa0bf8..3be04a53bed9 100644 --- a/toolkit/system/osxproxy/nsOSXSystemProxySettings.mm +++ b/toolkit/system/osxproxy/nsOSXSystemProxySettings.mm @@ -27,6 +27,7 @@ * Robert O'Callahan * HÃ¥kan Waara * Josh Aas + * Andrew Shilliday * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or @@ -54,7 +55,6 @@ #include "nsIURI.h" #include "nsObjCExceptions.h" - class nsOSXSystemProxySettings : public nsISystemProxySettings { public: NS_DECL_ISUPPORTS @@ -72,7 +72,7 @@ public: nsresult GetAutoconfigURL(nsCAutoString& aResult) const; // Find the SystemConfiguration proxy & port for a given URI - nsresult FindSCProxyPort(nsIURI* aURI, nsACString& aResultHost, PRInt32& aResultPort); + nsresult FindSCProxyPort(nsIURI* aURI, nsACString& aResultHost, PRInt32& aResultPort, PRBool& aResultSocksProxy); // is host:port on the proxy exception list? PRBool IsInExceptionList(const nsACString& aHost) const; @@ -91,6 +91,7 @@ private: CFStringRef mEnabled; CFStringRef mHost; CFStringRef mPort; + PRPackedBool mIsSocksProxy; }; static const SchemeMapping gSchemeMappingList[]; }; @@ -99,11 +100,11 @@ NS_IMPL_ISUPPORTS1(nsOSXSystemProxySettings, nsISystemProxySettings) // Mapping of URI schemes to SystemConfiguration keys const nsOSXSystemProxySettings::SchemeMapping nsOSXSystemProxySettings::gSchemeMappingList[] = { - {"http", kSCPropNetProxiesHTTPEnable, kSCPropNetProxiesHTTPProxy, kSCPropNetProxiesHTTPPort}, - {"https", kSCPropNetProxiesHTTPSEnable, kSCPropNetProxiesHTTPSProxy, kSCPropNetProxiesHTTPSPort}, - {"ftp", kSCPropNetProxiesFTPEnable, kSCPropNetProxiesFTPProxy, kSCPropNetProxiesFTPPort}, - {"socks", kSCPropNetProxiesSOCKSEnable, kSCPropNetProxiesSOCKSProxy, kSCPropNetProxiesSOCKSPort}, - {NULL, NULL, NULL, NULL}, + {"http", kSCPropNetProxiesHTTPEnable, kSCPropNetProxiesHTTPProxy, kSCPropNetProxiesHTTPPort, PR_FALSE}, + {"https", kSCPropNetProxiesHTTPSEnable, kSCPropNetProxiesHTTPSProxy, kSCPropNetProxiesHTTPSPort, PR_FALSE}, + {"ftp", kSCPropNetProxiesFTPEnable, kSCPropNetProxiesFTPProxy, kSCPropNetProxiesFTPPort, PR_FALSE}, + {"socks", kSCPropNetProxiesSOCKSEnable, kSCPropNetProxiesSOCKSProxy, kSCPropNetProxiesSOCKSPort, PR_TRUE}, + {NULL, NULL, NULL, NULL, PR_FALSE}, }; static void @@ -193,25 +194,24 @@ nsOSXSystemProxySettings::ProxyHasChanged() } nsresult -nsOSXSystemProxySettings::FindSCProxyPort(nsIURI* aURI, nsACString& aResultHost, PRInt32& aResultPort) +nsOSXSystemProxySettings::FindSCProxyPort(nsIURI* aURI, nsACString& aResultHost, PRInt32& aResultPort, PRBool& aResultSocksProxy) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; NS_ENSURE_TRUE(mProxyDict != NULL, NS_ERROR_FAILURE); for (const SchemeMapping* keys = gSchemeMappingList; keys->mScheme != NULL; ++keys) { - // Check for matching scheme + // Check for matching scheme (when appropriate) PRBool res; - if (NS_FAILED(aURI->SchemeIs(keys->mScheme, &res)) || !res) { + if ((NS_FAILED(aURI->SchemeIs(keys->mScheme, &res)) || !res) && !keys->mIsSocksProxy) continue; - } // Check the proxy is enabled NSNumber* enabled = [mProxyDict objectForKey:(NSString*)keys->mEnabled]; NS_ENSURE_TRUE(enabled == NULL || [enabled isKindOfClass:[NSNumber class]], NS_ERROR_FAILURE); if ([enabled intValue] == 0) - break; - + continue; + // Get the proxy host NSString* host = [mProxyDict objectForKey:(NSString*)keys->mHost]; if (host == NULL) @@ -224,6 +224,8 @@ nsOSXSystemProxySettings::FindSCProxyPort(nsIURI* aURI, nsACString& aResultHost, NS_ENSURE_TRUE([port isKindOfClass:[NSNumber class]], NS_ERROR_FAILURE); aResultPort = [port intValue]; + aResultSocksProxy = keys->mIsSocksProxy; + return NS_OK; } @@ -267,11 +269,6 @@ IsHostProxyEntry(const nsACString& aHost, const nsACString& aOverride) nsCAutoString host(aHost); nsCAutoString override(aOverride); - /* - printf("IsHostProxyEntry\nRequest: %s\nOverride: %s\n", - nsPromiseFlatCString(host).get(), nsPromiseFlatCString(override).get()); - */ - PRInt32 overrideLength = override.Length(); PRInt32 tokenStart = 0; PRInt32 offset = 0; @@ -354,11 +351,14 @@ nsOSXSystemProxySettings::GetProxyForURI(nsIURI* aURI, nsACString& aResult) PRInt32 proxyPort; nsCAutoString proxyHost; - rv = FindSCProxyPort(aURI, proxyHost, proxyPort); + PRBool proxySocks; + rv = FindSCProxyPort(aURI, proxyHost, proxyPort, proxySocks); if (NS_FAILED(rv) || IsInExceptionList(host)) { aResult.AssignLiteral("DIRECT"); - } else { + } else if (proxySocks) { + aResult.Assign(NS_LITERAL_CSTRING("SOCKS ") + proxyHost + nsPrintfCString(":%d", proxyPort)); + } else { aResult.Assign(NS_LITERAL_CSTRING("PROXY ") + proxyHost + nsPrintfCString(":%d", proxyPort)); } From 3b6026f4db45d9ea7ce4c3143abe0c2f98e8ca67 Mon Sep 17 00:00:00 2001 From: Axel Hecht Date: Fri, 26 Jun 2009 21:08:56 +0200 Subject: [PATCH 55/70] bug 489313, bustage fix for mac repacks, get dependencies right, r=ted --- browser/locales/Makefile.in | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/browser/locales/Makefile.in b/browser/locales/Makefile.in index 05c866939fad..04b6d01dc6da 100644 --- a/browser/locales/Makefile.in +++ b/browser/locales/Makefile.in @@ -64,8 +64,6 @@ vpath book%.inc @srcdir@/en-US/profile endif -run_for_effects_too := if ! test -d $(DIST)/branding; then $(NSINSTALL) -D $(DIST)/branding; fi) - ifdef MOZ_BRANDING_DIRECTORY SUBMAKEFILES += \ $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/Makefile \ @@ -104,6 +102,11 @@ include $(topsrcdir)/config/rules.mk include $(topsrcdir)/toolkit/locales/l10n.mk +$(STAGEDIST): $(DIST)/branding + +$(DIST)/branding: + $(NSINSTALL) -D $@ + libs:: @if test -f "$(LOCALE_SRCDIR)/existing-profile-defaults.js"; then \ $(PERL) $(topsrcdir)/config/preprocessor.pl $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) \ From f436ac4b7ecb1d70422e6aba24c4369b78f7d099 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Fri, 26 Jun 2009 15:03:00 -0400 Subject: [PATCH 56/70] Bug 498428. Try to updating cairo again. r=joe Try the update without a patch suspected of causing the Tsvg regression. --- gfx/cairo/cairo/src/cairo-debug.c | 42 +++++++++++++++++ gfx/cairo/cairo/src/cairo-ft-font.c | 34 ++++++++------ gfx/cairo/cairo/src/cairo-image-surface.c | 22 +++++---- gfx/cairo/cairo/src/cairo-malloc-private.h | 2 +- gfx/cairo/cairo/src/cairo-misc.c | 2 + gfx/cairo/cairo/src/cairo-path-stroke.c | 1 + gfx/cairo/cairo/src/cairo-pattern.c | 2 + gfx/cairo/cairo/src/cairo-png.c | 46 +++++++++++++------ gfx/cairo/cairo/src/cairo-scaled-font.c | 3 ++ gfx/cairo/cairo/src/cairo-skiplist.c | 4 ++ gfx/cairo/cairo/src/cairo-surface-fallback.c | 10 +++- gfx/cairo/cairo/src/cairo-surface.c | 43 ++++++++++++----- gfx/cairo/cairo/src/cairo-user-font.c | 14 ++++-- gfx/cairo/cairo/src/cairo-win32-font.c | 14 ++++++ .../cairo/src/cairo-win32-printing-surface.c | 6 ++- gfx/cairo/cairo/src/cairo-xlib-surface.c | 20 ++++---- gfx/cairo/cairo/src/cairo.h | 25 +++++----- gfx/cairo/cairo/src/cairoint.h | 20 ++++++-- 18 files changed, 230 insertions(+), 80 deletions(-) diff --git a/gfx/cairo/cairo/src/cairo-debug.c b/gfx/cairo/cairo/src/cairo-debug.c index 5100a855d98d..d463be29d744 100644 --- a/gfx/cairo/cairo/src/cairo-debug.c +++ b/gfx/cairo/cairo/src/cairo-debug.c @@ -77,3 +77,45 @@ cairo_debug_reset_static_data (void) CAIRO_MUTEX_FINALIZE (); } + +#if HAVE_VALGRIND +#include + +void +_cairo_debug_check_image_surface_is_defined (const cairo_surface_t *surface) +{ + const cairo_image_surface_t *image = (cairo_image_surface_t *) surface; + const uint8_t *bits; + int row, width; + + if (surface == NULL) + return; + + if (! RUNNING_ON_VALGRIND) + return; + + bits = image->data; + switch (image->format) { + case CAIRO_FORMAT_A1: + width = (image->width + 7)/8; + break; + case CAIRO_FORMAT_A8: + width = image->width; + break; + case CAIRO_FORMAT_RGB24: + case CAIRO_FORMAT_ARGB32: + width = image->width*4; + break; + default: + ASSERT_NOT_REACHED; + return; + } + + for (row = 0; row < image->height; row++) { + VALGRIND_CHECK_MEM_IS_DEFINED (bits, width); + /* and then silence any future valgrind warnings */ + VALGRIND_MAKE_MEM_DEFINED (bits, width); + bits += image->stride; + } +} +#endif diff --git a/gfx/cairo/cairo/src/cairo-ft-font.c b/gfx/cairo/cairo/src/cairo-ft-font.c index 48dd838754eb..f097399df1df 100644 --- a/gfx/cairo/cairo/src/cairo-ft-font.c +++ b/gfx/cairo/cairo/src/cairo-ft-font.c @@ -486,24 +486,26 @@ _cairo_ft_unscaled_font_create_for_pattern (FcPattern *pattern, FcResult ret; ret = FcPatternGetFTFace (pattern, FC_FT_FACE, 0, &font_face); - switch ((int) ret) { - case FcResultMatch: + if (ret == FcResultMatch) + goto DONE; + if (ret == FcResultOutOfMemory) + return _cairo_error (CAIRO_STATUS_NO_MEMORY); + + ret = FcPatternGetString (pattern, FC_FILE, 0, (FcChar8 **) &filename); + if (ret == FcResultOutOfMemory) + return _cairo_error (CAIRO_STATUS_NO_MEMORY); + if (ret == FcResultMatch) { + /* If FC_INDEX is not set, we just use 0 */ + ret = FcPatternGetInteger (pattern, FC_INDEX, 0, &id); + if (ret == FcResultOutOfMemory) + return _cairo_error (CAIRO_STATUS_NO_MEMORY); + goto DONE; - case FcResultOutOfMemory: - break; - default: - if (FcPatternGetString (pattern, FC_FILE, 0, - (FcChar8 **) &filename) == FcResultMatch) - { - /* If FC_INDEX is not set, we just use 0 */ - if (FcPatternGetInteger (pattern, - FC_INDEX, 0, &id) != FcResultOutOfMemory) - goto DONE; - } - break; } - return _cairo_error (CAIRO_STATUS_NO_MEMORY); + /* The pattern contains neither a face nor a filename, resolve it later. */ + *out = NULL; + return CAIRO_STATUS_SUCCESS; DONE: return _cairo_ft_unscaled_font_create_internal (font_face != NULL, @@ -1000,6 +1002,8 @@ _get_bitmap_surface (FT_Bitmap *bitmap, _cairo_image_surface_assume_ownership_of_data ((*surface)); + _cairo_debug_check_image_surface_is_defined (&(*surface)->base); + return CAIRO_STATUS_SUCCESS; } diff --git a/gfx/cairo/cairo/src/cairo-image-surface.c b/gfx/cairo/cairo/src/cairo-image-surface.c index 3a6dbad3586d..ba7de8fba274 100644 --- a/gfx/cairo/cairo/src/cairo-image-surface.c +++ b/gfx/cairo/cairo/src/cairo-image-surface.c @@ -569,7 +569,7 @@ cairo_image_surface_get_format (cairo_surface_t *surface) if (! _cairo_surface_is_image (surface)) { _cairo_error_throw (CAIRO_STATUS_SURFACE_TYPE_MISMATCH); - return 0; + return CAIRO_FORMAT_INVALID; } return image_surface->format; @@ -1586,15 +1586,18 @@ _cairo_image_analyze_transparency (cairo_image_surface_t *image) if (image->transparency != CAIRO_IMAGE_UNKNOWN) return image->transparency; - if (image->format == CAIRO_FORMAT_RGB24) { - image->transparency = CAIRO_IMAGE_IS_OPAQUE; - return CAIRO_IMAGE_IS_OPAQUE; + if ((image->base.content & CAIRO_CONTENT_ALPHA) == 0) + return image->transparency = CAIRO_IMAGE_IS_OPAQUE; + + if ((image->base.content & CAIRO_CONTENT_COLOR) == 0) { + if (image->format == CAIRO_FORMAT_A1) + return image->transparency = CAIRO_IMAGE_HAS_BILEVEL_ALPHA; + else + return image->transparency = CAIRO_IMAGE_HAS_ALPHA; } - if (image->format != CAIRO_FORMAT_ARGB32) { - image->transparency = CAIRO_IMAGE_HAS_ALPHA; - return CAIRO_IMAGE_HAS_ALPHA; - } + if (image->format != CAIRO_FORMAT_ARGB32) + return image->transparency = CAIRO_IMAGE_HAS_ALPHA; image->transparency = CAIRO_IMAGE_IS_OPAQUE; for (y = 0; y < image->height; y++) { @@ -1603,8 +1606,7 @@ _cairo_image_analyze_transparency (cairo_image_surface_t *image) for (x = 0; x < image->width; x++, pixel++) { int a = (*pixel & 0xff000000) >> 24; if (a > 0 && a < 255) { - image->transparency = CAIRO_IMAGE_HAS_ALPHA; - return CAIRO_IMAGE_HAS_ALPHA; + return image->transparency = CAIRO_IMAGE_HAS_ALPHA; } else if (a == 0) { image->transparency = CAIRO_IMAGE_HAS_BILEVEL_ALPHA; } diff --git a/gfx/cairo/cairo/src/cairo-malloc-private.h b/gfx/cairo/cairo/src/cairo-malloc-private.h index e36f93b8da4b..d812058f34ee 100644 --- a/gfx/cairo/cairo/src/cairo-malloc-private.h +++ b/gfx/cairo/cairo/src/cairo-malloc-private.h @@ -41,7 +41,7 @@ #if HAVE_MEMFAULT #include -#define CAIRO_INJECT_FAULT() VALGRIND_INJECT_FAULT() +#define CAIRO_INJECT_FAULT() MEMFAULT_INJECT_FAULT() #else #define CAIRO_INJECT_FAULT() 0 #endif diff --git a/gfx/cairo/cairo/src/cairo-misc.c b/gfx/cairo/cairo/src/cairo-misc.c index d4b10e1c4e0f..20f0ef1b123f 100644 --- a/gfx/cairo/cairo/src/cairo-misc.c +++ b/gfx/cairo/cairo/src/cairo-misc.c @@ -123,6 +123,8 @@ cairo_status_to_string (cairo_status_t status) return "invalid value for an input #cairo_font_weight_t"; case CAIRO_STATUS_INVALID_SIZE: return "invalid value for the size of the input (surface, pattern, etc.)"; + case CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED: + return "user-font method not implemented"; default: case CAIRO_STATUS_LAST_STATUS: return ""; diff --git a/gfx/cairo/cairo/src/cairo-path-stroke.c b/gfx/cairo/cairo/src/cairo-path-stroke.c index 37ac79c7e0b2..79bf09b0b0f4 100644 --- a/gfx/cairo/cairo/src/cairo-path-stroke.c +++ b/gfx/cairo/cairo/src/cairo-path-stroke.c @@ -35,6 +35,7 @@ * Carl D. Worth */ +#define _BSD_SOURCE /* for hypot() */ #include "cairoint.h" #include "cairo-path-fixed-private.h" diff --git a/gfx/cairo/cairo/src/cairo-pattern.c b/gfx/cairo/cairo/src/cairo-pattern.c index 0fb36bfa7bc2..5282159eaa4b 100644 --- a/gfx/cairo/cairo/src/cairo-pattern.c +++ b/gfx/cairo/cairo/src/cairo-pattern.c @@ -1449,6 +1449,8 @@ _cairo_pattern_acquire_surface_for_gradient (const cairo_gradient_pattern_t *pat pixman_image_unref (pixman_image); + _cairo_debug_check_image_surface_is_defined (&image->base); + status = _cairo_surface_clone_similar (dst, &image->base, 0, 0, width, height, &clone_offset_x, diff --git a/gfx/cairo/cairo/src/cairo-png.c b/gfx/cairo/cairo/src/cairo-png.c index 0e8f63d87c2e..d4f04760baa6 100644 --- a/gfx/cairo/cairo/src/cairo-png.c +++ b/gfx/cairo/cairo/src/cairo-png.c @@ -143,6 +143,7 @@ write_png (cairo_surface_t *surface, int i; cairo_status_t status; cairo_image_surface_t *image; + cairo_image_surface_t * volatile clone; void *image_extra; png_struct *png; png_info *info; @@ -166,40 +167,52 @@ write_png (cairo_surface_t *surface, goto BAIL1; } - rows = _cairo_malloc_ab (image->height, sizeof (png_byte*)); + /* Handle the various fallback formats (e.g. low bit-depth XServers) + * by coercing them to a simpler format using pixman. + */ + if (image->format == CAIRO_FORMAT_INVALID) { + clone = _cairo_image_surface_coerce (image, + _cairo_format_from_content (image->base.content)); + status = clone->base.status; + if (unlikely (status)) + goto BAIL1; + } else + clone = image; + + rows = _cairo_malloc_ab (clone->height, sizeof (png_byte*)); if (unlikely (rows == NULL)) { status = _cairo_error (CAIRO_STATUS_NO_MEMORY); - goto BAIL1; + goto BAIL2; } - for (i = 0; i < image->height; i++) - rows[i] = (png_byte *) image->data + i * image->stride; + for (i = 0; i < clone->height; i++) + rows[i] = (png_byte *) clone->data + i * clone->stride; png = png_create_write_struct (PNG_LIBPNG_VER_STRING, &status, png_simple_error_callback, png_simple_warning_callback); if (unlikely (png == NULL)) { status = _cairo_error (CAIRO_STATUS_NO_MEMORY); - goto BAIL2; + goto BAIL3; } info = png_create_info_struct (png); if (unlikely (info == NULL)) { status = _cairo_error (CAIRO_STATUS_NO_MEMORY); - goto BAIL3; + goto BAIL4; } #ifdef PNG_SETJMP_SUPPORTED if (setjmp (png_jmpbuf (png))) - goto BAIL3; + goto BAIL4; #endif png_set_write_fn (png, closure, write_func, png_simple_output_flush_fn); - switch (image->format) { + switch (clone->format) { case CAIRO_FORMAT_ARGB32: depth = 8; - if (_cairo_image_analyze_transparency (image) == CAIRO_IMAGE_IS_OPAQUE) + if (_cairo_image_analyze_transparency (clone) == CAIRO_IMAGE_IS_OPAQUE) png_color_type = PNG_COLOR_TYPE_RGB; else png_color_type = PNG_COLOR_TYPE_RGB_ALPHA; @@ -221,12 +234,12 @@ write_png (cairo_surface_t *surface, break; default: status = _cairo_error (CAIRO_STATUS_INVALID_FORMAT); - goto BAIL3; + goto BAIL4; } png_set_IHDR (png, info, - image->width, - image->height, depth, + clone->width, + clone->height, depth, png_color_type, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, @@ -259,10 +272,13 @@ write_png (cairo_surface_t *surface, png_write_image (png, rows); png_write_end (png, info); -BAIL3: +BAIL4: png_destroy_write_struct (&png, &info); -BAIL2: +BAIL3: free (rows); +BAIL2: + if (clone != image) + cairo_surface_destroy (&clone->base); BAIL1: _cairo_surface_release_source_image (surface, image, image_extra); @@ -638,6 +654,8 @@ read_png (struct png_read_closure_t *png_closure) _cairo_image_surface_assume_ownership_of_data ((cairo_image_surface_t*)surface); data = NULL; + _cairo_debug_check_image_surface_is_defined (surface); + status = _cairo_memory_stream_destroy (png_closure->png_data, &mime_data, &mime_data_length); diff --git a/gfx/cairo/cairo/src/cairo-scaled-font.c b/gfx/cairo/cairo/src/cairo-scaled-font.c index d39f651581ae..2f10699fa3e6 100644 --- a/gfx/cairo/cairo/src/cairo-scaled-font.c +++ b/gfx/cairo/cairo/src/cairo-scaled-font.c @@ -2409,6 +2409,9 @@ _cairo_scaled_glyph_set_surface (cairo_scaled_glyph_t *scaled_glyph, { if (scaled_glyph->surface != NULL) cairo_surface_destroy (&scaled_glyph->surface->base); + + /* sanity check the backend glyph contents */ + _cairo_debug_check_image_surface_is_defined (&surface->base); scaled_glyph->surface = surface; } diff --git a/gfx/cairo/cairo/src/cairo-skiplist.c b/gfx/cairo/cairo/src/cairo-skiplist.c index 5c2c477ed39f..18d69ca6cc7f 100644 --- a/gfx/cairo/cairo/src/cairo-skiplist.c +++ b/gfx/cairo/cairo/src/cairo-skiplist.c @@ -25,6 +25,10 @@ #include "cairo-skiplist-private.h" +#if HAVE_FFS +#include /* ffs() */ +#endif + #define ELT_DATA(elt) (void *) ((char*) (elt) - list->data_size) #define NEXT_TO_ELT(next) (skip_elt_t *) ((char *) (next) - offsetof (skip_elt_t, next)) diff --git a/gfx/cairo/cairo/src/cairo-surface-fallback.c b/gfx/cairo/cairo/src/cairo-surface-fallback.c index a78c6ad7b7ee..90191023771e 100644 --- a/gfx/cairo/cairo/src/cairo-surface-fallback.c +++ b/gfx/cairo/cairo/src/cairo-surface-fallback.c @@ -1115,6 +1115,7 @@ _cairo_surface_fallback_snapshot (cairo_surface_t *surface) { cairo_surface_t *snapshot; cairo_status_t status; + cairo_format_t format; cairo_surface_pattern_t pattern; cairo_image_surface_t *image; void *image_extra; @@ -1124,7 +1125,14 @@ _cairo_surface_fallback_snapshot (cairo_surface_t *surface) if (unlikely (status)) return _cairo_surface_create_in_error (status); - snapshot = cairo_image_surface_create (image->format, + format = image->format; + if (format == CAIRO_FORMAT_INVALID) { + /* Non-standard images formats can be generated when retrieving + * images from unusual xservers, for example. + */ + format = _cairo_format_from_content (image->base.content); + } + snapshot = cairo_image_surface_create (format, image->width, image->height); if (cairo_surface_status (snapshot)) { diff --git a/gfx/cairo/cairo/src/cairo-surface.c b/gfx/cairo/cairo/src/cairo-surface.c index 0696a0b4de2f..2667f39dacba 100644 --- a/gfx/cairo/cairo/src/cairo-surface.c +++ b/gfx/cairo/cairo/src/cairo-surface.c @@ -79,6 +79,7 @@ static DEFINE_NIL_SURFACE(CAIRO_STATUS_TEMP_FILE_ERROR, _cairo_surface_nil_temp_ static DEFINE_NIL_SURFACE(CAIRO_STATUS_READ_ERROR, _cairo_surface_nil_read_error); static DEFINE_NIL_SURFACE(CAIRO_STATUS_WRITE_ERROR, _cairo_surface_nil_write_error); static DEFINE_NIL_SURFACE(CAIRO_STATUS_INVALID_STRIDE, _cairo_surface_nil_invalid_stride); +static DEFINE_NIL_SURFACE(CAIRO_STATUS_INVALID_SIZE, _cairo_surface_nil_invalid_size); static cairo_status_t _cairo_surface_copy_pattern_for_destination (const cairo_pattern_t **pattern, @@ -1159,6 +1160,8 @@ _cairo_surface_acquire_source_image (cairo_surface_t *surface, cairo_image_surface_t **image_out, void **image_extra) { + cairo_status_t status; + if (surface->status) return surface->status; @@ -1167,9 +1170,14 @@ _cairo_surface_acquire_source_image (cairo_surface_t *surface, if (surface->backend->acquire_source_image == NULL) return CAIRO_INT_STATUS_UNSUPPORTED; - return _cairo_surface_set_error (surface, - surface->backend->acquire_source_image (surface, - image_out, image_extra)); + status = surface->backend->acquire_source_image (surface, + image_out, image_extra); + if (unlikely (status)) + return _cairo_surface_set_error (surface, status); + + _cairo_debug_check_image_surface_is_defined (&(*image_out)->base); + + return CAIRO_STATUS_SUCCESS; } /** @@ -1228,6 +1236,8 @@ _cairo_surface_acquire_dest_image (cairo_surface_t *surface, cairo_rectangle_int_t *image_rect, void **image_extra) { + cairo_status_t status; + if (surface->status) return surface->status; @@ -1236,12 +1246,17 @@ _cairo_surface_acquire_dest_image (cairo_surface_t *surface, if (surface->backend->acquire_dest_image == NULL) return CAIRO_INT_STATUS_UNSUPPORTED; - return _cairo_surface_set_error (surface, - surface->backend->acquire_dest_image (surface, - interest_rect, - image_out, - image_rect, - image_extra)); + status = surface->backend->acquire_dest_image (surface, + interest_rect, + image_out, + image_rect, + image_extra); + if (unlikely (status)) + return _cairo_surface_set_error (surface, status); + + _cairo_debug_check_image_surface_is_defined (&(*image_out)->base); + + return CAIRO_STATUS_SUCCESS; } /** @@ -1377,6 +1392,9 @@ _cairo_surface_clone_similar (cairo_surface_t *surface, clone_out); if (status == CAIRO_INT_STATUS_UNSUPPORTED) { + if (_cairo_surface_is_image (src)) + return CAIRO_INT_STATUS_UNSUPPORTED; + /* First check to see if we can replay to a similar surface */ if (_cairo_surface_is_meta (src)) { cairo_surface_t *similar; @@ -1423,7 +1441,7 @@ _cairo_surface_clone_similar (cairo_surface_t *surface, } /* If we're still unsupported, hit our fallback path to get a clone */ - if (status == CAIRO_INT_STATUS_UNSUPPORTED) + if (status == CAIRO_INT_STATUS_UNSUPPORTED) { status = _cairo_surface_fallback_clone_similar (surface, src, src_x, src_y, @@ -1431,6 +1449,7 @@ _cairo_surface_clone_similar (cairo_surface_t *surface, clone_offset_x, clone_offset_y, clone_out); + } /* We should never get UNSUPPORTED here, so if we have an error, bail. */ if (unlikely (status)) @@ -3015,6 +3034,8 @@ _cairo_surface_create_in_error (cairo_status_t status) return (cairo_surface_t *) &_cairo_surface_nil_temp_file_error; case CAIRO_STATUS_INVALID_STRIDE: return (cairo_surface_t *) &_cairo_surface_nil_invalid_stride; + case CAIRO_STATUS_INVALID_SIZE: + return (cairo_surface_t *) &_cairo_surface_nil_invalid_size; case CAIRO_STATUS_SUCCESS: case CAIRO_STATUS_LAST_STATUS: ASSERT_NOT_REACHED; @@ -3041,7 +3062,7 @@ _cairo_surface_create_in_error (cairo_status_t status) case CAIRO_STATUS_INVALID_CLUSTERS: case CAIRO_STATUS_INVALID_SLANT: case CAIRO_STATUS_INVALID_WEIGHT: - case CAIRO_STATUS_INVALID_SIZE: + case CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED: default: _cairo_error_throw (CAIRO_STATUS_NO_MEMORY); return (cairo_surface_t *) &_cairo_surface_nil; diff --git a/gfx/cairo/cairo/src/cairo-user-font.c b/gfx/cairo/cairo/src/cairo-user-font.c index fe475ab4187d..6b4f0d43b339 100644 --- a/gfx/cairo/cairo/src/cairo-user-font.c +++ b/gfx/cairo/cairo/src/cairo-user-font.c @@ -118,7 +118,7 @@ _cairo_user_scaled_glyph_init (void *abstract_font, _cairo_scaled_glyph_index(scaled_glyph), cr, &extents); else - status = CAIRO_STATUS_USER_FONT_ERROR; + status = CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED; if (status == CAIRO_STATUS_SUCCESS) status = cairo_status (cr); @@ -260,12 +260,16 @@ _cairo_user_ucs4_to_index (void *abstract_font, status = face->scaled_font_methods.unicode_to_glyph (&scaled_font->base, ucs4, &glyph); + if (status == CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED) + goto not_implemented; + if (status != CAIRO_STATUS_SUCCESS) { status = _cairo_scaled_font_set_error (&scaled_font->base, status); glyph = 0; } } else { +not_implemented: glyph = ucs4; } @@ -300,10 +304,11 @@ _cairo_user_text_to_glyphs (void *abstract_font, glyphs, num_glyphs, clusters, num_clusters, cluster_flags); - if (status != CAIRO_STATUS_SUCCESS) + if (status != CAIRO_STATUS_SUCCESS && + status != CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED) return status; - if (*num_glyphs < 0) { + if (status == CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED || *num_glyphs < 0) { if (orig_glyphs != *glyphs) { cairo_glyph_free (*glyphs); *glyphs = orig_glyphs; @@ -434,6 +439,9 @@ _cairo_user_font_face_scaled_font_create (void *abstract_ cr, &font_extents); + if (status == CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED) + status = CAIRO_STATUS_SUCCESS; + if (status == CAIRO_STATUS_SUCCESS) status = cairo_status (cr); diff --git a/gfx/cairo/cairo/src/cairo-win32-font.c b/gfx/cairo/cairo/src/cairo-win32-font.c index e0ece5b7aba5..94114ac94b97 100644 --- a/gfx/cairo/cairo/src/cairo-win32-font.c +++ b/gfx/cairo/cairo/src/cairo-win32-font.c @@ -979,6 +979,19 @@ _cairo_win32_scaled_font_init_glyph_metrics (cairo_win32_scaled_font_t *scaled_f &metrics, 0, NULL, &matrix) == GDI_ERROR) { status = _cairo_win32_print_gdi_error ("_cairo_win32_scaled_font_init_glyph_metrics:GetGlyphOutlineW"); memset (&metrics, 0, sizeof (GLYPHMETRICS)); + } else { + if (metrics.gmBlackBoxX > 0 && scaled_font->base.options.antialias != CAIRO_ANTIALIAS_NONE) { + /* The bounding box reported by Windows supposedly contains the glyph's "black" area; + * however, antialiasing (especially with ClearType) means that the actual image that + * needs to be rendered may "bleed" into the adjacent pixels, mainly on the right side. + * To avoid clipping the glyphs when drawn by _cairo_surface_fallback_show_glyphs, + * for example, or other code that uses glyph extents to determine the area to update, + * we add a pixel of "slop" to left side of the nominal "black" area returned by GDI, + * and two pixels to the right (as tests show some glyphs bleed into this column). + */ + metrics.gmptGlyphOrigin.x -= 1; + metrics.gmBlackBoxX += 3; + } } cairo_win32_scaled_font_done_font (&scaled_font->base); if (status) @@ -1543,6 +1556,7 @@ _cairo_win32_scaled_font_index_to_ucs4 (void *abstract_font, goto exit1; } + *ucs4 = (uint32_t) -1; for (i = 0; i < glyph_set->cRanges; i++) { num_glyphs = glyph_set->ranges[i].cGlyphs; diff --git a/gfx/cairo/cairo/src/cairo-win32-printing-surface.c b/gfx/cairo/cairo/src/cairo-win32-printing-surface.c index 989f01864113..e7ff3bb672b3 100644 --- a/gfx/cairo/cairo/src/cairo-win32-printing-surface.c +++ b/gfx/cairo/cairo/src/cairo-win32-printing-surface.c @@ -722,7 +722,7 @@ _cairo_win32_printing_surface_paint_image_pattern (cairo_win32_surface_t *surf _cairo_matrix_to_win32_xform (&m, &xform); if (! SetWorldTransform (surface->dc, &xform)) { - status = _cairo_win32_print_gdi_error ("_win32_scaled_font_set_world_transform"); + status = _cairo_win32_print_gdi_error ("_cairo_win32_printing_surface_paint_image_pattern"); goto CLEANUP_OPAQUE_IMAGE; } @@ -1451,6 +1451,7 @@ _cairo_win32_printing_surface_show_glyphs (void *abstract_surfac * If we are printing a bitmap font, use fallback images to * ensure the font is not substituted. */ +#if CAIRO_HAS_WIN32_FONT if (cairo_scaled_font_get_type (scaled_font) == CAIRO_FONT_TYPE_WIN32) { if (_cairo_win32_scaled_font_is_bitmap (scaled_font)) return CAIRO_INT_STATUS_UNSUPPORTED; @@ -1472,6 +1473,7 @@ _cairo_win32_printing_surface_show_glyphs (void *abstract_surfac if (status) return status; } +#endif return _cairo_win32_printing_surface_analyze_operation (surface, op, source); } @@ -1490,6 +1492,7 @@ _cairo_win32_printing_surface_show_glyphs (void *abstract_surfac source = opaque; } +#if CAIRO_HAS_WIN32_FONT if (cairo_scaled_font_get_type (scaled_font) == CAIRO_FONT_TYPE_WIN32 && source->type == CAIRO_PATTERN_TYPE_SOLID) { @@ -1554,6 +1557,7 @@ _cairo_win32_printing_surface_show_glyphs (void *abstract_surfac return status; } +#endif SaveDC (surface->dc); old_ctm = surface->ctm; diff --git a/gfx/cairo/cairo/src/cairo-xlib-surface.c b/gfx/cairo/cairo/src/cairo-xlib-surface.c index cffd85e7516d..93b984ba08ae 100644 --- a/gfx/cairo/cairo/src/cairo-xlib-surface.c +++ b/gfx/cairo/cairo/src/cairo-xlib-surface.c @@ -208,7 +208,7 @@ _cairo_xlib_surface_create_similar (void *abstract_src, Pixmap pix; if (width > XLIB_COORD_MAX || height > XLIB_COORD_MAX) - return _cairo_surface_create_in_error (_cairo_error(CAIRO_STATUS_INVALID_SIZE)); + return NULL; _cairo_xlib_display_notify (src->display); @@ -952,7 +952,8 @@ _draw_image_surface (cairo_xlib_surface_t *surface, ximage.blue_mask = surface->b_mask; ximage.xoffset = 0; - if (image_masks.red_mask == surface->r_mask && + if (image_masks.alpha_mask == surface->a_mask && + image_masks.red_mask == surface->r_mask && image_masks.green_mask == surface->g_mask && image_masks.blue_mask == surface->b_mask) { @@ -1018,8 +1019,8 @@ _draw_image_surface (cairo_xlib_surface_t *surface, goto BAIL; } - rowstride = cairo_image_surface_get_stride (&image->base) >> 2; - row = (uint32_t *) cairo_image_surface_get_data (&image->base); + rowstride = image->stride >> 2; + row = (uint32_t *) image->data; x0 = dst_x + surface->base.device_transform.x0; y0 = dst_y + surface->base.device_transform.y0; for (y = 0, y_off = y0 % ARRAY_LENGTH (dither_pattern); @@ -1196,16 +1197,17 @@ _cairo_xlib_surface_clone_similar (void *abstract_surface, } } else if (_cairo_surface_is_image (src)) { cairo_image_surface_t *image_src = (cairo_image_surface_t *)src; - - if (! CAIRO_FORMAT_VALID (image_src->format)) - return CAIRO_INT_STATUS_UNSUPPORTED; + cairo_format_t format; if (width > XLIB_COORD_MAX || height > XLIB_COORD_MAX) - return _cairo_error (CAIRO_STATUS_INVALID_SIZE); + return CAIRO_INT_STATUS_UNSUPPORTED; + format = image_src->format; + if (format == CAIRO_FORMAT_INVALID) + format = _cairo_format_from_content (image_src->base.content); clone = (cairo_xlib_surface_t *) _cairo_xlib_surface_create_similar_with_format (surface, - image_src->format, + format, width, height); if (clone == NULL) return CAIRO_INT_STATUS_UNSUPPORTED; diff --git a/gfx/cairo/cairo/src/cairo.h b/gfx/cairo/cairo/src/cairo.h index 51ebad4a5154..a908f4932678 100644 --- a/gfx/cairo/cairo/src/cairo.h +++ b/gfx/cairo/cairo/src/cairo.h @@ -208,7 +208,6 @@ typedef struct _cairo_user_data_key { /** * cairo_status_t: * @CAIRO_STATUS_SUCCESS: no error has occurred - * * @CAIRO_STATUS_NO_MEMORY: out of memory * @CAIRO_STATUS_INVALID_RESTORE: cairo_restore() called without matching cairo_save() * @CAIRO_STATUS_INVALID_POP_GROUP: no saved group to pop @@ -241,7 +240,7 @@ typedef struct _cairo_user_data_key { * @CAIRO_STATUS_INVALID_SLANT: invalid value for an input #cairo_font_slant_t (Since 1.8) * @CAIRO_STATUS_INVALID_WEIGHT: invalid value for an input #cairo_font_weight_t (Since 1.8) * @CAIRO_STATUS_INVALID_SIZE: invalid value (typically too big) for a size (Since 1.10) - * + * @CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED: user-font method not implemented (Since 1.10) * @CAIRO_STATUS_LAST_STATUS: this is a special value indicating the number of * status values defined in this enumeration. When using this value, note * that the version of cairo at run-time may have additional status values @@ -290,6 +289,7 @@ typedef enum _cairo_status { CAIRO_STATUS_INVALID_SLANT, CAIRO_STATUS_INVALID_WEIGHT, CAIRO_STATUS_INVALID_SIZE, + CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED, CAIRO_STATUS_LAST_STATUS } cairo_status_t; @@ -1455,8 +1455,7 @@ cairo_user_font_face_create (void); * point and trying to use it for text operations in the callback will result * in deadlock. * - * Returns: %CAIRO_STATUS_SUCCESS upon success, or - * %CAIRO_STATUS_USER_FONT_ERROR or any other error status on error. + * Returns: %CAIRO_STATUS_SUCCESS upon success, or an error status on error. * * Since: 1.8 **/ @@ -1557,7 +1556,8 @@ typedef cairo_status_t (*cairo_user_scaled_font_render_glyph_func_t) (cairo_scal * will free the allocated cluster array using cairo_text_cluster_free(). * * The callback is optional. If @num_glyphs is negative upon - * the callback returning, the unicode_to_glyph callback + * the callback returning or if the return value + * is %CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED, the unicode_to_glyph callback * is tried. See #cairo_user_scaled_font_unicode_to_glyph_func_t. * * Note: While cairo does not impose any limitation on glyph indices, @@ -1568,8 +1568,9 @@ typedef cairo_status_t (*cairo_user_scaled_font_render_glyph_func_t) (cairo_scal * are advised to use glyph 0 for such purposes and do not use that * glyph value for other purposes. * - * Returns: %CAIRO_STATUS_SUCCESS upon success, or - * %CAIRO_STATUS_USER_FONT_ERROR or any other error status on error. + * Returns: %CAIRO_STATUS_SUCCESS upon success, + * %CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED if fallback options should be tried, + * or %CAIRO_STATUS_USER_FONT_ERROR or any other error status on error. * * Since: 1.8 **/ @@ -1602,8 +1603,9 @@ typedef cairo_status_t (*cairo_user_scaled_font_text_to_glyphs_func_t) (cairo_sc * complex scripts can be implemented using this callback. * * The callback is optional, and only used if text_to_glyphs callback is not - * set or fails to return glyphs. If this callback is not set, an identity - * mapping from Unicode code-points to glyph indices is assumed. + * set or fails to return glyphs. If this callback is not set or if it returns + * %CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED, an identity mapping from Unicode + * code-points to glyph indices is assumed. * * Note: While cairo does not impose any limitation on glyph indices, * some applications may assume that a glyph index fits in a 16-bit @@ -1613,8 +1615,9 @@ typedef cairo_status_t (*cairo_user_scaled_font_text_to_glyphs_func_t) (cairo_sc * are advised to use glyph 0 for such purposes and do not use that * glyph value for other purposes. * - * Returns: %CAIRO_STATUS_SUCCESS upon success, or - * %CAIRO_STATUS_USER_FONT_ERROR or any other error status on error. + * Returns: %CAIRO_STATUS_SUCCESS upon success, + * %CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED if fallback options should be tried, + * or %CAIRO_STATUS_USER_FONT_ERROR or any other error status on error. * * Since: 1.8 **/ diff --git a/gfx/cairo/cairo/src/cairoint.h b/gfx/cairo/cairo/src/cairoint.h index 1c47cca080e4..5fdeef24f456 100644 --- a/gfx/cairo/cairo/src/cairoint.h +++ b/gfx/cairo/cairo/src/cairoint.h @@ -85,7 +85,7 @@ CAIRO_BEGIN_DECLS -#if _WIN32 && !_WIN32_WCE // we don't have to worry about permissions on WinCE +#if _WIN32 && !_WIN32_WCE /* Permissions on WinCE? No worries! */ cairo_private FILE * _cairo_win32_tmpfile (void); #define tmpfile() _cairo_win32_tmpfile() @@ -134,7 +134,7 @@ _cairo_win32_tmpfile (void); #ifdef __GNUC__ #define cairo_container_of(ptr, type, member) ({ \ - const typeof(((type *) 0)->member) *mptr__ = (ptr); \ + const __typeof__ (((type *) 0)->member) *mptr__ = (ptr); \ (type *) ((char *) mptr__ - offsetof (type, member)); \ }) #else @@ -158,7 +158,7 @@ do { \ assert (NOT_REACHED); \ } while (0) #define COMPILE_TIME_ASSERT1(condition, line) \ - typedef int compile_time_assertion_at_line_##line##_failed [(condition)?1:-1]; + typedef int compile_time_assertion_at_line_##line##_failed [(condition)?1:-1] #define COMPILE_TIME_ASSERT0(condition, line) COMPILE_TIME_ASSERT1(condition, line) #define COMPILE_TIME_ASSERT(condition) COMPILE_TIME_ASSERT0(condition, __LINE__) @@ -497,7 +497,8 @@ struct _cairo_scaled_font_backend { unsigned char *buffer, unsigned long *length); - /* returns -1 if the unicode character could not be found for the glyph */ + /* ucs4 is set to -1 if the unicode character could not be found + * for the glyph */ cairo_warn cairo_int_status_t (*index_to_ucs4)(void *scaled_font, unsigned long index, @@ -2753,4 +2754,15 @@ CAIRO_END_DECLS #include "cairo-malloc-private.h" #include "cairo-hash-private.h" +#if HAVE_VALGRIND + +cairo_private void +_cairo_debug_check_image_surface_is_defined (const cairo_surface_t *surface); + +#else + +#define _cairo_debug_check_image_surface_is_defined(X) + +#endif + #endif From d6e210b7b6126091b2975fadddeb1ceada78d653 Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Fri, 26 Jun 2009 15:31:16 -0400 Subject: [PATCH 57/70] Bug 498228 - "Profile item doesn't look selected anymore in the profile manager." r+sr=bzbarsky --- layout/reftests/bugs/498228-1-ref.xul | 27 +++++++ layout/reftests/bugs/498228-1.xul | 31 ++++++++ layout/reftests/bugs/reftest.list | 1 + layout/xul/base/src/nsListBoxBodyFrame.cpp | 82 ++++++++++++---------- 4 files changed, 104 insertions(+), 37 deletions(-) create mode 100644 layout/reftests/bugs/498228-1-ref.xul create mode 100644 layout/reftests/bugs/498228-1.xul diff --git a/layout/reftests/bugs/498228-1-ref.xul b/layout/reftests/bugs/498228-1-ref.xul new file mode 100644 index 000000000000..323acf86671d --- /dev/null +++ b/layout/reftests/bugs/498228-1-ref.xul @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + diff --git a/layout/reftests/bugs/498228-1.xul b/layout/reftests/bugs/498228-1.xul new file mode 100644 index 000000000000..c11a634f0b84 --- /dev/null +++ b/layout/reftests/bugs/498228-1.xul @@ -0,0 +1,31 @@ + + + + + + + + + + diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index 8cc71c887bda..c7c5e8c21ada 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -1267,4 +1267,5 @@ fails-if(MOZ_WIDGET_TOOLKIT!="cocoa") == 488692-1.html 488692-1-ref.html # needs == 495385-3.html 495385-3-ref.html == 495385-4.html 495385-4-ref.html == 495385-5.html 495385-5-ref.html +== 498228-1.xul 498228-1-ref.xul == 496032-1.html 496032-1-ref.html diff --git a/layout/xul/base/src/nsListBoxBodyFrame.cpp b/layout/xul/base/src/nsListBoxBodyFrame.cpp index 6eaf819b2704..ccbd10f8e979 100644 --- a/layout/xul/base/src/nsListBoxBodyFrame.cpp +++ b/layout/xul/base/src/nsListBoxBodyFrame.cpp @@ -519,7 +519,6 @@ nsListBoxBodyFrame::EnsureIndexIsVisible(PRInt32 aRowIndex) if (mCurrentIndex <= aRowIndex && aRowIndex < bottomIndex) return NS_OK; - // Check to be sure we're not scrolling off the bottom of the tree PRInt32 delta; PRBool up = aRowIndex < mCurrentIndex; @@ -528,6 +527,10 @@ nsListBoxBodyFrame::EnsureIndexIsVisible(PRInt32 aRowIndex) mCurrentIndex = aRowIndex; } else { + // Check to be sure we're not scrolling off the bottom of the tree + if (aRowIndex >= GetRowCount()) + return NS_ERROR_ILLEGAL_VALUE; + // Bring it just into view. delta = 1 + (aRowIndex-bottomIndex); mCurrentIndex += delta; @@ -894,9 +897,7 @@ nsListBoxBodyFrame::DoInternalPositionChanged(PRBool aUp, PRInt32 aDelta) if (aDelta == 0) return NS_OK; - nsAutoScriptBlocker scriptBlocker; - - nsPresContext *presContext = PresContext(); + nsRefPtr presContext(PresContext()); nsBoxLayoutState state(presContext); // begin timing how long it takes to scroll a row @@ -908,45 +909,52 @@ nsListBoxBodyFrame::DoInternalPositionChanged(PRBool aUp, PRInt32 aDelta) return NS_OK; } - PRInt32 visibleRows = 0; - if (mRowHeight) - visibleRows = GetAvailableHeight()/mRowHeight; + { + nsAutoScriptBlocker scriptBlocker; + + PRInt32 visibleRows = 0; + if (mRowHeight) + visibleRows = GetAvailableHeight()/mRowHeight; - if (aDelta < visibleRows) { - PRInt32 loseRows = aDelta; - if (aUp) { - // scrolling up, destroy rows from the bottom downwards - ReverseDestroyRows(loseRows); - mRowsToPrepend += aDelta; - mLinkupFrame = nsnull; + if (aDelta < visibleRows) { + PRInt32 loseRows = aDelta; + if (aUp) { + // scrolling up, destroy rows from the bottom downwards + ReverseDestroyRows(loseRows); + mRowsToPrepend += aDelta; + mLinkupFrame = nsnull; + } + else { + // scrolling down, destroy rows from the top upwards + DestroyRows(loseRows); + mRowsToPrepend = 0; + } } else { - // scrolling down, destroy rows from the top upwards - DestroyRows(loseRows); - mRowsToPrepend = 0; + // We have scrolled so much that all of our current frames will + // go off screen, so blow them all away. Weeee! + nsIFrame *currBox = mFrames.FirstChild(); + nsCSSFrameConstructor* fc = presContext->PresShell()->FrameConstructor(); + fc->BeginUpdate(); + while (currBox) { + nsIFrame *nextBox = currBox->GetNextSibling(); + RemoveChildFrame(state, currBox); + currBox = nextBox; + } + fc->EndUpdate(); } - } - else { - // We have scrolled so much that all of our current frames will - // go off screen, so blow them all away. Weeee! - nsIFrame *currBox = mFrames.FirstChild(); - nsCSSFrameConstructor* fc = PresContext()->PresShell()->FrameConstructor(); - fc->BeginUpdate(); - while (currBox) { - nsIFrame *nextBox = currBox->GetNextSibling(); - RemoveChildFrame(state, currBox); - currBox = nextBox; - } - fc->EndUpdate(); - } - // clear frame markers so that CreateRows will re-create - mTopFrame = mBottomFrame = nsnull; + // clear frame markers so that CreateRows will re-create + mTopFrame = mBottomFrame = nsnull; - mYPosition = mCurrentIndex*mRowHeight; - mScrolling = PR_TRUE; - PresContext()->PresShell()-> - FrameNeedsReflow(this, nsIPresShell::eResize, NS_FRAME_HAS_DIRTY_CHILDREN); + mYPosition = mCurrentIndex*mRowHeight; + mScrolling = PR_TRUE; + presContext->PresShell()-> + FrameNeedsReflow(this, nsIPresShell::eResize, NS_FRAME_HAS_DIRTY_CHILDREN); + } + if (!weakThis.IsAlive()) { + return NS_OK; + } // Flush calls CreateRows // XXXbz there has to be a better way to do this than flushing! presContext->PresShell()->FlushPendingNotifications(Flush_Layout); From 9dfa1e8a22872126f7922e4e1b1c32eeb571974a Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 26 Jun 2009 21:13:07 +0100 Subject: [PATCH 58/70] Bug 366697 - getCTM() shouldn't return the same matrix as .getScreenCTM() for nested SVG elements. r=longsonr --- content/svg/content/src/nsSVGElement.cpp | 3 +- .../content/src/nsSVGForeignObjectElement.cpp | 20 ++ .../content/src/nsSVGForeignObjectElement.h | 3 + .../svg/content/src/nsSVGGraphicElement.cpp | 61 +---- content/svg/content/src/nsSVGGraphicElement.h | 5 +- content/svg/content/src/nsSVGSVGElement.cpp | 230 ++++-------------- content/svg/content/src/nsSVGSVGElement.h | 2 + content/svg/content/test/Makefile.in | 2 + content/svg/content/test/getCTM-helper.svg | 35 +++ content/svg/content/test/test_getCTM.html | 91 +++++++ content/svg/content/test/test_viewport.html | 2 +- layout/svg/base/src/nsSVGUtils.cpp | 95 ++++++++ layout/svg/base/src/nsSVGUtils.h | 22 ++ 13 files changed, 331 insertions(+), 240 deletions(-) create mode 100644 content/svg/content/test/getCTM-helper.svg create mode 100644 content/svg/content/test/test_getCTM.html diff --git a/content/svg/content/src/nsSVGElement.cpp b/content/svg/content/src/nsSVGElement.cpp index 88dd4e2d6e6b..cf81177988a6 100644 --- a/content/svg/content/src/nsSVGElement.cpp +++ b/content/svg/content/src/nsSVGElement.cpp @@ -932,7 +932,8 @@ nsSVGElement::GetOwnerSVGElement(nsIDOMSVGSVGElement * *aOwnerSVGElement) NS_IMETHODIMP nsSVGElement::GetViewportElement(nsIDOMSVGElement * *aViewportElement) { - return nsSVGUtils::GetNearestViewportElement(this, aViewportElement); + nsSVGUtils::GetNearestViewportElement(this, aViewportElement); + return NS_OK; // we can't throw exceptions from this API. } //---------------------------------------------------------------------- diff --git a/content/svg/content/src/nsSVGForeignObjectElement.cpp b/content/svg/content/src/nsSVGForeignObjectElement.cpp index 2ecd373dc3fb..84e45a5ac2e0 100644 --- a/content/svg/content/src/nsSVGForeignObjectElement.cpp +++ b/content/svg/content/src/nsSVGForeignObjectElement.cpp @@ -38,6 +38,7 @@ #include "nsCOMPtr.h" #include "nsSVGForeignObjectElement.h" +#include "nsSVGMatrix.h" nsSVGElement::LengthInfo nsSVGForeignObjectElement::sLengthInfo[4] = { @@ -116,6 +117,25 @@ nsSVGForeignObjectElement::PrependLocalTransformTo(const gfxMatrix &aMatrix) return gfxMatrix().Translate(gfxPoint(x, y)) * matrix; } +nsresult +nsSVGForeignObjectElement::AppendTransform(nsIDOMSVGMatrix *aCTM, + nsIDOMSVGMatrix **_retval) +{ + nsresult rv; + // foreignObject is one of establishing-viewport elements. + // so we are translated by foreignObject's x and y attribs. + float x, y; + GetAnimatedLengthValues(&x, &y, nsnull); + nsCOMPtr translate; + rv = NS_NewSVGMatrix(getter_AddRefs(translate), 1, 0, 0, 1, x, y); + if (NS_FAILED(rv)) return rv; + nsCOMPtr tmp; + rv = aCTM->Multiply(translate, getter_AddRefs(tmp)); + if (NS_FAILED(rv)) return rv; + + return nsSVGGraphicElement::AppendTransform(tmp, _retval); +} + //---------------------------------------------------------------------- // nsIContent methods diff --git a/content/svg/content/src/nsSVGForeignObjectElement.h b/content/svg/content/src/nsSVGForeignObjectElement.h index 4ba5c357774f..f3d05218cb49 100644 --- a/content/svg/content/src/nsSVGForeignObjectElement.h +++ b/content/svg/content/src/nsSVGForeignObjectElement.h @@ -74,6 +74,9 @@ public: virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; + // public helpers + nsresult AppendTransform(nsIDOMSVGMatrix *aCTM, + nsIDOMSVGMatrix **_retval); protected: virtual LengthAttributesInfo GetLengthInfo(); diff --git a/content/svg/content/src/nsSVGGraphicElement.cpp b/content/svg/content/src/nsSVGGraphicElement.cpp index 857ff655973d..92cd2c028e59 100644 --- a/content/svg/content/src/nsSVGGraphicElement.cpp +++ b/content/svg/content/src/nsSVGGraphicElement.cpp @@ -75,7 +75,8 @@ nsSVGGraphicElement::nsSVGGraphicElement(nsINodeInfo *aNodeInfo) /* readonly attribute nsIDOMSVGElement nearestViewportElement; */ NS_IMETHODIMP nsSVGGraphicElement::GetNearestViewportElement(nsIDOMSVGElement * *aNearestViewportElement) { - return nsSVGUtils::GetNearestViewportElement(this, aNearestViewportElement); + nsSVGUtils::GetNearestViewportElement(this, aNearestViewportElement); + return NS_OK; // we can't throw exceptions from this API. } /* readonly attribute nsIDOMSVGElement farthestViewportElement; */ @@ -103,8 +104,8 @@ NS_IMETHODIMP nsSVGGraphicElement::GetBBox(nsIDOMSVGRect **_retval) /* Helper for GetCTM and GetScreenCTM */ nsresult -nsSVGGraphicElement::AppendLocalTransform(nsIDOMSVGMatrix *aCTM, - nsIDOMSVGMatrix **_retval) +nsSVGGraphicElement::AppendTransform(nsIDOMSVGMatrix *aCTM, + nsIDOMSVGMatrix **_retval) { if (!mTransforms) { *_retval = aCTM; @@ -127,61 +128,15 @@ nsSVGGraphicElement::AppendLocalTransform(nsIDOMSVGMatrix *aCTM, } /* nsIDOMSVGMatrix getCTM (); */ -NS_IMETHODIMP nsSVGGraphicElement::GetCTM(nsIDOMSVGMatrix **_retval) +NS_IMETHODIMP nsSVGGraphicElement::GetCTM(nsIDOMSVGMatrix * *aCTM) { - nsresult rv; - *_retval = nsnull; - - nsIDocument* currentDoc = GetCurrentDoc(); - if (currentDoc) { - // Flush all pending notifications so that our frames are uptodate - currentDoc->FlushPendingNotifications(Flush_Layout); - } - - nsIContent* parent = nsSVGUtils::GetParentElement(this); - - nsCOMPtr locatableElement = do_QueryInterface(parent); - if (!locatableElement) { - // we don't have an SVGLocatable parent so we aren't even rendered - NS_WARNING("SVGGraphicElement without an SVGLocatable parent"); - return NS_ERROR_FAILURE; - } - - // get our parent's CTM - nsCOMPtr parentCTM; - rv = locatableElement->GetCTM(getter_AddRefs(parentCTM)); - if (NS_FAILED(rv)) return rv; - - return AppendLocalTransform(parentCTM, _retval); + return nsSVGUtils::GetCTM(this, aCTM); } /* nsIDOMSVGMatrix getScreenCTM (); */ -NS_IMETHODIMP nsSVGGraphicElement::GetScreenCTM(nsIDOMSVGMatrix **_retval) +NS_IMETHODIMP nsSVGGraphicElement::GetScreenCTM(nsIDOMSVGMatrix * *aCTM) { - nsresult rv; - *_retval = nsnull; - - nsIDocument* currentDoc = GetCurrentDoc(); - if (currentDoc) { - // Flush all pending notifications so that our frames are uptodate - currentDoc->FlushPendingNotifications(Flush_Layout); - } - - nsIContent* parent = nsSVGUtils::GetParentElement(this); - - nsCOMPtr locatableElement = do_QueryInterface(parent); - if (!locatableElement) { - // we don't have an SVGLocatable parent so we aren't even rendered - NS_WARNING("SVGGraphicElement without an SVGLocatable parent"); - return NS_ERROR_FAILURE; - } - - // get our parent's "screen" CTM - nsCOMPtr parentScreenCTM; - rv = locatableElement->GetScreenCTM(getter_AddRefs(parentScreenCTM)); - if (NS_FAILED(rv)) return rv; - - return AppendLocalTransform(parentScreenCTM, _retval); + return nsSVGUtils::GetScreenCTM(this, aCTM); } /* nsIDOMSVGMatrix getTransformToElement (in nsIDOMSVGElement element); */ diff --git a/content/svg/content/src/nsSVGGraphicElement.h b/content/svg/content/src/nsSVGGraphicElement.h index cb4ea02f3c6c..b4ba5d387624 100644 --- a/content/svg/content/src/nsSVGGraphicElement.h +++ b/content/svg/content/src/nsSVGGraphicElement.h @@ -64,6 +64,9 @@ public: virtual gfxMatrix PrependLocalTransformTo(const gfxMatrix &aMatrix); + // public helpers + virtual nsresult AppendTransform(nsIDOMSVGMatrix *aCTM, + nsIDOMSVGMatrix **_retval); protected: // nsSVGElement overrides virtual PRBool IsEventName(nsIAtom* aName); @@ -75,8 +78,6 @@ protected: // helper nsresult CreateTransformList(); - nsresult AppendLocalTransform(nsIDOMSVGMatrix *aCTM, - nsIDOMSVGMatrix **_retval); }; #endif // __NS_SVGGRAPHICELEMENT_H__ diff --git a/content/svg/content/src/nsSVGSVGElement.cpp b/content/svg/content/src/nsSVGSVGElement.cpp index 2d1273b81720..ae69da724caa 100644 --- a/content/svg/content/src/nsSVGSVGElement.cpp +++ b/content/svg/content/src/nsSVGSVGElement.cpp @@ -746,7 +746,8 @@ nsSVGSVGElement::GetPreserveAspectRatio(nsIDOMSVGAnimatedPreserveAspectRatio NS_IMETHODIMP nsSVGSVGElement::GetNearestViewportElement(nsIDOMSVGElement * *aNearestViewportElement) { - return nsSVGUtils::GetNearestViewportElement(this, aNearestViewportElement); + nsSVGUtils::GetNearestViewportElement(this, aNearestViewportElement); + return NS_OK; // we can't throw exceptions from this API. } /* readonly attribute nsIDOMSVGElement farthestViewportElement; */ @@ -774,205 +775,68 @@ nsSVGSVGElement::GetBBox(nsIDOMSVGRect **_retval) return NS_ERROR_NOT_IMPLEMENTED; // XXX: outer svg } -/* nsIDOMSVGMatrix getCTM (); */ -NS_IMETHODIMP -nsSVGSVGElement::GetCTM(nsIDOMSVGMatrix **_retval) +nsresult +nsSVGSVGElement::AppendTransform(nsIDOMSVGMatrix *aCTM, + nsIDOMSVGMatrix **_retval) { nsresult rv; - *_retval = nsnull; - nsIDocument* currentDoc = GetCurrentDoc(); - if (currentDoc) { - // Flush all pending notifications so that our frames are uptodate - currentDoc->FlushPendingNotifications(Flush_Layout); - } + // first check what are our parents and calculate offsets accordingly. - // first try to get the "screen" CTM of our nearest SVG ancestor - - nsCOMPtr element = this; - nsCOMPtr ancestor; - unsigned short ancestorCount = 0; - nsCOMPtr ancestorCTM; - - while (1) { - ancestor = nsSVGUtils::GetParentElement(element); - if (!ancestor) { - // reached the top of our parent chain without finding an SVG ancestor - break; - } - - nsSVGSVGElement *viewportElement = QI_AND_CAST_TO_NSSVGSVGELEMENT(ancestor); - if (viewportElement) { - rv = viewportElement->GetViewboxToViewportTransform(getter_AddRefs(ancestorCTM)); - if (NS_FAILED(rv)) return rv; - break; - } - - nsCOMPtr locatableElement = do_QueryInterface(ancestor); - if (locatableElement) { - rv = locatableElement->GetCTM(getter_AddRefs(ancestorCTM)); - if (NS_FAILED(rv)) return rv; - break; - } - - // ancestor was not SVG content. loop until we find an SVG ancestor - element = ancestor; - ancestorCount++; - } - - // now account for our offset - - if (!ancestorCTM) { - // we didn't find an SVG ancestor - float s=1, x=0, y=0; - if (IsRoot()) { - // we're the root element. get our currentScale and currentTranslate vals - s = mCurrentScale; - x = mCurrentTranslate.GetX(); - y = mCurrentTranslate.GetY(); - } - else { - // we're inline in some non-SVG content. get our offset from the root - GetOffsetToAncestor(nsnull, x, y); - } - rv = NS_NewSVGMatrix(getter_AddRefs(ancestorCTM), s, 0, 0, s, x, y); + float s=1, x=0, y=0; + nsIContent *ancestor = nsSVGUtils::GetParentElement(this); + if (ancestor && ancestor->GetNameSpaceID() == kNameSpaceID_SVG && + ancestor->Tag() == nsGkAtoms::foreignObject) { + // this is a nested element. immediate parent is an element. + // we ignore this element's x and y attribs in layout so do the same. + } else { + nsCOMPtr nearestViewportElement; + rv = nsSVGUtils::GetNearestViewportElement(this, getter_AddRefs(nearestViewportElement)); if (NS_FAILED(rv)) return rv; - } - else { - // we found an SVG ancestor - float x=0, y=0; - nsCOMPtr tmp; - if (ancestorCount == 0) { - // our immediate parent is an SVG element. get our 'x' and 'y' attribs. - // cast to nsSVGElement so we get our ancestor coord context. - x = mLengthAttributes[X].GetAnimValue(static_cast - (this)); - y = mLengthAttributes[Y].GetAnimValue(static_cast - (this)); - } - else { - // We have an SVG ancestor, but with non-SVG content between us -#if 0 - nsCOMPtr foreignObject - = do_QueryInterface(ancestor); - if (!foreignObject) { - NS_ERROR("the none-SVG content in the parent chain between us and our " - "SVG ancestor isn't rooted in a foreignObject element"); - return NS_ERROR_FAILURE; + + if (!nearestViewportElement) { + if (IsRoot()) { + // we're the root element. get our currentScale and currentTranslate vals + s = mCurrentScale; + x = mCurrentTranslate.GetX(); + y = mCurrentTranslate.GetY(); + } else { + // we're inline in some non-SVG content. get our offset from the root + GetOffsetToAncestor(nsnull, x, y); } -#endif - // XXXjwatt: this isn't quite right since foreignObject can transform its - // content, but it's close enough until we turn foreignObject back on - GetOffsetToAncestor(ancestor, x, y); + } else { + // this is a nested element. + GetAnimatedLengthValues(&x, &y, nsnull); } - rv = ancestorCTM->Translate(x, y, getter_AddRefs(tmp)); - if (NS_FAILED(rv)) return rv; - ancestorCTM.swap(tmp); } + nsCOMPtr local; + rv = NS_NewSVGMatrix(getter_AddRefs(local), s, 0, 0, s, x, y); + if (NS_FAILED(rv)) return rv; + // finally append our viewbox transform - nsCOMPtr tmp; - rv = GetViewboxToViewportTransform(getter_AddRefs(tmp)); + nsCOMPtr viewbox; + rv = GetViewboxToViewportTransform(getter_AddRefs(viewbox)); if (NS_FAILED(rv)) return rv; - return ancestorCTM->Multiply(tmp, _retval); // addrefs, so we don't + nsCOMPtr tmp; + rv = local->Multiply(viewbox, getter_AddRefs(tmp)); // addrefs, so we don't + if (NS_FAILED(rv)) return rv; + return aCTM->Multiply(tmp, _retval); // addrefs, so we don't +} + +/* nsIDOMSVGMatrix getCTM (); */ +NS_IMETHODIMP +nsSVGSVGElement::GetCTM(nsIDOMSVGMatrix * *aCTM) +{ + return nsSVGUtils::GetCTM(this, aCTM); } /* nsIDOMSVGMatrix getScreenCTM (); */ NS_IMETHODIMP -nsSVGSVGElement::GetScreenCTM(nsIDOMSVGMatrix **_retval) +nsSVGSVGElement::GetScreenCTM(nsIDOMSVGMatrix **aCTM) { - nsresult rv; - *_retval = nsnull; - - nsIDocument* currentDoc = GetCurrentDoc(); - if (currentDoc) { - // Flush all pending notifications so that our frames are uptodate - currentDoc->FlushPendingNotifications(Flush_Layout); - } - - // first try to get the "screen" CTM of our nearest SVG ancestor - - nsCOMPtr element = this; - nsCOMPtr ancestor; - unsigned short ancestorCount = 0; - nsCOMPtr ancestorScreenCTM; - - while (1) { - ancestor = nsSVGUtils::GetParentElement(element); - if (!ancestor) { - // reached the top of our parent chain without finding an SVG ancestor - break; - } - - nsCOMPtr locatableElement = do_QueryInterface(ancestor); - if (locatableElement) { - rv = locatableElement->GetScreenCTM(getter_AddRefs(ancestorScreenCTM)); - if (NS_FAILED(rv)) return rv; - break; - } - - // ancestor was not SVG content. loop until we find an SVG ancestor - element = ancestor; - ancestorCount++; - } - - // now account for our offset - - if (!ancestorScreenCTM) { - // we didn't find an SVG ancestor - float s=1, x=0, y=0; - if (IsRoot()) { - // we're the root element. get our currentScale and currentTranslate vals - s = mCurrentScale; - x = mCurrentTranslate.GetX(); - y = mCurrentTranslate.GetY(); - } - else { - // we're inline in some non-SVG content. get our offset from the root - GetOffsetToAncestor(nsnull, x, y); - } - rv = NS_NewSVGMatrix(getter_AddRefs(ancestorScreenCTM), s, 0, 0, s, x, y); - if (NS_FAILED(rv)) return rv; - } - else { - // we found an SVG ancestor - float x=0, y=0; - nsCOMPtr tmp; - if (ancestorCount == 0) { - // our immediate parent is an SVG element. get our 'x' and 'y' attribs - // cast to nsSVGElement so we get our ancestor coord context. - x = mLengthAttributes[X].GetAnimValue(static_cast - (this)); - y = mLengthAttributes[Y].GetAnimValue(static_cast - (this)); - } - else { - // We have an SVG ancestor, but with non-SVG content between us -#if 0 - nsCOMPtr foreignObject - = do_QueryInterface(ancestor); - if (!foreignObject) { - NS_ERROR("the none-SVG content in the parent chain between us and our " - "SVG ancestor isn't rooted in a foreignObject element"); - return NS_ERROR_FAILURE; - } -#endif - // XXXjwatt: this isn't quite right since foreignObject can transform its - // content, but it's close enough until we turn foreignObject back on - GetOffsetToAncestor(ancestor, x, y); - } - rv = ancestorScreenCTM->Translate(x, y, getter_AddRefs(tmp)); - if (NS_FAILED(rv)) return rv; - ancestorScreenCTM.swap(tmp); - } - - // finally append our viewbox transform - - nsCOMPtr tmp; - rv = GetViewboxToViewportTransform(getter_AddRefs(tmp)); - if (NS_FAILED(rv)) return rv; - return ancestorScreenCTM->Multiply(tmp, _retval); // addrefs, so we don't + return nsSVGUtils::GetScreenCTM(this, aCTM); } /* nsIDOMSVGMatrix getTransformToElement (in nsIDOMSVGElement element); */ diff --git a/content/svg/content/src/nsSVGSVGElement.h b/content/svg/content/src/nsSVGSVGElement.h index 56deba11f831..aab34a77ee9a 100644 --- a/content/svg/content/src/nsSVGSVGElement.h +++ b/content/svg/content/src/nsSVGSVGElement.h @@ -200,6 +200,8 @@ public: // public helpers: nsresult GetViewboxToViewportTransform(nsIDOMSVGMatrix **_retval); + nsresult AppendTransform(nsIDOMSVGMatrix *aCTM, + nsIDOMSVGMatrix **_retval); virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; diff --git a/content/svg/content/test/Makefile.in b/content/svg/content/test/Makefile.in index f03403536fa5..5743cf6645ba 100644 --- a/content/svg/content/test/Makefile.in +++ b/content/svg/content/test/Makefile.in @@ -50,6 +50,8 @@ _TEST_FILES = \ bounds-helper.svg \ test_dataTypes.html \ dataTypes-helper.svg \ + getCTM-helper.svg \ + test_getCTM.html \ test_getSubStringLength.xhtml \ getSubStringLength-helper.svg \ test_pathSeg.xhtml \ diff --git a/content/svg/content/test/getCTM-helper.svg b/content/svg/content/test/getCTM-helper.svg new file mode 100644 index 000000000000..865f0447555f --- /dev/null +++ b/content/svg/content/test/getCTM-helper.svg @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/content/svg/content/test/test_getCTM.html b/content/svg/content/test/test_getCTM.html new file mode 100644 index 000000000000..bbc0778c47b7 --- /dev/null +++ b/content/svg/content/test/test_getCTM.html @@ -0,0 +1,91 @@ + + + + + Test for Bug 366697 + + + + + +Mozilla Bug 366697 +

    + + + + +
    +
    +
    + + diff --git a/content/svg/content/test/test_viewport.html b/content/svg/content/test/test_viewport.html index b260a34e4c80..04e64e730038 100644 --- a/content/svg/content/test/test_viewport.html +++ b/content/svg/content/test/test_viewport.html @@ -39,7 +39,7 @@ function runTest() is(g1.viewportElement, inner, "g1.viewportElement"); is(outer.viewportElement, null, "outer.viewportElement"); is(g2.viewportElement, outer, "g2.viewportElement"); - is(g3.viewportElement, null, "g2.viewportElement"); + is(g3.viewportElement, null, "g3.viewportElement"); is(symbolRect.viewportElement, sym, "symbolRect.viewportElement"); diff --git a/layout/svg/base/src/nsSVGUtils.cpp b/layout/svg/base/src/nsSVGUtils.cpp index 6ed5f60348f8..eecd9ecfd014 100644 --- a/layout/svg/base/src/nsSVGUtils.cpp +++ b/layout/svg/base/src/nsSVGUtils.cpp @@ -69,6 +69,7 @@ #include "nsSVGContainerFrame.h" #include "nsSVGLength2.h" #include "nsGenericElement.h" +#include "nsSVGGraphicElement.h" #include "nsAttrValue.h" #include "nsSVGGeometryFrame.h" #include "nsIScriptError.h" @@ -457,10 +458,104 @@ nsSVGUtils::GetNearestViewportElement(nsIContent *aContent, ancestor = GetParentElement(ancestor); } + if (ancestor && ancestor->GetNameSpaceID() == kNameSpaceID_SVG && + ancestor->Tag() == nsGkAtoms::foreignObject ) + return NS_ERROR_FAILURE; return NS_OK; } +nsresult +nsSVGUtils::AppendTransformUptoElement(nsIContent *aContent, nsIDOMSVGElement *aElement, nsIDOMSVGMatrix * *aCTM){ + nsresult rv; + nsCOMPtr element = do_QueryInterface(aContent); + nsIContent *ancestor = GetParentElement(aContent); + if (!aElement) { + // calculating GetScreenCTM(): traverse upto the root or non-SVG content. + if (ancestor && ancestor->GetNameSpaceID() == kNameSpaceID_SVG) { + if (ancestor->Tag() == nsGkAtoms::foreignObject && aContent->Tag() != nsGkAtoms::svg) + return NS_ERROR_FAILURE; + rv = AppendTransformUptoElement(ancestor, aElement, aCTM); + if (NS_FAILED(rv)) return rv; + } + } else if (element != aElement) { // calculating GetCTM(): stop at aElement. + NS_ASSERTION(ancestor != nsnull, "ancestor shouldn't be null."); + if (!ancestor) + return NS_ERROR_FAILURE; + rv = AppendTransformUptoElement(ancestor, aElement, aCTM); + if (NS_FAILED(rv)) return rv; + } + + nsCOMPtr tmp; + if (nsCOMPtr(do_QueryInterface(aContent))) { + nsSVGSVGElement *svgElement = static_cast(aContent); + rv = svgElement->AppendTransform(*aCTM, getter_AddRefs(tmp)); + if (NS_FAILED(rv)) return rv; + } else if (nsCOMPtr(do_QueryInterface(aContent))) { + nsSVGGraphicElement *graphicElement = static_cast(aContent); + rv = graphicElement->AppendTransform(*aCTM, getter_AddRefs(tmp)); + if (NS_FAILED(rv)) return rv; + } else { + //XXX aContent may be other type of viewport-establising elements + // (e.g. and ) and handle them? + } + if (tmp) + tmp.swap(*aCTM); + + return NS_OK; +} + +nsresult +nsSVGUtils::GetCTM(nsIContent *aContent, nsIDOMSVGMatrix * *aCTM) +{ + nsresult rv; + nsIDocument* currentDoc = aContent->GetCurrentDoc(); + if (currentDoc) { + // Flush all pending notifications so that our frames are uptodate + currentDoc->FlushPendingNotifications(Flush_Layout); + } + + *aCTM = nsnull; + nsCOMPtr nearestViewportElement; + rv = GetNearestViewportElement(aContent, getter_AddRefs(nearestViewportElement)); + // According to the spec(http://www.w3.org/TR/SVG11/types.html#InterfaceSVGLocatable), + // GetCTM is strictly defined to be the CTM for nearestViewportElement, + // Thus, if it is null, this is null, too. + if (NS_FAILED(rv) || !nearestViewportElement) + return NS_OK; // we can't throw exceptions from this API. + + nsCOMPtr tmp; + rv = NS_NewSVGMatrix(getter_AddRefs(tmp), 1, 0, 0, 1, 0, 0); + if (NS_FAILED(rv)) return NS_OK; // we can't throw exceptions from this API. + tmp.swap(*aCTM); + rv = AppendTransformUptoElement(aContent, nearestViewportElement, aCTM); + if (NS_FAILED(rv)) + tmp.swap(*aCTM); + return NS_OK; // we can't throw exceptions from this API. +} + +nsresult +nsSVGUtils::GetScreenCTM(nsIContent *aContent, nsIDOMSVGMatrix * *aCTM) +{ + nsresult rv; + nsIDocument* currentDoc = aContent->GetCurrentDoc(); + if (currentDoc) { + // Flush all pending notifications so that our frames are uptodate + currentDoc->FlushPendingNotifications(Flush_Layout); + } + + *aCTM = nsnull; + + nsCOMPtr tmp; + rv = NS_NewSVGMatrix(getter_AddRefs(tmp), 1, 0, 0, 1, 0, 0); + if (NS_FAILED(rv)) return NS_OK; // we can't throw exceptions from this API. + tmp.swap(*aCTM); + rv = AppendTransformUptoElement(aContent, nsnull, aCTM); + if (NS_FAILED(rv)) + tmp.swap(*aCTM); + return NS_OK; // we can't throw exceptions from this API. +} + nsSVGDisplayContainerFrame* nsSVGUtils::GetNearestSVGViewport(nsIFrame *aFrame) { diff --git a/layout/svg/base/src/nsSVGUtils.h b/layout/svg/base/src/nsSVGUtils.h index 8d82e1df2135..376ab57b3e02 100644 --- a/layout/svg/base/src/nsSVGUtils.h +++ b/layout/svg/base/src/nsSVGUtils.h @@ -250,6 +250,28 @@ public: static float CoordToFloat(nsPresContext *aPresContext, nsSVGElement *aContent, const nsStyleCoord &aCoord); + + /* + * This does the actual job for GetCTM and GetScreenCTM. When called, + * this goes up the tree starting from aContent, until reaching to aElement. + * When aElement is null, this goes up to the outermost SVG parent. Then, + * this post-multiplies aCTM by each parent node's transformation matrix, + * going down the tree from aElement to aContent. + * This doesn't initialize aCTM. So callers usually should pass + * the identity matrix by aCTM. + */ + static nsresult AppendTransformUptoElement(nsIContent *aContent, + nsIDOMSVGElement *aElement, + nsIDOMSVGMatrix * *aCTM); + /* + * Return the CTM + */ + static nsresult GetCTM(nsIContent *aContent, nsIDOMSVGMatrix * *aCTM); + + /* + * Return the screen CTM + */ + static nsresult GetScreenCTM(nsIContent *aContent, nsIDOMSVGMatrix * *aCTM); /* * Return the nearest viewport element */ From 3d3efc34e4bb25433be293f03dad6e4d95d770f7 Mon Sep 17 00:00:00 2001 From: Shawn Wilsher Date: Fri, 26 Jun 2009 15:03:53 -0700 Subject: [PATCH 59/70] Bug 500750 - mDBConn is not set to NULL in release builds r=asuth --- storage/src/mozStorageConnection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/src/mozStorageConnection.cpp b/storage/src/mozStorageConnection.cpp index ba94f791efd5..02001afde608 100644 --- a/storage/src/mozStorageConnection.cpp +++ b/storage/src/mozStorageConnection.cpp @@ -507,8 +507,8 @@ Connection::Close() } int srv = ::sqlite3_close(mDBConn); - if (srv != SQLITE_OK) - NS_ERROR("sqlite3_close failed. There are probably outstanding statements that are listed above!"); + NS_ASSERTION(srv == SQLITE_OK, + "sqlite3_close failed. There are probably outstanding statements that are listed above!"); mDBConn = NULL; return convertResultCode(srv); From 93266472302b1636fec254661ea1f31ae833b9d6 Mon Sep 17 00:00:00 2001 From: Jesse Ruderman Date: Fri, 26 Jun 2009 17:26:31 -0700 Subject: [PATCH 60/70] Add crashtest for bug 500847 (just filed) --- editor/composer/src/crashtests/crashtests.list | 1 + .../removing-editable-xslt-inner.xhtml | 4 ++++ .../src/crashtests/removing-editable-xslt.html | 17 +++++++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 editor/composer/src/crashtests/removing-editable-xslt-inner.xhtml create mode 100644 editor/composer/src/crashtests/removing-editable-xslt.html diff --git a/editor/composer/src/crashtests/crashtests.list b/editor/composer/src/crashtests/crashtests.list index c12659111c40..0a46b7e60c23 100644 --- a/editor/composer/src/crashtests/crashtests.list +++ b/editor/composer/src/crashtests/crashtests.list @@ -1,2 +1,3 @@ load 351236-1.html skip-if(MOZ_WIDGET_TOOLKIT=="windows") load 428844-1.html # bug 471185 +load removing-editable-xslt.html diff --git a/editor/composer/src/crashtests/removing-editable-xslt-inner.xhtml b/editor/composer/src/crashtests/removing-editable-xslt-inner.xhtml new file mode 100644 index 000000000000..cbf206d7ed13 --- /dev/null +++ b/editor/composer/src/crashtests/removing-editable-xslt-inner.xhtml @@ -0,0 +1,4 @@ + + + + diff --git a/editor/composer/src/crashtests/removing-editable-xslt.html b/editor/composer/src/crashtests/removing-editable-xslt.html new file mode 100644 index 000000000000..cbf104ac99cd --- /dev/null +++ b/editor/composer/src/crashtests/removing-editable-xslt.html @@ -0,0 +1,17 @@ + + + + + + + + From e7d4b33ab3489d90bda1e9092b967be31579d77d Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Fri, 26 Jun 2009 22:31:32 -0700 Subject: [PATCH 61/70] Bug 499632 - Remove run_viewer target, r=ted --- config/autoconf.mk.in | 3 --- config/rules.mk | 8 +------- configure.in | 10 ---------- js/src/config/autoconf.mk.in | 3 --- js/src/config/rules.mk | 8 +------- js/src/configure.in | 10 ---------- 6 files changed, 2 insertions(+), 40 deletions(-) diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index 796cebb7f771..32d715debdb5 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -546,9 +546,6 @@ STATIC_LIBIDL = @STATIC_LIBIDL@ MOZ_NATIVE_MAKEDEPEND = @SYSTEM_MAKEDEPEND@ -# Used for LD_LIBRARY_PATH -LIBS_PATH = @LIBS_PATH@ - MOZ_AUTO_DEPS = @MOZ_AUTO_DEPS@ COMPILER_DEPEND = @COMPILER_DEPEND@ MDDEPDIR := @MDDEPDIR@ diff --git a/config/rules.mk b/config/rules.mk index 01c52d2b10a3..d62bc862b7fc 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -946,12 +946,6 @@ endif # NO_PROFILE_GUIDED_OPTIMIZE checkout: $(MAKE) -C $(topsrcdir) -f client.mk checkout -run_viewer: $(FINAL_TARGET)/viewer - cd $(FINAL_TARGET); \ - MOZILLA_FIVE_HOME=`pwd` \ - LD_LIBRARY_PATH=".:$(LIBS_PATH):$$LD_LIBRARY_PATH" \ - viewer - clean clobber realclean clobber_all:: $(SUBMAKEFILES) -rm -f $(ALL_TRASH) -rm -rf $(ALL_TRASH_DIRS) @@ -2106,7 +2100,7 @@ endif # Fake targets. Always run these rules, even if a file/directory with that # name already exists. # -.PHONY: all alltags boot checkout chrome realchrome clean clobber clobber_all export install libs makefiles realclean run_viewer run_apprunner tools $(DIRS) $(TOOL_DIRS) FORCE +.PHONY: all alltags boot checkout chrome realchrome clean clobber clobber_all export install libs makefiles realclean run_apprunner tools $(DIRS) $(TOOL_DIRS) FORCE # Used as a dependency to force targets to rebuild FORCE: diff --git a/configure.in b/configure.in index 87e2281b0484..4a3e9611774e 100644 --- a/configure.in +++ b/configure.in @@ -8325,16 +8325,6 @@ if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION) fi -# Used for LD_LIBRARY_PATH of run_viewer target -LIBS_PATH= -for lib_arg in $NSPR_LIBS $TK_LIBS; do - case $lib_arg in - -L* ) LIBS_PATH="${LIBS_PATH:+$LIBS_PATH:}"`expr $lib_arg : "-L\(.*\)"` ;; - * ) ;; - esac -done -AC_SUBST(LIBS_PATH) - dnl ======================================================== dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW dnl ======================================================== diff --git a/js/src/config/autoconf.mk.in b/js/src/config/autoconf.mk.in index 71d646f21614..459d0895b856 100644 --- a/js/src/config/autoconf.mk.in +++ b/js/src/config/autoconf.mk.in @@ -294,9 +294,6 @@ MOZ_TOOLKIT_REGISTRY_CFLAGS = \ MOZ_NATIVE_MAKEDEPEND = @SYSTEM_MAKEDEPEND@ -# Used for LD_LIBRARY_PATH -LIBS_PATH = @LIBS_PATH@ - MOZ_AUTO_DEPS = @MOZ_AUTO_DEPS@ COMPILER_DEPEND = @COMPILER_DEPEND@ MDDEPDIR := @MDDEPDIR@ diff --git a/js/src/config/rules.mk b/js/src/config/rules.mk index 01c52d2b10a3..d62bc862b7fc 100644 --- a/js/src/config/rules.mk +++ b/js/src/config/rules.mk @@ -946,12 +946,6 @@ endif # NO_PROFILE_GUIDED_OPTIMIZE checkout: $(MAKE) -C $(topsrcdir) -f client.mk checkout -run_viewer: $(FINAL_TARGET)/viewer - cd $(FINAL_TARGET); \ - MOZILLA_FIVE_HOME=`pwd` \ - LD_LIBRARY_PATH=".:$(LIBS_PATH):$$LD_LIBRARY_PATH" \ - viewer - clean clobber realclean clobber_all:: $(SUBMAKEFILES) -rm -f $(ALL_TRASH) -rm -rf $(ALL_TRASH_DIRS) @@ -2106,7 +2100,7 @@ endif # Fake targets. Always run these rules, even if a file/directory with that # name already exists. # -.PHONY: all alltags boot checkout chrome realchrome clean clobber clobber_all export install libs makefiles realclean run_viewer run_apprunner tools $(DIRS) $(TOOL_DIRS) FORCE +.PHONY: all alltags boot checkout chrome realchrome clean clobber clobber_all export install libs makefiles realclean run_apprunner tools $(DIRS) $(TOOL_DIRS) FORCE # Used as a dependency to force targets to rebuild FORCE: diff --git a/js/src/configure.in b/js/src/configure.in index 4cde3dac935f..460628cfa163 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -5206,16 +5206,6 @@ if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION) fi -# Used for LD_LIBRARY_PATH of run_viewer target -LIBS_PATH= -for lib_arg in $NSPR_LIBS $TK_LIBS; do - case $lib_arg in - -L* ) LIBS_PATH="${LIBS_PATH:+$LIBS_PATH:}"`expr $lib_arg : "-L\(.*\)"` ;; - * ) ;; - esac -done -AC_SUBST(LIBS_PATH) - dnl ======================================================== dnl JavaScript shell dnl ======================================================== From 43ec1ef72c79ece99d68f10f5cd389a558dc0e18 Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Fri, 26 Jun 2009 22:31:36 -0700 Subject: [PATCH 62/70] Bug 499437 - nsHTMLEditor::ReplaceStyleSheet fails to replace if both sheets are loaded, r+sr=neil --- editor/libeditor/html/nsHTMLEditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor/libeditor/html/nsHTMLEditor.cpp b/editor/libeditor/html/nsHTMLEditor.cpp index e07405eb6cd5..3b96e695e820 100644 --- a/editor/libeditor/html/nsHTMLEditor.cpp +++ b/editor/libeditor/html/nsHTMLEditor.cpp @@ -3372,7 +3372,7 @@ nsHTMLEditor::ReplaceStyleSheet(const nsAString& aURL) if (EnableExistingStyleSheet(aURL)) { // Disable last sheet if not the same as new one - if (!mLastStyleSheetURL.IsEmpty() && mLastStyleSheetURL.Equals(aURL)) + if (!mLastStyleSheetURL.IsEmpty() && !mLastStyleSheetURL.Equals(aURL)) return EnableStyleSheet(mLastStyleSheetURL, PR_FALSE); return NS_OK; From e9b3889757b129bfc037f74bbbd963145fa25d91 Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Fri, 26 Jun 2009 22:31:39 -0700 Subject: [PATCH 63/70] Bug 496809 - Define @BIN_SUFFIX@ for removed-files.in, r=ted --- browser/installer/removed-files.in | 4 +--- toolkit/mozapps/installer/packager.mk | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/browser/installer/removed-files.in b/browser/installer/removed-files.in index a76af88391e8..9f0f7c10a9e7 100644 --- a/browser/installer/removed-files.in +++ b/browser/installer/removed-files.in @@ -641,9 +641,7 @@ msvcr80.dll #else mozcrt19.dll #endif -xpicleanup.exe -#else -xpicleanup #endif +xpicleanup@BIN_SUFFIX@ chrome.manifest install.rdf diff --git a/toolkit/mozapps/installer/packager.mk b/toolkit/mozapps/installer/packager.mk index de87ec476f83..2844f138b004 100644 --- a/toolkit/mozapps/installer/packager.mk +++ b/toolkit/mozapps/installer/packager.mk @@ -271,7 +271,7 @@ ifndef PACKAGER_NO_LIBS libs:: make-package endif -DEFINES += -DDLL_PREFIX=$(DLL_PREFIX) -DDLL_SUFFIX=$(DLL_SUFFIX) +DEFINES += -DDLL_PREFIX=$(DLL_PREFIX) -DDLL_SUFFIX=$(DLL_SUFFIX) -DBIN_SUFFIX=$(BIN_SUFFIX) ifdef MOZ_PKG_REMOVALS MOZ_PKG_REMOVALS_GEN = removed-files From f71d261e9f272be4515a51e99f6eaf39629e5fa0 Mon Sep 17 00:00:00 2001 From: Robert Longson Date: Sat, 27 Jun 2009 11:26:32 +0100 Subject: [PATCH 64/70] reenable crashtest for bug 492186 --- layout/svg/crashtests/crashtests.list | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/svg/crashtests/crashtests.list b/layout/svg/crashtests/crashtests.list index 80ecf67d1a8a..2cec70c61091 100644 --- a/layout/svg/crashtests/crashtests.list +++ b/layout/svg/crashtests/crashtests.list @@ -73,5 +73,5 @@ load 472782-1.svg load 475181-1.svg load 475193-1.html load 478128-1.svg -# load 492186-1.svg +load 492186-1.svg load extref-test-1.xhtml From c732d806b1b36d4d09356335c260fec71213e202 Mon Sep 17 00:00:00 2001 From: Peter Weilbacher Date: Sat, 27 Jun 2009 17:23:31 +0300 Subject: [PATCH 65/70] [OS/2] Bug 500414: new FF icon, adapted for OS/2 by Stefan Schmohl, r=pweilbacher --- .../branding/firefox/firefox-os2.ico | Bin 7824 -> 22480 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/other-licenses/branding/firefox/firefox-os2.ico b/other-licenses/branding/firefox/firefox-os2.ico index aa7606919f0a7ae350880f03f595a28fc832221f..99de1d8f20e126b0795214593757f929b0d725b6 100644 GIT binary patch literal 22480 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 WN02{y>-i%0Mb!8s_SI;8j?|wJWtI{E From 00b2db6e32efd085992e169f0c40d7d93185ae39 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Sat, 27 Jun 2009 15:58:03 +0200 Subject: [PATCH 66/70] Bug 420491 - Factor out window mask identification from nsCocoaWindow::CreateNativeWindow. r=josh --- widget/src/cocoa/nsCocoaWindow.mm | 84 +++++++++++-------------------- 1 file changed, 28 insertions(+), 56 deletions(-) diff --git a/widget/src/cocoa/nsCocoaWindow.mm b/widget/src/cocoa/nsCocoaWindow.mm index 7cd10441caf3..3644175d43ec 100644 --- a/widget/src/cocoa/nsCocoaWindow.mm +++ b/widget/src/cocoa/nsCocoaWindow.mm @@ -280,56 +280,47 @@ nsresult nsCocoaWindow::StandardCreate(nsIWidget *aParent, } +static unsigned int WindowMaskForBorderStyle(nsBorderStyle aBorderStyle) +{ + PRBool allOrDefault = (aBorderStyle == eBorderStyle_all || + aBorderStyle == eBorderStyle_default); + + /* Apple's docs on NSWindow styles say that "a window's style mask should + * include NSTitledWindowMask if it includes any of the others [besides + * NSBorderlessWindowMask]". This implies that a borderless window + * shouldn't have any other styles than NSBorderlessWindowMask. + */ + if (!allOrDefault && !(aBorderStyle & eBorderStyle_title)) + return NSBorderlessWindowMask; + + unsigned int mask = NSTitledWindowMask | NSMiniaturizableWindowMask; + if (allOrDefault || aBorderStyle & eBorderStyle_close) + mask |= NSClosableWindowMask; + if (allOrDefault || aBorderStyle & eBorderStyle_resizeh) + mask |= NSResizableWindowMask; + + return mask; +} + + nsresult nsCocoaWindow::CreateNativeWindow(const nsIntRect &aRect, nsBorderStyle aBorderStyle) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; - - PRBool allOrDefault = aBorderStyle == eBorderStyle_all || - aBorderStyle == eBorderStyle_default; - - // if a toplevel window was requested without a titlebar, use a dialog - if (mWindowType == eWindowType_toplevel && - (aBorderStyle == eBorderStyle_none || - !allOrDefault && - !(aBorderStyle & eBorderStyle_title))) - mWindowType = eWindowType_dialog; - - // we default to NSBorderlessWindowMask, add features if needed + // We default to NSBorderlessWindowMask, add features if needed. unsigned int features = NSBorderlessWindowMask; - // Configure the window we will create based on the window type + // Configure the window we will create based on the window type. switch (mWindowType) { case eWindowType_invisible: case eWindowType_child: + case eWindowType_popup: break; + case eWindowType_toplevel: case eWindowType_dialog: - switch (aBorderStyle) - { - case eBorderStyle_none: - break; - case eBorderStyle_default: - features |= NSTitledWindowMask; - break; - case eBorderStyle_all: - features |= NSClosableWindowMask; - features |= NSTitledWindowMask; - features |= NSResizableWindowMask; - features |= NSMiniaturizableWindowMask; - break; - default: - if (aBorderStyle & eBorderStyle_title) { - features |= NSTitledWindowMask; - features |= NSMiniaturizableWindowMask; - } - if (aBorderStyle & eBorderStyle_resizeh) - features |= NSResizableWindowMask; - if (aBorderStyle & eBorderStyle_close) - features |= NSClosableWindowMask; - break; - } + features = WindowMaskForBorderStyle(aBorderStyle); break; case eWindowType_sheet: nsWindowType parentType; @@ -343,30 +334,11 @@ nsresult nsCocoaWindow::CreateNativeWindow(const nsIntRect &aRect, } features |= NSTitledWindowMask; break; - case eWindowType_popup: - features |= NSBorderlessWindowMask; - break; - case eWindowType_toplevel: - features |= NSTitledWindowMask; - features |= NSMiniaturizableWindowMask; - if (allOrDefault || aBorderStyle & eBorderStyle_close) - features |= NSClosableWindowMask; - if (allOrDefault || aBorderStyle & eBorderStyle_resizeh) - features |= NSResizableWindowMask; - break; default: NS_ERROR("Unhandled window type!"); return NS_ERROR_FAILURE; } - /* Apple's docs on NSWindow styles say that "a window's style mask should - * include NSTitledWindowMask if it includes any of the others [besides - * NSBorderlessWindowMask]". This implies that a borderless window - * shouldn't have any other styles than NSBorderlessWindowMask. - */ - if (!(features & NSTitledWindowMask)) - features = NSBorderlessWindowMask; - /* * We pass a content area rect to initialize the native Cocoa window. The * content rect we give is the same size as the size we're given by gecko. From 8bb8ed55a10228befc4b48fb52d5640dfe8da2d7 Mon Sep 17 00:00:00 2001 From: Steffen Imhof Date: Sat, 27 Jun 2009 16:34:36 +0200 Subject: [PATCH 67/70] Bug 464880 - Shift-Tab does not move the focus backwards on Qt. r=romaxa, sr=pavlov --- widget/src/qt/nsQtKeyUtils.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/widget/src/qt/nsQtKeyUtils.cpp b/widget/src/qt/nsQtKeyUtils.cpp index f754ad709fc6..e68def3a3133 100644 --- a/widget/src/qt/nsQtKeyUtils.cpp +++ b/widget/src/qt/nsQtKeyUtils.cpp @@ -54,6 +54,7 @@ static struct nsKeyConverter nsKeycodes[] = // { NS_VK_CANCEL, Qt::Key_Cancel }, { NS_VK_BACK, Qt::Key_Backspace }, { NS_VK_TAB, Qt::Key_Tab }, + { NS_VK_TAB, Qt::Key_Backtab }, // { NS_VK_CLEAR, Qt::Key_Clear }, { NS_VK_RETURN, Qt::Key_Return }, { NS_VK_RETURN, Qt::Key_Enter }, From 29496df51093488a19d17a32f6c8b56ff13c2862 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20O=E2=80=9A=C3=84=C3=B4Shannessy?= Date: Mon, 15 Jun 2009 10:40:49 -0700 Subject: [PATCH 68/70] Bug 493823 - One test from browser_394759 not being run, r=zeniko --- browser/components/sessionstore/src/nsSessionStore.js | 2 +- .../components/sessionstore/test/browser/browser_394759.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/browser/components/sessionstore/src/nsSessionStore.js b/browser/components/sessionstore/src/nsSessionStore.js index 46c1f82f152f..56b6eab05a05 100644 --- a/browser/components/sessionstore/src/nsSessionStore.js +++ b/browser/components/sessionstore/src/nsSessionStore.js @@ -2766,7 +2766,7 @@ SessionStoreService.prototype = { let normalWindowIndex = 0; // try to find a non-popup window in this._closedWindows while (normalWindowIndex < this._closedWindows.length && - this._closedWindows[normalWindowIndex].isPopup) + !!this._closedWindows[normalWindowIndex].isPopup) normalWindowIndex++; if (normalWindowIndex >= maxWindowsUndo) spliceTo = normalWindowIndex + 1; diff --git a/browser/components/sessionstore/test/browser/browser_394759.js b/browser/components/sessionstore/test/browser/browser_394759.js index 4f56d23a35a0..86451b34c349 100644 --- a/browser/components/sessionstore/test/browser/browser_394759.js +++ b/browser/components/sessionstore/test/browser/browser_394759.js @@ -113,7 +113,7 @@ function test() { function test_behavior (callback) { // helper function that does the actual testing - function openWindowRec(windowsToOpen, expectedResults) { + function openWindowRec(windowsToOpen, expectedResults, recCallback) { // do actual checking if (!windowsToOpen.length) { let closedWindowData = JSON.parse(ss.getClosedWindowData()); @@ -130,7 +130,7 @@ function test() { "There were " + oResults.normal + " normal windows to repoen"); // cleanup & return - executeSoon(callback); + executeSoon(recCallback); return; } // hack to force window to be considered a popup (toolbar=no didn't work) @@ -149,7 +149,7 @@ function test() { executeSoon(function() { window.close(); executeSoon(function() { - openWindowRec(windowsToOpen, expectedResults); + openWindowRec(windowsToOpen, expectedResults, recCallback); }); }); }, true); From f97c1cf5ba6cf2be868869cef70b6ce3201a3fa8 Mon Sep 17 00:00:00 2001 From: Michael Ventnor Date: Sat, 27 Jun 2009 16:40:12 +0200 Subject: [PATCH 69/70] Bug 500897 - Window resizer is not drawn correctly on some themes. r+sr=roc --- widget/src/gtk2/gtk2drawing.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/widget/src/gtk2/gtk2drawing.c b/widget/src/gtk2/gtk2drawing.c index 596bbf33344d..cfc5fa5bc377 100644 --- a/widget/src/gtk2/gtk2drawing.c +++ b/widget/src/gtk2/gtk2drawing.c @@ -2130,15 +2130,15 @@ moz_gtk_resizer_paint(GdkDrawable* drawable, GdkRectangle* rect, GtkStyle* style; GtkStateType state_type = ConvertGtkState(state); - ensure_window_widget(); - gtk_widget_set_direction(gProtoWindow, direction); + ensure_frame_widget(); + gtk_widget_set_direction(gStatusbarWidget, direction); - style = gProtoWindow->style; + style = gStatusbarWidget->style; TSOffsetStyleGCs(style, rect->x, rect->y); - gtk_paint_resize_grip(style, drawable, state_type, cliprect, gProtoWindow, - NULL, (direction == GTK_TEXT_DIR_LTR) ? + gtk_paint_resize_grip(style, drawable, state_type, cliprect, gStatusbarWidget, + "statusbar", (direction == GTK_TEXT_DIR_LTR) ? GDK_WINDOW_EDGE_SOUTH_EAST : GDK_WINDOW_EDGE_SOUTH_WEST, rect->x, rect->y, rect->width, rect->height); From 57cfb0b344594b003c1980f0b23aa3792903d94d Mon Sep 17 00:00:00 2001 From: Jonathan Griffin Date: Sat, 27 Jun 2009 16:43:34 +0200 Subject: [PATCH 70/70] Bug 400925 - Reftests for live changes to gradients and patterns. r=roc --- layout/reftests/svg/gradient-live-01-ref.svg | 14 +++++++++ layout/reftests/svg/gradient-live-01a.svg | 28 ++++++++++++++++++ layout/reftests/svg/gradient-live-01b.svg | 26 +++++++++++++++++ layout/reftests/svg/gradient-live-01c.svg | 27 ++++++++++++++++++ layout/reftests/svg/gradient-live-01d.svg | 30 ++++++++++++++++++++ layout/reftests/svg/pattern-live-01-ref.svg | 10 +++++++ layout/reftests/svg/pattern-live-01a.svg | 24 ++++++++++++++++ layout/reftests/svg/pattern-live-01b.svg | 23 +++++++++++++++ layout/reftests/svg/pattern-live-01c.svg | 27 ++++++++++++++++++ layout/reftests/svg/reftest.list | 7 +++++ 10 files changed, 216 insertions(+) create mode 100644 layout/reftests/svg/gradient-live-01-ref.svg create mode 100644 layout/reftests/svg/gradient-live-01a.svg create mode 100644 layout/reftests/svg/gradient-live-01b.svg create mode 100644 layout/reftests/svg/gradient-live-01c.svg create mode 100644 layout/reftests/svg/gradient-live-01d.svg create mode 100644 layout/reftests/svg/pattern-live-01-ref.svg create mode 100644 layout/reftests/svg/pattern-live-01a.svg create mode 100644 layout/reftests/svg/pattern-live-01b.svg create mode 100644 layout/reftests/svg/pattern-live-01c.svg diff --git a/layout/reftests/svg/gradient-live-01-ref.svg b/layout/reftests/svg/gradient-live-01-ref.svg new file mode 100644 index 000000000000..8f8c66e1b4ed --- /dev/null +++ b/layout/reftests/svg/gradient-live-01-ref.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff --git a/layout/reftests/svg/gradient-live-01a.svg b/layout/reftests/svg/gradient-live-01a.svg new file mode 100644 index 000000000000..df3e8259a151 --- /dev/null +++ b/layout/reftests/svg/gradient-live-01a.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + diff --git a/layout/reftests/svg/gradient-live-01b.svg b/layout/reftests/svg/gradient-live-01b.svg new file mode 100644 index 000000000000..60740c0e87f8 --- /dev/null +++ b/layout/reftests/svg/gradient-live-01b.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + diff --git a/layout/reftests/svg/gradient-live-01c.svg b/layout/reftests/svg/gradient-live-01c.svg new file mode 100644 index 000000000000..cc985bcadfdf --- /dev/null +++ b/layout/reftests/svg/gradient-live-01c.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + diff --git a/layout/reftests/svg/gradient-live-01d.svg b/layout/reftests/svg/gradient-live-01d.svg new file mode 100644 index 000000000000..41cba3f881b6 --- /dev/null +++ b/layout/reftests/svg/gradient-live-01d.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + diff --git a/layout/reftests/svg/pattern-live-01-ref.svg b/layout/reftests/svg/pattern-live-01-ref.svg new file mode 100644 index 000000000000..374c84d34383 --- /dev/null +++ b/layout/reftests/svg/pattern-live-01-ref.svg @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/layout/reftests/svg/pattern-live-01a.svg b/layout/reftests/svg/pattern-live-01a.svg new file mode 100644 index 000000000000..1409495e4656 --- /dev/null +++ b/layout/reftests/svg/pattern-live-01a.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + diff --git a/layout/reftests/svg/pattern-live-01b.svg b/layout/reftests/svg/pattern-live-01b.svg new file mode 100644 index 000000000000..60011c4efa0e --- /dev/null +++ b/layout/reftests/svg/pattern-live-01b.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + diff --git a/layout/reftests/svg/pattern-live-01c.svg b/layout/reftests/svg/pattern-live-01c.svg new file mode 100644 index 000000000000..46c421b9292e --- /dev/null +++ b/layout/reftests/svg/pattern-live-01c.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + diff --git a/layout/reftests/svg/reftest.list b/layout/reftests/svg/reftest.list index aa14f61600e6..e8e39f350c00 100644 --- a/layout/reftests/svg/reftest.list +++ b/layout/reftests/svg/reftest.list @@ -73,6 +73,10 @@ include moz-only/reftest.list == foreignObject-move-repaint-01.svg pass.svg == foreignObject-overflow-01.svg pass.svg == getElementById-a-element-01.svg pass.svg +== gradient-live-01a.svg gradient-live-01-ref.svg +== gradient-live-01b.svg gradient-live-01-ref.svg +== gradient-live-01c.svg gradient-live-01-ref.svg +== gradient-live-01d.svg gradient-live-01-ref.svg fails == inline-in-xul-basic-01.xul pass.svg == image-scaling-01.svg pass.svg == image-scaling-02.svg pass.svg @@ -93,6 +97,9 @@ fails == inline-in-xul-basic-01.xul pass.svg # See bugs 379610 and 432298. random-if(MOZ_WIDGET_TOOLKIT=="cocoa") == opacity-and-gradient-01.svg pass.svg == opacity-and-pattern-01.svg pass.svg +== pattern-live-01a.svg pattern-live-01-ref.svg +== pattern-live-01b.svg pattern-live-01-ref.svg +== pattern-live-01c.svg pattern-live-01-ref.svg == pseudo-classes-01.svg pass.svg == pseudo-classes-02.svg pseudo-classes-02-ref.svg == radialGradient-basic-01.svg pass.svg