From 57633e799d86f65e00f3253152d19ce5f95dfb71 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Mon, 3 Mar 2014 18:39:22 -0500 Subject: [PATCH 01/34] Bug 973192 - Work around nouveau driver bug: do nothing in MOZ_gdk_display_close - r=karlt --- toolkit/xre/nsAppRunner.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index aab992d97fc..81423f2e3f6 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -2583,6 +2583,7 @@ static PRFuncPtr FindFunction(const char* aName) static void MOZ_gdk_display_close(GdkDisplay *display) { +#if CLEANUP_MEMORY // XXX wallpaper for bug 417163: don't close the Display if we're using the // Qt theme because we crash (in Qt code) when using jemalloc. bool theme_is_qt = false; @@ -2597,12 +2598,10 @@ static void MOZ_gdk_display_close(GdkDisplay *display) g_free(theme_name); } -#if CLEANUP_MEMORY // Get a (new) Pango context that holds a reference to the fontmap that // GTK has been using. gdk_pango_context_get() must be called while GTK // has a default display. PangoContext *pangoContext = gdk_pango_context_get(); -#endif bool buggyCairoShutdown = cairo_version() < CAIRO_VERSION_ENCODE(1, 4, 0); @@ -2615,7 +2614,6 @@ static void MOZ_gdk_display_close(GdkDisplay *display) gdk_display_close(display); } -#if CLEANUP_MEMORY // Clean up PangoCairo's default fontmap. // This pango_fc_font_map_shutdown call (and the associated code to // get the font map) really shouldn't be needed anymore, except that @@ -2647,12 +2645,16 @@ static void MOZ_gdk_display_close(GdkDisplay *display) cairo_debug_reset_static_data(); // FIXME: Do we need to call this in non-GTK2 cases as well? FcFini(); -#endif // CLEANUP_MEMORY if (buggyCairoShutdown) { if (!theme_is_qt) gdk_display_close(display); } +#else // not CLEANUP_MEMORY + // Don't do anything to avoid running into driver bugs under XCloseDisplay(). + // See bug 973192. + (void) display; +#endif } #endif // MOZ_WIDGET_GTK2 From 63ccdb1f51d38e44a0efd171d20693a9bb7f045b Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 3 Mar 2014 17:23:13 -0800 Subject: [PATCH 02/34] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/6bddd383012e Author: Marcus Cavanaugh Desc: Merge pull request #16582 from mcav/perfmark Bug 837670 - [Clock] "ready to use" perf measurement. r=jugglinmike ======== https://hg.mozilla.org/integration/gaia-central/rev/687699b043d2 Author: Marcus Cavanaugh Desc: Bug 837670 - [Clock] "ready to use" perf measurement. r=jugglinmike ======== https://hg.mozilla.org/integration/gaia-central/rev/5b1b283beeb1 Author: Marcus Cavanaugh Desc: Merge pull request #16630 from mcav/dumb-l10n-gmail Bug 975654 - [B2G][l10n][Email] Disabling IMAP on a Gmail account expose... ======== https://hg.mozilla.org/integration/gaia-central/rev/c9f9392bd474 Author: Marcus Cavanaugh Desc: Bug 975654 - [B2G][l10n][Email] Disabling IMAP on a Gmail account exposes user to old UI which is globally not translated. r=asuth --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 14d54a81344..b55c59c946e 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "branch": "", "revision": "" }, - "revision": "ac8b988b122a95d657c730dcdfabbebf03385b43", + "revision": "6bddd383012eee5fda3b8372773a7fd0ac66979a", "repo_path": "/integration/gaia-central" } From d4bb7d970246ffe1ff0149f726e48b3e58857a82 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 3 Mar 2014 17:23:22 -0800 Subject: [PATCH 03/34] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 30 ++++++++++++++++++++++++++++- b2g/config/emulator-jb/sources.xml | 26 ++++++++++++++++++++++++- b2g/config/emulator/sources.xml | 30 ++++++++++++++++++++++++++++- b2g/config/hamachi/sources.xml | 26 ++++++++++++++++++++++++- b2g/config/helix/sources.xml | 22 ++++++++++++++++++++- b2g/config/inari/sources.xml | 30 ++++++++++++++++++++++++++++- b2g/config/leo/sources.xml | 26 ++++++++++++++++++++++++- b2g/config/mako/sources.xml | 26 ++++++++++++++++++++++++- b2g/config/wasabi/sources.xml | 26 ++++++++++++++++++++++++- 9 files changed, 233 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 776b52a17f5..1af5d080c00 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -1,17 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -19,7 +47,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 0c15332adb6..5d4509a5ea0 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -1,15 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -17,7 +41,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 776b52a17f5..1af5d080c00 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -1,17 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -19,7 +47,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index c7134fae040..78a69d42d73 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -1,15 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -17,7 +41,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index a713db5988a..b1209ae8dc3 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -1,13 +1,33 @@ + + + + + + + + + + + + + + + + + + + + @@ -15,7 +35,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index 1da8c3968b0..ea3d8a34b5e 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -1,17 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -19,7 +47,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index 550722d34d4..b76c534f9f7 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -1,15 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -17,7 +41,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index 68e1dd8af65..f95937dbb01 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -1,15 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -17,7 +41,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 6aaadaeaad0..d7410a48f1a 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -1,15 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -17,7 +41,7 @@ - + From 5ff9aed4b5ddf7fbd61f49abd10ec7dc1d76ef8d Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 3 Mar 2014 17:26:22 -0800 Subject: [PATCH 04/34] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 28 ---------------------------- b2g/config/emulator-jb/sources.xml | 24 ------------------------ b2g/config/emulator/sources.xml | 28 ---------------------------- b2g/config/hamachi/sources.xml | 24 ------------------------ b2g/config/helix/sources.xml | 20 -------------------- b2g/config/inari/sources.xml | 28 ---------------------------- b2g/config/leo/sources.xml | 24 ------------------------ b2g/config/mako/sources.xml | 24 ------------------------ b2g/config/wasabi/sources.xml | 24 ------------------------ 9 files changed, 224 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 1af5d080c00..002f75f7103 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -1,45 +1,17 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 5d4509a5ea0..843ea70974e 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -1,39 +1,15 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 1af5d080c00..002f75f7103 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -1,45 +1,17 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 78a69d42d73..f73eb669a72 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -1,39 +1,15 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index b1209ae8dc3..fa600813254 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -1,33 +1,13 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index ea3d8a34b5e..9c2d5c6ef9e 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -1,45 +1,17 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index b76c534f9f7..0f128d9aa66 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -1,39 +1,15 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index f95937dbb01..2581c7003d7 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -1,39 +1,15 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index d7410a48f1a..a40d89a62db 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -1,39 +1,15 @@ - - - - - - - - - - - - - - - - - - - - - - - - From 97ffbf115b3dcbbb9eec02957eb724c71fa6beea Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Tue, 4 Mar 2014 10:34:27 +0900 Subject: [PATCH 05/34] Bug 962140 When PeekMessage() fails to remove found char message, just ignore it (not to dispatch keyprese event) r=jimm --- widget/windows/KeyboardLayout.cpp | 64 ++++++++++++++++++++----------- widget/windows/KeyboardLayout.h | 9 +++++ 2 files changed, 51 insertions(+), 22 deletions(-) diff --git a/widget/windows/KeyboardLayout.cpp b/widget/windows/KeyboardLayout.cpp index 16f8c31a36c..54e7f5bb3e8 100644 --- a/widget/windows/KeyboardLayout.cpp +++ b/widget/windows/KeyboardLayout.cpp @@ -1070,6 +1070,13 @@ NativeKey::HandleKeyDownMessage(bool* aEventDispatched) const MSG followingCharMsg; if (GetFollowingCharMessage(followingCharMsg)) { + // Even if there was char message, it might be redirected by different + // window (perhaps, focus move?). Then, we shouldn't continue to handle + // the message since no input should occur on the window. + if (followingCharMsg.message == WM_NULL || + followingCharMsg.hwnd != mMsg.hwnd) { + return false; + } return DispatchKeyPressEventForFollowingCharMessage(followingCharMsg); } @@ -1344,41 +1351,55 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg) const // the message range. So, if it returns WM_NULL, we should retry to get // the following char message it was found above. for (uint32_t i = 0; i < 5; i++) { + static const LPARAM kScanCodeMask = 0x00FF0000; + MSG removedMsg; - if (!WinUtils::PeekMessage(&removedMsg, nextKeyMsg.hwnd, + if (!WinUtils::PeekMessage(&removedMsg, mMsg.hwnd, nextKeyMsg.message, nextKeyMsg.message, PM_REMOVE | PM_NOYIELD)) { + MSG nextKeyMsgInAllWindows; + // The char message is redirected to different thread's window by focus + // move or something or just cancelled by external application. + if (!WinUtils::PeekMessage(&nextKeyMsgInAllWindows, 0, + WM_KEYFIRST, WM_KEYLAST, + PM_NOREMOVE | PM_NOYIELD)) { + return true; + } + // The char message is redirected to different window created by our + // thread. + if (nextKeyMsgInAllWindows.message == nextKeyMsg.message && + nextKeyMsgInAllWindows.wParam == nextKeyMsg.wParam && + (nextKeyMsgInAllWindows.lParam & ~kScanCodeMask) == + (nextKeyMsg.lParam & ~kScanCodeMask) && + nextKeyMsgInAllWindows.hwnd != mMsg.hwnd) { + aCharMsg = nextKeyMsgInAllWindows; + return true; + } + // Otherwise, perhaps, we meet a PeekMessage()'s bug. Let's crash and + // collect the detail. #ifdef MOZ_CRASHREPORTER nsPrintfCString info("\nHandling message: %s (0x%08X), wParam: 0x%08X, " "lParam: 0x%08X, hwnd=0x%p, InSendMessageEx()=%s, \n" "Found message: %s (0x%08X), wParam: 0x%08X, " - "lParam: 0x%08X, \nWM_NULL has been removed: %d, ", + "lParam: 0x%08X, hwnd=0x%p, " + "\nWM_NULL has been removed: %d, " + "\nNext key message in all windows: %s (0x%08X), " + "wParam: 0x%08X, lParam: 0x%08X, hwnd=0x%p, " + "time=%d, ", GetMessageName(mMsg.message), mMsg.message, mMsg.wParam, mMsg.lParam, nextKeyMsg.hwnd, GetResultOfInSendMessageEx().get(), GetMessageName(nextKeyMsg.message), nextKeyMsg.message, nextKeyMsg.wParam, - nextKeyMsg.lParam, i); + nextKeyMsg.lParam, nextKeyMsg.hwnd, i, + GetMessageName(nextKeyMsgInAllWindows.message), + nextKeyMsgInAllWindows.message, + nextKeyMsgInAllWindows.wParam, + nextKeyMsgInAllWindows.lParam, + nextKeyMsgInAllWindows.hwnd, + nextKeyMsgInAllWindows.time); CrashReporter::AppendAppNotesToCrashReport(info); - MSG nextKeyMsgInAllWindows; - if (WinUtils::PeekMessage(&nextKeyMsgInAllWindows, 0, - WM_KEYFIRST, WM_KEYLAST, - PM_NOREMOVE | PM_NOYIELD)) { - nsPrintfCString info("\nNext key message in all windows: %s (0x%08X), " - "wParam: 0x%08X, lParam: 0x%08X, hwnd=0x%p, " - "time=%d, ", - GetMessageName(nextKeyMsgInAllWindows.message), - nextKeyMsgInAllWindows.message, - nextKeyMsgInAllWindows.wParam, - nextKeyMsgInAllWindows.lParam, - nextKeyMsgInAllWindows.hwnd, - nextKeyMsgInAllWindows.time); - CrashReporter::AppendAppNotesToCrashReport(info); - } else { - CrashReporter::AppendAppNotesToCrashReport( - NS_LITERAL_CSTRING("\nThere is no key message in any window, ")); - } MSG nextMsg; if (WinUtils::PeekMessage(&nextMsg, 0, 0, 0, PM_NOREMOVE | PM_NOYIELD)) { @@ -1405,7 +1426,6 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg) const // NOTE: Although, we don't know when this case occurs, the scan code value // in lParam may be changed from 0 to something. The changed value // is different from the scan code of handling keydown message. - static const LPARAM kScanCodeMask = 0x00FF0000; if (removedMsg.message != nextKeyMsg.message || removedMsg.wParam != nextKeyMsg.wParam || (removedMsg.lParam & ~kScanCodeMask) != diff --git a/widget/windows/KeyboardLayout.h b/widget/windows/KeyboardLayout.h index 50b2fb97a19..31b9594fef6 100644 --- a/widget/windows/KeyboardLayout.h +++ b/widget/windows/KeyboardLayout.h @@ -369,6 +369,15 @@ private: return (aMessage == WM_SYSCHAR || aMessage == WM_SYSDEADCHAR); } bool IsFollowedByDeadCharMessage() const; + + /** + * GetFollowingCharMessage() returns following char message of handling + * keydown event. If the message is found, this method returns true. + * Otherwise, returns false. + * + * WARNING: Even if this returns true, aCharMsg may be WM_NULL or its + * hwnd may be different window. + */ bool GetFollowingCharMessage(MSG& aCharMsg) const; /** From daca2d2104f12b2394e6075fa8280569139cadf1 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Mon, 3 Mar 2014 20:51:27 -0500 Subject: [PATCH 06/34] Bug 978995 - Stop exporting symbols from xpconnect; r=bholley --- js/xpconnect/src/BackstagePass.h | 2 +- js/xpconnect/src/XPCJSRuntime.cpp | 2 +- js/xpconnect/src/XPCLocale.cpp | 4 ++-- js/xpconnect/src/XPCShellImpl.cpp | 2 +- js/xpconnect/src/nsCxPusher.cpp | 8 ++------ js/xpconnect/src/nsCxPusher.h | 14 +++----------- js/xpconnect/src/nsXPConnect.cpp | 13 +++---------- js/xpconnect/src/xpcprivate.h | 4 ++-- js/xpconnect/src/xpcpublic.h | 16 ++++------------ 9 files changed, 19 insertions(+), 46 deletions(-) diff --git a/js/xpconnect/src/BackstagePass.h b/js/xpconnect/src/BackstagePass.h index 692fc2cef9b..7106a96ec33 100644 --- a/js/xpconnect/src/BackstagePass.h +++ b/js/xpconnect/src/BackstagePass.h @@ -53,7 +53,7 @@ private: JS::TenuredHeap mGlobal; }; -NS_EXPORT nsresult +nsresult NS_NewBackstagePass(BackstagePass** ret); #endif // BackstagePass_h__ diff --git a/js/xpconnect/src/XPCJSRuntime.cpp b/js/xpconnect/src/XPCJSRuntime.cpp index c32b305dee4..6060c34b8be 100644 --- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -1304,7 +1304,7 @@ XPCJSRuntime::GetWatchdogTimestamp(WatchdogTimestampCategory aCategory) return mWatchdogManager->GetTimestamp(aCategory); } -NS_EXPORT_(void) +void xpc::SimulateActivityCallback(bool aActive) { XPCJSRuntime::ActivityCallback(XPCJSRuntime::Get(), aActive); diff --git a/js/xpconnect/src/XPCLocale.cpp b/js/xpconnect/src/XPCLocale.cpp index 6bb3527ce7b..b66ba210629 100644 --- a/js/xpconnect/src/XPCLocale.cpp +++ b/js/xpconnect/src/XPCLocale.cpp @@ -249,7 +249,7 @@ private: #endif }; -NS_EXPORT_(bool) +bool xpc_LocalizeRuntime(JSRuntime *rt) { JS_SetLocaleCallbacks(rt, new XPCLocaleCallbacks()); @@ -273,7 +273,7 @@ xpc_LocalizeRuntime(JSRuntime *rt) return !!JS_SetDefaultLocale(rt, locale.get()); } -NS_EXPORT_(void) +void xpc_DelocalizeRuntime(JSRuntime *rt) { XPCLocaleCallbacks* lc = XPCLocaleCallbacks::This(rt); diff --git a/js/xpconnect/src/XPCShellImpl.cpp b/js/xpconnect/src/XPCShellImpl.cpp index ef9e2c05379..f3059bbfde0 100644 --- a/js/xpconnect/src/XPCShellImpl.cpp +++ b/js/xpconnect/src/XPCShellImpl.cpp @@ -1282,7 +1282,7 @@ XPCShellErrorReporter(JSContext *cx, const char *message, JSErrorReport *rep) gExitCode = EXITCODE_RUNTIME_ERROR; // Delegate to the system error reporter for heavy lifting. - xpc::SystemErrorReporterExternal(cx, message, rep); + xpc::SystemErrorReporter(cx, message, rep); } static bool diff --git a/js/xpconnect/src/nsCxPusher.cpp b/js/xpconnect/src/nsCxPusher.cpp index f24a0006640..15388993141 100644 --- a/js/xpconnect/src/nsCxPusher.cpp +++ b/js/xpconnect/src/nsCxPusher.cpp @@ -15,9 +15,6 @@ using mozilla::dom::EventTarget; using mozilla::DebugOnly; -NS_EXPORT -nsCxPusher::~nsCxPusher() {} - bool nsCxPusher::Push(EventTarget *aCurrentTarget) { @@ -78,7 +75,7 @@ nsCxPusher::RePush(EventTarget *aCurrentTarget) return Push(aCurrentTarget); } -NS_EXPORT_(void) +void nsCxPusher::Push(JSContext *cx) { mPusher.construct(cx); @@ -92,7 +89,7 @@ nsCxPusher::PushNull() mPusher.construct(static_cast(nullptr), /* aAllowNull = */ true); } -NS_EXPORT_(void) +void nsCxPusher::Pop() { if (!mPusher.empty()) @@ -135,7 +132,6 @@ AutoCxPusher::AutoCxPusher(JSContext* cx, bool allowNull) } } -NS_EXPORT AutoCxPusher::~AutoCxPusher() { // GC when we pop a script entry point. This is a useful heuristic that helps diff --git a/js/xpconnect/src/nsCxPusher.h b/js/xpconnect/src/nsCxPusher.h index a9a0fa64fd2..a01e12e2f63 100644 --- a/js/xpconnect/src/nsCxPusher.h +++ b/js/xpconnect/src/nsCxPusher.h @@ -27,7 +27,7 @@ class MOZ_STACK_CLASS AutoCxPusher public: AutoCxPusher(JSContext *aCx, bool aAllowNull = false); // XPCShell uses an nsCxPusher, which contains an AutoCxPusher. - NS_EXPORT ~AutoCxPusher(); + ~AutoCxPusher(); nsIScriptContext* GetScriptContext() { return mScx; } @@ -63,14 +63,6 @@ private: class MOZ_STACK_CLASS nsCxPusher { public: - // This destructor doesn't actually do anything, but it implicitly depends on - // the Maybe destructor, which in turn depends on the - // ~AutoCxPusher destructor. If we stick with the default destructor, the - // caller needs to be able to link against the AutoCxPusher destructor, which - // isn't possible with externally-linked consumers like xpcshell. Hoist this - // work into nsCxPusher.cpp and use NS_EXPORT to make it all work right. - NS_EXPORT ~nsCxPusher(); - // Returns false if something erroneous happened. bool Push(mozilla::dom::EventTarget *aCurrentTarget); // If nothing has been pushed to stack, this works like Push. @@ -78,12 +70,12 @@ public: bool RePush(mozilla::dom::EventTarget *aCurrentTarget); // If a null JSContext is passed to Push(), that will cause no // push to happen and false to be returned. - NS_EXPORT_(void) Push(JSContext *cx); + void Push(JSContext *cx); // Explicitly push a null JSContext on the the stack void PushNull(); // Pop() will be a no-op if Push() or PushNull() fail - NS_EXPORT_(void) Pop(); + void Pop(); nsIScriptContext* GetCurrentScriptContext() { return mPusher.empty() ? nullptr : mPusher.ref().GetScriptContext(); diff --git a/js/xpconnect/src/nsXPConnect.cpp b/js/xpconnect/src/nsXPConnect.cpp index 2db0bf58638..4f1d5a131c9 100644 --- a/js/xpconnect/src/nsXPConnect.cpp +++ b/js/xpconnect/src/nsXPConnect.cpp @@ -233,13 +233,6 @@ xpc::SystemErrorReporter(JSContext *cx, const char *message, JSErrorReport *rep) } -NS_EXPORT_(void) -xpc::SystemErrorReporterExternal(JSContext *cx, const char *message, - JSErrorReport *rep) -{ - return SystemErrorReporter(cx, message, rep); -} - /***************************************************************************/ @@ -1221,7 +1214,7 @@ nsXPConnect::CheckForDebugMode(JSRuntime *rt) #endif //#ifdef MOZ_JSDEBUGGER -NS_EXPORT_(void) +void xpc_ActivateDebugMode() { XPCJSRuntime* rt = nsXPConnect::GetRuntimeInstance(); @@ -1310,7 +1303,7 @@ nsXPConnect::HoldObject(JSContext *aJSContext, JSObject *aObjectArg, namespace xpc { -NS_EXPORT_(bool) +bool Base64Encode(JSContext *cx, HandleValue val, MutableHandleValue out) { MOZ_ASSERT(cx); @@ -1336,7 +1329,7 @@ Base64Encode(JSContext *cx, HandleValue val, MutableHandleValue out) return true; } -NS_EXPORT_(bool) +bool Base64Decode(JSContext *cx, HandleValue val, MutableHandleValue out) { MOZ_ASSERT(cx); diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h index 741f699d334..6d9dda89a02 100644 --- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -3620,9 +3620,9 @@ DefineStaticJSVals(JSContext *cx); } // namespace dom } // namespace mozilla -NS_EXPORT_(bool) +bool xpc_LocalizeRuntime(JSRuntime *rt); -NS_EXPORT_(void) +void xpc_DelocalizeRuntime(JSRuntime *rt); /***************************************************************************/ diff --git a/js/xpconnect/src/xpcpublic.h b/js/xpconnect/src/xpcpublic.h index 63ba9cd6de2..3b94f226bd1 100644 --- a/js/xpconnect/src/xpcpublic.h +++ b/js/xpconnect/src/xpcpublic.h @@ -173,7 +173,7 @@ xpc_UnmarkSkippableJSHolders(); // No JS can be on the stack when this is called. Probably only useful from // xpcshell. -NS_EXPORT_(void) +void xpc_ActivateDebugMode(); // readable string conversions, static methods and members only @@ -259,8 +259,8 @@ private: namespace xpc { // If these functions return false, then an exception will be set on cx. -NS_EXPORT_(bool) Base64Encode(JSContext *cx, JS::HandleValue val, JS::MutableHandleValue out); -NS_EXPORT_(bool) Base64Decode(JSContext *cx, JS::HandleValue val, JS::MutableHandleValue out); +bool Base64Encode(JSContext *cx, JS::HandleValue val, JS::MutableHandleValue out); +bool Base64Decode(JSContext *cx, JS::HandleValue val, JS::MutableHandleValue out); /** * Convert an nsString to jsval, returning true on success. @@ -427,15 +427,7 @@ WindowGlobalOrNull(JSObject *aObj); void SystemErrorReporter(JSContext *cx, const char *message, JSErrorReport *rep); -// We have a separate version that's exported with external linkage for use by -// xpcshell, since external linkage on windows changes the signature to make it -// incompatible with the JSErrorReporter type, causing JS_SetErrorReporter calls -// to fail to compile. -NS_EXPORT_(void) -SystemErrorReporterExternal(JSContext *cx, const char *message, - JSErrorReport *rep); - -NS_EXPORT_(void) +void SimulateActivityCallback(bool aActive); void From b703b39b447d7a6d91057d64ca984b8ddd1c54d5 Mon Sep 17 00:00:00 2001 From: Shu-yu Guo Date: Mon, 3 Mar 2014 18:12:05 -0800 Subject: [PATCH 07/34] Bug 979056 - Refactor readFrameArgs in Ion frame iterators. (r=jandem) --- js/src/jit/IonFrameIterator.h | 136 +++++++++++++++++++++------------- js/src/jit/IonFrames.cpp | 2 +- js/src/jsfun.cpp | 5 +- js/src/vm/Stack-inl.h | 4 +- 4 files changed, 92 insertions(+), 55 deletions(-) diff --git a/js/src/jit/IonFrameIterator.h b/js/src/jit/IonFrameIterator.h index a34e7a2e0ba..653a70c1f58 100644 --- a/js/src/jit/IonFrameIterator.h +++ b/js/src/jit/IonFrameIterator.h @@ -9,6 +9,7 @@ #ifdef JS_ION +#include "jsfun.h" #include "jsscript.h" #include "jstypes.h" @@ -66,6 +67,17 @@ enum FrameType IonFrame_Osr }; +enum ReadFrameArgsBehavior { + // Only read formals (i.e. [0 ... callee()->nargs] + ReadFrame_Formals, + + // Only read overflown args (i.e. [callee()->nargs ... numActuals()] + ReadFrame_Overflown, + + // Read all args (i.e. [0 ... numActuals()]) + ReadFrame_Actuals +}; + class IonCommonFrameLayout; class IonJSFrameLayout; class IonExitFrameLayout; @@ -205,15 +217,24 @@ class IonFrameIterator MachineState machineState() const; template - void forEachCanonicalActualArg(Op op, unsigned start, unsigned count) const { + void forEachCanonicalActualArg(Op op, ReadFrameArgsBehavior behavior) const { JS_ASSERT(isBaselineJS()); unsigned nactual = numActualArgs(); - if (count == unsigned(-1)) - count = nactual - start; - - unsigned end = start + count; - JS_ASSERT(start <= end && end <= nactual); + unsigned start, end; + switch (behavior) { + case ReadFrame_Formals: + start = 0; + end = callee()->nargs(); + break; + case ReadFrame_Overflown: + start = callee()->nargs(); + end = nactual; + break; + case ReadFrame_Actuals: + start = 0; + end = nactual; + } Value *argv = actualArgs(); for (unsigned i = start; i < end; i++) @@ -273,8 +294,8 @@ class SnapshotIterator : public SnapshotReader } template - void readFrameArgs(Op &op, const Value *argv, Value *scopeChain, Value *thisv, - unsigned start, unsigned formalEnd, unsigned iterEnd, JSScript *script) + void readFrameArgs(Op &op, Value *scopeChain, Value *thisv, + unsigned start, unsigned end, JSScript *script) { if (scopeChain) *scopeChain = read(); @@ -294,22 +315,18 @@ class SnapshotIterator : public SnapshotReader skip(); unsigned i = 0; - if (formalEnd < start) + if (end < start) i = start; for (; i < start; i++) skip(); - for (; i < formalEnd && i < iterEnd; i++) { + for (; i < end; i++) { // We are not always able to read values from the snapshots, some values // such as non-gc things may still be live in registers and cause an // error while reading the machine state. Value v = maybeRead(); op(v); } - if (iterEnd >= formalEnd) { - for (; i < iterEnd; i++) - op(argv[i]); - } } Value maybeReadAllocByIndex(size_t index) { @@ -341,6 +358,10 @@ class InlineFrameIteratorMaybeGC jsbytecode *pc_; uint32_t numActualArgs_; + struct Nop { + void operator()(const Value &v) { } + }; + private: void findNextFrame(); @@ -399,50 +420,65 @@ class InlineFrameIteratorMaybeGC return frame_->numActualArgs(); } - template - void forEachCanonicalActualArg(JSContext *cx, Op op, unsigned start, unsigned count) const { + template + void readFrameArgsAndLocals(JSContext *cx, ArgOp &argOp, LocalOp &localOp, + Value *scopeChain, Value *thisv, + ReadFrameArgsBehavior behavior) const + { unsigned nactual = numActualArgs(); - if (count == unsigned(-1)) - count = nactual - start; - - unsigned end = start + count; unsigned nformal = callee()->nargs(); - JS_ASSERT(start <= end && end <= nactual); + // Get the non overflown arguments, which are taken from the inlined + // frame, because it will have the updated value when JSOP_SETARG is + // done. + SnapshotIterator s(si_); + if (behavior != ReadFrame_Overflown) + s.readFrameArgs(argOp, scopeChain, thisv, 0, nformal, script()); - if (more()) { - // There is still a parent frame of this inlined frame. - // The not overflown arguments are taken from the inlined frame, - // because it will have the updated value when JSOP_SETARG is done. - // All arguments (also the overflown) are the last pushed values in the parent frame. - // To get the overflown arguments, we need to take them from there. + if (behavior != ReadFrame_Formals) { + if (more()) { + // There is still a parent frame of this inlined frame. All + // arguments (also the overflown) are the last pushed values + // in the parent frame. To get the overflown arguments, we + // need to take them from there. - // Get the non overflown arguments - unsigned formal_end = (end < nformal) ? end : nformal; - SnapshotIterator s(si_); - s.readFrameArgs(op, nullptr, nullptr, nullptr, start, nformal, formal_end, script()); + // The overflown arguments are not available in current frame. + // They are the last pushed arguments in the parent frame of + // this inlined frame. + InlineFrameIteratorMaybeGC it(cx, this); + ++it; + unsigned argsObjAdj = it.script()->argumentsHasVarBinding() ? 1 : 0; + SnapshotIterator parent_s(it.snapshotIterator()); - // The overflown arguments are not available in current frame. - // They are the last pushed arguments in the parent frame of this inlined frame. - InlineFrameIteratorMaybeGC it(cx, this); - ++it; - unsigned argsObjAdj = it.script()->argumentsHasVarBinding() ? 1 : 0; - SnapshotIterator parent_s(it.snapshotIterator()); + // Skip over all slots until we get to the last slots + // (= arguments slots of callee) the +3 is for [this], [returnvalue], + // [scopechain], and maybe +1 for [argsObj] + JS_ASSERT(parent_s.allocations() >= nactual + 3 + argsObjAdj); + unsigned skip = parent_s.allocations() - nactual - 3 - argsObjAdj; + for (unsigned j = 0; j < skip; j++) + parent_s.skip(); - // Skip over all slots untill we get to the last slots (= arguments slots of callee) - // the +3 is for [this], [returnvalue], [scopechain], and maybe +1 for [argsObj] - JS_ASSERT(parent_s.allocations() >= nactual + 3 + argsObjAdj); - unsigned skip = parent_s.allocations() - nactual - 3 - argsObjAdj; - for (unsigned j = 0; j < skip; j++) - parent_s.skip(); - - // Get the overflown arguments - parent_s.readFrameArgs(op, nullptr, nullptr, nullptr, nformal, nactual, end, it.script()); - } else { - SnapshotIterator s(si_); - Value *argv = frame_->actualArgs(); - s.readFrameArgs(op, argv, nullptr, nullptr, start, nformal, end, script()); + // Get the overflown arguments + parent_s.readFrameArgs(argOp, nullptr, nullptr, nformal, nactual, it.script()); + } else { + // There is no parent frame to this inlined frame, we can read + // from the frame's Value vector directly. + Value *argv = frame_->actualArgs(); + for (unsigned i = nformal; i < nactual; i++) + argOp(argv[i]); + } } + + // At this point we've read all the formals in s, and can read the + // locals. + for (unsigned i = 0; i < script()->nfixed(); i++) + localOp(s.read()); + } + + template + void forEachCanonicalActualArg(JSContext *cx, Op op, ReadFrameArgsBehavior behavior) const { + Nop nop; + readFrameArgsAndLocals(cx, op, nop, nullptr, nullptr, behavior); } JSScript *script() const { diff --git a/js/src/jit/IonFrames.cpp b/js/src/jit/IonFrames.cpp index 8644bccb529..1fce1635c04 100644 --- a/js/src/jit/IonFrames.cpp +++ b/js/src/jit/IonFrames.cpp @@ -1829,7 +1829,7 @@ InlineFrameIteratorMaybeGC::dump() const else { if (i - 2 == callee()->nargs() && numActualArgs() > callee()->nargs()) { DumpOp d(callee()->nargs()); - forEachCanonicalActualArg(GetJSContextFromJitCode(), d, d.i_, numActualArgs() - d.i_); + forEachCanonicalActualArg(GetJSContextFromJitCode(), d, ReadFrame_Overflown); } fprintf(stderr, " slot %d: ", int(i - 2 - callee()->nargs())); diff --git a/js/src/jsfun.cpp b/js/src/jsfun.cpp index dcff6b8d5cd..bd3dd3f1e32 100644 --- a/js/src/jsfun.cpp +++ b/js/src/jsfun.cpp @@ -966,7 +966,7 @@ PushBaselineFunApplyArguments(JSContext *cx, jit::IonFrameIterator &frame, Invok args.setThis(vp[2]); /* Steps 7-8. */ - frame.forEachCanonicalActualArg(CopyTo(args.array()), 0, -1); + frame.forEachCanonicalActualArg(CopyTo(args.array()), jit::ReadFrame_Actuals); return true; } #endif @@ -1024,7 +1024,8 @@ js_fun_apply(JSContext *cx, unsigned argc, Value *vp) args.setThis(vp[2]); /* Steps 7-8. */ - iter.forEachCanonicalActualArg(cx, CopyTo(args.array()), 0, -1); + iter.forEachCanonicalActualArg(cx, CopyTo(args.array()), + jit::ReadFrame_Actuals); } else { JS_ASSERT(frame.isBaselineStub()); diff --git a/js/src/vm/Stack-inl.h b/js/src/vm/Stack-inl.h index 5b0f6c0ea8e..cac4a8362b9 100644 --- a/js/src/vm/Stack-inl.h +++ b/js/src/vm/Stack-inl.h @@ -330,10 +330,10 @@ ScriptFrameIter::ionForEachCanonicalActualArg(JSContext *cx, Op op) JS_ASSERT(isJit()); #ifdef JS_ION if (data_.ionFrames_.isOptimizedJS()) { - ionInlineFrames_.forEachCanonicalActualArg(cx, op, 0, -1); + ionInlineFrames_.forEachCanonicalActualArg(cx, op, jit::ReadFrame_Actuals); } else { JS_ASSERT(data_.ionFrames_.isBaselineJS()); - data_.ionFrames_.forEachCanonicalActualArg(op, 0, -1); + data_.ionFrames_.forEachCanonicalActualArg(op, jit::ReadFrame_Actuals); } #endif } From 7b61c2cf521933f4ff514cd28c8f79d807efca90 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 3 Mar 2014 18:15:28 -0800 Subject: [PATCH 08/34] Bumping gaia.json for 5 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/020bf0df084e Author: Kyle Machulis Desc: Merge pull request #16755 from qdot/978364-fix-ftu-tests 978364 fix ftu tests ======== https://hg.mozilla.org/integration/gaia-central/rev/bb11e2a9fb86 Author: Kyle Machulis Desc: Bug 978364 - Move FTU Tests to correct filename scheme ======== https://hg.mozilla.org/integration/gaia-central/rev/20c00f5bf6c3 Author: Kyle Machulis Desc: Bug 978364 - Fix missing helper call in FTU integration tests ======== https://hg.mozilla.org/integration/gaia-central/rev/d021424e69bf Author: Jan Keromnes Desc: Merge pull request #16748 from jankeromnes/target Bug 978058 - Make Firefox OS' devtools track frames instead of manifests. r=21 ======== https://hg.mozilla.org/integration/gaia-central/rev/ae27845e0f86 Author: Jan Keromnes Desc: Bug 978058 - Make Firefox OS' devtools track frames instead of app manifests. r=vingtetun --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index b55c59c946e..5b75040b65c 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "branch": "", "revision": "" }, - "revision": "6bddd383012eee5fda3b8372773a7fd0ac66979a", + "revision": "020bf0df084e3e80e51f9dfd5fdeef2e8ab90452", "repo_path": "/integration/gaia-central" } From 4afed33e98fa693e8c501e131a1e276420f8541a Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 3 Mar 2014 18:16:13 -0800 Subject: [PATCH 09/34] Bug 977496 - Make Array.join more efficient when the array has length 1. r=luke. --HG-- extra : rebase_source : 53741b382e8f4bc122ecea4bd99357129a877140 --- js/src/jsarray.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/js/src/jsarray.cpp b/js/src/jsarray.cpp index 529c388c5e1..20d1abe2946 100644 --- a/js/src/jsarray.cpp +++ b/js/src/jsarray.cpp @@ -1094,7 +1094,20 @@ ArrayJoin(JSContext *cx, CallArgs &args) JS::Anchor anchor(sepstr); - // Step 6 is implicit in the loops below + // Step 6 is implicit in the loops below. + + // An optimized version of a special case of steps 7-11: when length==1 and + // the 0th element is a string, ToString() of that element is a no-op and + // so it can be immediately returned as the result. + if (length == 1 && !Locale && obj->is() && + obj->getDenseInitializedLength() == 1) + { + const Value &elem0 = obj->getDenseElement(0); + if (elem0.isString()) { + args.rval().setString(elem0.toString()); + return true; + } + } StringBuffer sb(cx); @@ -1103,7 +1116,7 @@ ArrayJoin(JSContext *cx, CallArgs &args) if (length > 0 && !sb.reserve(seplen * (length - 1))) return false; - // Various optimized versions of steps 7-10 + // Various optimized versions of steps 7-10. if (seplen == 0) { EmptySeparatorOp op; if (!ArrayJoinKernel(cx, op, obj, length, sb)) From 81bc5250a93166a1bd4df0fe684ead3e7fa42096 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Mon, 3 Mar 2014 18:16:45 -0800 Subject: [PATCH 10/34] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/inari/sources.xml | 2 +- b2g/config/leo/sources.xml | 2 +- b2g/config/mako/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 002f75f7103..44ce58e32bc 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 843ea70974e..41b4ed966db 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 002f75f7103..44ce58e32bc 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index f73eb669a72..77c1e8d986c 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index fa600813254..a4371c50579 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index 9c2d5c6ef9e..b326687790c 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index 0f128d9aa66..800c7349e11 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index 2581c7003d7..64b03e1f160 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index a40d89a62db..991911279e9 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 8a77f5f20539d8ab6df08446dbca08e27cda7a70 Mon Sep 17 00:00:00 2001 From: Terrence Cole Date: Mon, 3 Mar 2014 18:23:24 -0800 Subject: [PATCH 11/34] Bug 978226 - Don't leak the script's table when we OOM in LazyScript::CreateRaw; r=till --HG-- extra : rebase_source : d1a4d6c9cbe09a8956893f8810c75fdb2f8d7ccb --- js/src/jsscript.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/js/src/jsscript.cpp b/js/src/jsscript.cpp index 0ef846da198..929ff87d09b 100644 --- a/js/src/jsscript.cpp +++ b/js/src/jsscript.cpp @@ -36,6 +36,7 @@ #include "jit/BaselineJIT.h" #include "jit/IonCode.h" #include "js/OldDebugAPI.h" +#include "js/Utility.h" #include "vm/ArgumentsObject.h" #include "vm/Compression.h" #include "vm/Debugger.h" @@ -3582,12 +3583,9 @@ LazyScript::CreateRaw(ExclusiveContext *cx, HandleFunction fun, size_t bytes = (p.numFreeVariables * sizeof(HeapPtrAtom)) + (p.numInnerFunctions * sizeof(HeapPtrFunction)); - void *table = nullptr; - if (bytes) { - table = cx->malloc_(bytes); - if (!table) - return nullptr; - } + ScopedJSFreePtr table(bytes ? cx->malloc_(bytes) : nullptr); + if (bytes && !table) + return nullptr; LazyScript *res = js_NewGCLazyScript(cx); if (!res) @@ -3595,7 +3593,7 @@ LazyScript::CreateRaw(ExclusiveContext *cx, HandleFunction fun, cx->compartment()->scheduleDelazificationForDebugMode(); - return new (res) LazyScript(fun, table, packed, begin, end, lineno, column); + return new (res) LazyScript(fun, table.forget(), packed, begin, end, lineno, column); } /* static */ LazyScript * From c7e03b491d0e75a421b00585d7a92f8d690c6f47 Mon Sep 17 00:00:00 2001 From: Terrence Cole Date: Mon, 3 Mar 2014 18:23:26 -0800 Subject: [PATCH 12/34] Bug 976889 - Fix the check in CurrentThreadCanAccessRuntime; r=shu --HG-- extra : rebase_source : 1ad4f015458b617c6c4d52dda17feed158b66509 --- js/src/jit-test/tests/parallel/bug976889.js | 3 +++ js/src/vm/Runtime.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 js/src/jit-test/tests/parallel/bug976889.js diff --git a/js/src/jit-test/tests/parallel/bug976889.js b/js/src/jit-test/tests/parallel/bug976889.js new file mode 100644 index 00000000000..14c0d225dee --- /dev/null +++ b/js/src/jit-test/tests/parallel/bug976889.js @@ -0,0 +1,3 @@ +Array.buildPar(5, function() { + return [].t = encodeURI +}) diff --git a/js/src/vm/Runtime.cpp b/js/src/vm/Runtime.cpp index 22724d81731..c623e9437a0 100644 --- a/js/src/vm/Runtime.cpp +++ b/js/src/vm/Runtime.cpp @@ -870,7 +870,7 @@ JSRuntime::clearUsedByExclusiveThread(Zone *zone) bool js::CurrentThreadCanAccessRuntime(JSRuntime *rt) { - return rt->ownerThread_ == PR_GetCurrentThread() || InExclusiveParallelSection(); + return rt->ownerThread_ == PR_GetCurrentThread() && !InParallelSection(); } bool From e31b65559d5dc2bb5320cfaec053a2b33d604b1e Mon Sep 17 00:00:00 2001 From: Terrence Cole Date: Mon, 3 Mar 2014 18:26:24 -0800 Subject: [PATCH 13/34] Bug 945152 - Never allocate ArrayBuffers with unknown API contents in the nursery; r=sfink --HG-- extra : rebase_source : e1aee850668dd148fc85836a27864fe21fd82e69 --- js/src/vm/ArrayBufferObject.cpp | 11 ++++++++--- js/src/vm/ArrayBufferObject.h | 3 ++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/js/src/vm/ArrayBufferObject.cpp b/js/src/vm/ArrayBufferObject.cpp index b9d466a2633..cdf74994523 100644 --- a/js/src/vm/ArrayBufferObject.cpp +++ b/js/src/vm/ArrayBufferObject.cpp @@ -664,9 +664,10 @@ ArrayBufferObject::addView(ArrayBufferViewObject *view) } ArrayBufferObject * -ArrayBufferObject::create(JSContext *cx, uint32_t nbytes, bool clear /* = true */) +ArrayBufferObject::create(JSContext *cx, uint32_t nbytes, bool clear /* = true */, + NewObjectKind newKind /* = GenericObject */) { - Rooted obj(cx, NewBuiltinClassInstance(cx)); + Rooted obj(cx, NewBuiltinClassInstance(cx, newKind)); if (!obj) return nullptr; JS_ASSERT_IF(obj->isTenured(), obj->tenuredGetAllocKind() == gc::FINALIZE_OBJECT16_BACKGROUND); @@ -1350,7 +1351,11 @@ JS_PUBLIC_API(JSObject *) JS_NewArrayBufferWithContents(JSContext *cx, void *contents) { JS_ASSERT(contents); - JSObject *obj = ArrayBufferObject::create(cx, 0); + + // Do not allocate ArrayBuffers with an API-provided pointer in the nursery. + // These are likely to be long lived and the nursery does not know how to + // free the contents. + JSObject *obj = ArrayBufferObject::create(cx, 0, true, TenuredObject); if (!obj) return nullptr; js::ObjectElements *elements = reinterpret_cast(contents); diff --git a/js/src/vm/ArrayBufferObject.h b/js/src/vm/ArrayBufferObject.h index ee5b105d71d..0eb373f44b2 100644 --- a/js/src/vm/ArrayBufferObject.h +++ b/js/src/vm/ArrayBufferObject.h @@ -67,7 +67,8 @@ class ArrayBufferObject : public JSObject static bool class_constructor(JSContext *cx, unsigned argc, Value *vp); - static ArrayBufferObject *create(JSContext *cx, uint32_t nbytes, bool clear = true); + static ArrayBufferObject *create(JSContext *cx, uint32_t nbytes, bool clear = true, + NewObjectKind newKind = GenericObject); static JSObject *createSlice(JSContext *cx, Handle arrayBuffer, uint32_t begin, uint32_t end); From 87855800effd23ff3a373500c7c2b1994f410640 Mon Sep 17 00:00:00 2001 From: Matthew Gregan Date: Tue, 4 Mar 2014 15:31:57 +1300 Subject: [PATCH 14/34] Bug 962353 - Remove totalFrameDelay from VideoPlaybackQuality. r=chris.double It's not implemented by other vendors and marked as "at risk" in the spec. Easy to add back if there's real demand/a concrete spec. --- content/html/content/src/HTMLVideoElement.cpp | 4 +--- content/media/MediaDecoder.h | 17 ----------------- content/media/MediaDecoderStateMachine.cpp | 3 --- content/media/VideoPlaybackQuality.cpp | 4 +--- content/media/VideoPlaybackQuality.h | 8 +------- .../media/test/test_VideoPlaybackQuality.html | 3 --- dom/webidl/VideoPlaybackQuality.webidl | 2 +- 7 files changed, 4 insertions(+), 37 deletions(-) diff --git a/content/html/content/src/HTMLVideoElement.cpp b/content/html/content/src/HTMLVideoElement.cpp index 2a48392d323..93128e89f23 100644 --- a/content/html/content/src/HTMLVideoElement.cpp +++ b/content/html/content/src/HTMLVideoElement.cpp @@ -254,7 +254,6 @@ HTMLVideoElement::GetVideoPlaybackQuality() uint64_t totalFrames = 0; uint64_t droppedFrames = 0; uint64_t corruptedFrames = 0; - double totalFrameDelay = 0.0; if (sVideoStatsEnabled) { nsPIDOMWindow* window = OwnerDoc()->GetInnerWindow(); @@ -270,13 +269,12 @@ HTMLVideoElement::GetVideoPlaybackQuality() totalFrames = stats.GetParsedFrames(); droppedFrames = totalFrames - stats.GetPresentedFrames(); corruptedFrames = totalFrames - stats.GetDecodedFrames(); - totalFrameDelay = stats.GetTotalFrameDelay(); } } nsRefPtr playbackQuality = new VideoPlaybackQuality(this, creationTime, totalFrames, droppedFrames, - corruptedFrames, totalFrameDelay); + corruptedFrames); return playbackQuality.forget(); } diff --git a/content/media/MediaDecoder.h b/content/media/MediaDecoder.h index 99f85953f91..60d117f193a 100644 --- a/content/media/MediaDecoder.h +++ b/content/media/MediaDecoder.h @@ -893,7 +893,6 @@ public: FrameStatistics() : mReentrantMonitor("MediaDecoder::FrameStats"), - mTotalFrameDelay(0.0), mParsedFrames(0), mDecodedFrames(0), mPresentedFrames(0) {} @@ -920,11 +919,6 @@ public: return mPresentedFrames; } - double GetTotalFrameDelay() { - ReentrantMonitorAutoEnter mon(mReentrantMonitor); - return mTotalFrameDelay; - } - // Increments the parsed and decoded frame counters by the passed in counts. // Can be called on any thread. void NotifyDecodedFrames(uint32_t aParsed, uint32_t aDecoded) { @@ -942,22 +936,11 @@ public: ++mPresentedFrames; } - // Tracks the sum of display delay. - // Can be called on any thread. - void NotifyFrameDelay(double aFrameDelay) { - ReentrantMonitorAutoEnter mon(mReentrantMonitor); - mTotalFrameDelay += aFrameDelay; - } - private: // ReentrantMonitor to protect access of playback statistics. ReentrantMonitor mReentrantMonitor; - // Sum of displayed frame delays. - // Access protected by mReentrantMonitor. - double mTotalFrameDelay; - // Number of frames parsed and demuxed from media. // Access protected by mReentrantMonitor. uint32_t mParsedFrames; diff --git a/content/media/MediaDecoderStateMachine.cpp b/content/media/MediaDecoderStateMachine.cpp index f2e3449484f..1e709c99526 100644 --- a/content/media/MediaDecoderStateMachine.cpp +++ b/content/media/MediaDecoderStateMachine.cpp @@ -2336,9 +2336,6 @@ void MediaDecoderStateMachine::AdvanceFrame() } MediaDecoder::FrameStatistics& frameStats = mDecoder->GetFrameStatistics(); frameStats.NotifyPresentedFrame(); - double frameDelay = double(clock_time - currentFrame->mTime) / USECS_PER_S; - NS_ASSERTION(frameDelay >= 0.0, "Frame should never be displayed early."); - frameStats.NotifyFrameDelay(frameDelay); remainingTime = currentFrame->GetEndTime() - clock_time; currentFrame = nullptr; } diff --git a/content/media/VideoPlaybackQuality.cpp b/content/media/VideoPlaybackQuality.cpp index 3904cd82c25..63c8c23a6bf 100644 --- a/content/media/VideoPlaybackQuality.cpp +++ b/content/media/VideoPlaybackQuality.cpp @@ -18,14 +18,12 @@ VideoPlaybackQuality::VideoPlaybackQuality(HTMLMediaElement* aElement, DOMHighResTimeStamp aCreationTime, uint64_t aTotalFrames, uint64_t aDroppedFrames, - uint64_t aCorruptedFrames, - double aTotalFrameDelay) + uint64_t aCorruptedFrames) : mElement(aElement) , mCreationTime(aCreationTime) , mTotalFrames(aTotalFrames) , mDroppedFrames(aDroppedFrames) , mCorruptedFrames(aCorruptedFrames) - , mTotalFrameDelay(aTotalFrameDelay) { SetIsDOMBinding(); } diff --git a/content/media/VideoPlaybackQuality.h b/content/media/VideoPlaybackQuality.h index 3921a75475b..d5706d29072 100644 --- a/content/media/VideoPlaybackQuality.h +++ b/content/media/VideoPlaybackQuality.h @@ -23,7 +23,7 @@ public: VideoPlaybackQuality(HTMLMediaElement* aElement, DOMHighResTimeStamp aCreationTime, uint64_t aTotalFrames, uint64_t aDroppedFrames, - uint64_t aCorruptedFrames, double aTotalFrameDelay); + uint64_t aCorruptedFrames); HTMLMediaElement* GetParentObject() const; @@ -49,18 +49,12 @@ public: return mCorruptedFrames; } - double TotalFrameDelay() - { - return mTotalFrameDelay; - } - private: nsRefPtr mElement; DOMHighResTimeStamp mCreationTime; uint64_t mTotalFrames; uint64_t mDroppedFrames; uint64_t mCorruptedFrames; - double mTotalFrameDelay; }; } // namespace dom diff --git a/content/media/test/test_VideoPlaybackQuality.html b/content/media/test/test_VideoPlaybackQuality.html index 962e3760e44..ce08f144afa 100644 --- a/content/media/test/test_VideoPlaybackQuality.html +++ b/content/media/test/test_VideoPlaybackQuality.html @@ -21,7 +21,6 @@ function test() { is(vpq.totalVideoFrames, 0, "totalVideoFrames should be 0"); is(vpq.droppedVideoFrames, 0, "droppedVideoFrames should be 0"); is(vpq.corruptedVideoFrames, 0, "corruptedVideoFrames should be 0"); - is(vpq.totalFrameDelay, 0, "totalFrameDelay should be 0"); var vpq2 = video.getVideoPlaybackQuality(); ok(vpq !== vpq2, "getVideoPlaybackQuality should return a new object"); @@ -38,7 +37,6 @@ function test() { ok(vpq.totalVideoFrames > 0, "totalVideoFrames should be > 0"); ok(vpq.droppedVideoFrames >= 0, "droppedVideoFrames should be >= 0"); ok(vpq.corruptedVideoFrames >= 0, "corruptedVideoFrames should be >= 0"); - ok(vpq.totalFrameDelay >= 0, "totalFrameDelay should be >= 0"); SpecialPowers.pushPrefEnv({"set": [["media.video_stats.enabled", false]]}, function () { vpq = video.getVideoPlaybackQuality(); @@ -46,7 +44,6 @@ function test() { is(vpq.totalVideoFrames, 0, "totalVideoFrames should be 0"); is(vpq.droppedVideoFrames, 0, "droppedVideoFrames should be 0"); is(vpq.corruptedVideoFrames, 0, "corruptedVideoFrames should be 0"); - is(vpq.totalFrameDelay, 0, "totalFrameDelay should be 0"); SimpleTest.finish(); }); diff --git a/dom/webidl/VideoPlaybackQuality.webidl b/dom/webidl/VideoPlaybackQuality.webidl index 737bed305c8..a65024ae38e 100644 --- a/dom/webidl/VideoPlaybackQuality.webidl +++ b/dom/webidl/VideoPlaybackQuality.webidl @@ -16,6 +16,6 @@ interface VideoPlaybackQuality { readonly attribute unsigned long totalVideoFrames; readonly attribute unsigned long droppedVideoFrames; readonly attribute unsigned long corruptedVideoFrames; - readonly attribute double totalFrameDelay; +// At Risk: readonly attribute double totalFrameDelay; }; From f4686ac699a070b338585fb56d0cc78e7a5bb578 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Mon, 3 Mar 2014 21:35:51 -0500 Subject: [PATCH 15/34] Bug 976258 - Undo the damage of including windows.h in IPCMessageUtils.h; r=bent --- dom/events/moz.build | 23 +++++-------------- dom/plugins/ipc/PluginHangUIParent.cpp | 4 ++-- ipc/chromium/src/base/process_util.h | 8 +++++++ ipc/chromium/src/chrome/common/ipc_logging.cc | 4 ++-- ipc/glue/MessageChannel.cpp | 2 +- 5 files changed, 19 insertions(+), 22 deletions(-) diff --git a/dom/events/moz.build b/dom/events/moz.build index 1bf5c00de15..aa26a093dec 100644 --- a/dom/events/moz.build +++ b/dom/events/moz.build @@ -84,45 +84,34 @@ UNIFIED_SOURCES += [ 'MouseScrollEvent.cpp', 'MutationEvent.cpp', 'NotifyAudioAvailableEvent.cpp', + 'NotifyPaintEvent.cpp', 'nsAsyncDOMEvent.cpp', 'nsContentEventHandler.cpp', + 'nsDOMEvent.cpp', 'nsDOMEventTargetHelper.cpp', 'nsDOMTextEvent.cpp', 'nsEventDispatcher.cpp', + 'nsEventListenerManager.cpp', 'nsEventListenerService.cpp', 'nsIMEStateManager.cpp', 'nsJSEventListener.cpp', 'nsPaintRequest.cpp', 'nsPrivateTextRange.cpp', 'PointerEvent.cpp', + 'ScrollAreaEvent.cpp', 'SimpleGestureEvent.cpp', 'TextComposition.cpp', 'Touch.cpp', 'TouchEvent.cpp', 'TransitionEvent.cpp', + 'UIEvent.cpp', 'WheelEvent.cpp', 'XULCommandEvent.cpp', ] +# nsEventStateManager.cpp should be built separately because of Mac OS X headers. SOURCES += [ - # nsDOMEvent.cpp should be built separately because it includes - # ipc/IPCMessageUtils.h, which on Windows includes windows.h. - 'NotifyPaintEvent.cpp', - # nsDOMEvent.cpp should be built separately because it includes - # ipc/IPCMessageUtils.h, which on Windows includes windows.h. - 'nsDOMEvent.cpp', - # nsDOMEvent.cpp should be built separately because it includes - # mozilla/HalSensor.h, which includes ipc/IPCMessageUtils.h, which - # on Windows includes windows.h. - 'nsEventListenerManager.cpp', - # nsEventStateManager.cpp should be built separately because of Mac OS X headers. 'nsEventStateManager.cpp', - # nsDOMEvent.cpp should be built separately because it includes - # ipc/IPCMessageUtils.h, which on Windows includes windows.h. - 'ScrollAreaEvent.cpp', - # nsDOMEvent.cpp should be built separately because it includes - # ipc/IPCMessageUtils.h, which on Windows includes windows.h. - 'UIEvent.cpp', ] if CONFIG['MOZ_WEBSPEECH']: diff --git a/dom/plugins/ipc/PluginHangUIParent.cpp b/dom/plugins/ipc/PluginHangUIParent.cpp index 94991f13fa2..fcf1a0ca0f4 100644 --- a/dom/plugins/ipc/PluginHangUIParent.cpp +++ b/dom/plugins/ipc/PluginHangUIParent.cpp @@ -224,7 +224,7 @@ PluginHangUIParent::Init(const nsString& aPluginName) } commandLine.AppendLooseValue(ipcCookie); - ScopedHandle showEvent(::CreateEvent(nullptr, FALSE, FALSE, nullptr)); + ScopedHandle showEvent(::CreateEventW(nullptr, FALSE, FALSE, nullptr)); if (!showEvent.IsValid()) { return false; } @@ -290,7 +290,7 @@ PluginHangUIParent::UnwatchHangUIChildProcess(bool aWait) // constructor) completionEvent ScopedHandle completionEvent; if (aWait) { - completionEvent.Set(::CreateEvent(nullptr, FALSE, FALSE, nullptr)); + completionEvent.Set(::CreateEventW(nullptr, FALSE, FALSE, nullptr)); if (!completionEvent.IsValid()) { return false; } diff --git a/ipc/chromium/src/base/process_util.h b/ipc/chromium/src/base/process_util.h index 98a34861d30..1b90b9a9a9a 100644 --- a/ipc/chromium/src/base/process_util.h +++ b/ipc/chromium/src/base/process_util.h @@ -303,4 +303,12 @@ class ProcessMetrics { } // namespace base +#if defined(OS_WIN) +// Undo the windows.h damage +#undef GetMessage +#undef CreateEvent +#undef GetClassName +#undef GetBinaryType +#endif + #endif // BASE_PROCESS_UTIL_H_ diff --git a/ipc/chromium/src/chrome/common/ipc_logging.cc b/ipc/chromium/src/chrome/common/ipc_logging.cc index dcdc7e511f7..99173b98738 100644 --- a/ipc/chromium/src/chrome/common/ipc_logging.cc +++ b/ipc/chromium/src/chrome/common/ipc_logging.cc @@ -79,11 +79,11 @@ Logging::Logging() std::wstring event_name = GetEventName(browser_pid, true); logging_event_on_.reset(new base::WaitableEvent( - CreateEvent(NULL, TRUE, FALSE, event_name.c_str()))); + CreateEventW(NULL, TRUE, FALSE, event_name.c_str()))); event_name = GetEventName(browser_pid, false); logging_event_off_.reset(new base::WaitableEvent( - CreateEvent(NULL, TRUE, FALSE, event_name.c_str()))); + CreateEventW(NULL, TRUE, FALSE, event_name.c_str()))); RegisterWaitForEvent(true); #endif diff --git a/ipc/glue/MessageChannel.cpp b/ipc/glue/MessageChannel.cpp index 2dc207b411d..a1aa053d9a1 100644 --- a/ipc/glue/MessageChannel.cpp +++ b/ipc/glue/MessageChannel.cpp @@ -217,7 +217,7 @@ MessageChannel::MessageChannel(MessageListener *aListener) &MessageChannel::OnMaybeDequeueOne)); #ifdef OS_WIN - mEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr); + mEvent = CreateEventW(nullptr, TRUE, FALSE, nullptr); NS_ASSERTION(mEvent, "CreateEvent failed! Nothing is going to work!"); #endif } From 288e6d233cd420124ae752ce40ef25f41363690e Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Mon, 3 Mar 2014 18:47:43 -0800 Subject: [PATCH 16/34] Bug 978414 - Mark GLContext virtuals const and MOZ_OVERRIDE where appropriate. - r=bjacob --- gfx/gl/GLContext.h | 22 +++++++++------------- gfx/gl/GLContextCGL.h | 18 ++++++++---------- gfx/gl/GLContextEGL.h | 29 ++++++++++++----------------- gfx/gl/GLContextGLX.h | 14 +++++++------- gfx/gl/GLContextProviderCGL.mm | 17 +++++++---------- gfx/gl/GLContextProviderEGL.cpp | 6 ------ gfx/gl/GLContextProviderGLX.cpp | 4 ++-- gfx/gl/GLContextProviderWGL.cpp | 29 +++++++++++++---------------- gfx/gl/GLContextWGL.h | 16 +++++++--------- gfx/gl/GLLibraryEGL.h | 6 +++--- 10 files changed, 68 insertions(+), 93 deletions(-) diff --git a/gfx/gl/GLContext.h b/gfx/gl/GLContext.h index c1c5c59adae..7636cb195ab 100644 --- a/gfx/gl/GLContext.h +++ b/gfx/gl/GLContext.h @@ -162,7 +162,7 @@ public: * Returns true if the context is using ANGLE. This should only be overridden * for an ANGLE implementation. */ - virtual bool IsANGLE() { + virtual bool IsANGLE() const { return false; } @@ -273,13 +273,11 @@ public: /** * If this context is double-buffered, returns TRUE. */ - virtual bool IsDoubleBuffered() { + virtual bool IsDoubleBuffered() const { return false; } - virtual GLContextType GetContextType() { - return GLContextType::Unknown; - } + virtual GLContextType GetContextType() const = 0; virtual bool IsCurrent() = 0; @@ -500,7 +498,7 @@ private: // Robustness handling public: - bool HasRobustness() { + bool HasRobustness() const { return mHasRobustness; } @@ -508,7 +506,7 @@ public: * The derived class is expected to provide information on whether or not it * supports robustness. */ - virtual bool SupportsRobustness() = 0; + virtual bool SupportsRobustness() const = 0; private: @@ -2460,15 +2458,13 @@ public: // ----------------------------------------------------------------------------- // Everything that isn't standard GL APIs protected: - typedef class gfx::SharedSurface SharedSurface; typedef gfx::SharedSurfaceType SharedSurfaceType; typedef gfx::SurfaceFormat SurfaceFormat; + virtual bool MakeCurrentImpl(bool aForce) = 0; + public: - - virtual bool MakeCurrentImpl(bool aForce = false) = 0; - #ifdef MOZ_ENABLE_GL_TRACKING static void StaticInit() { PR_NewThreadPrivateIndex(&sCurrentGLContextTLS, nullptr); @@ -2548,7 +2544,7 @@ public: * * Only valid if IsOffscreen() returns true. */ - virtual bool ResizeOffscreen(const gfx::IntSize& size) { + bool ResizeOffscreen(const gfx::IntSize& size) { return ResizeScreenBuffer(size); } @@ -2635,7 +2631,7 @@ public: void ForceDirtyScreen(); void CleanDirtyScreen(); - virtual GLenum GetPreferredARGB32Format() { return LOCAL_GL_RGBA; } + virtual GLenum GetPreferredARGB32Format() const { return LOCAL_GL_RGBA; } virtual bool RenewSurface() { return false; } diff --git a/gfx/gl/GLContextCGL.h b/gfx/gl/GLContextCGL.h index 1843f1d0c21..99e975f251e 100644 --- a/gfx/gl/GLContextCGL.h +++ b/gfx/gl/GLContextCGL.h @@ -34,7 +34,7 @@ public: ~GLContextCGL(); - virtual GLContextType GetContextType() MOZ_OVERRIDE { return GLContextType::CGL; } + virtual GLContextType GetContextType() const MOZ_OVERRIDE { return GLContextType::CGL; } static GLContextCGL* Cast(GLContext* gl) { MOZ_ASSERT(gl->GetContextType() == GLContextType::CGL); @@ -46,21 +46,19 @@ public: NSOpenGLContext* GetNSOpenGLContext() const { return mContext; } CGLContextObj GetCGLContext() const; - bool MakeCurrentImpl(bool aForce = false); + virtual bool MakeCurrentImpl(bool aForce) MOZ_OVERRIDE; - virtual bool IsCurrent(); + virtual bool IsCurrent() MOZ_OVERRIDE; - virtual GLenum GetPreferredARGB32Format() MOZ_OVERRIDE; + virtual GLenum GetPreferredARGB32Format() const MOZ_OVERRIDE; - bool SetupLookupFunction(); + virtual bool SetupLookupFunction() MOZ_OVERRIDE; - bool IsDoubleBuffered(); + virtual bool IsDoubleBuffered() const MOZ_OVERRIDE; - bool SupportsRobustness(); + virtual bool SupportsRobustness() const MOZ_OVERRIDE; - bool SwapBuffers(); - - bool ResizeOffscreen(const gfx::IntSize& aNewSize); + virtual bool SwapBuffers() MOZ_OVERRIDE; }; } diff --git a/gfx/gl/GLContextEGL.h b/gfx/gl/GLContextEGL.h index e3ddea67a7d..6f9487d0184 100644 --- a/gfx/gl/GLContextEGL.h +++ b/gfx/gl/GLContextEGL.h @@ -38,7 +38,7 @@ public: ~GLContextEGL(); - virtual GLContextType GetContextType() MOZ_OVERRIDE { return GLContextType::EGL; } + virtual GLContextType GetContextType() const MOZ_OVERRIDE { return GLContextType::EGL; } static GLContextEGL* Cast(GLContext* gl) { MOZ_ASSERT(gl->GetContextType() == GLContextType::EGL); @@ -47,7 +47,7 @@ public: bool Init(); - bool IsDoubleBuffered() { + virtual bool IsDoubleBuffered() const MOZ_OVERRIDE { return mIsDoubleBuffered; } @@ -55,35 +55,31 @@ public: mIsDoubleBuffered = aIsDB; } - bool SupportsRobustness() - { + virtual bool SupportsRobustness() const MOZ_OVERRIDE { return sEGLLibrary.HasRobustness(); } - virtual bool IsANGLE() - { + virtual bool IsANGLE() const MOZ_OVERRIDE { return sEGLLibrary.IsANGLE(); } - bool BindTexImage(); + virtual bool BindTexImage() MOZ_OVERRIDE; - bool ReleaseTexImage(); + virtual bool ReleaseTexImage() MOZ_OVERRIDE; void SetEGLSurfaceOverride(EGLSurface surf); - bool MakeCurrentImpl(bool aForce = false); + virtual bool MakeCurrentImpl(bool aForce) MOZ_OVERRIDE; - virtual bool IsCurrent(); + virtual bool IsCurrent() MOZ_OVERRIDE; - virtual bool - RenewSurface(); + virtual bool RenewSurface() MOZ_OVERRIDE; - virtual void - ReleaseSurface(); + virtual void ReleaseSurface() MOZ_OVERRIDE; - bool SetupLookupFunction(); + virtual bool SetupLookupFunction() MOZ_OVERRIDE; - bool SwapBuffers(); + virtual bool SwapBuffers() MOZ_OVERRIDE; // hold a reference to the given surface // for the lifetime of this context. @@ -95,7 +91,6 @@ public: bool BindTex2DOffscreen(GLContext *aOffscreen); void UnbindTex2DOffscreen(GLContext *aOffscreen); - bool ResizeOffscreen(const gfx::IntSize& aNewSize); void BindOffscreenFramebuffer(); static already_AddRefed diff --git a/gfx/gl/GLContextGLX.h b/gfx/gl/GLContextGLX.h index 8f09512e850..d7ae8837592 100644 --- a/gfx/gl/GLContextGLX.h +++ b/gfx/gl/GLContextGLX.h @@ -28,7 +28,7 @@ public: ~GLContextGLX(); - virtual GLContextType GetContextType() MOZ_OVERRIDE { return GLContextType::GLX; } + virtual GLContextType GetContextType() const MOZ_OVERRIDE { return GLContextType::GLX; } static GLContextGLX* Cast(GLContext* gl) { MOZ_ASSERT(gl->GetContextType() == GLContextType::GLX); @@ -37,17 +37,17 @@ public: bool Init(); - bool MakeCurrentImpl(bool aForce = false); + virtual bool MakeCurrentImpl(bool aForce) MOZ_OVERRIDE; - virtual bool IsCurrent(); + virtual bool IsCurrent() MOZ_OVERRIDE; - bool SetupLookupFunction(); + virtual bool SetupLookupFunction() MOZ_OVERRIDE; - bool IsDoubleBuffered(); + virtual bool IsDoubleBuffered() const MOZ_OVERRIDE; - bool SupportsRobustness(); + virtual bool SupportsRobustness() const MOZ_OVERRIDE; - bool SwapBuffers(); + virtual bool SwapBuffers() MOZ_OVERRIDE; private: friend class GLContextProviderGLX; diff --git a/gfx/gl/GLContextProviderCGL.mm b/gfx/gl/GLContextProviderCGL.mm index f85cf4c4dfd..18c9cafe38a 100644 --- a/gfx/gl/GLContextProviderCGL.mm +++ b/gfx/gl/GLContextProviderCGL.mm @@ -78,7 +78,7 @@ private: bool mInitialized; PRLibrary *mOGLLibrary; NSOpenGLPixelFormat *mPixelFormat; -}; +}; CGLLibrary sCGLLibrary; @@ -151,7 +151,10 @@ GLContextCGL::IsCurrent() { } GLenum -GLContextCGL::GetPreferredARGB32Format() { return LOCAL_GL_BGRA; } +GLContextCGL::GetPreferredARGB32Format() const +{ + return LOCAL_GL_BGRA; +} bool GLContextCGL::SetupLookupFunction() @@ -166,7 +169,7 @@ GLContextCGL::IsDoubleBuffered() } bool -GLContextCGL::SupportsRobustness() +GLContextCGL::SupportsRobustness() const { return false; } @@ -180,12 +183,6 @@ GLContextCGL::SwapBuffers() } -bool -GLContextCGL::ResizeOffscreen(const gfx::IntSize& aNewSize) -{ - return ResizeScreenBuffer(aNewSize); -} - static GLContextCGL * GetGlobalContextCGL() { @@ -283,7 +280,7 @@ GLContextProviderCGL::GetGlobalContext() if (!gGlobalContext || !static_cast(gGlobalContext.get())->Init()) { NS_WARNING("Couldn't init gGlobalContext."); gGlobalContext = nullptr; - return nullptr; + return nullptr; } } diff --git a/gfx/gl/GLContextProviderEGL.cpp b/gfx/gl/GLContextProviderEGL.cpp index ce2bbc1f4a3..c36ad788516 100644 --- a/gfx/gl/GLContextProviderEGL.cpp +++ b/gfx/gl/GLContextProviderEGL.cpp @@ -547,12 +547,6 @@ TRY_AGAIN_POWER_OF_TWO: return surface; } -bool -GLContextEGL::ResizeOffscreen(const gfx::IntSize& aNewSize) -{ - return ResizeScreenBuffer(aNewSize); -} - static const EGLint kEGLConfigAttribsOffscreenPBuffer[] = { LOCAL_EGL_SURFACE_TYPE, LOCAL_EGL_PBUFFER_BIT, LOCAL_EGL_RENDERABLE_TYPE, LOCAL_EGL_OPENGL_ES2_BIT, diff --git a/gfx/gl/GLContextProviderGLX.cpp b/gfx/gl/GLContextProviderGLX.cpp index 939bfa3ca62..f9ebbb7c0ca 100644 --- a/gfx/gl/GLContextProviderGLX.cpp +++ b/gfx/gl/GLContextProviderGLX.cpp @@ -885,13 +885,13 @@ GLContextGLX::SetupLookupFunction() } bool -GLContextGLX::IsDoubleBuffered() +GLContextGLX::IsDoubleBuffered() const { return mDoubleBuffered; } bool -GLContextGLX::SupportsRobustness() +GLContextGLX::SupportsRobustness() const { return mGLX->HasRobustness(); } diff --git a/gfx/gl/GLContextProviderWGL.cpp b/gfx/gl/GLContextProviderWGL.cpp index de2224534e2..e880b8c2f55 100644 --- a/gfx/gl/GLContextProviderWGL.cpp +++ b/gfx/gl/GLContextProviderWGL.cpp @@ -97,7 +97,7 @@ WGLLibrary::EnsureInitialized() { if (mInitialized) return true; - + mozilla::ScopedGfxFeatureReporter reporter("WGL"); std::string libGLFilename = "Opengl32.dll"; @@ -320,22 +320,25 @@ GLContextWGL::MakeCurrentImpl(bool aForce) } bool -GLContextWGL::IsCurrent() { +GLContextWGL::IsCurrent() +{ return sWGLLib.fGetCurrentContext() == mContext; } void -GLContextWGL::SetIsDoubleBuffered(bool aIsDB) { +GLContextWGL::SetIsDoubleBuffered(bool aIsDB) +{ mIsDoubleBuffered = aIsDB; } bool -GLContextWGL::IsDoubleBuffered() { +GLContextWGL::IsDoubleBuffered() const +{ return mIsDoubleBuffered; } bool -GLContextWGL::SupportsRobustness() +GLContextWGL::SupportsRobustness() const { return sWGLLib.HasRobustness(); } @@ -376,7 +379,7 @@ GetMaxSize(HDC hDC, int format, gfxIntSize& size) } static bool -IsValidSizeForFormat(HDC hDC, int format, +IsValidSizeForFormat(HDC hDC, int format, const gfxIntSize& requested) { gfxIntSize max; @@ -391,12 +394,6 @@ IsValidSizeForFormat(HDC hDC, int format, return true; } -bool -GLContextWGL::ResizeOffscreen(const gfx::IntSize& aNewSize) -{ - return ResizeScreenBuffer(aNewSize); -} - static GLContextWGL * GetGlobalContextWGL() { @@ -411,8 +408,8 @@ GLContextProviderWGL::CreateForWindow(nsIWidget *aWidget) } /** - * We need to make sure we call SetPixelFormat -after- calling - * EnsureInitialized, otherwise it can load/unload the dll and + * We need to make sure we call SetPixelFormat -after- calling + * EnsureInitialized, otherwise it can load/unload the dll and * wglCreateContext will fail. */ @@ -564,13 +561,13 @@ CreateWindowOffscreenContext() if (!shareContext) { return nullptr; } - + HDC dc; HWND win = sWGLLib.CreateDummyWindow(&dc); if (!win) { return nullptr; } - + HGLRC context = sWGLLib.fCreateContext(dc); if (sWGLLib.HasRobustness()) { int attribs[] = { diff --git a/gfx/gl/GLContextWGL.h b/gfx/gl/GLContextWGL.h index acef96a226e..bded9746b4c 100644 --- a/gfx/gl/GLContextWGL.h +++ b/gfx/gl/GLContextWGL.h @@ -35,7 +35,7 @@ public: ~GLContextWGL(); - virtual GLContextType GetContextType() MOZ_OVERRIDE { return GLContextType::WGL; } + virtual GLContextType GetContextType() const MOZ_OVERRIDE { return GLContextType::WGL; } static GLContextWGL* Cast(GLContext* gl) { MOZ_ASSERT(gl->GetContextType() == GLContextType::WGL); @@ -44,21 +44,19 @@ public: bool Init(); - bool MakeCurrentImpl(bool aForce = false); + virtual bool MakeCurrentImpl(bool aForce) MOZ_OVERRIDE; - virtual bool IsCurrent(); + virtual bool IsCurrent() MOZ_OVERRIDE; void SetIsDoubleBuffered(bool aIsDB); - virtual bool IsDoubleBuffered(); + virtual bool IsDoubleBuffered() const MOZ_OVERRIDE; - bool SupportsRobustness(); + virtual bool SupportsRobustness() const MOZ_OVERRIDE; - virtual bool SwapBuffers(); + virtual bool SwapBuffers() MOZ_OVERRIDE; - bool SetupLookupFunction(); - - bool ResizeOffscreen(const gfx::IntSize& aNewSize); + virtual bool SetupLookupFunction() MOZ_OVERRIDE; HGLRC Context() { return mContext; } diff --git a/gfx/gl/GLLibraryEGL.h b/gfx/gl/GLLibraryEGL.h index 9525bca7f6b..c5e8094dec1 100644 --- a/gfx/gl/GLLibraryEGL.h +++ b/gfx/gl/GLLibraryEGL.h @@ -120,7 +120,7 @@ public: Extensions_Max }; - bool IsExtensionSupported(EGLExtensions aKnownExtension) { + bool IsExtensionSupported(EGLExtensions aKnownExtension) const { return mAvailableExtensions[aKnownExtension]; } @@ -411,7 +411,7 @@ public: return mEGLDisplay; } - bool IsANGLE() { + bool IsANGLE() const { return mIsANGLE; } @@ -431,7 +431,7 @@ public: return IsExtensionSupported(ANGLE_surface_d3d_texture_2d_share_handle); } - bool HasRobustness() { + bool HasRobustness() const { return IsExtensionSupported(EXT_create_context_robustness); } From 776480c93490b1a949e56ee40ea3fd7cd20f1218 Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Mon, 3 Mar 2014 18:50:45 -0800 Subject: [PATCH 17/34] Bug 978422 - ReattachTextureToAnyFramebufferToWorkAroundBugs no longer needed. - r=bjacob --- content/canvas/src/WebGLContext.h | 2 - content/canvas/src/WebGLContextGL.cpp | 59 --------------------------- 2 files changed, 61 deletions(-) diff --git a/content/canvas/src/WebGLContext.h b/content/canvas/src/WebGLContext.h index e6e58bd3ac2..effdb0d8125 100644 --- a/content/canvas/src/WebGLContext.h +++ b/content/canvas/src/WebGLContext.h @@ -1204,8 +1204,6 @@ protected: template JSObject* WebGLObjectAsJSObject(JSContext *cx, const WebGLObjectType *, ErrorResult& rv) const; - void ReattachTextureToAnyFramebufferToWorkAroundBugs(WebGLTexture *tex, GLint level); - #ifdef XP_MACOSX // see bug 713305. This RAII helper guarantees that we're on the discrete GPU, during its lifetime // Debouncing note: we don't want to switch GPUs too frequently, so try to not create and destroy diff --git a/content/canvas/src/WebGLContextGL.cpp b/content/canvas/src/WebGLContextGL.cpp index 354cec2389b..5573ef0186d 100644 --- a/content/canvas/src/WebGLContextGL.cpp +++ b/content/canvas/src/WebGLContextGL.cpp @@ -477,9 +477,6 @@ WebGLContext::CopyTexSubImage2D_base(GLenum target, gl->fCopyTexSubImage2D(target, level, actual_xoffset, actual_yoffset, actual_x, actual_y, actual_width, actual_height); } - - if (!sub) - ReattachTextureToAnyFramebufferToWorkAroundBugs(tex, level); } void @@ -3375,8 +3372,6 @@ WebGLContext::CompressedTexImage2D(GLenum target, GLint level, GLenum internalfo MOZ_ASSERT(tex); tex->SetImageInfo(target, level, width, height, internalformat, LOCAL_GL_UNSIGNED_BYTE, WebGLImageDataStatus::InitializedImageData); - - ReattachTextureToAnyFramebufferToWorkAroundBugs(tex, level); } void @@ -3784,8 +3779,6 @@ WebGLContext::TexImage2D_base(GLenum target, GLint level, GLenum internalformat, MOZ_ASSERT(imageInfoStatusIfSuccess != WebGLImageDataStatus::NoImageData); tex->SetImageInfo(target, level, width, height, internalformat, type, imageInfoStatusIfSuccess); - - ReattachTextureToAnyFramebufferToWorkAroundBugs(tex, level); } void @@ -4220,58 +4213,6 @@ InternalFormatForFormatAndType(GLenum format, GLenum type, bool isGLES2) return 0; } -void -WebGLContext::ReattachTextureToAnyFramebufferToWorkAroundBugs(WebGLTexture *tex, - GLint level) -{ - MOZ_ASSERT(tex); - - if (!gl->WorkAroundDriverBugs()) - return; - - if (!mIsMesa) - return; - - MakeContextCurrent(); - WebGLFramebuffer* curFB = mBoundFramebuffer; - - for(WebGLFramebuffer *framebuffer = mFramebuffers.getFirst(); - framebuffer; - framebuffer = framebuffer->getNext()) - { - size_t colorAttachmentCount = framebuffer->mColorAttachments.Length(); - for (size_t i = 0; i < colorAttachmentCount; i++) - { - if (framebuffer->ColorAttachment(i).Texture() == tex) { - BindFramebuffer(LOCAL_GL_FRAMEBUFFER, framebuffer); - framebuffer->FramebufferTexture2D( - LOCAL_GL_FRAMEBUFFER, LOCAL_GL_COLOR_ATTACHMENT0 + i, - tex->Target(), tex, level); - } - } - if (framebuffer->DepthAttachment().Texture() == tex) { - BindFramebuffer(LOCAL_GL_FRAMEBUFFER, framebuffer); - framebuffer->FramebufferTexture2D( - LOCAL_GL_FRAMEBUFFER, LOCAL_GL_DEPTH_ATTACHMENT, - tex->Target(), tex, level); - } - if (framebuffer->StencilAttachment().Texture() == tex) { - BindFramebuffer(LOCAL_GL_FRAMEBUFFER, framebuffer); - framebuffer->FramebufferTexture2D( - LOCAL_GL_FRAMEBUFFER, LOCAL_GL_STENCIL_ATTACHMENT, - tex->Target(), tex, level); - } - if (framebuffer->DepthStencilAttachment().Texture() == tex) { - BindFramebuffer(LOCAL_GL_FRAMEBUFFER, framebuffer); - framebuffer->FramebufferTexture2D( - LOCAL_GL_FRAMEBUFFER, LOCAL_GL_DEPTH_STENCIL_ATTACHMENT, - tex->Target(), tex, level); - } - } - - BindFramebuffer(LOCAL_GL_FRAMEBUFFER, curFB); -} - void WebGLContext::BlendColor(GLclampf r, GLclampf g, GLclampf b, GLclampf a) { if (IsContextLost()) From c8b87eb077bd9cb6c76f09526e222a7a32916958 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Mon, 3 Mar 2014 21:58:37 -0500 Subject: [PATCH 18/34] Bug 977964 - Move some flags to moz.build; r=glandium --- hal/Makefile.in | 4 ---- hal/moz.build | 3 +++ media/omx-plugin/Makefile.in | 18 ------------------ media/omx-plugin/moz.build | 20 ++++++++++++++++++++ netwerk/protocol/rtsp/Makefile.in | 19 ------------------- netwerk/protocol/rtsp/moz.build | 7 +++++++ toolkit/components/downloads/Makefile.in | 2 +- toolkit/components/downloads/moz.build | 1 + toolkit/components/protobuf/Makefile.in | 2 +- toolkit/components/protobuf/moz.build | 2 ++ 10 files changed, 35 insertions(+), 43 deletions(-) delete mode 100644 netwerk/protocol/rtsp/Makefile.in diff --git a/hal/Makefile.in b/hal/Makefile.in index cd63929dcbc..230d8af7403 100644 --- a/hal/Makefile.in +++ b/hal/Makefile.in @@ -7,7 +7,3 @@ include $(topsrcdir)/config/rules.mk CFLAGS += $(GLIB_CFLAGS) $(MOZ_DBUS_GLIB_CFLAGS) CXXFLAGS += $(GLIB_CFLAGS) $(MOZ_DBUS_GLIB_CFLAGS) - -ifeq (gonk,$(MOZ_WIDGET_TOOLKIT)) - LOCAL_INCLUDES += -I$(ANDROID_SOURCE)/hardware/libhardware_legacy/include -endif diff --git a/hal/moz.build b/hal/moz.build index f3591c58c24..9cf12a10832 100644 --- a/hal/moz.build +++ b/hal/moz.build @@ -188,3 +188,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': '/widget/gonk', '/widget/xpwidgets' ] + +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': + CXXFLAGS += ['-I%s/hardware/libhardware_legacy/include' % CONFIG['ANDROID_SOURCE']] diff --git a/media/omx-plugin/Makefile.in b/media/omx-plugin/Makefile.in index eeb2560b3d5..812c1767b07 100644 --- a/media/omx-plugin/Makefile.in +++ b/media/omx-plugin/Makefile.in @@ -17,29 +17,11 @@ STL_FLAGS = include $(topsrcdir)/config/rules.mk -ifdef GNU_CXX -# Stagefright header files define many multichar constants. -CXXFLAGS += -Wno-multichar -endif - ifeq ($(MOZ_WIDGET_TOOLKIT),gonk) EXTRA_DSO_LDOPTS += \ -lutils -lstagefright -lmedia -lstagefright_omx -lbinder -lui \ -lhardware -lcutils \ $(NULL) - -CXXFLAGS += \ - -I$(ANDROID_SOURCE)/dalvik/libnativehelper/include/nativehelper \ - -I$(ANDROID_SOURCE)/frameworks/base/include/ \ - -I$(ANDROID_SOURCE)/frameworks/base/include/binder/ \ - -I$(ANDROID_SOURCE)/frameworks/base/include/utils/ \ - -I$(ANDROID_SOURCE)/frameworks/base/include/media/ \ - -I$(ANDROID_SOURCE)/frameworks/base/include/media/stagefright/openmax \ - -I$(ANDROID_SOURCE)/frameworks/base/media/libstagefright/include \ - -I$(ANDROID_SOURCE)/frameworks/base/native/include \ - -I$(ANDROID_SOURCE)/system/core/include \ - -I$(ANDROID_SOURCE)/hardware/libhardware/include \ - $(NULL) else EXTRA_DSO_LDOPTS += \ -L$(DEPTH)/media/omx-plugin/lib/ics/libutils \ diff --git a/media/omx-plugin/moz.build b/media/omx-plugin/moz.build index 9763d9730fa..10c89eb5174 100644 --- a/media/omx-plugin/moz.build +++ b/media/omx-plugin/moz.build @@ -33,3 +33,23 @@ else: 'include/ics', 'include/ics/media/stagefright/openmax', ] + +if CONFIG['GNU_CXX']: + # Stagefright header files define many multichar constants. + CXXFLAGS += ['-Wno-multichar'] + +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': + CXXFLAGS += [ + '-I%s/%s' % (CONFIG['ANDROID_SOURCE'], d) for d in [ + 'dalvik/libnativehelper/include/nativehelper', + 'frameworks/base/include/', + 'frameworks/base/include/binder/', + 'frameworks/base/include/utils/', + 'frameworks/base/include/media/', + 'frameworks/base/include/media/stagefright/openmax', + 'frameworks/base/media/libstagefright/include', + 'frameworks/base/native/include', + 'system/core/include', + 'hardware/libhardware/include', + ] + ] diff --git a/netwerk/protocol/rtsp/Makefile.in b/netwerk/protocol/rtsp/Makefile.in deleted file mode 100644 index 3b54fb6c565..00000000000 --- a/netwerk/protocol/rtsp/Makefile.in +++ /dev/null @@ -1,19 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -include $(topsrcdir)/config/rules.mk - -ifeq ($(ANDROID_VERSION),$(findstring $(ANDROID_VERSION),15)) -CXXFLAGS += \ - -I$(ANDROID_SOURCE)/frameworks/base/media/libstagefright/mpeg2ts \ - $(NULL) -else -CXXFLAGS += \ - -I$(ANDROID_SOURCE)/frameworks/av/media/libstagefright/mpeg2ts \ - $(NULL) -endif - -CXXFLAGS += \ - -Wno-multichar \ - $(NULL) diff --git a/netwerk/protocol/rtsp/moz.build b/netwerk/protocol/rtsp/moz.build index c0220867139..e722f41d2d1 100644 --- a/netwerk/protocol/rtsp/moz.build +++ b/netwerk/protocol/rtsp/moz.build @@ -63,3 +63,10 @@ LOCAL_INCLUDES += [ for var in ('IMPL_NS_NET', 'FORCE_PR_LOG'): DEFINES[var] = True + +if CONFIG['ANDROID_VERSION'] == '15': + CXXFLAGS += ['-I%s/frameworks/base/media/libstagefright/mpeg2ts' % CONFIG['ANDROID_SOURCE']] +else: + CXXFLAGS += ['-I%s/frameworks/av/media/libstagefright/mpeg2ts' % CONFIG['ANDROID_SOURCE']] + +CXXFLAGS += ['-Wno-multichar'] diff --git a/toolkit/components/downloads/Makefile.in b/toolkit/components/downloads/Makefile.in index 8c2b5f8f9dc..c0b41278ddb 100644 --- a/toolkit/components/downloads/Makefile.in +++ b/toolkit/components/downloads/Makefile.in @@ -5,5 +5,5 @@ include $(topsrcdir)/config/rules.mk -CXXFLAGS += $(TK_CFLAGS) -DGOOGLE_PROTOBUF_NO_RTTI +CXXFLAGS += $(TK_CFLAGS) diff --git a/toolkit/components/downloads/moz.build b/toolkit/components/downloads/moz.build index e291a4a7101..5b2075c6196 100644 --- a/toolkit/components/downloads/moz.build +++ b/toolkit/components/downloads/moz.build @@ -57,3 +57,4 @@ LOCAL_INCLUDES += [ '../protobuf', ] +DEFINES['GOOGLE_PROTOBUF_NO_RTTI'] = True diff --git a/toolkit/components/protobuf/Makefile.in b/toolkit/components/protobuf/Makefile.in index 5986be717d0..913d590ecca 100644 --- a/toolkit/components/protobuf/Makefile.in +++ b/toolkit/components/protobuf/Makefile.in @@ -5,4 +5,4 @@ include $(topsrcdir)/config/rules.mk -CXXFLAGS += $(TK_CFLAGS) -DGOOGLE_PROTOBUF_NO_RTTI +CXXFLAGS += $(TK_CFLAGS) diff --git a/toolkit/components/protobuf/moz.build b/toolkit/components/protobuf/moz.build index 8d4cdc5751d..077fe435fdd 100644 --- a/toolkit/components/protobuf/moz.build +++ b/toolkit/components/protobuf/moz.build @@ -44,3 +44,5 @@ UNIFIED_SOURCES += [ ] FINAL_LIBRARY = 'toolkitcomps' + +DEFINES['GOOGLE_PROTOBUF_NO_RTTI'] = True From 3b5df918d976863ce9d7ee4ae03acc9705358be0 Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Mon, 3 Mar 2014 19:13:34 -0800 Subject: [PATCH 19/34] Bug 978414 - GLContextCGL::IsDoubleBuffered should be const at definition. - r=bustage on a CLOSED TREE --- gfx/gl/GLContextProviderCGL.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gfx/gl/GLContextProviderCGL.mm b/gfx/gl/GLContextProviderCGL.mm index 18c9cafe38a..b3e40bc5942 100644 --- a/gfx/gl/GLContextProviderCGL.mm +++ b/gfx/gl/GLContextProviderCGL.mm @@ -163,7 +163,7 @@ GLContextCGL::SetupLookupFunction() } bool -GLContextCGL::IsDoubleBuffered() +GLContextCGL::IsDoubleBuffered() const { return gUseDoubleBufferedWindows; } From 943d4ff94df9efd21f976f6d4c210777449ce1b7 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Mon, 3 Mar 2014 22:38:55 -0500 Subject: [PATCH 20/34] Bug 978784 - Stop exporting ICU symbols from xul.dll; r=glandium --- build/autoconf/icu.m4 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/build/autoconf/icu.m4 b/build/autoconf/icu.m4 index 2dcf93eada0..4a4f5e8b567 100644 --- a/build/autoconf/icu.m4 +++ b/build/autoconf/icu.m4 @@ -119,11 +119,8 @@ AC_SUBST(ICU_LIB_NAMES) AC_SUBST(MOZ_ICU_LIBS) if test -n "$ENABLE_INTL_API" -a -z "$MOZ_NATIVE_ICU"; then - dnl We build ICU as a static library for non-shared js builds and as a shared library for shared js builds. if test -z "$MOZ_SHARED_ICU"; then AC_DEFINE(U_STATIC_IMPLEMENTATION) - else - AC_DEFINE(U_COMBINED_IMPLEMENTATION) fi dnl Source files that use ICU should have control over which parts of the ICU dnl namespace they want to use. @@ -140,6 +137,12 @@ if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then if test -n "$ENABLE_INTL_API" -a -z "$MOZ_NATIVE_ICU"; then # Set ICU compile options ICU_CPPFLAGS="" + dnl We build ICU as a static library for non-shared js builds and as a shared library for shared js builds. + if test -z "$MOZ_SHARED_ICU"; then + ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_STATIC_IMPLEMENTATION" + else + ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_COMBINED_IMPLEMENTATION" + fi # don't use icu namespace automatically in client code ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_USING_ICU_NAMESPACE=0" # don't include obsolete header files From d0c1e2f3fb5596fdbd6900f8e52252b435c74be1 Mon Sep 17 00:00:00 2001 From: Seth Fowler Date: Mon, 3 Mar 2014 19:40:27 -0800 Subject: [PATCH 21/34] Bug 63895 (Part 1) - Add helper methods for retrieving overflow areas in the frame's local coordinate space. r=dbaron --- layout/generic/nsFrame.cpp | 27 +++++++++++++++++++++++++++ layout/generic/nsIFrame.h | 18 ++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index dfe91ef9610..e21ce0177d3 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -5117,12 +5117,39 @@ nsIFrame::GetOverflowAreas() const nsRect(nsPoint(0, 0), GetSize())); } +nsOverflowAreas +nsIFrame::GetOverflowAreasRelativeToSelf() const +{ + if (IsTransformed()) { + nsOverflowAreas* preTransformOverflows = static_cast + (Properties().Get(PreTransformOverflowAreasProperty())); + if (preTransformOverflows) { + return nsOverflowAreas(preTransformOverflows->VisualOverflow(), + preTransformOverflows->ScrollableOverflow()); + } + } + return nsOverflowAreas(GetVisualOverflowRect(), + GetScrollableOverflowRect()); +} + nsRect nsIFrame::GetScrollableOverflowRectRelativeToParent() const { return GetScrollableOverflowRect() + mRect.TopLeft(); } +nsRect +nsIFrame::GetScrollableOverflowRectRelativeToSelf() const +{ + if (IsTransformed()) { + nsOverflowAreas* preTransformOverflows = static_cast + (Properties().Get(PreTransformOverflowAreasProperty())); + if (preTransformOverflows) + return preTransformOverflows->ScrollableOverflow(); + } + return GetScrollableOverflowRect(); +} + nsRect nsIFrame::GetVisualOverflowRectRelativeToSelf() const { diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 9218bc12acf..d6adba47e8f 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -2235,6 +2235,15 @@ public: nsOverflowAreas GetOverflowAreas() const; + /** + * Same as GetOverflowAreas, except in this frame's coordinate + * system (before transforms are applied). + * + * @return the overflow areas relative to this frame, before any CSS transforms have + * been applied, i.e. in this frame's coordinate system + */ + nsOverflowAreas GetOverflowAreasRelativeToSelf() const; + /** * Same as GetScrollableOverflowRect, except relative to the parent * frame. @@ -2244,6 +2253,15 @@ public: */ nsRect GetScrollableOverflowRectRelativeToParent() const; + /** + * Same as GetScrollableOverflowRect, except in this frame's coordinate + * system (before transforms are applied). + * + * @return the rect relative to this frame, before any CSS transforms have + * been applied, i.e. in this frame's coordinate system + */ + nsRect GetScrollableOverflowRectRelativeToSelf() const; + /** * Like GetVisualOverflowRect, except in this frame's * coordinate system (before transforms are applied). From c731aa8fb77a3bbcf0aa16d9dd06b70a165b64a3 Mon Sep 17 00:00:00 2001 From: Seth Fowler Date: Mon, 3 Mar 2014 19:40:29 -0800 Subject: [PATCH 22/34] Bug 63895 (Part 2) - Support table parts as absolute containing blocks. r=dbaron --- layout/base/nsCSSFrameConstructor.cpp | 117 +++++++++++++++------ layout/base/nsCSSFrameConstructor.h | 12 +-- layout/tables/nsTableCellFrame.cpp | 10 ++ layout/tables/nsTableCellFrame.h | 2 + layout/tables/nsTableFrame.cpp | 139 +++++++++++++++++++++++++ layout/tables/nsTableFrame.h | 30 ++++++ layout/tables/nsTableRowFrame.cpp | 10 ++ layout/tables/nsTableRowFrame.h | 3 + layout/tables/nsTableRowGroupFrame.cpp | 10 ++ layout/tables/nsTableRowGroupFrame.h | 3 + 10 files changed, 299 insertions(+), 37 deletions(-) diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 30d38b52532..1f557e3a92e 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -1984,27 +1984,64 @@ nsCSSFrameConstructor::ConstructTable(nsFrameConstructorState& aState, return newFrame; } -nsIFrame* -nsCSSFrameConstructor::ConstructTableRow(nsFrameConstructorState& aState, - FrameConstructionItem& aItem, - nsIFrame* aParentFrame, - const nsStyleDisplay* aDisplay, - nsFrameItems& aFrameItems) +static void +MakeTablePartAbsoluteContainingBlockIfNeeded(nsFrameConstructorState& aState, + const nsStyleDisplay* aDisplay, + nsFrameConstructorSaveState& aAbsSaveState, + nsIFrame* aFrame) { - NS_PRECONDITION(aDisplay->mDisplay == NS_STYLE_DISPLAY_TABLE_ROW, + // If we're positioned, then we need to become an absolute containing block + // for any absolutely positioned children and register for post-reflow fixup. + // + // Note that usually if a frame type can be an absolute containing block, we + // always set NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN, whether it actually is or not. + // However, in this case flag serves the additional purpose of indicating that + // the frame was registered with its table frame. This allows us to avoid the + // overhead of unregistering the frame in most cases. + if (aDisplay->IsRelativelyPositionedStyle() || + aDisplay->IsAbsolutelyPositionedStyle() || + aDisplay->HasTransform(aFrame)) { + aFrame->AddStateBits(NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN); + aState.PushAbsoluteContainingBlock(aFrame, aFrame, aAbsSaveState); + nsTableFrame::RegisterPositionedTablePart(aFrame); + } +} + +nsIFrame* +nsCSSFrameConstructor::ConstructTableRowOrRowGroup(nsFrameConstructorState& aState, + FrameConstructionItem& aItem, + nsIFrame* aParentFrame, + const nsStyleDisplay* aDisplay, + nsFrameItems& aFrameItems) +{ + NS_PRECONDITION(aDisplay->mDisplay == NS_STYLE_DISPLAY_TABLE_ROW || + aDisplay->mDisplay == NS_STYLE_DISPLAY_TABLE_ROW_GROUP || + aDisplay->mDisplay == NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP || + aDisplay->mDisplay == NS_STYLE_DISPLAY_TABLE_HEADER_GROUP, "Unexpected call"); + MOZ_ASSERT(aItem.mStyleContext->StyleDisplay() == aDisplay, + "Display style doesn't match style context"); nsIContent* const content = aItem.mContent; nsStyleContext* const styleContext = aItem.mStyleContext; const uint32_t nameSpaceID = aItem.mNameSpaceID; nsIFrame* newFrame; - if (kNameSpaceID_MathML == nameSpaceID) - newFrame = NS_NewMathMLmtrFrame(mPresShell, styleContext); - else - newFrame = NS_NewTableRowFrame(mPresShell, styleContext); + if (aDisplay->mDisplay == NS_STYLE_DISPLAY_TABLE_ROW) { + if (kNameSpaceID_MathML == nameSpaceID) + newFrame = NS_NewMathMLmtrFrame(mPresShell, styleContext); + else + newFrame = NS_NewTableRowFrame(mPresShell, styleContext); + } else { + newFrame = NS_NewTableRowGroupFrame(mPresShell, styleContext); + } InitAndRestoreFrame(aState, content, aParentFrame, newFrame); + nsFrameConstructorSaveState absoluteSaveState; + MakeTablePartAbsoluteContainingBlockIfNeeded(aState, aDisplay, + absoluteSaveState, + newFrame); + nsFrameItems childItems; NS_ASSERTION(aItem.mAnonChildren.IsEmpty(), "nsIAnonymousContentCreator::CreateAnonymousContent " @@ -2107,6 +2144,11 @@ nsCSSFrameConstructor::ConstructTableCell(nsFrameConstructorState& aState, InitAndRestoreFrame(aState, content, newFrame, cellInnerFrame); + nsFrameConstructorSaveState absoluteSaveState; + MakeTablePartAbsoluteContainingBlockIfNeeded(aState, aDisplay, + absoluteSaveState, + newFrame); + nsFrameItems childItems; NS_ASSERTION(aItem.mAnonChildren.IsEmpty(), "nsIAnonymousContentCreator::CreateAnonymousContent " @@ -4393,20 +4435,17 @@ nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay, FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeTable), NS_NewTableCaptionFrame) }, { NS_STYLE_DISPLAY_TABLE_ROW_GROUP, - FCDATA_DECL(FCDATA_IS_TABLE_PART | FCDATA_DISALLOW_OUT_OF_FLOW | - FCDATA_SKIP_ABSPOS_PUSH | - FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeTable), - NS_NewTableRowGroupFrame) }, + FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | + FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeTable), + &nsCSSFrameConstructor::ConstructTableRowOrRowGroup) }, { NS_STYLE_DISPLAY_TABLE_HEADER_GROUP, - FCDATA_DECL(FCDATA_IS_TABLE_PART | FCDATA_DISALLOW_OUT_OF_FLOW | - FCDATA_SKIP_ABSPOS_PUSH | - FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeTable), - NS_NewTableRowGroupFrame) }, + FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | + FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeTable), + &nsCSSFrameConstructor::ConstructTableRowOrRowGroup) }, { NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP, - FCDATA_DECL(FCDATA_IS_TABLE_PART | FCDATA_DISALLOW_OUT_OF_FLOW | - FCDATA_SKIP_ABSPOS_PUSH | - FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeTable), - NS_NewTableRowGroupFrame) }, + FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | + FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeTable), + &nsCSSFrameConstructor::ConstructTableRowOrRowGroup) }, { NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP, FCDATA_DECL(FCDATA_IS_TABLE_PART | FCDATA_DISALLOW_OUT_OF_FLOW | FCDATA_SKIP_ABSPOS_PUSH | @@ -4419,7 +4458,7 @@ nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay, { NS_STYLE_DISPLAY_TABLE_ROW, FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRowGroup), - &nsCSSFrameConstructor::ConstructTableRow) }, + &nsCSSFrameConstructor::ConstructTableRowOrRowGroup) }, { NS_STYLE_DISPLAY_TABLE_CELL, FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRow), @@ -7993,8 +8032,16 @@ nsCSSFrameConstructor::CreateContinuingTableFrame(nsIPresShell* aPresShell, nullptr); state.mCreatingExtraFrames = true; + nsStyleContext* const headerFooterStyleContext = rowGroupFrame->StyleContext(); headerFooterFrame = static_cast - (NS_NewTableRowGroupFrame(aPresShell, rowGroupFrame->StyleContext())); + (NS_NewTableRowGroupFrame(aPresShell, headerFooterStyleContext)); + + nsFrameConstructorSaveState absoluteSaveState; + MakeTablePartAbsoluteContainingBlockIfNeeded(state, + headerFooterStyleContext->StyleDisplay(), + absoluteSaveState, + headerFooterFrame); + nsIContent* headerFooter = rowGroupFrame->GetContent(); headerFooterFrame->Init(headerFooter, newFrame, nullptr); ProcessChildren(state, headerFooter, rowGroupFrame->StyleContext(), @@ -8071,10 +8118,16 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext, } else if (nsGkAtoms::tableRowGroupFrame == frameType) { newFrame = NS_NewTableRowGroupFrame(shell, styleContext); newFrame->Init(content, aParentFrame, aFrame); + if (newFrame->GetStateBits() & NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN) { + nsTableFrame::RegisterPositionedTablePart(newFrame); + } } else if (nsGkAtoms::tableRowFrame == frameType) { newFrame = NS_NewTableRowFrame(shell, styleContext); newFrame->Init(content, aParentFrame, aFrame); + if (newFrame->GetStateBits() & NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN) { + nsTableFrame::RegisterPositionedTablePart(newFrame); + } // Create a continuing frame for each table cell frame nsFrameItems newChildList; @@ -8099,6 +8152,9 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext, newFrame = NS_NewTableCellFrame(shell, styleContext, IsBorderCollapse(aParentFrame)); newFrame->Init(content, aParentFrame, aFrame); + if (newFrame->GetStateBits() & NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN) { + nsTableFrame::RegisterPositionedTablePart(newFrame); + } // Create a continuing area frame nsIFrame* blockFrame = aFrame->GetFirstPrincipalChild(); @@ -8799,15 +8855,14 @@ nsCSSFrameConstructor::sPseudoParentData[eParentTypeCount] = { FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET | FCDATA_USE_CHILD_ITEMS | FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRowGroup), - &nsCSSFrameConstructor::ConstructTableRow), + &nsCSSFrameConstructor::ConstructTableRowOrRowGroup), &nsCSSAnonBoxes::tableRow }, { // Row group - FCDATA_DECL(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET | - FCDATA_DISALLOW_OUT_OF_FLOW | FCDATA_USE_CHILD_ITEMS | - FCDATA_SKIP_ABSPOS_PUSH | - FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeTable), - NS_NewTableRowGroupFrame), + FULL_CTOR_FCDATA(FCDATA_IS_TABLE_PART | FCDATA_SKIP_FRAMESET | + FCDATA_USE_CHILD_ITEMS | + FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeTable), + &nsCSSFrameConstructor::ConstructTableRowOrRowGroup), &nsCSSAnonBoxes::tableRowGroup }, { // Column group diff --git a/layout/base/nsCSSFrameConstructor.h b/layout/base/nsCSSFrameConstructor.h index d011f576106..a97074ef167 100644 --- a/layout/base/nsCSSFrameConstructor.h +++ b/layout/base/nsCSSFrameConstructor.h @@ -383,13 +383,13 @@ private: nsFrameItems& aFrameItems); /** - * FrameConstructionData callback used for constructing table rows. + * FrameConstructionData callback for constructing table rows and row groups. */ - nsIFrame* ConstructTableRow(nsFrameConstructorState& aState, - FrameConstructionItem& aItem, - nsIFrame* aParentFrame, - const nsStyleDisplay* aStyleDisplay, - nsFrameItems& aFrameItems); + nsIFrame* ConstructTableRowOrRowGroup(nsFrameConstructorState& aState, + FrameConstructionItem& aItem, + nsIFrame* aParentFrame, + const nsStyleDisplay* aStyleDisplay, + nsFrameItems& aFrameItems); /** * FrameConstructionData callback used for constructing table columns. diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp index fcde41fcf96..d0affa09208 100644 --- a/layout/tables/nsTableCellFrame.cpp +++ b/layout/tables/nsTableCellFrame.cpp @@ -87,6 +87,16 @@ nsTableCellFrame::Init(nsIContent* aContent, } } +void +nsTableCellFrame::DestroyFrom(nsIFrame* aDestructRoot) +{ + if (GetStateBits() & NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN) { + nsTableFrame::UnregisterPositionedTablePart(this, aDestructRoot); + } + + nsContainerFrame::DestroyFrom(aDestructRoot); +} + // nsIPercentHeightObserver methods void diff --git a/layout/tables/nsTableCellFrame.h b/layout/tables/nsTableCellFrame.h index dc9cd6d02a7..97ce9f7ecc9 100644 --- a/layout/tables/nsTableCellFrame.h +++ b/layout/tables/nsTableCellFrame.h @@ -47,6 +47,8 @@ public: nsIFrame* aParent, nsIFrame* aPrevInFlow) MOZ_OVERRIDE; + virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE; + #ifdef ACCESSIBILITY virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE; #endif diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 2b97f8b0a24..ffafba6b6c6 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -41,6 +41,7 @@ #include "nsDisplayList.h" #include "nsIScrollableFrame.h" #include "nsCSSProps.h" +#include "RestyleTracker.h" #include using namespace mozilla; @@ -252,6 +253,64 @@ nsTableFrame::PageBreakAfter(nsIFrame* aSourceFrame, return false; } +typedef nsTArray FrameTArray; + +/* static */ void +nsTableFrame::DestroyPositionedTablePartArray(void* aPropertyValue) +{ + auto positionedObjs = static_cast(aPropertyValue); + delete positionedObjs; +} + +/* static */ void +nsTableFrame::RegisterPositionedTablePart(nsIFrame* aFrame) +{ + nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(aFrame); + MOZ_ASSERT(tableFrame, "Should have a table frame here"); + tableFrame = static_cast(tableFrame->FirstContinuation()); + + // Retrieve the positioned parts array for this table. + FrameProperties props = tableFrame->Properties(); + auto positionedParts = + static_cast(props.Get(PositionedTablePartArray())); + + // Lazily create the array if it doesn't exist yet. + if (!positionedParts) { + positionedParts = new FrameTArray; + props.Set(PositionedTablePartArray(), positionedParts); + } + + // Add this frame to the list. + positionedParts->AppendElement(aFrame); +} + +/* static */ void +nsTableFrame::UnregisterPositionedTablePart(nsIFrame* aFrame, + nsIFrame* aDestructRoot) +{ + // Retrieve the table frame, and ensure that we hit aDestructRoot on the way. + // If we don't, that means that the table frame will be destroyed, so we don't + // need to bother with unregistering this frame. + nsTableFrame* tableFrame = GetTableFramePassingThrough(aDestructRoot, aFrame); + if (!tableFrame) { + return; + } + tableFrame = static_cast(tableFrame->FirstContinuation()); + + // Retrieve the positioned parts array for this table. + FrameProperties props = tableFrame->Properties(); + auto positionedParts = + static_cast(props.Get(PositionedTablePartArray())); + + // Remove the frame. + MOZ_ASSERT(positionedParts && + positionedParts->IndexOf(aFrame) != FrameTArray::NoIndex, + "Asked to unregister a positioned table part that wasn't registered"); + if (positionedParts) { + positionedParts->RemoveElement(aFrame); + } +} + // XXX this needs to be cleaned up so that the frame constructor breaks out col group // frames into a separate child list, bug 343048. nsresult @@ -1814,6 +1873,10 @@ nsresult nsTableFrame::Reflow(nsPresContext* aPresContext, AdjustForCollapsingRowsCols(aDesiredSize, borderPadding); } + // If there are any relatively-positioned table parts, we need to reflow their + // absolutely-positioned descendants now that their dimensions are final. + FixupPositionedTableParts(aPresContext, aReflowState); + // make sure the table overflow area does include the table rect. nsRect tableRect(0, 0, aDesiredSize.Width(), aDesiredSize.Height()) ; @@ -1834,6 +1897,57 @@ nsresult nsTableFrame::Reflow(nsPresContext* aPresContext, return rv; } +void +nsTableFrame::FixupPositionedTableParts(nsPresContext* aPresContext, + const nsHTMLReflowState& aReflowState) +{ + auto positionedParts = + static_cast(Properties().Get(PositionedTablePartArray())); + if (!positionedParts) { + return; + } + + OverflowChangedTracker overflowTracker; + overflowTracker.SetSubtreeRoot(this); + + for (size_t i = 0; i < positionedParts->Length(); ++i) { + nsIFrame* positionedPart = positionedParts->ElementAt(i); + + // As we've already finished reflow, positionedParts's size and overflow + // areas have already been assigned, so we just pull them back out. + nsSize size(positionedPart->GetSize()); + nsHTMLReflowMetrics desiredSize(aReflowState.GetWritingMode()); + desiredSize.Width() = size.width; + desiredSize.Height() = size.height; + desiredSize.mOverflowAreas = positionedPart->GetOverflowAreasRelativeToSelf(); + + // Construct a dummy reflow state and reflow status. + // XXX(seth): Note that the dummy reflow state doesn't have a correct + // chain of parent reflow states. It also doesn't necessarily have a + // correct containing block. + nsHTMLReflowState reflowState(aPresContext, positionedPart, + aReflowState.rendContext, + nsSize(size.width, NS_UNCONSTRAINEDSIZE), + nsHTMLReflowState::DUMMY_PARENT_REFLOW_STATE); + nsReflowStatus reflowStatus = NS_FRAME_COMPLETE; + + // Reflow absolutely-positioned descendants of the positioned part. + // FIXME: Unconditionally using NS_UNCONSTRAINEDSIZE for the height and + // ignoring any change to the reflow status aren't correct. We'll never + // paginate absolutely positioned frames. + overflowTracker.AddFrame(positionedPart); + nsFrame* positionedFrame = static_cast(positionedPart); + positionedFrame->FinishReflowWithAbsoluteFrames(PresContext(), + desiredSize, + reflowState, + reflowStatus, + true); + } + + // Propagate updated overflow areas up the tree. + overflowTracker.Flush(); +} + bool nsTableFrame::UpdateOverflow() { @@ -3444,6 +3558,31 @@ nsTableFrame::GetTableFrame(nsIFrame* aFrame) return nullptr; } +nsTableFrame* +nsTableFrame::GetTableFramePassingThrough(nsIFrame* aMustPassThrough, + nsIFrame* aFrame) +{ + MOZ_ASSERT(aMustPassThrough == aFrame || + nsLayoutUtils::IsProperAncestorFrame(aMustPassThrough, aFrame), + "aMustPassThrough should be an ancestor"); + + // Retrieve the table frame, and ensure that we hit aMustPassThrough on the + // way. If we don't, just return null. + nsTableFrame* tableFrame = nullptr; + for (nsIFrame* ancestor = aFrame; ancestor; ancestor = ancestor->GetParent()) { + if (nsGkAtoms::tableFrame == ancestor->GetType()) { + tableFrame = static_cast(ancestor); + break; + } + if (ancestor == aMustPassThrough) { + return nullptr; + } + } + + MOZ_ASSERT(tableFrame, "Should have a table frame here"); + return tableFrame; +} + bool nsTableFrame::IsAutoHeight() { diff --git a/layout/tables/nsTableFrame.h b/layout/tables/nsTableFrame.h index 44646540905..bc2141c65e5 100644 --- a/layout/tables/nsTableFrame.h +++ b/layout/tables/nsTableFrame.h @@ -111,6 +111,9 @@ class nsTableFrame : public nsContainerFrame public: NS_DECL_FRAMEARENA_HELPERS + static void DestroyPositionedTablePartArray(void* aPropertyValue); + NS_DECLARE_FRAME_PROPERTY(PositionedTablePartArray, DestroyPositionedTablePartArray) + /** nsTableOuterFrame has intimate knowledge of the inner table frame */ friend class nsTableOuterFrame; @@ -146,6 +149,15 @@ public: static bool PageBreakAfter(nsIFrame* aSourceFrame, nsIFrame* aNextFrame); + + // Register a positioned table part with its nsTableFrame. These objects will + // be visited by FixupPositionedTableParts after reflow is complete. (See that + // function for more explanation.) Should be called during frame construction. + static void RegisterPositionedTablePart(nsIFrame* aFrame); + + // Unregister a positioned table part with its nsTableFrame. + static void UnregisterPositionedTablePart(nsIFrame* aFrame, + nsIFrame* aDestructRoot); nsPoint GetFirstSectionOrigin(const nsHTMLReflowState& aReflowState) const; /* @@ -179,6 +191,12 @@ public: /** helper method to find the table parent of any table frame object */ static nsTableFrame* GetTableFrame(nsIFrame* aSourceFrame); + /* Like GetTableFrame, but will return nullptr if we don't pass through + * aMustPassThrough on the way to the table. + */ + static nsTableFrame* GetTableFramePassingThrough(nsIFrame* aMustPassThrough, + nsIFrame* aSourceFrame); + typedef void (* DisplayGenericTablePartTraversal) (nsDisplayListBuilder* aBuilder, nsFrame* aFrame, const nsRect& aDirtyRect, const nsDisplayListSet& aLists); @@ -549,6 +567,18 @@ protected: void AdjustForCollapsingRowsCols(nsHTMLReflowMetrics& aDesiredSize, nsMargin aBorderPadding); + /** FixupPositionedTableParts is called at the end of table reflow to reflow + * the absolutely positioned descendants of positioned table parts. This is + * necessary because the dimensions of table parts may change after they've + * been reflowed (e.g. in AdjustForCollapsingRowsCols). + */ + + void FixupPositionedTableParts(nsPresContext* aPresContext, + const nsHTMLReflowState& aReflowState); + + // Clears the list of positioned table parts. + void ClearAllPositionedTableParts(); + nsITableLayoutStrategy* LayoutStrategy() const { return static_cast(FirstInFlow())-> mTableLayoutStrategy; diff --git a/layout/tables/nsTableRowFrame.cpp b/layout/tables/nsTableRowFrame.cpp index e941a654ef6..efeeb671826 100644 --- a/layout/tables/nsTableRowFrame.cpp +++ b/layout/tables/nsTableRowFrame.cpp @@ -150,6 +150,16 @@ nsTableRowFrame::Init(nsIContent* aContent, } } +void +nsTableRowFrame::DestroyFrom(nsIFrame* aDestructRoot) +{ + if (GetStateBits() & NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN) { + nsTableFrame::UnregisterPositionedTablePart(this, aDestructRoot); + } + + nsContainerFrame::DestroyFrom(aDestructRoot); +} + /* virtual */ void nsTableRowFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext) { diff --git a/layout/tables/nsTableRowFrame.h b/layout/tables/nsTableRowFrame.h index 99925d6981b..0aedf578ff3 100644 --- a/layout/tables/nsTableRowFrame.h +++ b/layout/tables/nsTableRowFrame.h @@ -36,6 +36,9 @@ public: virtual void Init(nsIContent* aContent, nsIFrame* aParent, nsIFrame* aPrevInFlow) MOZ_OVERRIDE; + + virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE; + /** @see nsIFrame::DidSetStyleContext */ virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) MOZ_OVERRIDE; diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp index 044eda6b504..307a3b3eff6 100644 --- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -34,6 +34,16 @@ nsTableRowGroupFrame::~nsTableRowGroupFrame() { } +void +nsTableRowGroupFrame::DestroyFrom(nsIFrame* aDestructRoot) +{ + if (GetStateBits() & NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN) { + nsTableFrame::UnregisterPositionedTablePart(this, aDestructRoot); + } + + nsContainerFrame::DestroyFrom(aDestructRoot); +} + NS_QUERYFRAME_HEAD(nsTableRowGroupFrame) NS_QUERYFRAME_ENTRY(nsTableRowGroupFrame) NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame) diff --git a/layout/tables/nsTableRowGroupFrame.h b/layout/tables/nsTableRowGroupFrame.h index ff466333743..98f27b47afb 100644 --- a/layout/tables/nsTableRowGroupFrame.h +++ b/layout/tables/nsTableRowGroupFrame.h @@ -67,6 +67,9 @@ public: */ friend nsIFrame* NS_NewTableRowGroupFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); virtual ~nsTableRowGroupFrame(); + + virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE; + /** @see nsIFrame::DidSetStyleContext */ virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) MOZ_OVERRIDE; From 750ecf0bd495132a9074b09ff1e7c7fe7c6236f3 Mon Sep 17 00:00:00 2001 From: Seth Fowler Date: Mon, 3 Mar 2014 19:40:31 -0800 Subject: [PATCH 23/34] Bug 63895 (Part 3) - Add tests for positioned internal table objects serving as absolute containing blocks. r=dbaron --- layout/reftests/abs-pos/reftest.list | 20 +++++++ layout/reftests/abs-pos/table-cell-1.html | 36 +++++++++++++ layout/reftests/abs-pos/table-cell-2.html | 38 +++++++++++++ layout/reftests/abs-pos/table-cell-3.html | 50 +++++++++++++++++ layout/reftests/abs-pos/table-cell-4.html | 50 +++++++++++++++++ .../abs-pos/table-footer-group-1.html | 38 +++++++++++++ .../abs-pos/table-footer-group-2.html | 40 ++++++++++++++ .../abs-pos/table-footer-group-3.html | 54 +++++++++++++++++++ .../abs-pos/table-footer-group-4.html | 54 +++++++++++++++++++ .../abs-pos/table-header-group-1.html | 38 +++++++++++++ .../abs-pos/table-header-group-2.html | 40 ++++++++++++++ .../abs-pos/table-header-group-3.html | 54 +++++++++++++++++++ .../abs-pos/table-header-group-4.html | 54 +++++++++++++++++++ .../abs-pos/table-internal-1-ref.html | 32 +++++++++++ .../abs-pos/table-internal-2-ref.html | 34 ++++++++++++ .../abs-pos/table-internal-3-ref.html | 52 ++++++++++++++++++ .../abs-pos/table-internal-4-ref.html | 53 ++++++++++++++++++ layout/reftests/abs-pos/table-row-1.html | 36 +++++++++++++ layout/reftests/abs-pos/table-row-2.html | 38 +++++++++++++ layout/reftests/abs-pos/table-row-3.html | 50 +++++++++++++++++ layout/reftests/abs-pos/table-row-4.html | 50 +++++++++++++++++ .../reftests/abs-pos/table-row-group-1.html | 38 +++++++++++++ .../reftests/abs-pos/table-row-group-2.html | 40 ++++++++++++++ .../reftests/abs-pos/table-row-group-3.html | 54 +++++++++++++++++++ .../reftests/abs-pos/table-row-group-4.html | 54 +++++++++++++++++++ 25 files changed, 1097 insertions(+) create mode 100644 layout/reftests/abs-pos/table-cell-1.html create mode 100644 layout/reftests/abs-pos/table-cell-2.html create mode 100644 layout/reftests/abs-pos/table-cell-3.html create mode 100644 layout/reftests/abs-pos/table-cell-4.html create mode 100644 layout/reftests/abs-pos/table-footer-group-1.html create mode 100644 layout/reftests/abs-pos/table-footer-group-2.html create mode 100644 layout/reftests/abs-pos/table-footer-group-3.html create mode 100644 layout/reftests/abs-pos/table-footer-group-4.html create mode 100644 layout/reftests/abs-pos/table-header-group-1.html create mode 100644 layout/reftests/abs-pos/table-header-group-2.html create mode 100644 layout/reftests/abs-pos/table-header-group-3.html create mode 100644 layout/reftests/abs-pos/table-header-group-4.html create mode 100644 layout/reftests/abs-pos/table-internal-1-ref.html create mode 100644 layout/reftests/abs-pos/table-internal-2-ref.html create mode 100644 layout/reftests/abs-pos/table-internal-3-ref.html create mode 100644 layout/reftests/abs-pos/table-internal-4-ref.html create mode 100644 layout/reftests/abs-pos/table-row-1.html create mode 100644 layout/reftests/abs-pos/table-row-2.html create mode 100644 layout/reftests/abs-pos/table-row-3.html create mode 100644 layout/reftests/abs-pos/table-row-4.html create mode 100644 layout/reftests/abs-pos/table-row-group-1.html create mode 100644 layout/reftests/abs-pos/table-row-group-2.html create mode 100644 layout/reftests/abs-pos/table-row-group-3.html create mode 100644 layout/reftests/abs-pos/table-row-group-4.html diff --git a/layout/reftests/abs-pos/reftest.list b/layout/reftests/abs-pos/reftest.list index f4c24725822..1516e88e29f 100644 --- a/layout/reftests/abs-pos/reftest.list +++ b/layout/reftests/abs-pos/reftest.list @@ -5,6 +5,26 @@ fuzzy-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)&&!layersGPUAccelerated&&!azur == table-1.html table-1-ref.html == table-2.html table-2-ref.html == table-3.html table-3-ref.html +== table-cell-1.html table-internal-1-ref.html +== table-cell-2.html table-internal-2-ref.html +== table-cell-3.html table-internal-3-ref.html +== table-cell-4.html table-internal-4-ref.html +== table-row-1.html table-internal-1-ref.html +== table-row-2.html table-internal-2-ref.html +== table-row-3.html table-internal-3-ref.html +== table-row-4.html table-internal-4-ref.html +== table-row-group-1.html table-internal-1-ref.html +== table-row-group-2.html table-internal-2-ref.html +== table-row-group-3.html table-internal-3-ref.html +== table-row-group-4.html table-internal-4-ref.html +== table-header-group-1.html table-internal-1-ref.html +== table-header-group-2.html table-internal-2-ref.html +== table-header-group-3.html table-internal-3-ref.html +== table-header-group-4.html table-internal-4-ref.html +== table-footer-group-1.html table-internal-1-ref.html +== table-footer-group-2.html table-internal-2-ref.html +== table-footer-group-3.html table-internal-3-ref.html +== table-footer-group-4.html table-internal-4-ref.html == continuation-positioned-inline-1.html continuation-positioned-inline-ref.html == continuation-positioned-inline-2.html continuation-positioned-inline-ref.html == scrollframe-1.html scrollframe-1-ref.html diff --git a/layout/reftests/abs-pos/table-cell-1.html b/layout/reftests/abs-pos/table-cell-1.html new file mode 100644 index 00000000000..b0c03e9a0b2 --- /dev/null +++ b/layout/reftests/abs-pos/table-cell-1.html @@ -0,0 +1,36 @@ + + + + + + + The green square should not completely cover the blue square. +
+ + + + +
+
+
+ + diff --git a/layout/reftests/abs-pos/table-cell-2.html b/layout/reftests/abs-pos/table-cell-2.html new file mode 100644 index 00000000000..457c6b03568 --- /dev/null +++ b/layout/reftests/abs-pos/table-cell-2.html @@ -0,0 +1,38 @@ + + + + + + + The green square should not completely cover the blue square. +
+
+ + + + +
+
+
+
+ + diff --git a/layout/reftests/abs-pos/table-cell-3.html b/layout/reftests/abs-pos/table-cell-3.html new file mode 100644 index 00000000000..52f89b1caf5 --- /dev/null +++ b/layout/reftests/abs-pos/table-cell-3.html @@ -0,0 +1,50 @@ + + + + + + + The green square should not touch the blue square. + + + + + + + + + + + + + +
+
+
+ + diff --git a/layout/reftests/abs-pos/table-cell-4.html b/layout/reftests/abs-pos/table-cell-4.html new file mode 100644 index 00000000000..9831b5c9910 --- /dev/null +++ b/layout/reftests/abs-pos/table-cell-4.html @@ -0,0 +1,50 @@ + + + + + + + The green square should not touch the blue square. + + + + + + + + + + + + + +
+
+
+ + diff --git a/layout/reftests/abs-pos/table-footer-group-1.html b/layout/reftests/abs-pos/table-footer-group-1.html new file mode 100644 index 00000000000..2f94a6313de --- /dev/null +++ b/layout/reftests/abs-pos/table-footer-group-1.html @@ -0,0 +1,38 @@ + + + + + + + The green square should not completely cover the blue square. +
+ + + + + + +
+
+
+ + diff --git a/layout/reftests/abs-pos/table-footer-group-2.html b/layout/reftests/abs-pos/table-footer-group-2.html new file mode 100644 index 00000000000..b5d70f3ef77 --- /dev/null +++ b/layout/reftests/abs-pos/table-footer-group-2.html @@ -0,0 +1,40 @@ + + + + + + + The green square should not completely cover the blue square. +
+
+ + + + + + +
+
+
+
+ + diff --git a/layout/reftests/abs-pos/table-footer-group-3.html b/layout/reftests/abs-pos/table-footer-group-3.html new file mode 100644 index 00000000000..f5e60a0aa12 --- /dev/null +++ b/layout/reftests/abs-pos/table-footer-group-3.html @@ -0,0 +1,54 @@ + + + + + + + The green square should not touch the blue square. + + + + + + + + + + + + + + + + + +
+
+
+ + diff --git a/layout/reftests/abs-pos/table-footer-group-4.html b/layout/reftests/abs-pos/table-footer-group-4.html new file mode 100644 index 00000000000..23f1a351eaf --- /dev/null +++ b/layout/reftests/abs-pos/table-footer-group-4.html @@ -0,0 +1,54 @@ + + + + + + + The green square should not touch the blue square. + + + + + + + + + + + + + + + + + +
+
+
+ + diff --git a/layout/reftests/abs-pos/table-header-group-1.html b/layout/reftests/abs-pos/table-header-group-1.html new file mode 100644 index 00000000000..346cafeea91 --- /dev/null +++ b/layout/reftests/abs-pos/table-header-group-1.html @@ -0,0 +1,38 @@ + + + + + + + The green square should not completely cover the blue square. +
+ + + + + + +
+
+
+ + diff --git a/layout/reftests/abs-pos/table-header-group-2.html b/layout/reftests/abs-pos/table-header-group-2.html new file mode 100644 index 00000000000..7573e917f5d --- /dev/null +++ b/layout/reftests/abs-pos/table-header-group-2.html @@ -0,0 +1,40 @@ + + + + + + + The green square should not completely cover the blue square. +
+
+ + + + + + +
+
+
+
+ + diff --git a/layout/reftests/abs-pos/table-header-group-3.html b/layout/reftests/abs-pos/table-header-group-3.html new file mode 100644 index 00000000000..0e9697d55fd --- /dev/null +++ b/layout/reftests/abs-pos/table-header-group-3.html @@ -0,0 +1,54 @@ + + + + + + + The green square should not touch the blue square. + + + + + + + + + + + + + + + + + +
+
+
+ + diff --git a/layout/reftests/abs-pos/table-header-group-4.html b/layout/reftests/abs-pos/table-header-group-4.html new file mode 100644 index 00000000000..4533a205f90 --- /dev/null +++ b/layout/reftests/abs-pos/table-header-group-4.html @@ -0,0 +1,54 @@ + + + + + + + The green square should not touch the blue square. + + + + + + + + + + + + + + + + + +
+
+
+ + diff --git a/layout/reftests/abs-pos/table-internal-1-ref.html b/layout/reftests/abs-pos/table-internal-1-ref.html new file mode 100644 index 00000000000..34b141c18cc --- /dev/null +++ b/layout/reftests/abs-pos/table-internal-1-ref.html @@ -0,0 +1,32 @@ + + + + + + + The green square should not completely cover the blue square. +
+
+
+
+ + diff --git a/layout/reftests/abs-pos/table-internal-2-ref.html b/layout/reftests/abs-pos/table-internal-2-ref.html new file mode 100644 index 00000000000..308935ede01 --- /dev/null +++ b/layout/reftests/abs-pos/table-internal-2-ref.html @@ -0,0 +1,34 @@ + + + + + + + The green square should not completely cover the blue square. +
+
+
+
+
+
+ + diff --git a/layout/reftests/abs-pos/table-internal-3-ref.html b/layout/reftests/abs-pos/table-internal-3-ref.html new file mode 100644 index 00000000000..fbf74508d3f --- /dev/null +++ b/layout/reftests/abs-pos/table-internal-3-ref.html @@ -0,0 +1,52 @@ + + + + + + + The green square should not touch the blue square. + + + + + + + + + + + + + +
+
+
+
+
+ + diff --git a/layout/reftests/abs-pos/table-internal-4-ref.html b/layout/reftests/abs-pos/table-internal-4-ref.html new file mode 100644 index 00000000000..9180ba705f9 --- /dev/null +++ b/layout/reftests/abs-pos/table-internal-4-ref.html @@ -0,0 +1,53 @@ + + + + + + + The green square should not touch the blue square. + + + + + + + + + + + + + +
+
+
+
+
+ + diff --git a/layout/reftests/abs-pos/table-row-1.html b/layout/reftests/abs-pos/table-row-1.html new file mode 100644 index 00000000000..6caf394e4b3 --- /dev/null +++ b/layout/reftests/abs-pos/table-row-1.html @@ -0,0 +1,36 @@ + + + + + + + The green square should not completely cover the blue square. +
+ + + + +
+
+
+ + diff --git a/layout/reftests/abs-pos/table-row-2.html b/layout/reftests/abs-pos/table-row-2.html new file mode 100644 index 00000000000..ef9a6f5d716 --- /dev/null +++ b/layout/reftests/abs-pos/table-row-2.html @@ -0,0 +1,38 @@ + + + + + + + The green square should not completely cover the blue square. +
+
+ + + + +
+
+
+
+ + diff --git a/layout/reftests/abs-pos/table-row-3.html b/layout/reftests/abs-pos/table-row-3.html new file mode 100644 index 00000000000..fbb2e77ec9e --- /dev/null +++ b/layout/reftests/abs-pos/table-row-3.html @@ -0,0 +1,50 @@ + + + + + + + The green square should not touch the blue square. + + + + + + + + + + + + + +
+
+
+ + diff --git a/layout/reftests/abs-pos/table-row-4.html b/layout/reftests/abs-pos/table-row-4.html new file mode 100644 index 00000000000..8785e0752f1 --- /dev/null +++ b/layout/reftests/abs-pos/table-row-4.html @@ -0,0 +1,50 @@ + + + + + + + The green square should not touch the blue square. + + + + + + + + + + + + + +
+
+
+ + diff --git a/layout/reftests/abs-pos/table-row-group-1.html b/layout/reftests/abs-pos/table-row-group-1.html new file mode 100644 index 00000000000..9f5072d7629 --- /dev/null +++ b/layout/reftests/abs-pos/table-row-group-1.html @@ -0,0 +1,38 @@ + + + + + + + The green square should not completely cover the blue square. +
+ + + + + + +
+
+
+ + diff --git a/layout/reftests/abs-pos/table-row-group-2.html b/layout/reftests/abs-pos/table-row-group-2.html new file mode 100644 index 00000000000..619a8cc4d67 --- /dev/null +++ b/layout/reftests/abs-pos/table-row-group-2.html @@ -0,0 +1,40 @@ + + + + + + + The green square should not completely cover the blue square. +
+
+ + + + + + +
+
+
+
+ + diff --git a/layout/reftests/abs-pos/table-row-group-3.html b/layout/reftests/abs-pos/table-row-group-3.html new file mode 100644 index 00000000000..d5d6686b15a --- /dev/null +++ b/layout/reftests/abs-pos/table-row-group-3.html @@ -0,0 +1,54 @@ + + + + + + + The green square should not touch the blue square. + + + + + + + + + + + + + + + + + +
+
+
+ + diff --git a/layout/reftests/abs-pos/table-row-group-4.html b/layout/reftests/abs-pos/table-row-group-4.html new file mode 100644 index 00000000000..c8430060c21 --- /dev/null +++ b/layout/reftests/abs-pos/table-row-group-4.html @@ -0,0 +1,54 @@ + + + + + + + The green square should not touch the blue square. + + + + + + + + + + + + + + + + + +
+
+
+ + From 1b528727d5b709fcddeaebf7c5ca71144b4166b9 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Mon, 3 Mar 2014 22:47:56 -0500 Subject: [PATCH 24/34] Bug 978594 - Part 1: Remove the old code to support MSVC 2005 and 2008 from gfx/cairo/libpixman/src/Makefile.in; r=glandium --- gfx/cairo/libpixman/src/Makefile.in | 7 ------- 1 file changed, 7 deletions(-) diff --git a/gfx/cairo/libpixman/src/Makefile.in b/gfx/cairo/libpixman/src/Makefile.in index ba025ae0ede..54458dc7f4b 100644 --- a/gfx/cairo/libpixman/src/Makefile.in +++ b/gfx/cairo/libpixman/src/Makefile.in @@ -11,16 +11,9 @@ ifdef _MSC_VER ifeq (86,$(findstring 86,$(OS_TEST))) USE_SSE2=1 MMX_CFLAGS= -ifneq (,$(filter 1400 1500, $(_MSC_VER))) -# MSVC 2005 and 2008 generate code that breaks alignment -# restrictions in debug mode so always optimize. -# See bug 640250 for more info. -SSE2_CFLAGS=-O2 -else SSE2_CFLAGS= endif endif -endif ifdef GNU_CC ifeq (ppc,$(findstring ppc,$(OS_TEST))) From 00ee8fa24b8a7045c4616215fffcd6686474fe55 Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Mon, 3 Mar 2014 20:14:48 -0800 Subject: [PATCH 25/34] Back out c75ce018e5db (bug 978784) for Windows build bustage CLOSED TREE --- build/autoconf/icu.m4 | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/build/autoconf/icu.m4 b/build/autoconf/icu.m4 index 4a4f5e8b567..2dcf93eada0 100644 --- a/build/autoconf/icu.m4 +++ b/build/autoconf/icu.m4 @@ -119,8 +119,11 @@ AC_SUBST(ICU_LIB_NAMES) AC_SUBST(MOZ_ICU_LIBS) if test -n "$ENABLE_INTL_API" -a -z "$MOZ_NATIVE_ICU"; then + dnl We build ICU as a static library for non-shared js builds and as a shared library for shared js builds. if test -z "$MOZ_SHARED_ICU"; then AC_DEFINE(U_STATIC_IMPLEMENTATION) + else + AC_DEFINE(U_COMBINED_IMPLEMENTATION) fi dnl Source files that use ICU should have control over which parts of the ICU dnl namespace they want to use. @@ -137,12 +140,6 @@ if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then if test -n "$ENABLE_INTL_API" -a -z "$MOZ_NATIVE_ICU"; then # Set ICU compile options ICU_CPPFLAGS="" - dnl We build ICU as a static library for non-shared js builds and as a shared library for shared js builds. - if test -z "$MOZ_SHARED_ICU"; then - ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_STATIC_IMPLEMENTATION" - else - ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_COMBINED_IMPLEMENTATION" - fi # don't use icu namespace automatically in client code ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_USING_ICU_NAMESPACE=0" # don't include obsolete header files From eb5f1f2a2d68594f9da97a9d6843b5487e3deca0 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Mon, 3 Mar 2014 22:38:55 -0500 Subject: [PATCH 26/34] Bug 978784 - Stop exporting ICU symbols from xul.dll; r=glandium --- CLOBBER | 2 +- build/autoconf/icu.m4 | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CLOBBER b/CLOBBER index 468558ab8ac..98f0cb22dfa 100644 --- a/CLOBBER +++ b/CLOBBER @@ -22,4 +22,4 @@ # changes to stick? As of bug 928195, this shouldn't be necessary! Please # don't change CLOBBER for WebIDL changes any more. -Update CLOBBER for bug 939672 moves file location and requires clobber build. +Update CLOBBER for bug 978784 because it touches the ICU build system. diff --git a/build/autoconf/icu.m4 b/build/autoconf/icu.m4 index 2dcf93eada0..4a4f5e8b567 100644 --- a/build/autoconf/icu.m4 +++ b/build/autoconf/icu.m4 @@ -119,11 +119,8 @@ AC_SUBST(ICU_LIB_NAMES) AC_SUBST(MOZ_ICU_LIBS) if test -n "$ENABLE_INTL_API" -a -z "$MOZ_NATIVE_ICU"; then - dnl We build ICU as a static library for non-shared js builds and as a shared library for shared js builds. if test -z "$MOZ_SHARED_ICU"; then AC_DEFINE(U_STATIC_IMPLEMENTATION) - else - AC_DEFINE(U_COMBINED_IMPLEMENTATION) fi dnl Source files that use ICU should have control over which parts of the ICU dnl namespace they want to use. @@ -140,6 +137,12 @@ if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then if test -n "$ENABLE_INTL_API" -a -z "$MOZ_NATIVE_ICU"; then # Set ICU compile options ICU_CPPFLAGS="" + dnl We build ICU as a static library for non-shared js builds and as a shared library for shared js builds. + if test -z "$MOZ_SHARED_ICU"; then + ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_STATIC_IMPLEMENTATION" + else + ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_COMBINED_IMPLEMENTATION" + fi # don't use icu namespace automatically in client code ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_USING_ICU_NAMESPACE=0" # don't include obsolete header files From ff14895221bb43ec8ecc3d1a66d2228ca65658a0 Mon Sep 17 00:00:00 2001 From: Kyle Machulis Date: Mon, 3 Mar 2014 20:05:14 -0800 Subject: [PATCH 27/34] Bug 979088 - Add padding to pickling in ipc so valgrind doesn't complain; r=bent --- ipc/chromium/src/base/pickle.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ipc/chromium/src/base/pickle.cc b/ipc/chromium/src/base/pickle.cc index 3d58226f0d2..582d6af0c24 100644 --- a/ipc/chromium/src/base/pickle.cc +++ b/ipc/chromium/src/base/pickle.cc @@ -511,6 +511,16 @@ char* Pickle::BeginWrite(uint32_t length, uint32_t alignment) { DCHECK(intptr_t(buffer) % alignment == 0); header_->payload_size = new_size; + +#ifdef MOZ_VALGRIND + // pad the trailing end as well, so that valgrind + // doesn't complain when we write the buffer + padding = AlignInt(length) - length; + if (padding) { + memset(buffer + length, kBytePaddingMarker, padding); + } +#endif + return buffer; } From 96e380e604ab6c8845c9ef440114d26a18b3bd0a Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Mon, 3 Mar 2014 22:33:09 -0600 Subject: [PATCH 28/34] Bug 978248. If the scrollframe has gone away just use the scroll offset that the APZC controller had instead of (0,0). r=botond --- widget/xpwidgets/APZCCallbackHelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/widget/xpwidgets/APZCCallbackHelper.cpp b/widget/xpwidgets/APZCCallbackHelper.cpp index 04a8ddd0b38..6bf6dc43e10 100644 --- a/widget/xpwidgets/APZCCallbackHelper.cpp +++ b/widget/xpwidgets/APZCCallbackHelper.cpp @@ -99,7 +99,7 @@ ScrollFrameTo(nsIScrollableFrame* aFrame, const CSSPoint& aPoint, bool& aSuccess aSuccessOut = false; if (!aFrame) { - return CSSPoint(); + return aPoint; } // If the scrollable frame is currently in the middle of an async or smooth From edf71fcafba8bec11ea33341a2b78f00ca58f3f6 Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Mon, 3 Mar 2014 21:26:19 -0800 Subject: [PATCH 29/34] Back out 47afb5f53400 (bug 978784) because it's still busted with a clobber CLOSED TREE --- CLOBBER | 2 +- build/autoconf/icu.m4 | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/CLOBBER b/CLOBBER index 98f0cb22dfa..468558ab8ac 100644 --- a/CLOBBER +++ b/CLOBBER @@ -22,4 +22,4 @@ # changes to stick? As of bug 928195, this shouldn't be necessary! Please # don't change CLOBBER for WebIDL changes any more. -Update CLOBBER for bug 978784 because it touches the ICU build system. +Update CLOBBER for bug 939672 moves file location and requires clobber build. diff --git a/build/autoconf/icu.m4 b/build/autoconf/icu.m4 index 4a4f5e8b567..2dcf93eada0 100644 --- a/build/autoconf/icu.m4 +++ b/build/autoconf/icu.m4 @@ -119,8 +119,11 @@ AC_SUBST(ICU_LIB_NAMES) AC_SUBST(MOZ_ICU_LIBS) if test -n "$ENABLE_INTL_API" -a -z "$MOZ_NATIVE_ICU"; then + dnl We build ICU as a static library for non-shared js builds and as a shared library for shared js builds. if test -z "$MOZ_SHARED_ICU"; then AC_DEFINE(U_STATIC_IMPLEMENTATION) + else + AC_DEFINE(U_COMBINED_IMPLEMENTATION) fi dnl Source files that use ICU should have control over which parts of the ICU dnl namespace they want to use. @@ -137,12 +140,6 @@ if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then if test -n "$ENABLE_INTL_API" -a -z "$MOZ_NATIVE_ICU"; then # Set ICU compile options ICU_CPPFLAGS="" - dnl We build ICU as a static library for non-shared js builds and as a shared library for shared js builds. - if test -z "$MOZ_SHARED_ICU"; then - ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_STATIC_IMPLEMENTATION" - else - ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_COMBINED_IMPLEMENTATION" - fi # don't use icu namespace automatically in client code ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_USING_ICU_NAMESPACE=0" # don't include obsolete header files From 67d11a57eb670cbdb6f4db8e4bcc32b855789d74 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Tue, 4 Mar 2014 05:37:40 +0000 Subject: [PATCH 30/34] bug 969814 - build freetype with support for color bitmap (png) glyphs within opentype fonts. r=ted,jrmuizel --- configure.in | 6 ++++-- media/libpng/mozpngconf.h | 27 ++++++++++++++++-------- widget/gonk/libdisplay/BootAnimation.cpp | 2 +- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/configure.in b/configure.in index 1e8fb551ea9..a515d34e8ea 100644 --- a/configure.in +++ b/configure.in @@ -952,7 +952,7 @@ MOZ_JPEG_CFLAGS= MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)' MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)' -MOZ_PNG_CFLAGS= +MOZ_PNG_CFLAGS="-I$_objdir/dist/include" # needed for freetype compilation MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)' MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)' @@ -8927,8 +8927,10 @@ if test "$MOZ_TREE_FREETYPE"; then export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS" export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS" export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS" + export LIBPNG_CFLAGS="$MOZ_PNG_CFLAGS" + export LIBPNG_LDFLAGS="$MOZ_PNG_LIBS" export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in" - ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --without-png" + ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes" if ! test -e modules; then mkdir modules diff --git a/media/libpng/mozpngconf.h b/media/libpng/mozpngconf.h index 0b5c7420ab3..101c9ef247d 100644 --- a/media/libpng/mozpngconf.h +++ b/media/libpng/mozpngconf.h @@ -66,19 +66,25 @@ #define PNG_READ_SCALE_16_TO_8_SUPPORTED #define PNG_READ_TRANSFORMS_SUPPORTED -/* necessary for boot animation code */ +/* necessary for freetype color bitmap support (Android & B2G) + and boot animation code (Gonk) */ +#if defined(ANDROID) || defined(FT_CONFIG_OPTION_USE_PNG) +#define PNG_READ_PACK_SUPPORTED +#define PNG_READ_FILLER_SUPPORTED +#define PNG_READ_STRIP_16_TO_8_SUPPORTED +#define PNG_READ_USER_TRANSFORM_SUPPORTED +#define PNG_SEQUENTIAL_READ_SUPPORTED +#endif + +/* necessary for boot animation code (Gonk) */ #ifdef MOZ_WIDGET_GONK #define PNG_UNKNOWN_CHUNKS_SUPPORTED #define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED #define PNG_HANDLE_AS_UNKNOWN_SUPPORTED #define PNG_EASY_ACCESS_SUPPORTED #define PNG_READ_BGR_SUPPORTED -#define PNG_READ_FILLER_SUPPORTED #define PNG_READ_GRAY_TO_RGB_SUPPORTED -#define PNG_READ_STRIP_16_TO_8_SUPPORTED #define PNG_READ_STRIP_ALPHA_SUPPORTED -#define PNG_READ_USER_TRANSFORM_SUPPORTED -#define PNG_SEQUENTIAL_READ_SUPPORTED #endif #define PNG_WRITE_SUPPORTED @@ -109,11 +115,8 @@ #define PNG_SETJMP_SUPPORTED #define PNG_STDIO_SUPPORTED #define PNG_TEXT_SUPPORTED - -#ifdef PR_LOGGING #define PNG_ERROR_TEXT_SUPPORTED #define PNG_WARNINGS_SUPPORTED -#endif /* Mangle names of exported libpng functions so different libpng versions can coexist. It is recommended that if you do this, you give your @@ -644,9 +647,11 @@ #define png_realloc_array MOZ_PNG_realloc_array #define png_zstream_error MOZ_PNG_zstream_error +/* needed by FreeType's PNG support */ +#define png_error MOZ_PNG_error + #if defined(PR_LOGGING) && defined(PNG_WARNINGS_SUPPORTED) #define png_warning MOZ_PNG_warning -#define png_error MOZ_PNG_error #define png_chunk_error MOZ_PNG_chunk_err #define png_fixed_error MOZ_PNG_fixed_err #define png_formatted_warning MOZ_PNG_formatted_warning @@ -656,4 +661,8 @@ #define png_warning_parameter_unsigned MOZ_PNG_warn_param_unsigned #endif +#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED) +#define png_set_packing MOZ_PNG_set_packing +#endif + #endif /* MOZPNGCONF_H */ diff --git a/widget/gonk/libdisplay/BootAnimation.cpp b/widget/gonk/libdisplay/BootAnimation.cpp index a30175a4bdb..49e47623244 100644 --- a/widget/gonk/libdisplay/BootAnimation.cpp +++ b/widget/gonk/libdisplay/BootAnimation.cpp @@ -267,7 +267,7 @@ RawReader(png_structp png_ptr, png_bytep data, png_size_t length) { RawReadState *state = (RawReadState *)png_get_io_ptr(png_ptr); if (length > (state->length - state->offset)) - png_err(png_ptr); + png_error(png_ptr, "PNG read overrun"); memcpy(data, state->start + state->offset, length); state->offset += length; From 46d21b2ed490a675bf6f6cbfd8349cc592eddc38 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Tue, 4 Mar 2014 05:37:40 +0000 Subject: [PATCH 31/34] bug 974575 - backport Behdad's patches for color bitmap glyph support from current cairo trunk. r=jrmuizel * * * [ft] Fix resizing of bitmap fonts From b94a519aad3d5b50aa6de47ee16ee6a099de9791 Mon Sep 17 00:00:00 2001 Say, you were asking cairo for a font at 200px. For bitmap-only fonts, cairo was finding the closes strike size and using it. If the strike was at 20px, well, that's what you were getting. We now scale that 20px strike by a factor of 10 to get the correct size rendering. Note that by itself this patch doesn't change much on the Linux desktop. The reason is that the size you are interested in (eg. 200px) is lost by fontconfig. When you request a font at 200px, fontconfig returns a font pattern that says 20px, and so the next layers thing you want a font at 20px. To address that, one also needs a piece of fontconfig config that puts the 200 back into the pixelsize. Something like this: false size dpi 0.0138888888888 I'm going to try to upstream this config so it will be enabled by default. The config can be a bit smarter. For example, if metricshinting is enabled and the size difference is small, we may as well not scale. The nice thing about this is that the configuration of whether and when to scale bitmaps will be done in fontconfig, not cairo / Qt / ... code. --- * * * [FT] Prefer downscaling bitmap glyphs to upscaling From a8f1b456db744e33a10b2301df03528787e5b1ca Mon Sep 17 00:00:00 2001 Say, you have bitmap strikes for sizes 50ppem and 100ppem. To render at 60ppem, it's much better to downscale the 100ppem bitmap than upscale 50ppem one. Prefer downscaling. --- * * * [ft] I meant fabs(), not abs() From 13bd8d09b44e50649f6fc4d58d036bc32c1d5c5b Mon Sep 17 00:00:00 2001 --- * * * [ft] Fix memory bug in copying bitmaps From a0f556f37fb7016aa304b7cf0e811c0d38f0b969 Mon Sep 17 00:00:00 2001 --- * * * [ft] Fix wrong assumptions From e738079302a968b7b1fb9101cd4d92a8887bedce Mon Sep 17 00:00:00 2001 If subpixel rendering is enabled, but FT returns a 8bit gray bitmap (perhaps because the font has 8bit embedded bitmaps) we were hitting the assertions because the assumptions made were wrong. Fix up. --- * * * Towards support loading color glyphs from FreeType From 2cc353c3dbe01b4d8f65d6de800f2b1d6004a1c2 Mon Sep 17 00:00:00 2001 See comments. --- * * * Support 2bit and 4bit embedded bitmaps From 9444ef09ccde2735258cc1bd2f1912119a32dd88 Mon Sep 17 00:00:00 2001 --- * * * [ft] Fix math From 7d26341072b13a78d4b3fe58779057ac020be487 Mon Sep 17 00:00:00 2001 --- * * * [ft] Add missing include From 0554d76402321b25cc952180e4d19436a9038d1a Mon Sep 17 00:00:00 2001 --- * * * [ft] Fix alignment From 34a747e7bdeba1cfe17318f80fbe6720d47bc023 Mon Sep 17 00:00:00 2001 --- * * * [ft] Ensure alignment of bitmaps received from FreeType From 46d9db96d460fea72f0420102e8a90c6a7231f79 Mon Sep 17 00:00:00 2001 --- --- gfx/cairo/cairo/src/cairo-ft-font.c | 201 +++++++++++++++++++--------- 1 file changed, 140 insertions(+), 61 deletions(-) diff --git a/gfx/cairo/cairo/src/cairo-ft-font.c b/gfx/cairo/cairo/src/cairo-ft-font.c index d5b0bcea1d2..51bf7aef4bb 100644 --- a/gfx/cairo/cairo/src/cairo-ft-font.c +++ b/gfx/cairo/cairo/src/cairo-ft-font.c @@ -52,6 +52,7 @@ #include FT_FREETYPE_H #include FT_OUTLINE_H #include FT_IMAGE_H +#include FT_BITMAP_H #include FT_TRUETYPE_TABLES_H #if HAVE_FT_GLYPHSLOT_EMBOLDEN #include FT_SYNTHESIS_H @@ -702,7 +703,8 @@ _cairo_ft_unscaled_font_unlock_face (cairo_ft_unscaled_font_t *unscaled) static cairo_status_t _compute_transform (cairo_ft_font_transform_t *sf, - cairo_matrix_t *scale) + cairo_matrix_t *scale, + cairo_ft_unscaled_font_t *unscaled) { cairo_status_t status; double x_scale, y_scale; @@ -730,6 +732,39 @@ _compute_transform (cairo_ft_font_transform_t *sf, if (y_scale < 1.0) y_scale = 1.0; + if (unscaled && (unscaled->face->face_flags & FT_FACE_FLAG_SCALABLE) == 0) { + double min_distance = DBL_MAX; + cairo_bool_t magnify = TRUE; + int i; + int best_i = 0; + double best_x_size = 0; + double best_y_size = 0; + + for (i = 0; i < unscaled->face->num_fixed_sizes; i++) { + double x_size = unscaled->face->available_sizes[i].y_ppem / 64.; + double y_size = unscaled->face->available_sizes[i].y_ppem / 64.; + double distance = y_size - y_scale; + + /* + * distance is positive if current strike is larger than desired + * size, and negative if smaller. + * + * We like to prefer down-scaling to upscaling. + */ + + if ((magnify && distance >= 0) || fabs (distance) <= min_distance) { + magnify = distance < 0; + min_distance = fabs (distance); + best_i = i; + best_x_size = x_size; + best_y_size = y_size; + } + } + + x_scale = best_x_size; + y_scale = best_y_size; + } + sf->x_scale = x_scale; sf->y_scale = y_scale; @@ -767,7 +802,7 @@ _cairo_ft_unscaled_font_set_scale (cairo_ft_unscaled_font_t *unscaled, unscaled->have_scale = TRUE; unscaled->current_scale = *scale; - status = _compute_transform (&sf, scale); + status = _compute_transform (&sf, scale, unscaled); if (unlikely (status)) return status; @@ -792,46 +827,12 @@ _cairo_ft_unscaled_font_set_scale (cairo_ft_unscaled_font_t *unscaled, FT_Set_Transform(unscaled->face, &mat, NULL); - if ((unscaled->face->face_flags & FT_FACE_FLAG_SCALABLE) != 0) { - double x_scale = MIN(sf.x_scale, MAX_FONT_SIZE); - double y_scale = MIN(sf.y_scale, MAX_FONT_SIZE); - error = FT_Set_Char_Size (unscaled->face, - x_scale * 64.0 + .5, - y_scale * 64.0 + .5, - 0, 0); - if (error) - return _cairo_error (CAIRO_STATUS_NO_MEMORY); - } else { - double min_distance = DBL_MAX; - int i; - int best_i = 0; - - for (i = 0; i < unscaled->face->num_fixed_sizes; i++) { -#if HAVE_FT_BITMAP_SIZE_Y_PPEM - double size = unscaled->face->available_sizes[i].y_ppem / 64.; -#else - double size = unscaled->face->available_sizes[i].height; -#endif - double distance = fabs (size - sf.y_scale); - - if (distance <= min_distance) { - min_distance = distance; - best_i = i; - } - } -#if HAVE_FT_BITMAP_SIZE_Y_PPEM - error = FT_Set_Char_Size (unscaled->face, - unscaled->face->available_sizes[best_i].x_ppem, - unscaled->face->available_sizes[best_i].y_ppem, - 0, 0); - if (error) -#endif - error = FT_Set_Pixel_Sizes (unscaled->face, - unscaled->face->available_sizes[best_i].width, - unscaled->face->available_sizes[best_i].height); - if (error) - return _cairo_error (CAIRO_STATUS_NO_MEMORY); - } + error = FT_Set_Char_Size (unscaled->face, + sf.x_scale * 64.0 + .5, + sf.y_scale * 64.0 + .5, + 0, 0); + if (error) + return _cairo_error (CAIRO_STATUS_NO_MEMORY); return CAIRO_STATUS_SUCCESS; } @@ -1114,6 +1115,7 @@ _fill_xrender_bitmap(FT_Bitmap *target, */ static cairo_status_t _get_bitmap_surface (FT_Bitmap *bitmap, + FT_Library library, cairo_bool_t own_buffer, cairo_font_options_t *font_options, cairo_image_surface_t **surface) @@ -1122,6 +1124,7 @@ _get_bitmap_surface (FT_Bitmap *bitmap, unsigned char *data; int format = CAIRO_FORMAT_A8; cairo_image_surface_t *image; + cairo_bool_t component_alpha = FALSE; width = bitmap->width; height = bitmap->rows; @@ -1152,9 +1155,7 @@ _get_bitmap_surface (FT_Bitmap *bitmap, source = bitmap->buffer; dest = data; for (i = height; i; i--) { - memcpy (dest, source, bitmap->pitch); - memset (dest + bitmap->pitch, '\0', stride - bitmap->pitch); - + memcpy (dest, source, stride); source += bitmap->pitch; dest += stride; } @@ -1178,8 +1179,18 @@ _get_bitmap_surface (FT_Bitmap *bitmap, case FT_PIXEL_MODE_LCD: case FT_PIXEL_MODE_LCD_V: case FT_PIXEL_MODE_GRAY: - if (font_options->antialias != CAIRO_ANTIALIAS_SUBPIXEL) { + if (font_options->antialias != CAIRO_ANTIALIAS_SUBPIXEL || + bitmap->pixel_mode == FT_PIXEL_MODE_GRAY) + { stride = bitmap->pitch; + + /* We don't support stride not multiple of 4. */ + if (stride & 3) + { + assert (!own_buffer); + goto convert; + } + if (own_buffer) { data = bitmap->buffer; } else { @@ -1190,21 +1201,72 @@ _get_bitmap_surface (FT_Bitmap *bitmap, memcpy (data, bitmap->buffer, stride * height); } - format = CAIRO_FORMAT_A8; + format = CAIRO_FORMAT_A8; } else { - /* if we get there, the data from the source bitmap - * really comes from _fill_xrender_bitmap, and is - * made of 32-bit ARGB or ABGR values */ - assert (own_buffer != 0); - assert (bitmap->pixel_mode != FT_PIXEL_MODE_GRAY); - - data = bitmap->buffer; - stride = bitmap->pitch; - format = CAIRO_FORMAT_ARGB32; + data = bitmap->buffer; + stride = bitmap->pitch; + format = CAIRO_FORMAT_ARGB32; + component_alpha = TRUE; } break; +#ifdef FT_LOAD_COLOR + case FT_PIXEL_MODE_BGRA: + stride = width * 4; + if (own_buffer) { + data = bitmap->buffer; + } else { + data = _cairo_malloc_ab (height, stride); + if (!data) + return _cairo_error (CAIRO_STATUS_NO_MEMORY); + + memcpy (data, bitmap->buffer, stride * height); + } + format = CAIRO_FORMAT_ARGB32; + break; +#endif case FT_PIXEL_MODE_GRAY2: case FT_PIXEL_MODE_GRAY4: + convert: + if (!own_buffer && library) + { + /* This is pretty much the only case that we can get in here. */ + /* Convert to 8bit grayscale. */ + + FT_Bitmap tmp; + FT_Int align; + + format = CAIRO_FORMAT_A8; + + align = cairo_format_stride_for_width (format, bitmap->width); + + FT_Bitmap_New( &tmp ); + + if (FT_Bitmap_Convert( library, bitmap, &tmp, align )) + return _cairo_error (CAIRO_STATUS_NO_MEMORY); + + FT_Bitmap_Done( library, bitmap ); + *bitmap = tmp; + + stride = bitmap->pitch; + data = _cairo_malloc_ab (height, stride); + if (!data) + return _cairo_error (CAIRO_STATUS_NO_MEMORY); + + if (bitmap->num_grays != 256) + { + unsigned int x, y; + unsigned int mul = 255 / (bitmap->num_grays - 1); + FT_Byte *p = bitmap->buffer; + for (y = 0; y < height; y++) { + for (x = 0; x < width; x++) + p[x] *= mul; + p += bitmap->pitch; + } + } + + memcpy (data, bitmap->buffer, stride * height); + break; + } /* These could be triggered by very rare types of TrueType fonts */ default: if (own_buffer) @@ -1222,7 +1284,7 @@ _get_bitmap_surface (FT_Bitmap *bitmap, return (*surface)->base.status; } - if (format == CAIRO_FORMAT_ARGB32) + if (component_alpha) pixman_image_set_component_alpha (image->pixman_image, TRUE); _cairo_image_surface_assume_ownership_of_data (image); @@ -1403,7 +1465,7 @@ _render_glyph_outline (FT_Face face, /* Note: * _get_bitmap_surface will free bitmap.buffer if there is an error */ - status = _get_bitmap_surface (&bitmap, TRUE, font_options, surface); + status = _get_bitmap_surface (&bitmap, NULL, TRUE, font_options, surface); if (unlikely (status)) return status; @@ -1444,6 +1506,7 @@ _render_glyph_bitmap (FT_Face face, return _cairo_error (CAIRO_STATUS_NO_MEMORY); status = _get_bitmap_surface (&glyphslot->bitmap, + glyphslot->library, FALSE, font_options, surface); if (unlikely (status)) @@ -1485,7 +1548,7 @@ _transform_glyph_bitmap (cairo_matrix_t * shape, * the "shape" portion of the font transform */ original_to_transformed = *shape; - + cairo_surface_get_device_offset (&(*surface)->base, &origin_x, &origin_y); orig_width = (*surface)->width; orig_height = (*surface)->height; @@ -1535,7 +1598,11 @@ _transform_glyph_bitmap (cairo_matrix_t * shape, if (unlikely (status)) return status; - image = cairo_image_surface_create (CAIRO_FORMAT_A8, width, height); + if (cairo_image_surface_get_format (*surface) == CAIRO_FORMAT_ARGB32 && + !pixman_image_get_component_alpha ((*surface)->pixman_image)) + image = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height); + else + image = cairo_image_surface_create (CAIRO_FORMAT_A8, width, height); if (unlikely (image->status)) return image->status; @@ -2169,6 +2236,18 @@ _cairo_ft_scaled_glyph_init (void *abstract_font, vertical_layout = TRUE; } +#ifdef FT_LOAD_COLOR + /* Color-glyph support: + * + * This flags needs plumbing through fontconfig (does it?), and + * maybe we should cache color and grayscale bitmaps separately + * such that users of the font (ie. the surface) can choose which + * version to use based on target content type. + */ + + load_flags |= FT_LOAD_COLOR; +#endif + error = FT_Load_Glyph (scaled_font->unscaled->face, _cairo_scaled_glyph_index(scaled_glyph), load_flags); @@ -2926,7 +3005,7 @@ _cairo_ft_resolve_pattern (FcPattern *pattern, font_matrix, &scale); - status = _compute_transform (&sf, &scale); + status = _compute_transform (&sf, &scale, NULL); if (unlikely (status)) return (cairo_font_face_t *)&_cairo_font_face_nil; From 2341b68fd3bb9122d1882b7e1764090c55d7fe24 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Tue, 4 Mar 2014 05:37:40 +0000 Subject: [PATCH 32/34] bug 974575 - support color glyphs in cairo_image_surface's _composite_glyphs function. r=jrmuizel --- gfx/cairo/cairo/src/cairo-image-surface.c | 50 +++++++++++++++-------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/gfx/cairo/cairo/src/cairo-image-surface.c b/gfx/cairo/cairo/src/cairo-image-surface.c index e36d22ae635..a655f4d67f4 100644 --- a/gfx/cairo/cairo/src/cairo-image-surface.c +++ b/gfx/cairo/cairo/src/cairo-image-surface.c @@ -3958,16 +3958,6 @@ _composite_glyphs (void *closure, cairo_status_t status; int i; - if (pattern != NULL) { - src = _pixman_image_for_pattern (pattern, FALSE, extents, &src_x, &src_y); - src_x -= dst_x; - src_y -= dst_y; - } else { - src = _pixman_white_image (); - } - if (unlikely (src == NULL)) - return _cairo_error (CAIRO_STATUS_NO_MEMORY); - memset (glyph_cache, 0, sizeof (glyph_cache)); status = CAIRO_STATUS_SUCCESS; @@ -4018,17 +4008,43 @@ _composite_glyphs (void *closure, if (y2 > extents->y + extents->height) y2 = extents->y + extents->height; - pixman_image_composite32 (pixman_op, - src, glyph_surface->pixman_image, dst, - x1 + src_x, y1 + src_y, - x1 - x, y1 - y, - x1 - dst_x, y1 - dst_y, - x2 - x1, y2 - y1); + if (glyph_surface->format == CAIRO_FORMAT_A8 || + glyph_surface->format == CAIRO_FORMAT_A1) + { + if (unlikely (src == NULL)) { + if (pattern != NULL) { + src = _pixman_image_for_pattern (pattern, FALSE, extents, &src_x, &src_y); + src_x -= dst_x; + src_y -= dst_y; + } else { + src = _pixman_white_image (); + } + if (unlikely (src == NULL)) { + status = _cairo_error (CAIRO_STATUS_NO_MEMORY); + break; + } + } + + pixman_image_composite32 (pixman_op, + src, glyph_surface->pixman_image, dst, + x1 + src_x, y1 + src_y, + x1 - x, y1 - y, + x1 - dst_x, y1 - dst_y, + x2 - x1, y2 - y1); + } else { + pixman_image_composite32 (pixman_op, + glyph_surface->pixman_image, NULL, dst, + x1 - x, y1 - y, + 0, 0, + x1 - dst_x, y1 - dst_y, + x2 - x1, y2 - y1); + } } } _cairo_scaled_font_thaw_cache (info->font); - pixman_image_unref (src); + if (src != NULL) + pixman_image_unref (src); return status; } From b0cebde23e9d738e0481550bedf57576f5ef671a Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Mon, 3 Mar 2014 22:40:07 -0800 Subject: [PATCH 33/34] Back out bbd7b1da5d36:b0d1c4456b73 (bug 974575) and 6e8140ae4961 (bug 969814) for ASan bustage --- configure.in | 6 +- gfx/cairo/cairo/src/cairo-ft-font.c | 199 +++++++--------------- gfx/cairo/cairo/src/cairo-image-surface.c | 50 ++---- media/libpng/mozpngconf.h | 27 +-- widget/gonk/libdisplay/BootAnimation.cpp | 2 +- 5 files changed, 89 insertions(+), 195 deletions(-) diff --git a/configure.in b/configure.in index a515d34e8ea..1e8fb551ea9 100644 --- a/configure.in +++ b/configure.in @@ -952,7 +952,7 @@ MOZ_JPEG_CFLAGS= MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)' MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)' -MOZ_PNG_CFLAGS="-I$_objdir/dist/include" # needed for freetype compilation +MOZ_PNG_CFLAGS= MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)' MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)' @@ -8927,10 +8927,8 @@ if test "$MOZ_TREE_FREETYPE"; then export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS" export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS" export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS" - export LIBPNG_CFLAGS="$MOZ_PNG_CFLAGS" - export LIBPNG_LDFLAGS="$MOZ_PNG_LIBS" export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in" - ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes" + ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --without-png" if ! test -e modules; then mkdir modules diff --git a/gfx/cairo/cairo/src/cairo-ft-font.c b/gfx/cairo/cairo/src/cairo-ft-font.c index 51bf7aef4bb..d5b0bcea1d2 100644 --- a/gfx/cairo/cairo/src/cairo-ft-font.c +++ b/gfx/cairo/cairo/src/cairo-ft-font.c @@ -52,7 +52,6 @@ #include FT_FREETYPE_H #include FT_OUTLINE_H #include FT_IMAGE_H -#include FT_BITMAP_H #include FT_TRUETYPE_TABLES_H #if HAVE_FT_GLYPHSLOT_EMBOLDEN #include FT_SYNTHESIS_H @@ -703,8 +702,7 @@ _cairo_ft_unscaled_font_unlock_face (cairo_ft_unscaled_font_t *unscaled) static cairo_status_t _compute_transform (cairo_ft_font_transform_t *sf, - cairo_matrix_t *scale, - cairo_ft_unscaled_font_t *unscaled) + cairo_matrix_t *scale) { cairo_status_t status; double x_scale, y_scale; @@ -732,39 +730,6 @@ _compute_transform (cairo_ft_font_transform_t *sf, if (y_scale < 1.0) y_scale = 1.0; - if (unscaled && (unscaled->face->face_flags & FT_FACE_FLAG_SCALABLE) == 0) { - double min_distance = DBL_MAX; - cairo_bool_t magnify = TRUE; - int i; - int best_i = 0; - double best_x_size = 0; - double best_y_size = 0; - - for (i = 0; i < unscaled->face->num_fixed_sizes; i++) { - double x_size = unscaled->face->available_sizes[i].y_ppem / 64.; - double y_size = unscaled->face->available_sizes[i].y_ppem / 64.; - double distance = y_size - y_scale; - - /* - * distance is positive if current strike is larger than desired - * size, and negative if smaller. - * - * We like to prefer down-scaling to upscaling. - */ - - if ((magnify && distance >= 0) || fabs (distance) <= min_distance) { - magnify = distance < 0; - min_distance = fabs (distance); - best_i = i; - best_x_size = x_size; - best_y_size = y_size; - } - } - - x_scale = best_x_size; - y_scale = best_y_size; - } - sf->x_scale = x_scale; sf->y_scale = y_scale; @@ -802,7 +767,7 @@ _cairo_ft_unscaled_font_set_scale (cairo_ft_unscaled_font_t *unscaled, unscaled->have_scale = TRUE; unscaled->current_scale = *scale; - status = _compute_transform (&sf, scale, unscaled); + status = _compute_transform (&sf, scale); if (unlikely (status)) return status; @@ -827,12 +792,46 @@ _cairo_ft_unscaled_font_set_scale (cairo_ft_unscaled_font_t *unscaled, FT_Set_Transform(unscaled->face, &mat, NULL); - error = FT_Set_Char_Size (unscaled->face, - sf.x_scale * 64.0 + .5, - sf.y_scale * 64.0 + .5, - 0, 0); - if (error) - return _cairo_error (CAIRO_STATUS_NO_MEMORY); + if ((unscaled->face->face_flags & FT_FACE_FLAG_SCALABLE) != 0) { + double x_scale = MIN(sf.x_scale, MAX_FONT_SIZE); + double y_scale = MIN(sf.y_scale, MAX_FONT_SIZE); + error = FT_Set_Char_Size (unscaled->face, + x_scale * 64.0 + .5, + y_scale * 64.0 + .5, + 0, 0); + if (error) + return _cairo_error (CAIRO_STATUS_NO_MEMORY); + } else { + double min_distance = DBL_MAX; + int i; + int best_i = 0; + + for (i = 0; i < unscaled->face->num_fixed_sizes; i++) { +#if HAVE_FT_BITMAP_SIZE_Y_PPEM + double size = unscaled->face->available_sizes[i].y_ppem / 64.; +#else + double size = unscaled->face->available_sizes[i].height; +#endif + double distance = fabs (size - sf.y_scale); + + if (distance <= min_distance) { + min_distance = distance; + best_i = i; + } + } +#if HAVE_FT_BITMAP_SIZE_Y_PPEM + error = FT_Set_Char_Size (unscaled->face, + unscaled->face->available_sizes[best_i].x_ppem, + unscaled->face->available_sizes[best_i].y_ppem, + 0, 0); + if (error) +#endif + error = FT_Set_Pixel_Sizes (unscaled->face, + unscaled->face->available_sizes[best_i].width, + unscaled->face->available_sizes[best_i].height); + if (error) + return _cairo_error (CAIRO_STATUS_NO_MEMORY); + } return CAIRO_STATUS_SUCCESS; } @@ -1115,7 +1114,6 @@ _fill_xrender_bitmap(FT_Bitmap *target, */ static cairo_status_t _get_bitmap_surface (FT_Bitmap *bitmap, - FT_Library library, cairo_bool_t own_buffer, cairo_font_options_t *font_options, cairo_image_surface_t **surface) @@ -1124,7 +1122,6 @@ _get_bitmap_surface (FT_Bitmap *bitmap, unsigned char *data; int format = CAIRO_FORMAT_A8; cairo_image_surface_t *image; - cairo_bool_t component_alpha = FALSE; width = bitmap->width; height = bitmap->rows; @@ -1155,7 +1152,9 @@ _get_bitmap_surface (FT_Bitmap *bitmap, source = bitmap->buffer; dest = data; for (i = height; i; i--) { - memcpy (dest, source, stride); + memcpy (dest, source, bitmap->pitch); + memset (dest + bitmap->pitch, '\0', stride - bitmap->pitch); + source += bitmap->pitch; dest += stride; } @@ -1179,18 +1178,8 @@ _get_bitmap_surface (FT_Bitmap *bitmap, case FT_PIXEL_MODE_LCD: case FT_PIXEL_MODE_LCD_V: case FT_PIXEL_MODE_GRAY: - if (font_options->antialias != CAIRO_ANTIALIAS_SUBPIXEL || - bitmap->pixel_mode == FT_PIXEL_MODE_GRAY) - { + if (font_options->antialias != CAIRO_ANTIALIAS_SUBPIXEL) { stride = bitmap->pitch; - - /* We don't support stride not multiple of 4. */ - if (stride & 3) - { - assert (!own_buffer); - goto convert; - } - if (own_buffer) { data = bitmap->buffer; } else { @@ -1201,72 +1190,21 @@ _get_bitmap_surface (FT_Bitmap *bitmap, memcpy (data, bitmap->buffer, stride * height); } - format = CAIRO_FORMAT_A8; + format = CAIRO_FORMAT_A8; } else { - data = bitmap->buffer; - stride = bitmap->pitch; - format = CAIRO_FORMAT_ARGB32; - component_alpha = TRUE; - } - break; -#ifdef FT_LOAD_COLOR - case FT_PIXEL_MODE_BGRA: - stride = width * 4; - if (own_buffer) { - data = bitmap->buffer; - } else { - data = _cairo_malloc_ab (height, stride); - if (!data) - return _cairo_error (CAIRO_STATUS_NO_MEMORY); + /* if we get there, the data from the source bitmap + * really comes from _fill_xrender_bitmap, and is + * made of 32-bit ARGB or ABGR values */ + assert (own_buffer != 0); + assert (bitmap->pixel_mode != FT_PIXEL_MODE_GRAY); - memcpy (data, bitmap->buffer, stride * height); + data = bitmap->buffer; + stride = bitmap->pitch; + format = CAIRO_FORMAT_ARGB32; } - format = CAIRO_FORMAT_ARGB32; break; -#endif case FT_PIXEL_MODE_GRAY2: case FT_PIXEL_MODE_GRAY4: - convert: - if (!own_buffer && library) - { - /* This is pretty much the only case that we can get in here. */ - /* Convert to 8bit grayscale. */ - - FT_Bitmap tmp; - FT_Int align; - - format = CAIRO_FORMAT_A8; - - align = cairo_format_stride_for_width (format, bitmap->width); - - FT_Bitmap_New( &tmp ); - - if (FT_Bitmap_Convert( library, bitmap, &tmp, align )) - return _cairo_error (CAIRO_STATUS_NO_MEMORY); - - FT_Bitmap_Done( library, bitmap ); - *bitmap = tmp; - - stride = bitmap->pitch; - data = _cairo_malloc_ab (height, stride); - if (!data) - return _cairo_error (CAIRO_STATUS_NO_MEMORY); - - if (bitmap->num_grays != 256) - { - unsigned int x, y; - unsigned int mul = 255 / (bitmap->num_grays - 1); - FT_Byte *p = bitmap->buffer; - for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) - p[x] *= mul; - p += bitmap->pitch; - } - } - - memcpy (data, bitmap->buffer, stride * height); - break; - } /* These could be triggered by very rare types of TrueType fonts */ default: if (own_buffer) @@ -1284,7 +1222,7 @@ _get_bitmap_surface (FT_Bitmap *bitmap, return (*surface)->base.status; } - if (component_alpha) + if (format == CAIRO_FORMAT_ARGB32) pixman_image_set_component_alpha (image->pixman_image, TRUE); _cairo_image_surface_assume_ownership_of_data (image); @@ -1465,7 +1403,7 @@ _render_glyph_outline (FT_Face face, /* Note: * _get_bitmap_surface will free bitmap.buffer if there is an error */ - status = _get_bitmap_surface (&bitmap, NULL, TRUE, font_options, surface); + status = _get_bitmap_surface (&bitmap, TRUE, font_options, surface); if (unlikely (status)) return status; @@ -1506,7 +1444,6 @@ _render_glyph_bitmap (FT_Face face, return _cairo_error (CAIRO_STATUS_NO_MEMORY); status = _get_bitmap_surface (&glyphslot->bitmap, - glyphslot->library, FALSE, font_options, surface); if (unlikely (status)) @@ -1548,7 +1485,7 @@ _transform_glyph_bitmap (cairo_matrix_t * shape, * the "shape" portion of the font transform */ original_to_transformed = *shape; - + cairo_surface_get_device_offset (&(*surface)->base, &origin_x, &origin_y); orig_width = (*surface)->width; orig_height = (*surface)->height; @@ -1598,11 +1535,7 @@ _transform_glyph_bitmap (cairo_matrix_t * shape, if (unlikely (status)) return status; - if (cairo_image_surface_get_format (*surface) == CAIRO_FORMAT_ARGB32 && - !pixman_image_get_component_alpha ((*surface)->pixman_image)) - image = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height); - else - image = cairo_image_surface_create (CAIRO_FORMAT_A8, width, height); + image = cairo_image_surface_create (CAIRO_FORMAT_A8, width, height); if (unlikely (image->status)) return image->status; @@ -2236,18 +2169,6 @@ _cairo_ft_scaled_glyph_init (void *abstract_font, vertical_layout = TRUE; } -#ifdef FT_LOAD_COLOR - /* Color-glyph support: - * - * This flags needs plumbing through fontconfig (does it?), and - * maybe we should cache color and grayscale bitmaps separately - * such that users of the font (ie. the surface) can choose which - * version to use based on target content type. - */ - - load_flags |= FT_LOAD_COLOR; -#endif - error = FT_Load_Glyph (scaled_font->unscaled->face, _cairo_scaled_glyph_index(scaled_glyph), load_flags); @@ -3005,7 +2926,7 @@ _cairo_ft_resolve_pattern (FcPattern *pattern, font_matrix, &scale); - status = _compute_transform (&sf, &scale, NULL); + status = _compute_transform (&sf, &scale); if (unlikely (status)) return (cairo_font_face_t *)&_cairo_font_face_nil; diff --git a/gfx/cairo/cairo/src/cairo-image-surface.c b/gfx/cairo/cairo/src/cairo-image-surface.c index a655f4d67f4..e36d22ae635 100644 --- a/gfx/cairo/cairo/src/cairo-image-surface.c +++ b/gfx/cairo/cairo/src/cairo-image-surface.c @@ -3958,6 +3958,16 @@ _composite_glyphs (void *closure, cairo_status_t status; int i; + if (pattern != NULL) { + src = _pixman_image_for_pattern (pattern, FALSE, extents, &src_x, &src_y); + src_x -= dst_x; + src_y -= dst_y; + } else { + src = _pixman_white_image (); + } + if (unlikely (src == NULL)) + return _cairo_error (CAIRO_STATUS_NO_MEMORY); + memset (glyph_cache, 0, sizeof (glyph_cache)); status = CAIRO_STATUS_SUCCESS; @@ -4008,43 +4018,17 @@ _composite_glyphs (void *closure, if (y2 > extents->y + extents->height) y2 = extents->y + extents->height; - if (glyph_surface->format == CAIRO_FORMAT_A8 || - glyph_surface->format == CAIRO_FORMAT_A1) - { - if (unlikely (src == NULL)) { - if (pattern != NULL) { - src = _pixman_image_for_pattern (pattern, FALSE, extents, &src_x, &src_y); - src_x -= dst_x; - src_y -= dst_y; - } else { - src = _pixman_white_image (); - } - if (unlikely (src == NULL)) { - status = _cairo_error (CAIRO_STATUS_NO_MEMORY); - break; - } - } - - pixman_image_composite32 (pixman_op, - src, glyph_surface->pixman_image, dst, - x1 + src_x, y1 + src_y, - x1 - x, y1 - y, - x1 - dst_x, y1 - dst_y, - x2 - x1, y2 - y1); - } else { - pixman_image_composite32 (pixman_op, - glyph_surface->pixman_image, NULL, dst, - x1 - x, y1 - y, - 0, 0, - x1 - dst_x, y1 - dst_y, - x2 - x1, y2 - y1); - } + pixman_image_composite32 (pixman_op, + src, glyph_surface->pixman_image, dst, + x1 + src_x, y1 + src_y, + x1 - x, y1 - y, + x1 - dst_x, y1 - dst_y, + x2 - x1, y2 - y1); } } _cairo_scaled_font_thaw_cache (info->font); - if (src != NULL) - pixman_image_unref (src); + pixman_image_unref (src); return status; } diff --git a/media/libpng/mozpngconf.h b/media/libpng/mozpngconf.h index 101c9ef247d..0b5c7420ab3 100644 --- a/media/libpng/mozpngconf.h +++ b/media/libpng/mozpngconf.h @@ -66,25 +66,19 @@ #define PNG_READ_SCALE_16_TO_8_SUPPORTED #define PNG_READ_TRANSFORMS_SUPPORTED -/* necessary for freetype color bitmap support (Android & B2G) - and boot animation code (Gonk) */ -#if defined(ANDROID) || defined(FT_CONFIG_OPTION_USE_PNG) -#define PNG_READ_PACK_SUPPORTED -#define PNG_READ_FILLER_SUPPORTED -#define PNG_READ_STRIP_16_TO_8_SUPPORTED -#define PNG_READ_USER_TRANSFORM_SUPPORTED -#define PNG_SEQUENTIAL_READ_SUPPORTED -#endif - -/* necessary for boot animation code (Gonk) */ +/* necessary for boot animation code */ #ifdef MOZ_WIDGET_GONK #define PNG_UNKNOWN_CHUNKS_SUPPORTED #define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED #define PNG_HANDLE_AS_UNKNOWN_SUPPORTED #define PNG_EASY_ACCESS_SUPPORTED #define PNG_READ_BGR_SUPPORTED +#define PNG_READ_FILLER_SUPPORTED #define PNG_READ_GRAY_TO_RGB_SUPPORTED +#define PNG_READ_STRIP_16_TO_8_SUPPORTED #define PNG_READ_STRIP_ALPHA_SUPPORTED +#define PNG_READ_USER_TRANSFORM_SUPPORTED +#define PNG_SEQUENTIAL_READ_SUPPORTED #endif #define PNG_WRITE_SUPPORTED @@ -115,8 +109,11 @@ #define PNG_SETJMP_SUPPORTED #define PNG_STDIO_SUPPORTED #define PNG_TEXT_SUPPORTED + +#ifdef PR_LOGGING #define PNG_ERROR_TEXT_SUPPORTED #define PNG_WARNINGS_SUPPORTED +#endif /* Mangle names of exported libpng functions so different libpng versions can coexist. It is recommended that if you do this, you give your @@ -647,11 +644,9 @@ #define png_realloc_array MOZ_PNG_realloc_array #define png_zstream_error MOZ_PNG_zstream_error -/* needed by FreeType's PNG support */ -#define png_error MOZ_PNG_error - #if defined(PR_LOGGING) && defined(PNG_WARNINGS_SUPPORTED) #define png_warning MOZ_PNG_warning +#define png_error MOZ_PNG_error #define png_chunk_error MOZ_PNG_chunk_err #define png_fixed_error MOZ_PNG_fixed_err #define png_formatted_warning MOZ_PNG_formatted_warning @@ -661,8 +656,4 @@ #define png_warning_parameter_unsigned MOZ_PNG_warn_param_unsigned #endif -#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED) -#define png_set_packing MOZ_PNG_set_packing -#endif - #endif /* MOZPNGCONF_H */ diff --git a/widget/gonk/libdisplay/BootAnimation.cpp b/widget/gonk/libdisplay/BootAnimation.cpp index 49e47623244..a30175a4bdb 100644 --- a/widget/gonk/libdisplay/BootAnimation.cpp +++ b/widget/gonk/libdisplay/BootAnimation.cpp @@ -267,7 +267,7 @@ RawReader(png_structp png_ptr, png_bytep data, png_size_t length) { RawReadState *state = (RawReadState *)png_get_io_ptr(png_ptr); if (length > (state->length - state->offset)) - png_error(png_ptr, "PNG read overrun"); + png_err(png_ptr); memcpy(data, state->start + state->offset, length); state->offset += length; From 27a4bb82ef434a6a4185f2bdf107ce03baed2818 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Tue, 4 Mar 2014 16:09:08 +0900 Subject: [PATCH 34/34] Bug 977951 - Don't force build a static libxul. r=gps --- config/config.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/config.mk b/config/config.mk index d9cbe86e4b0..50b9d9f340d 100644 --- a/config/config.mk +++ b/config/config.mk @@ -345,8 +345,10 @@ ifdef LIBXUL_LIBRARY ifdef IS_COMPONENT $(error IS_COMPONENT is set, but is not compatible with LIBXUL_LIBRARY) endif +ifneq (xul,$(LIBRARY_NAME)) FORCE_STATIC_LIB=1 endif +endif # If we are building this component into an extension/xulapp, it cannot be # statically linked. In the future we may want to add a xulapp meta-component