mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 966986 - Part 1: Fix format of DataTransfer.getData(text/x-moz-url) and return each text and URL as a separated item on Mac. r=smichaud, vlad (4de2b9ee3f) - Bug 966986 - Part 2: Return true from nsDragService::IsDataFlavorSupported for text/x-moz-url-desc and text/x-moz-url-data on Mac. r=smichaud, vlad (210fb284cc) - Bug 1167834 - Fix -Wwritable-strings warnings in widget/cocoa/. r=smichaud (933fa44bb4) - Bug 1206766 - Show meaningful module offsets in stack traces even when no symbol found. r=spohl (406e2019dc) - Bug 1205399 - Remove some leftover Growl strings. r=mstange (44dd51e2cd) - Bug 1205399 - OS X: Implement disabling Notifications for the site from the native notifications. r=mstange (4c5c3c3c41) - Bug 1208685 - Dedupe alert.css and cleanup alert.js heading. r=bgrins (669f2f5347) - Bug 1208295 - Show an additional action on OS X notifications to open notification settings. r=mstange (4562ca98f5) - Bug 935434 - Make XUL alertNotifcations use dir/bidi parameter by setting the according css direction attribute. Set lang attribute for labels. r=jaws (0e1e045f28) - Bug 1202933, Part 1 - Show the origin for XUL notifications. r=MattN,wchen (836ca78e53) - Bug 1202933, Part 2 - Show the origin for OS X notifications. r=MattN,wchen (468b702443) - Bug 1201397 - New layout of XUL Notifications. r=MattN (1133670c5d) - Bug 1209602 - XUL: Implement disabling notifications for a site. r=MattN (980f441952) - Bug 1218315 - Replace NS_LITERAL_STRING(...).get() with MOZ_UTF16(...) on widget. r=nfroyd (4605f28ee6) - Bug 1221449: Add null ptr check and fix variable shadowing in OSXNotificationCenter.mm. r=spohl (6064ea34ec) - Bug 1052776 - fix role=alert usage and ensure alert events fire, r=MattN (45cb398d87) - Bug 1217621 - Show settings action for XUL notifications. r=jaws (9cb70137c2) - Bug 1205172 - Do Not Disturb Button for Push Notifications on Windows. r=MattN (16b068c676) - Bug 1219458 - Remove the notification animation until we have better transparency support. r=MattN (bcd89030e2) - Bug 1214029 - Use double-quotes for strings in alert.js. r=MattN (a8b2a60ab6) - Bug 1213421 - Truncate long body and title text in notifications. r=MattN (b91c55cb1b) - Bug 1213421 - Follow-up, set the bodyText even when text is not being truncated. r=MattN (47212a10ca) - Bug 1216161 - XUL notifications on Linux can't be closed. r=MattN (0ad4abe149) - Bug 1218781 - Padding on the right side of notifications is missing when an icon is supplied. r=MattN (b0661b491c) - Bug 1218785 - Remove top and bottom margins on images in notifications. r=MattN (fb5f74249c) - Bug 1218780 - Notifications shouldn't use a hand cursor. r=MattN (be6da71ee0) - Bug 1218789 - Close button and gear button are misaligned in notifications. r=MattN (a6d684f008) - fix misspatch (e9a9840e80) - Bug 1148933 - Remove old storageservice.js and tests. r=gps (6308b7230f) - reorder (2095058419) - Don't mix GPU adapters across processes. (bug 1183910 part 10, r=jmuizelaar) (fa313da63d) - Don't attempt to use WARP after D3D11CreateDevice crashes. (bug 1201202, r=bas) (10d8424a75) - Bug 1207437 (part 1) - Don't recompute Windows feature levels. r=dvander. (0b0d3c11a1) - Bug 1207437 (part 2) - Don't re-get D3D11CreateDevice. r=dvander. It's always obtained during gfxWindowPlatform initialization and put into sD3D11CreateDeviceFn. (db99647c33) - Bug 1207437 (part 3) - Fix and disallow warnings in gfx/thebes/. r=dvander. (4cf28c971d) - Bug 1207437 - Extra qualification fixup. (05ab331aaa) - Search for a matching DXGI adapter in content processes. (bug 1225283 part 2, r=jrmuizel) (c1f715dd91) - Add IPC helpers to marshal DXGI_ADAPTER_DESC. (bug 1225283 part 1, r=mattwoodrow) (932804aab6) - Bug 1208465 - Part 1: Fix some reftest annotations. r=jrmuizel (725601b236) - Bug 1208465 - Part 2: Disable using Direct2D when 1.1 is unavailable. r=jrmuizel (2ad1fc80bd) - Bug 1196335 - Disambiguate the strings for scoped gfx reporter and D2D1.1. r=dvander (0cb2c1534c) - Bug 1222569 - fix -Wformat warning in gfxWindowsPlatform.cpp; r=Bas (95f339a567) - Bug 1195844: When checking for old DisplayLink versions, look for a few other DLLs. r=jrmuizel (8a316e876f) - Bug 1197296. Check for errors more during bug testing. r=Bas (21405bfe27) - Don't assume D3D11CreateDevice() gives back non-null devices. (bug 1209268, r=milan) (7208b1e52d) - Bug 1222569 - fix initialization order in gfxWindowsPlatform.cpp; r=Bas (530f2510b7) - Don't use Direct 2D 1.0 if Direct3D11 is using WARP. (bug 1207665 part 2, r=jmuizelaar) (a6f6aef92a) - Bug 1207258 - Give back the ability to run direct write without D2D, but only with a *force* preference. r=dvander (283454081b) - Bug 1097321 - Fix DoesD3D11TextureSharingWorkInternal to handle Intel/AMD configurations. r=Bas (efa1d2eeef) - Bug 1223002 - Always call ReleaseGrFace to balance GetGrFace, even if the face is null. r=jdaggett (06cb8447ba) - Bug 1225125: If all drawing is just clipped out anyway, just push a regular group, blending mode won't matter. r=jrmuizel (78a90991d4) - Bug 1223440 - Implement NativePanZoomController::setIsLongpressEnabled so long-press detection can be disabled during testing. r=kats (b8e31ab26a) - Bug 1202050 - Use UntransformTo in a few more places in APZ code. r=botond (6c43dda3c3) - Bug 1228501 patch 1 - Remove decorations parameter to nsFont constructors. r=jdaggett (ea43ab6167) - Bug 1228501 patch 2 - Remove nsFont::decorations member variable. r=jdaggett (57f9cc2520) - Bug 1228501 patch 3 - Remove nsFont::BaseEquals. r=jdaggett BaseEquals and Equals were made the same by patch 2, so BaseEquals can be removed. (925a469540) - Bug 576927 - Use saturating multiply when calculating zoomed app units to avoid integer overflow. r=roc (ab0caaa9c7) - Bug 1228501 patch 4 - Remove nsStyleFont::CalcFontDifference, which now duplicates the list of tests in nsFont::Equals. r=jdaggett (46523eaf4c) - Bug 1228501 patch 5 - Remove NS_FONT_DECORATION_* constants. r=jdaggett Decorations in Gecko are associated with the CSS 'text-decoration' property, so the constants should live in nsStyleConsts.h, as they largely already do (since the names defined there are the vast majority of the uses). (2895dfb610)
This commit is contained in:
@@ -50,10 +50,10 @@ pref(canvas.capturestream.enabled,true) skip-if(winWidget&&layersGPUAccelerated&
|
||||
== webgl-color-test.html?frame=1&aa&________&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
== webgl-color-test.html?frame=1&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
== webgl-color-test.html?frame=1&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) == webgl-color-test.html?frame=1&__&________&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) == webgl-color-test.html?frame=1&aa&________&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) == webgl-color-test.html?frame=1&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) == webgl-color-test.html?frame=1&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=1&__&________&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=1&aa&________&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=1&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=1&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
|
||||
== webgl-color-test.html?frame=1&__&________&premult&alpha wrapper.html?colors-premult.png
|
||||
== webgl-color-test.html?frame=1&aa&________&premult&alpha wrapper.html?colors-premult.png
|
||||
== webgl-color-test.html?frame=1&__&preserve&premult&alpha wrapper.html?colors-premult.png
|
||||
@@ -67,10 +67,10 @@ fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGP
|
||||
== webgl-color-test.html?frame=6&aa&________&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
== webgl-color-test.html?frame=6&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
== webgl-color-test.html?frame=6&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) == webgl-color-test.html?frame=6&__&________&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) == webgl-color-test.html?frame=6&aa&________&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) == webgl-color-test.html?frame=6&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&(!layersGPUAccelerated||!d2d)) == webgl-color-test.html?frame=6&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=6&__&________&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=6&aa&________&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) == webgl-color-test.html?frame=6&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&(!layersGPUAccelerated||!d3d11)) == webgl-color-test.html?frame=6&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
|
||||
== webgl-color-test.html?frame=6&__&________&premult&alpha wrapper.html?colors-premult.png
|
||||
== webgl-color-test.html?frame=6&aa&________&premult&alpha wrapper.html?colors-premult.png
|
||||
== webgl-color-test.html?frame=6&__&preserve&premult&alpha wrapper.html?colors-premult.png
|
||||
@@ -84,10 +84,10 @@ fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&(!layers
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&________&premult&alpha wrapper.html?colors-premult.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&aa&________&premult&alpha wrapper.html?colors-premult.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=1&readback&__&preserve&premult&alpha wrapper.html?colors-premult.png
|
||||
@@ -101,10 +101,10 @@ fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGP
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&preserve&premult&_____ wrapper.html?colors-no-alpha.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d2d) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&(!layersGPUAccelerated||!d2d)) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&layersGPUAccelerated&&!d3d11) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&_______&alpha wrapper.html?colors-non-premult.png
|
||||
fuzzy(1,30000) fails-if(gtkWidget&&browserIsRemote) fails-if(winWidget&&(!layersGPUAccelerated||!d3d11)) pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&preserve&_______&alpha wrapper.html?colors-non-premult.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&________&premult&alpha wrapper.html?colors-premult.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&aa&________&premult&alpha wrapper.html?colors-premult.png
|
||||
pref(webgl.force-layers-readback,true) == webgl-color-test.html?frame=6&readback&__&preserve&premult&alpha wrapper.html?colors-premult.png
|
||||
|
||||
@@ -1030,7 +1030,7 @@ PluginInstanceParent::NPP_SetWindow(const NPWindow* aWindow)
|
||||
#if defined(MOZ_X11) && defined(XP_UNIX) && !defined(XP_MACOSX)
|
||||
const NPSetWindowCallbackStruct* ws_info =
|
||||
static_cast<NPSetWindowCallbackStruct*>(aWindow->ws_info);
|
||||
window.visualID = ws_info->visual ? ws_info->visual->visualid : None;
|
||||
window.visualID = ws_info->visual ? ws_info->visual->visualid : 0;
|
||||
window.colormap = ws_info->colormap;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim: set ts=8 sts=4 et sw=4 tw=80: */
|
||||
/* 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 "D3DMessageUtils.h"
|
||||
#if defined(XP_WIN)
|
||||
# include "gfxWindowsPlatform.h"
|
||||
#endif
|
||||
|
||||
bool
|
||||
DxgiAdapterDesc::operator ==(const DxgiAdapterDesc& aOther) const
|
||||
{
|
||||
return memcmp(&aOther, this, sizeof(*this)) == 0;
|
||||
}
|
||||
|
||||
#if defined(XP_WIN)
|
||||
static_assert(sizeof(DxgiAdapterDesc) == sizeof(DXGI_ADAPTER_DESC),
|
||||
"DXGI_ADAPTER_DESC doe snot match DxgiAdapterDesc");
|
||||
|
||||
const DxgiAdapterDesc&
|
||||
DxgiAdapterDesc::From(const DXGI_ADAPTER_DESC& aDesc)
|
||||
{
|
||||
return reinterpret_cast<const DxgiAdapterDesc&>(aDesc);
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace IPC {
|
||||
|
||||
void
|
||||
ParamTraits<DxgiAdapterDesc>::Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
#if defined(XP_WIN)
|
||||
aMsg->WriteBytes(aParam.Description, sizeof(aParam.Description));
|
||||
WriteParam(aMsg, aParam.VendorId);
|
||||
WriteParam(aMsg, aParam.DeviceId);
|
||||
WriteParam(aMsg, aParam.SubSysId);
|
||||
WriteParam(aMsg, aParam.Revision);
|
||||
WriteParam(aMsg, aParam.DedicatedVideoMemory);
|
||||
WriteParam(aMsg, aParam.DedicatedSystemMemory);
|
||||
WriteParam(aMsg, aParam.SharedSystemMemory);
|
||||
WriteParam(aMsg, aParam.AdapterLuid.LowPart);
|
||||
WriteParam(aMsg, aParam.AdapterLuid.HighPart);
|
||||
#else
|
||||
MOZ_ASSERT_UNREACHABLE("DxgiAdapterDesc is Windows-only");
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
ParamTraits<DxgiAdapterDesc>::Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
#if defined(XP_WIN)
|
||||
const char* description = nullptr;
|
||||
if (!aMsg->ReadBytes(aIter, &description, sizeof(aResult->Description))) {
|
||||
return false;
|
||||
}
|
||||
memcpy(aResult->Description, description, sizeof(aResult->Description));
|
||||
|
||||
if (ReadParam(aMsg, aIter, &aResult->VendorId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->DeviceId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->SubSysId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->Revision) &&
|
||||
ReadParam(aMsg, aIter, &aResult->DedicatedVideoMemory) &&
|
||||
ReadParam(aMsg, aIter, &aResult->DedicatedSystemMemory) &&
|
||||
ReadParam(aMsg, aIter, &aResult->SharedSystemMemory) &&
|
||||
ReadParam(aMsg, aIter, &aResult->AdapterLuid.LowPart) &&
|
||||
ReadParam(aMsg, aIter, &aResult->AdapterLuid.HighPart))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
MOZ_ASSERT_UNREACHABLE("DxgiAdapterDesc is Windows-only");
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace IPC
|
||||
@@ -0,0 +1,47 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim: set ts=8 sts=4 et sw=4 tw=80: */
|
||||
/* 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/. */
|
||||
#ifndef _include_gfx_ipc_D3DMessageUtils_h__
|
||||
#define _include_gfx_ipc_D3DMessageUtils_h__
|
||||
|
||||
#include "chrome/common/ipc_message_utils.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
|
||||
// Can't include dxgi.h, since it leaks random identifiers and #defines, and
|
||||
// IPDL causes this file to be #included all over.
|
||||
typedef struct DXGI_ADAPTER_DESC DXGI_ADAPTER_DESC;
|
||||
|
||||
struct DxgiAdapterDesc
|
||||
{
|
||||
#if defined(XP_WIN)
|
||||
WCHAR Description[128];
|
||||
UINT VendorId;
|
||||
UINT DeviceId;
|
||||
UINT SubSysId;
|
||||
UINT Revision;
|
||||
SIZE_T DedicatedVideoMemory;
|
||||
SIZE_T DedicatedSystemMemory;
|
||||
SIZE_T SharedSystemMemory;
|
||||
LUID AdapterLuid;
|
||||
|
||||
static const DxgiAdapterDesc& From(const DXGI_ADAPTER_DESC& aDesc);
|
||||
#endif
|
||||
|
||||
bool operator ==(const DxgiAdapterDesc& aOther) const;
|
||||
};
|
||||
|
||||
namespace IPC {
|
||||
|
||||
template <>
|
||||
struct ParamTraits<DxgiAdapterDesc>
|
||||
{
|
||||
typedef DxgiAdapterDesc paramType;
|
||||
static void Write(Message* aMsg, const paramType& aParam);
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult);
|
||||
};
|
||||
|
||||
} // namespace IPC
|
||||
|
||||
#endif // _include_gfx_ipc_D3DMessageUtils_h__
|
||||
@@ -5,6 +5,8 @@
|
||||
* 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/. */
|
||||
|
||||
using struct DxgiAdapterDesc from "mozilla/D3DMessageUtils.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
||||
@@ -19,6 +21,7 @@ struct DeviceInitData
|
||||
bool d3d11TextureSharingWorks;
|
||||
bool useD2D;
|
||||
bool useD2D1;
|
||||
DxgiAdapterDesc adapter;
|
||||
};
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
EXPORTS.mozilla += [
|
||||
'D3DMessageUtils.h',
|
||||
'GfxMessageUtils.h'
|
||||
]
|
||||
|
||||
@@ -23,6 +24,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'D3DMessageUtils.cpp',
|
||||
'SharedDIB.cpp',
|
||||
]
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "TreeTraversal.h" // for generic tree traveral algorithms
|
||||
#include "LayersLogging.h" // for Stringify
|
||||
#include "Units.h" // for ParentlayerPixel
|
||||
#include "GestureEventListener.h" // for GestureEventListener::setLongTapEnabled
|
||||
|
||||
#define ENABLE_APZCTM_LOGGING 0
|
||||
// #define ENABLE_APZCTM_LOGGING 1
|
||||
@@ -749,10 +750,13 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
||||
// gecko space should only consist of overscroll-cancelling transforms.
|
||||
Matrix4x4 transformToGecko = GetScreenToApzcTransform(apzc)
|
||||
* GetApzcToGeckoTransform(apzc);
|
||||
MOZ_ASSERT(transformToGecko.Is2D());
|
||||
ScreenPoint untransformedOrigin = TransformTo<ScreenPixel>(
|
||||
Maybe<ScreenPoint> untransformedOrigin = UntransformTo<ScreenPixel>(
|
||||
transformToGecko, wheelInput.mOrigin);
|
||||
|
||||
if (!untransformedOrigin) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = mInputQueue->ReceiveInputEvent(
|
||||
apzc,
|
||||
/* aTargetConfirmed = */ hitResult == HitLayer,
|
||||
@@ -760,7 +764,7 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
||||
|
||||
// Update the out-parameters so they are what the caller expects.
|
||||
apzc->GetGuid(aOutTargetGuid);
|
||||
wheelInput.mOrigin = untransformedOrigin;
|
||||
wheelInput.mOrigin = *untransformedOrigin;
|
||||
}
|
||||
break;
|
||||
} case PANGESTURE_INPUT: {
|
||||
@@ -786,12 +790,15 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
||||
// gecko space should only consist of overscroll-cancelling transforms.
|
||||
Matrix4x4 transformToGecko = GetScreenToApzcTransform(apzc)
|
||||
* GetApzcToGeckoTransform(apzc);
|
||||
MOZ_ASSERT(transformToGecko.Is2D());
|
||||
ScreenPoint untransformedStartPoint = TransformTo<ScreenPixel>(
|
||||
Maybe<ScreenPoint> untransformedStartPoint = UntransformTo<ScreenPixel>(
|
||||
transformToGecko, panInput.mPanStartPoint);
|
||||
ScreenPoint untransformedDisplacement = TransformVector<ScreenPixel>(
|
||||
Maybe<ScreenPoint> untransformedDisplacement = UntransformVector<ScreenPixel>(
|
||||
transformToGecko, panInput.mPanDisplacement, panInput.mPanStartPoint);
|
||||
|
||||
if (!untransformedStartPoint || !untransformedDisplacement) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = mInputQueue->ReceiveInputEvent(
|
||||
apzc,
|
||||
/* aTargetConfirmed = */ hitResult == HitLayer,
|
||||
@@ -799,8 +806,8 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
||||
|
||||
// Update the out-parameters so they are what the caller expects.
|
||||
apzc->GetGuid(aOutTargetGuid);
|
||||
panInput.mPanStartPoint = untransformedStartPoint;
|
||||
panInput.mPanDisplacement = untransformedDisplacement;
|
||||
panInput.mPanStartPoint = *untransformedStartPoint;
|
||||
panInput.mPanDisplacement = *untransformedDisplacement;
|
||||
}
|
||||
break;
|
||||
} case PINCHGESTURE_INPUT: { // note: no one currently sends these
|
||||
@@ -810,6 +817,15 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
||||
if (apzc) {
|
||||
MOZ_ASSERT(hitResult == HitLayer || hitResult == HitDispatchToContentRegion);
|
||||
|
||||
Matrix4x4 outTransform = GetScreenToApzcTransform(apzc)
|
||||
* GetApzcToGeckoTransform(apzc);
|
||||
Maybe<ScreenPoint> untransformedFocusPoint = UntransformTo<ScreenPixel>(
|
||||
outTransform, pinchInput.mFocusPoint);
|
||||
|
||||
if (!untransformedFocusPoint) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = mInputQueue->ReceiveInputEvent(
|
||||
apzc,
|
||||
/* aTargetConfirmed = */ hitResult == HitLayer,
|
||||
@@ -817,11 +833,7 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
||||
|
||||
// Update the out-parameters so they are what the caller expects.
|
||||
apzc->GetGuid(aOutTargetGuid);
|
||||
Matrix4x4 outTransform = GetScreenToApzcTransform(apzc)
|
||||
* GetApzcToGeckoTransform(apzc);
|
||||
MOZ_ASSERT(outTransform.Is2D());
|
||||
pinchInput.mFocusPoint = TransformTo<ScreenPixel>(
|
||||
outTransform, pinchInput.mFocusPoint);
|
||||
pinchInput.mFocusPoint = *untransformedFocusPoint;
|
||||
}
|
||||
break;
|
||||
} case TAPGESTURE_INPUT: { // note: no one currently sends these
|
||||
@@ -831,6 +843,15 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
||||
if (apzc) {
|
||||
MOZ_ASSERT(hitResult == HitLayer || hitResult == HitDispatchToContentRegion);
|
||||
|
||||
Matrix4x4 outTransform = GetScreenToApzcTransform(apzc)
|
||||
* GetApzcToGeckoTransform(apzc);
|
||||
Maybe<ScreenIntPoint> untransformedPoint =
|
||||
UntransformTo<ScreenPixel>(outTransform, tapInput.mPoint);
|
||||
|
||||
if (!untransformedPoint) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = mInputQueue->ReceiveInputEvent(
|
||||
apzc,
|
||||
/* aTargetConfirmed = */ hitResult == HitLayer,
|
||||
@@ -838,10 +859,7 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
||||
|
||||
// Update the out-parameters so they are what the caller expects.
|
||||
apzc->GetGuid(aOutTargetGuid);
|
||||
Matrix4x4 outTransform = GetScreenToApzcTransform(apzc)
|
||||
* GetApzcToGeckoTransform(apzc);
|
||||
MOZ_ASSERT(outTransform.Is2D());
|
||||
tapInput.mPoint = TransformTo<ScreenPixel>(outTransform, tapInput.mPoint);
|
||||
tapInput.mPoint = *untransformedPoint;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -933,12 +951,15 @@ APZCTreeManager::ProcessTouchInput(MultiTouchInput& aInput,
|
||||
Matrix4x4 transformToApzc = GetScreenToApzcTransform(mApzcForInputBlock);
|
||||
Matrix4x4 transformToGecko = GetApzcToGeckoTransform(mApzcForInputBlock);
|
||||
Matrix4x4 outTransform = transformToApzc * transformToGecko;
|
||||
MOZ_ASSERT(outTransform.Is2D());
|
||||
|
||||
for (size_t i = 0; i < aInput.mTouches.Length(); i++) {
|
||||
SingleTouchData& touchData = aInput.mTouches[i];
|
||||
touchData.mScreenPoint = TransformTo<ScreenPixel>(
|
||||
Maybe<ScreenIntPoint> untransformedScreenPoint = UntransformTo<ScreenPixel>(
|
||||
outTransform, touchData.mScreenPoint);
|
||||
if (!untransformedScreenPoint) {
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
touchData.mScreenPoint = *untransformedScreenPoint;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -955,21 +976,6 @@ APZCTreeManager::ProcessTouchInput(MultiTouchInput& aInput,
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
APZCTreeManager::TransformCoordinateToGecko(const ScreenIntPoint& aPoint,
|
||||
LayoutDeviceIntPoint* aOutTransformedPoint)
|
||||
{
|
||||
MOZ_ASSERT(aOutTransformedPoint);
|
||||
RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(aPoint, nullptr);
|
||||
if (apzc && aOutTransformedPoint) {
|
||||
Matrix4x4 transformToApzc = GetScreenToApzcTransform(apzc);
|
||||
Matrix4x4 transformToGecko = GetApzcToGeckoTransform(apzc);
|
||||
Matrix4x4 outTransform = transformToApzc * transformToGecko;
|
||||
MOZ_ASSERT(outTransform.Is2D());
|
||||
*aOutTransformedPoint = TransformTo<LayoutDevicePixel>(outTransform, aPoint);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
APZCTreeManager::UpdateWheelTransaction(WidgetInputEvent& aEvent)
|
||||
{
|
||||
@@ -1035,8 +1041,11 @@ APZCTreeManager::ProcessEvent(WidgetInputEvent& aEvent,
|
||||
Matrix4x4 transformToApzc = GetScreenToApzcTransform(apzc);
|
||||
Matrix4x4 transformToGecko = GetApzcToGeckoTransform(apzc);
|
||||
Matrix4x4 outTransform = transformToApzc * transformToGecko;
|
||||
MOZ_ASSERT(outTransform.Is2D());
|
||||
aEvent.refPoint = TransformTo<LayoutDevicePixel>(outTransform, aEvent.refPoint);
|
||||
Maybe<LayoutDeviceIntPoint> untransformedRefPoint =
|
||||
UntransformTo<LayoutDevicePixel>(outTransform, aEvent.refPoint);
|
||||
if (untransformedRefPoint) {
|
||||
aEvent.refPoint = *untransformedRefPoint;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1590,6 +1599,13 @@ APZCTreeManager::BuildOverscrollHandoffChain(const RefPtr<AsyncPanZoomController
|
||||
return result;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
APZCTreeManager::SetLongTapEnabled(bool aLongTapEnabled)
|
||||
{
|
||||
APZThreadUtils::RunOnControllerThread(
|
||||
NewRunnableFunction(GestureEventListener::SetLongTapEnabled, aLongTapEnabled));
|
||||
}
|
||||
|
||||
HitTestingTreeNode*
|
||||
APZCTreeManager::FindTargetNode(HitTestingTreeNode* aNode,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
|
||||
@@ -212,15 +212,6 @@ public:
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId);
|
||||
|
||||
/**
|
||||
* A helper for transforming coordinates to gecko coordinate space.
|
||||
*
|
||||
* @param aPoint point to transform
|
||||
* @param aOutTransformedPoint resulting transformed point
|
||||
*/
|
||||
void TransformCoordinateToGecko(const ScreenIntPoint& aPoint,
|
||||
LayoutDeviceIntPoint* aOutTransformedPoint);
|
||||
|
||||
/**
|
||||
* Kicks an animation to zoom to a rect. This may be either a zoom out or zoom
|
||||
* in. The actual animation is done on the compositor thread after being set
|
||||
@@ -413,6 +404,14 @@ public:
|
||||
*/
|
||||
RefPtr<const OverscrollHandoffChain> BuildOverscrollHandoffChain(const RefPtr<AsyncPanZoomController>& aInitialTarget);
|
||||
|
||||
/**
|
||||
* Function used to disable LongTap gestures.
|
||||
*
|
||||
* On slow running tests, drags and touch events can be misinterpreted
|
||||
* as a long tap. This allows tests to disable long tap gesture detection.
|
||||
*/
|
||||
static void SetLongTapEnabled(bool aTapGestureEnabled);
|
||||
|
||||
protected:
|
||||
// Protected destructor, to discourage deletion outside of Release():
|
||||
virtual ~APZCTreeManager();
|
||||
|
||||
@@ -1516,13 +1516,15 @@ AsyncPanZoomController::ConvertToGecko(const ScreenIntPoint& aPoint, CSSPoint* a
|
||||
|
||||
// NOTE: This isn't *quite* LayoutDevicePoint, we just don't have a name
|
||||
// for this coordinate space and it maps the closest to LayoutDevicePoint.
|
||||
MOZ_ASSERT(transformScreenToGecko.Is2D());
|
||||
LayoutDevicePoint layoutPoint = TransformTo<LayoutDevicePixel>(
|
||||
Maybe<LayoutDeviceIntPoint> layoutPoint = UntransformTo<LayoutDevicePixel>(
|
||||
transformScreenToGecko, aPoint);
|
||||
if (!layoutPoint) {
|
||||
return false;
|
||||
}
|
||||
|
||||
{ // scoped lock to access mFrameMetrics
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
*aOut = layoutPoint / mFrameMetrics.GetDevPixelsPerCSSPixel();
|
||||
*aOut = LayoutDevicePoint(*layoutPoint) / mFrameMetrics.GetDevPixelsPerCSSPixel();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ static const uint32_t MAX_TAP_TIME = 300;
|
||||
*/
|
||||
static const float PINCH_START_THRESHOLD = 35.0f;
|
||||
|
||||
static bool sLongTapEnabled = true;
|
||||
|
||||
ParentLayerPoint GetCurrentFocus(const MultiTouchInput& aEvent)
|
||||
{
|
||||
const ParentLayerPoint& firstTouch = aEvent.mTouches[0].mLocalScreenPoint;
|
||||
@@ -131,6 +133,11 @@ int32_t GestureEventListener::GetLastTouchIdentifier() const
|
||||
return mTouches.IsEmpty() ? -1 : mTouches[0].mIdentifier;
|
||||
}
|
||||
|
||||
/* static */
|
||||
void GestureEventListener::SetLongTapEnabled(bool aLongTapEnabled)
|
||||
{
|
||||
sLongTapEnabled = aLongTapEnabled;
|
||||
}
|
||||
|
||||
nsEventStatus GestureEventListener::HandleInputTouchSingleStart()
|
||||
{
|
||||
@@ -139,7 +146,9 @@ nsEventStatus GestureEventListener::HandleInputTouchSingleStart()
|
||||
SetState(GESTURE_FIRST_SINGLE_TOUCH_DOWN);
|
||||
mTouchStartPosition = mLastTouchInput.mTouches[0].mLocalScreenPoint;
|
||||
|
||||
CreateLongTapTimeoutTask();
|
||||
if (sLongTapEnabled) {
|
||||
CreateLongTapTimeoutTask();
|
||||
}
|
||||
CreateMaxTapTimeoutTask();
|
||||
break;
|
||||
case GESTURE_FIRST_SINGLE_TOUCH_UP:
|
||||
|
||||
@@ -60,6 +60,14 @@ public:
|
||||
*/
|
||||
int32_t GetLastTouchIdentifier() const;
|
||||
|
||||
/**
|
||||
* Function used to disable long tap gestures.
|
||||
*
|
||||
* On slow running tests, drags and touch events can be misinterpreted
|
||||
* as a long tap. This allows tests to disable long tap gesture detection.
|
||||
*/
|
||||
static void SetLongTapEnabled(bool aLongTapEnabled);
|
||||
|
||||
private:
|
||||
// Private destructor, to discourage deletion outside of Release():
|
||||
~GestureEventListener();
|
||||
@@ -222,7 +230,6 @@ private:
|
||||
CancelableTask *mMaxTapTimeoutTask;
|
||||
void CancelMaxTapTimeoutTask();
|
||||
void CreateMaxTapTimeoutTask();
|
||||
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
|
||||
@@ -111,16 +111,18 @@ BasicLayerManager::PushGroupForLayer(gfxContext* aContext, Layer* aLayer, const
|
||||
IntRect surfRect;
|
||||
ToRect(rect).ToIntRect(&surfRect);
|
||||
|
||||
RefPtr<DrawTarget> dt = aContext->GetDrawTarget()->CreateSimilarDrawTarget(surfRect.Size(), SurfaceFormat::B8G8R8A8);
|
||||
if (!surfRect.IsEmpty()) {
|
||||
RefPtr<DrawTarget> dt = aContext->GetDrawTarget()->CreateSimilarDrawTarget(surfRect.Size(), SurfaceFormat::B8G8R8A8);
|
||||
|
||||
RefPtr<gfxContext> ctx = new gfxContext(dt, ToRect(rect).TopLeft());
|
||||
ctx->SetMatrix(oldMat);
|
||||
RefPtr<gfxContext> ctx = new gfxContext(dt, ToRect(rect).TopLeft());
|
||||
ctx->SetMatrix(oldMat);
|
||||
|
||||
group.mGroupOffset = surfRect.TopLeft();
|
||||
group.mGroupTarget = ctx;
|
||||
group.mGroupOffset = surfRect.TopLeft();
|
||||
group.mGroupTarget = ctx;
|
||||
|
||||
group.mMaskSurface = GetMaskForLayer(aLayer, &group.mMaskTransform);
|
||||
return group;
|
||||
group.mMaskSurface = GetMaskForLayer(aLayer, &group.mMaskTransform);
|
||||
return group;
|
||||
}
|
||||
}
|
||||
|
||||
Matrix maskTransform;
|
||||
|
||||
@@ -16,6 +16,8 @@ FeatureStatusToString(FeatureStatus aStatus)
|
||||
return "unused";
|
||||
case FeatureStatus::Unavailable:
|
||||
return "unavailable";
|
||||
case FeatureStatus::Crashed:
|
||||
return "crashed";
|
||||
case FeatureStatus::Blocked:
|
||||
return "blocked";
|
||||
case FeatureStatus::Blacklisted:
|
||||
|
||||
@@ -21,6 +21,9 @@ enum class FeatureStatus
|
||||
// the operating system.
|
||||
Unavailable,
|
||||
|
||||
// This feature crashed immediately when we tried to initialize it.
|
||||
Crashed,
|
||||
|
||||
// This feature was blocked for reasons outside the blacklist, such as a
|
||||
// runtime test failing.
|
||||
Blocked,
|
||||
|
||||
+3
-18
@@ -19,28 +19,24 @@
|
||||
using namespace mozilla;
|
||||
|
||||
nsFont::nsFont(const FontFamilyList& aFontlist, uint8_t aStyle,
|
||||
uint16_t aWeight, int16_t aStretch,
|
||||
uint8_t aDecoration, nscoord aSize)
|
||||
uint16_t aWeight, int16_t aStretch, nscoord aSize)
|
||||
: fontlist(aFontlist)
|
||||
{
|
||||
Init();
|
||||
style = aStyle;
|
||||
weight = aWeight;
|
||||
stretch = aStretch;
|
||||
decorations = aDecoration;
|
||||
size = aSize;
|
||||
}
|
||||
|
||||
nsFont::nsFont(FontFamilyType aGenericType, uint8_t aStyle,
|
||||
uint16_t aWeight, int16_t aStretch, uint8_t aDecoration,
|
||||
nscoord aSize)
|
||||
uint16_t aWeight, int16_t aStretch, nscoord aSize)
|
||||
: fontlist(aGenericType)
|
||||
{
|
||||
Init();
|
||||
style = aStyle;
|
||||
weight = aWeight;
|
||||
stretch = aStretch;
|
||||
decorations = aDecoration;
|
||||
size = aSize;
|
||||
}
|
||||
|
||||
@@ -68,7 +64,6 @@ nsFont::nsFont(const nsFont& aOther)
|
||||
systemFont = aOther.systemFont;
|
||||
weight = aOther.weight;
|
||||
stretch = aOther.stretch;
|
||||
decorations = aOther.decorations;
|
||||
smoothing = aOther.smoothing;
|
||||
size = aOther.size;
|
||||
sizeAdjust = aOther.sizeAdjust;
|
||||
@@ -94,7 +89,7 @@ nsFont::~nsFont()
|
||||
{
|
||||
}
|
||||
|
||||
bool nsFont::BaseEquals(const nsFont& aOther) const
|
||||
bool nsFont::Equals(const nsFont& aOther) const
|
||||
{
|
||||
if ((style == aOther.style) &&
|
||||
(systemFont == aOther.systemFont) &&
|
||||
@@ -121,15 +116,6 @@ bool nsFont::BaseEquals(const nsFont& aOther) const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool nsFont::Equals(const nsFont& aOther) const
|
||||
{
|
||||
if (BaseEquals(aOther) &&
|
||||
(decorations == aOther.decorations)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
nsFont& nsFont::operator=(const nsFont& aOther)
|
||||
{
|
||||
fontlist = aOther.fontlist;
|
||||
@@ -137,7 +123,6 @@ nsFont& nsFont::operator=(const nsFont& aOther)
|
||||
systemFont = aOther.systemFont;
|
||||
weight = aOther.weight;
|
||||
stretch = aOther.stretch;
|
||||
decorations = aOther.decorations;
|
||||
smoothing = aOther.smoothing;
|
||||
size = aOther.size;
|
||||
sizeAdjust = aOther.sizeAdjust;
|
||||
|
||||
+7
-16
@@ -66,10 +66,6 @@ struct nsFont {
|
||||
// -- bitmask for both enumerated and functional propvals
|
||||
uint16_t variantAlternates;
|
||||
|
||||
// The decorations on the font (underline, overline,
|
||||
// line-through). The decorations can be binary or'd together.
|
||||
uint8_t decorations;
|
||||
|
||||
// Smoothing - controls subpixel-antialiasing (currently OSX only)
|
||||
uint8_t smoothing;
|
||||
|
||||
@@ -111,13 +107,11 @@ struct nsFont {
|
||||
|
||||
// initialize the font with a fontlist
|
||||
nsFont(const mozilla::FontFamilyList& aFontlist, uint8_t aStyle,
|
||||
uint16_t aWeight, int16_t aStretch,
|
||||
uint8_t aDecoration, nscoord aSize);
|
||||
uint16_t aWeight, int16_t aStretch, nscoord aSize);
|
||||
|
||||
// initialize the font with a single generic
|
||||
nsFont(mozilla::FontFamilyType aGenericType, uint8_t aStyle,
|
||||
uint16_t aWeight, int16_t aStretch, uint8_t aDecoration,
|
||||
nscoord aSize);
|
||||
uint16_t aWeight, int16_t aStretch, nscoord aSize);
|
||||
|
||||
// Make a copy of the given font
|
||||
nsFont(const nsFont& aFont);
|
||||
@@ -129,9 +123,11 @@ struct nsFont {
|
||||
return Equals(aOther);
|
||||
}
|
||||
|
||||
bool Equals(const nsFont& aOther) const ;
|
||||
// Compare ignoring differences in 'variant' and 'decoration'
|
||||
bool BaseEquals(const nsFont& aOther) const;
|
||||
bool operator!=(const nsFont& aOther) const {
|
||||
return !Equals(aOther);
|
||||
}
|
||||
|
||||
bool Equals(const nsFont& aOther) const;
|
||||
|
||||
nsFont& operator=(const nsFont& aOther);
|
||||
|
||||
@@ -147,9 +143,4 @@ protected:
|
||||
#define NS_FONT_VARIANT_NORMAL 0
|
||||
#define NS_FONT_VARIANT_SMALL_CAPS 1
|
||||
|
||||
#define NS_FONT_DECORATION_NONE 0x0
|
||||
#define NS_FONT_DECORATION_UNDERLINE 0x1
|
||||
#define NS_FONT_DECORATION_OVERLINE 0x2
|
||||
#define NS_FONT_DECORATION_LINE_THROUGH 0x4
|
||||
|
||||
#endif /* nsFont_h___ */
|
||||
|
||||
@@ -84,12 +84,12 @@ switch(osName)
|
||||
}
|
||||
|
||||
var gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo);
|
||||
if (version < 6.0) {
|
||||
ok(!gfxInfo.D2DEnabled, "Direct2D not supported on Windows 2003 or older");
|
||||
ok(!gfxInfo.DWriteEnabled, "DirectWrite not supported on Windows 2003 or older");
|
||||
if (version < 6.2) {
|
||||
ok(!gfxInfo.D2DEnabled, "Direct2D not supported on Windows 2008 or older");
|
||||
ok(!gfxInfo.DWriteEnabled, "DirectWrite not supported on Windows 2008 or older");
|
||||
} else {
|
||||
ok(gfxInfo.D2DEnabled, "Direct2D enabled on Windows Vista or newer");
|
||||
ok(gfxInfo.DWriteEnabled, "DirectWrite enabled on Windows Vista or newer");
|
||||
ok(gfxInfo.D2DEnabled, "Direct2D enabled on Windows 8 or newer");
|
||||
ok(gfxInfo.DWriteEnabled, "DirectWrite enabled on Windows 8 or newer");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -871,8 +871,8 @@ gfxFontEntry::HasGraphiteSpaceContextuals()
|
||||
const gr_faceinfo* faceInfo = gr_face_info(face, 0);
|
||||
mHasGraphiteSpaceContextuals =
|
||||
faceInfo->space_contextuals != gr_faceinfo::gr_space_none;
|
||||
ReleaseGrFace(face);
|
||||
}
|
||||
ReleaseGrFace(face); // always balance GetGrFace, even if face is null
|
||||
mGraphiteSpaceContextualsInitialized = true;
|
||||
}
|
||||
return mHasGraphiteSpaceContextuals;
|
||||
@@ -1051,7 +1051,7 @@ gfxFontEntry::SupportsGraphiteFeature(uint32_t aFeatureTag)
|
||||
}
|
||||
|
||||
gr_face* face = GetGrFace();
|
||||
result = gr_face_find_fref(face, aFeatureTag) != nullptr;
|
||||
result = face ? gr_face_find_fref(face, aFeatureTag) != nullptr : false;
|
||||
ReleaseGrFace(face);
|
||||
|
||||
mSupportedFeatures->Put(scriptFeature, result);
|
||||
|
||||
@@ -240,7 +240,7 @@ private:
|
||||
DECL_GFX_PREF(Live, "gfx.direct2d.allow1_0", Direct2DAllow1_0, bool, false);
|
||||
DECL_GFX_PREF(Live, "gfx.draw-color-bars", CompositorDrawColorBars, bool, false);
|
||||
DECL_GFX_PREF(Once, "gfx.e10s.hide-plugins-for-scroll", HidePluginsForScroll, bool, true);
|
||||
DECL_GFX_PREF(Once, "gfx.font_rendering.directwrite.enabled", DirectWriteFontRenderingEnabled, bool, false);
|
||||
DECL_GFX_PREF(Once, "gfx.font_rendering.directwrite.force-enabled", DirectWriteFontRenderingForceEnabled, bool, false);
|
||||
DECL_GFX_PREF(Live, "gfx.gralloc.fence-with-readpixels", GrallocFenceWithReadPixels, bool, false);
|
||||
DECL_GFX_PREF(Live, "gfx.layerscope.enabled", LayerScopeEnabled, bool, false);
|
||||
DECL_GFX_PREF(Live, "gfx.layerscope.port", LayerScopePort, int32_t, 23456);
|
||||
|
||||
+399
-163
@@ -16,6 +16,7 @@
|
||||
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/Snprintf.h"
|
||||
#include "mozilla/WindowsVersion.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsTArray.h"
|
||||
@@ -490,12 +491,9 @@ gfxWindowsPlatform::HandleDeviceReset()
|
||||
}
|
||||
|
||||
// Remove devices and adapters.
|
||||
ResetD3D11Devices();
|
||||
mD3D10Device = nullptr;
|
||||
mD3D11Device = nullptr;
|
||||
mD3D11ContentDevice = nullptr;
|
||||
mD3D11ImageBridgeDevice = nullptr;
|
||||
mAdapter = nullptr;
|
||||
Factory::SetDirect3D11Device(nullptr);
|
||||
Factory::SetDirect3D10Device(nullptr);
|
||||
|
||||
// Reset local state. Note: we leave feature status variables as-is. They
|
||||
@@ -615,10 +613,10 @@ gfxWindowsPlatform::CreateDevice(RefPtr<IDXGIAdapter1> &adapter1,
|
||||
void
|
||||
gfxWindowsPlatform::VerifyD2DDevice(bool aAttemptForce)
|
||||
{
|
||||
if ((!Factory::SupportsD2D1() || !gfxPrefs::Direct2DUse1_1()) && !gfxPrefs::Direct2DAllow1_0()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((!Factory::SupportsD2D1() || !gfxPrefs::Direct2DUse1_1()) && !gfxPrefs::Direct2DAllow1_0()) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
||||
if (mD3D10Device) {
|
||||
if (SUCCEEDED(mD3D10Device->GetDeviceRemovedReason())) {
|
||||
@@ -676,7 +674,7 @@ gfxWindowsPlatform::VerifyD2DDevice(bool aAttemptForce)
|
||||
mozilla::gfx::Factory::SetDirect3D10Device(mD3D10Device);
|
||||
}
|
||||
|
||||
ScopedGfxFeatureReporter reporter1_1("D2D1.1");
|
||||
ScopedGfxFeatureReporter reporter1_1("D2D1.1V");
|
||||
|
||||
if (Factory::SupportsD2D1()) {
|
||||
reporter1_1.SetSuccessful();
|
||||
@@ -1293,7 +1291,7 @@ gfxWindowsPlatform::GetDLLVersion(char16ptr_t aDLLPath, nsAString& aVersion)
|
||||
vers[3] = LOWORD(fileVersLS);
|
||||
|
||||
char buf[256];
|
||||
sprintf(buf, "%d.%d.%d.%d", vers[0], vers[1], vers[2], vers[3]);
|
||||
snprintf_literal(buf, "%u.%u.%u.%u", vers[0], vers[1], vers[2], vers[3]);
|
||||
aVersion.Assign(NS_ConvertUTF8toUTF16(buf));
|
||||
}
|
||||
|
||||
@@ -1633,30 +1631,54 @@ gfxWindowsPlatform::GetDXGIAdapter()
|
||||
decltype(CreateDXGIFactory1)* createDXGIFactory1 = (decltype(CreateDXGIFactory1)*)
|
||||
GetProcAddress(dxgiModule, "CreateDXGIFactory1");
|
||||
|
||||
if (!createDXGIFactory1) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Try to use a DXGI 1.1 adapter in order to share resources
|
||||
// across processes.
|
||||
if (createDXGIFactory1) {
|
||||
RefPtr<IDXGIFactory1> factory1;
|
||||
HRESULT hr = createDXGIFactory1(__uuidof(IDXGIFactory1),
|
||||
getter_AddRefs(factory1));
|
||||
RefPtr<IDXGIFactory1> factory1;
|
||||
HRESULT hr = createDXGIFactory1(__uuidof(IDXGIFactory1),
|
||||
getter_AddRefs(factory1));
|
||||
if (FAILED(hr) || !factory1) {
|
||||
// This seems to happen with some people running the iZ3D driver.
|
||||
// They won't get acceleration.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (FAILED(hr) || !factory1) {
|
||||
// This seems to happen with some people running the iZ3D driver.
|
||||
// They won't get acceleration.
|
||||
if (!XRE_IsContentProcess()) {
|
||||
// In the parent process, we pick the first adapter.
|
||||
if (FAILED(factory1->EnumAdapters1(0, getter_AddRefs(mAdapter)))) {
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
const DxgiAdapterDesc& parent = GetParentDevicePrefs().adapter();
|
||||
|
||||
hr = factory1->EnumAdapters1(0, getter_AddRefs(mAdapter));
|
||||
if (FAILED(hr)) {
|
||||
// We should return and not accelerate if we can't obtain
|
||||
// an adapter.
|
||||
return nullptr;
|
||||
// In the child process, we search for the adapter that matches the parent
|
||||
// process. The first adapter can be mismatched on dual-GPU systems.
|
||||
for (UINT index = 0; ; index++) {
|
||||
RefPtr<IDXGIAdapter1> adapter;
|
||||
if (FAILED(factory1->EnumAdapters1(index, getter_AddRefs(adapter)))) {
|
||||
break;
|
||||
}
|
||||
|
||||
DXGI_ADAPTER_DESC desc;
|
||||
if (SUCCEEDED(adapter->GetDesc(&desc)) &&
|
||||
desc.AdapterLuid.HighPart == parent.AdapterLuid.HighPart &&
|
||||
desc.AdapterLuid.LowPart == parent.AdapterLuid.LowPart)
|
||||
{
|
||||
mAdapter = adapter.forget();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!mAdapter) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// We leak this module everywhere, we might as well do so here as well.
|
||||
dxgiModule.disown();
|
||||
|
||||
return mAdapter;
|
||||
}
|
||||
|
||||
@@ -1676,55 +1698,76 @@ bool DoesD3D11DeviceWork(ID3D11Device *device)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (GetModuleHandleW(L"dlumd32.dll") && GetModuleHandleW(L"igd10umd32.dll")) {
|
||||
nsString displayLinkModuleVersionString;
|
||||
gfxWindowsPlatform::GetDLLVersion(L"dlumd32.dll", displayLinkModuleVersionString);
|
||||
uint64_t displayLinkModuleVersion;
|
||||
if (!ParseDriverVersion(displayLinkModuleVersionString, &displayLinkModuleVersion)) {
|
||||
gfxCriticalError() << "DisplayLink: could not parse version";
|
||||
gANGLESupportsD3D11 = false;
|
||||
return false;
|
||||
}
|
||||
if (displayLinkModuleVersion <= V(8,6,1,36484)) {
|
||||
gfxCriticalError(CriticalLog::DefaultOptions(false)) << "DisplayLink: too old version";
|
||||
gANGLESupportsD3D11 = false;
|
||||
return false;
|
||||
if (GetModuleHandleW(L"igd10umd32.dll")) {
|
||||
const wchar_t* checkModules[] = {L"dlumd32.dll",
|
||||
L"dlumd11.dll",
|
||||
L"dlumd10.dll"};
|
||||
for (int i=0; i<PR_ARRAY_SIZE(checkModules); i+=1) {
|
||||
if (GetModuleHandleW(checkModules[i])) {
|
||||
nsString displayLinkModuleVersionString;
|
||||
gfxWindowsPlatform::GetDLLVersion(checkModules[i],
|
||||
displayLinkModuleVersionString);
|
||||
uint64_t displayLinkModuleVersion;
|
||||
if (!ParseDriverVersion(displayLinkModuleVersionString,
|
||||
&displayLinkModuleVersion)) {
|
||||
gfxCriticalError() << "DisplayLink: could not parse version "
|
||||
<< checkModules[i];
|
||||
gANGLESupportsD3D11 = false;
|
||||
return false;
|
||||
}
|
||||
if (displayLinkModuleVersion <= V(8,6,1,36484)) {
|
||||
gfxCriticalError(CriticalLog::DefaultOptions(false)) << "DisplayLink: too old version " << displayLinkModuleVersionString.get();
|
||||
gANGLESupportsD3D11 = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
result = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
GetDxgiDesc(ID3D11Device* device, DXGI_ADAPTER_DESC* out)
|
||||
{
|
||||
RefPtr<IDXGIDevice> dxgiDevice;
|
||||
HRESULT hr = device->QueryInterface(__uuidof(IDXGIDevice), getter_AddRefs(dxgiDevice));
|
||||
if (FAILED(hr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RefPtr<IDXGIAdapter> dxgiAdapter;
|
||||
if (FAILED(dxgiDevice->GetAdapter(getter_AddRefs(dxgiAdapter)))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return SUCCEEDED(dxgiAdapter->GetDesc(out));
|
||||
}
|
||||
|
||||
static void
|
||||
CheckForAdapterMismatch(ID3D11Device *device)
|
||||
{
|
||||
RefPtr<IDXGIDevice> dxgiDevice;
|
||||
if (FAILED(device->QueryInterface(__uuidof(IDXGIDevice),
|
||||
getter_AddRefs(dxgiDevice)))) {
|
||||
return;
|
||||
}
|
||||
RefPtr<IDXGIAdapter> dxgiAdapter;
|
||||
if (FAILED(dxgiDevice->GetAdapter(getter_AddRefs(dxgiAdapter)))) {
|
||||
return;
|
||||
}
|
||||
DXGI_ADAPTER_DESC desc;
|
||||
PodZero(&desc);
|
||||
GetDxgiDesc(device, &desc);
|
||||
|
||||
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
|
||||
nsString vendorID;
|
||||
gfxInfo->GetAdapterVendorID(vendorID);
|
||||
nsresult ec;
|
||||
int32_t vendor = vendorID.ToInteger(&ec, 16);
|
||||
DXGI_ADAPTER_DESC desc;
|
||||
dxgiAdapter->GetDesc(&desc);
|
||||
if (vendor != desc.VendorId) {
|
||||
gfxCriticalNote << "VendorIDMismatch " << hexa(vendor) << " " << hexa(desc.VendorId);
|
||||
}
|
||||
}
|
||||
|
||||
void CheckIfRenderTargetViewNeedsRecreating(ID3D11Device *device)
|
||||
bool DoesRenderTargetViewNeedsRecreating(ID3D11Device *device)
|
||||
{
|
||||
bool result = false;
|
||||
// CreateTexture2D is known to crash on lower feature levels, see bugs
|
||||
// 1170211 and 1089413.
|
||||
if (device->GetFeatureLevel() < D3D_FEATURE_LEVEL_10_0) {
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
RefPtr<ID3D11DeviceContext> deviceContext;
|
||||
@@ -1746,17 +1789,28 @@ void CheckIfRenderTargetViewNeedsRecreating(ID3D11Device *device)
|
||||
offscreenTextureDesc.CPUAccessFlags = 0;
|
||||
offscreenTextureDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX;
|
||||
|
||||
HRESULT result = device->CreateTexture2D(&offscreenTextureDesc, NULL, getter_AddRefs(offscreenTexture));
|
||||
|
||||
result = offscreenTexture->QueryInterface(__uuidof(IDXGIKeyedMutex), (void**)getter_AddRefs(keyedMutex));
|
||||
HRESULT hr = device->CreateTexture2D(&offscreenTextureDesc, NULL, getter_AddRefs(offscreenTexture));
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalNote << "DoesRecreatingCreateTexture2DFail";
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = offscreenTexture->QueryInterface(__uuidof(IDXGIKeyedMutex), (void**)getter_AddRefs(keyedMutex));
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalNote << "DoesRecreatingKeyedMutexFailed";
|
||||
return false;
|
||||
}
|
||||
D3D11_RENDER_TARGET_VIEW_DESC offscreenRTVDesc;
|
||||
offscreenRTVDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||
offscreenRTVDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
|
||||
offscreenRTVDesc.Texture2D.MipSlice = 0;
|
||||
|
||||
RefPtr<ID3D11RenderTargetView> offscreenRTView;
|
||||
result = device->CreateRenderTargetView(offscreenTexture, &offscreenRTVDesc, getter_AddRefs(offscreenRTView));
|
||||
hr = device->CreateRenderTargetView(offscreenTexture, &offscreenRTVDesc, getter_AddRefs(offscreenRTView));
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalNote << "DoesRecreatingCreateRenderTargetViewFailed";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Acquire and clear
|
||||
keyedMutex->AcquireSync(0, INFINITE);
|
||||
@@ -1777,7 +1831,11 @@ void CheckIfRenderTargetViewNeedsRecreating(ID3D11Device *device)
|
||||
desc.MiscFlags = 0;
|
||||
desc.BindFlags = 0;
|
||||
ID3D11Texture2D* cpuTexture;
|
||||
device->CreateTexture2D(&desc, NULL, &cpuTexture);
|
||||
hr = device->CreateTexture2D(&desc, NULL, &cpuTexture);
|
||||
if (FAILED(hr)) {
|
||||
gfxCriticalNote << "DoesRecreatingCreateCPUTextureFailed";
|
||||
return false;
|
||||
}
|
||||
|
||||
deviceContext->CopyResource(cpuTexture, offscreenTexture);
|
||||
|
||||
@@ -1791,12 +1849,14 @@ void CheckIfRenderTargetViewNeedsRecreating(ID3D11Device *device)
|
||||
// match the clear
|
||||
if (resultColor != 0xffffff00) {
|
||||
gfxCriticalNote << "RenderTargetViewNeedsRecreating";
|
||||
result = true;
|
||||
}
|
||||
|
||||
keyedMutex->ReleaseSync(0);
|
||||
|
||||
// It seems like this may only happen when we're using the NVIDIA gpu
|
||||
CheckForAdapterMismatch(device);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1823,16 +1883,16 @@ bool DoesD3D11TextureSharingWorkInternal(ID3D11Device *device, DXGI_FORMAT forma
|
||||
gfxInfo->GetAdapterVendorID(vendorID);
|
||||
gfxInfo->GetAdapterVendorID2(vendorID2);
|
||||
if (vendorID.EqualsLiteral("0x8086") && vendorID2.IsEmpty()) {
|
||||
gfxCriticalError(CriticalLog::DefaultOptions(false)) << "Unexpected Intel/AMD dual-GPU setup";
|
||||
return false;
|
||||
gfxCriticalError(CriticalLog::DefaultOptions(false)) << "PossiblyBrokenSurfaceSharing_UnexpectedAMDGPU";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<ID3D11Texture2D> texture;
|
||||
D3D11_TEXTURE2D_DESC desc;
|
||||
desc.Width = 32;
|
||||
desc.Height = 32;
|
||||
const int texture_size = 32;
|
||||
desc.Width = texture_size;
|
||||
desc.Height = texture_size;
|
||||
desc.MipLevels = 1;
|
||||
desc.ArraySize = 1;
|
||||
desc.Format = format;
|
||||
@@ -1842,7 +1902,17 @@ bool DoesD3D11TextureSharingWorkInternal(ID3D11Device *device, DXGI_FORMAT forma
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.MiscFlags = D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX;
|
||||
desc.BindFlags = bindflags;
|
||||
if (FAILED(device->CreateTexture2D(&desc, NULL, getter_AddRefs(texture)))) {
|
||||
|
||||
uint32_t color[texture_size * texture_size];
|
||||
for (size_t i = 0; i < sizeof(color)/sizeof(color[0]); i++) {
|
||||
color[i] = 0xff00ffff;
|
||||
}
|
||||
// We're going to check that sharing actually works with this format
|
||||
D3D11_SUBRESOURCE_DATA data;
|
||||
data.pSysMem = color;
|
||||
data.SysMemPitch = texture_size * 4;
|
||||
data.SysMemSlicePitch = 0;
|
||||
if (FAILED(device->CreateTexture2D(&desc, &data, getter_AddRefs(texture)))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1873,6 +1943,50 @@ bool DoesD3D11TextureSharingWorkInternal(ID3D11Device *device, DXGI_FORMAT forma
|
||||
return false;
|
||||
}
|
||||
|
||||
// create a staging texture for readback
|
||||
RefPtr<ID3D11Texture2D> cpuTexture;
|
||||
desc.Usage = D3D11_USAGE_STAGING;
|
||||
desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
|
||||
desc.MiscFlags = 0;
|
||||
desc.BindFlags = 0;
|
||||
if (FAILED(device->CreateTexture2D(&desc, nullptr, getter_AddRefs(cpuTexture)))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RefPtr<IDXGIKeyedMutex> sharedMutex;
|
||||
RefPtr<ID3D11DeviceContext> deviceContext;
|
||||
sharedResource->QueryInterface(__uuidof(IDXGIKeyedMutex), (void**)getter_AddRefs(sharedMutex));
|
||||
device->GetImmediateContext(getter_AddRefs(deviceContext));
|
||||
if (FAILED(sharedMutex->AcquireSync(0, 30*1000))) {
|
||||
gfxCriticalError() << "DoesD3D11TextureSharingWork_AcquireSyncTimeout";
|
||||
// only wait for 30 seconds
|
||||
return false;
|
||||
}
|
||||
|
||||
// Copy to the cpu texture so that we can readback
|
||||
deviceContext->CopyResource(cpuTexture, sharedTexture);
|
||||
|
||||
D3D11_MAPPED_SUBRESOURCE mapped;
|
||||
int resultColor = 0;
|
||||
if (SUCCEEDED(deviceContext->Map(cpuTexture, 0, D3D11_MAP_READ, 0, &mapped))) {
|
||||
// read the texture
|
||||
resultColor = *(int*)mapped.pData;
|
||||
deviceContext->Unmap(cpuTexture, 0);
|
||||
} else {
|
||||
gfxCriticalError() << "DoesD3D11TextureSharingWork_MapFailed";
|
||||
return false;
|
||||
}
|
||||
|
||||
sharedMutex->ReleaseSync(0);
|
||||
|
||||
// check that the color we put in is the color we get out
|
||||
if (resultColor != color[0]) {
|
||||
// Shared surfaces seem to be broken on dual AMD & Intel HW when using the
|
||||
// AMD GPU
|
||||
gfxCriticalNote << "DoesD3D11TextureSharingWork_ColorMismatch";
|
||||
return false;
|
||||
}
|
||||
|
||||
RefPtr<ID3D11ShaderResourceView> sharedView;
|
||||
|
||||
// This if(FAILED()) is the one that actually fails on systems affected by bug 1083071.
|
||||
@@ -1965,72 +2079,101 @@ gfxWindowsPlatform::CheckD3D11Support(bool* aCanUseHardware)
|
||||
// be used within InitializeD3D11.
|
||||
decltype(D3D11CreateDevice)* sD3D11CreateDeviceFn = nullptr;
|
||||
|
||||
void
|
||||
bool
|
||||
gfxWindowsPlatform::AttemptD3D11DeviceCreationHelper(
|
||||
IDXGIAdapter1* aAdapter, HRESULT& aResOut)
|
||||
{
|
||||
MOZ_SEH_TRY {
|
||||
aResOut =
|
||||
sD3D11CreateDeviceFn(
|
||||
aAdapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr,
|
||||
// Use D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS
|
||||
// to prevent bug 1092260. IE 11 also uses this flag.
|
||||
D3D11_CREATE_DEVICE_BGRA_SUPPORT | D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS,
|
||||
mFeatureLevels.Elements(), mFeatureLevels.Length(),
|
||||
D3D11_SDK_VERSION, getter_AddRefs(mD3D11Device), nullptr, nullptr);
|
||||
} MOZ_SEH_EXCEPT (EXCEPTION_EXECUTE_HANDLER) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
FeatureStatus
|
||||
gfxWindowsPlatform::AttemptD3D11DeviceCreation()
|
||||
{
|
||||
RefPtr<IDXGIAdapter1> adapter = GetDXGIAdapter();
|
||||
if (!adapter) {
|
||||
return;
|
||||
return FeatureStatus::Unavailable;
|
||||
}
|
||||
|
||||
HRESULT hr = E_INVALIDARG;
|
||||
MOZ_SEH_TRY {
|
||||
hr =
|
||||
sD3D11CreateDeviceFn(adapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr,
|
||||
// Use
|
||||
// D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS
|
||||
// to prevent bug 1092260. IE 11 also uses this flag.
|
||||
D3D11_CREATE_DEVICE_BGRA_SUPPORT | D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS,
|
||||
mFeatureLevels.Elements(), mFeatureLevels.Length(),
|
||||
D3D11_SDK_VERSION, getter_AddRefs(mD3D11Device), nullptr, nullptr);
|
||||
} MOZ_SEH_EXCEPT (EXCEPTION_EXECUTE_HANDLER) {
|
||||
HRESULT hr;
|
||||
if (!AttemptD3D11DeviceCreationHelper(adapter, hr)) {
|
||||
gfxCriticalError() << "Crash during D3D11 device creation";
|
||||
return;
|
||||
return FeatureStatus::Crashed;
|
||||
}
|
||||
|
||||
if (FAILED(hr) || !DoesD3D11DeviceWork(mD3D11Device)) {
|
||||
gfxCriticalError() << "D3D11 device creation failed" << hexa(hr);
|
||||
return;
|
||||
if (FAILED(hr) || !mD3D11Device) {
|
||||
mD3D11Device = nullptr;
|
||||
gfxCriticalError() << "D3D11 device creation failed: " << hexa(hr);
|
||||
return FeatureStatus::Failed;
|
||||
}
|
||||
if (!DoesD3D11DeviceWork(mD3D11Device)) {
|
||||
mD3D11Device = nullptr;
|
||||
return FeatureStatus::Blocked;
|
||||
}
|
||||
if (!mD3D11Device) {
|
||||
return;
|
||||
return FeatureStatus::Failed;
|
||||
}
|
||||
|
||||
CheckIfRenderTargetViewNeedsRecreating(mD3D11Device);
|
||||
|
||||
// Only test this when not using WARP since it can fail and cause
|
||||
// GetDeviceRemovedReason to return weird values.
|
||||
mCompositorD3D11TextureSharingWorks = ::DoesD3D11TextureSharingWork(mD3D11Device);
|
||||
|
||||
if (!mCompositorD3D11TextureSharingWorks || !DoesRenderTargetViewNeedsRecreating(mD3D11Device)) {
|
||||
gANGLESupportsD3D11 = false;
|
||||
}
|
||||
|
||||
mD3D11Device->SetExceptionMode(0);
|
||||
mIsWARP = false;
|
||||
return FeatureStatus::Available;
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
gfxWindowsPlatform::AttemptWARPDeviceCreationHelper(
|
||||
ScopedGfxFeatureReporter& aReporterWARP, HRESULT& aResOut)
|
||||
{
|
||||
MOZ_SEH_TRY {
|
||||
aResOut =
|
||||
sD3D11CreateDeviceFn(
|
||||
nullptr, D3D_DRIVER_TYPE_WARP, nullptr,
|
||||
// Use D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS
|
||||
// to prevent bug 1092260. IE 11 also uses this flag.
|
||||
D3D11_CREATE_DEVICE_BGRA_SUPPORT,
|
||||
mFeatureLevels.Elements(), mFeatureLevels.Length(),
|
||||
D3D11_SDK_VERSION, getter_AddRefs(mD3D11Device), nullptr, nullptr);
|
||||
|
||||
aReporterWARP.SetSuccessful();
|
||||
} MOZ_SEH_EXCEPT (EXCEPTION_EXECUTE_HANDLER) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
FeatureStatus
|
||||
gfxWindowsPlatform::AttemptWARPDeviceCreation()
|
||||
{
|
||||
ScopedGfxFeatureReporter reporterWARP("D3D11-WARP", gfxPrefs::LayersD3D11ForceWARP());
|
||||
|
||||
MOZ_SEH_TRY {
|
||||
HRESULT hr =
|
||||
sD3D11CreateDeviceFn(nullptr, D3D_DRIVER_TYPE_WARP, nullptr,
|
||||
// Use
|
||||
// D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS
|
||||
// to prevent bug 1092260. IE 11 also uses this flag.
|
||||
D3D11_CREATE_DEVICE_BGRA_SUPPORT,
|
||||
mFeatureLevels.Elements(), mFeatureLevels.Length(),
|
||||
D3D11_SDK_VERSION, getter_AddRefs(mD3D11Device), nullptr, nullptr);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
// This should always succeed... in theory.
|
||||
gfxCriticalError() << "Failed to initialize WARP D3D11 device! " << hexa(hr);
|
||||
return;
|
||||
}
|
||||
|
||||
reporterWARP.SetSuccessful();
|
||||
} MOZ_SEH_EXCEPT (EXCEPTION_EXECUTE_HANDLER) {
|
||||
HRESULT hr;
|
||||
if (!AttemptWARPDeviceCreationHelper(reporterWARP, hr)) {
|
||||
gfxCriticalError() << "Exception occurred initializing WARP D3D11 device!";
|
||||
return;
|
||||
return FeatureStatus::Crashed;
|
||||
}
|
||||
|
||||
if (FAILED(hr) || !mD3D11Device) {
|
||||
// This should always succeed... in theory.
|
||||
gfxCriticalError() << "Failed to initialize WARP D3D11 device! " << hexa(hr);
|
||||
return FeatureStatus::Failed;
|
||||
}
|
||||
|
||||
// Only test for texture sharing on Windows 8 since it puts the device into
|
||||
@@ -2040,34 +2183,68 @@ gfxWindowsPlatform::AttemptWARPDeviceCreation()
|
||||
}
|
||||
mD3D11Device->SetExceptionMode(0);
|
||||
mIsWARP = true;
|
||||
return FeatureStatus::Available;
|
||||
}
|
||||
|
||||
bool
|
||||
gfxWindowsPlatform::ContentAdapterIsParentAdapter(ID3D11Device* device)
|
||||
{
|
||||
DXGI_ADAPTER_DESC desc;
|
||||
if (!GetDxgiDesc(device, &desc)) {
|
||||
gfxCriticalNote << "Could not query device DXGI adapter info";
|
||||
return false;
|
||||
}
|
||||
|
||||
const DxgiAdapterDesc& parent = GetParentDevicePrefs().adapter();
|
||||
if (desc.VendorId != parent.VendorId ||
|
||||
desc.DeviceId != parent.DeviceId ||
|
||||
desc.SubSysId != parent.SubSysId ||
|
||||
desc.AdapterLuid.HighPart != parent.AdapterLuid.HighPart ||
|
||||
desc.AdapterLuid.LowPart != parent.AdapterLuid.LowPart)
|
||||
{
|
||||
gfxCriticalNote << "VendorIDMismatch " << hexa(parent.VendorId) << " " << hexa(desc.VendorId);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
gfxWindowsPlatform::AttemptD3D11ContentDeviceCreationHelper(
|
||||
IDXGIAdapter1* aAdapter, HRESULT& aResOut)
|
||||
{
|
||||
MOZ_SEH_TRY {
|
||||
aResOut =
|
||||
sD3D11CreateDeviceFn(
|
||||
aAdapter, mIsWARP ? D3D_DRIVER_TYPE_WARP : D3D_DRIVER_TYPE_UNKNOWN,
|
||||
nullptr, D3D11_CREATE_DEVICE_BGRA_SUPPORT,
|
||||
mFeatureLevels.Elements(), mFeatureLevels.Length(),
|
||||
D3D11_SDK_VERSION, getter_AddRefs(mD3D11ContentDevice), nullptr, nullptr);
|
||||
|
||||
} MOZ_SEH_EXCEPT (EXCEPTION_EXECUTE_HANDLER) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
FeatureStatus
|
||||
gfxWindowsPlatform::AttemptD3D11ContentDeviceCreation()
|
||||
{
|
||||
RefPtr<IDXGIAdapter1> adapter;
|
||||
if (!mIsWARP) {
|
||||
adapter = GetDXGIAdapter();
|
||||
if (!adapter) {
|
||||
return false;
|
||||
return FeatureStatus::Unavailable;
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT hr = E_INVALIDARG;
|
||||
MOZ_SEH_TRY {
|
||||
hr =
|
||||
sD3D11CreateDeviceFn(adapter,
|
||||
mIsWARP ? D3D_DRIVER_TYPE_WARP : D3D_DRIVER_TYPE_UNKNOWN,
|
||||
nullptr,
|
||||
D3D11_CREATE_DEVICE_BGRA_SUPPORT,
|
||||
mFeatureLevels.Elements(), mFeatureLevels.Length(),
|
||||
D3D11_SDK_VERSION, getter_AddRefs(mD3D11ContentDevice), nullptr, nullptr);
|
||||
} MOZ_SEH_EXCEPT (EXCEPTION_EXECUTE_HANDLER) {
|
||||
return false;
|
||||
HRESULT hr;
|
||||
if (!AttemptD3D11ContentDeviceCreationHelper(adapter, hr)) {
|
||||
return FeatureStatus::Crashed;
|
||||
}
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return false;
|
||||
if (FAILED(hr) || !mD3D11ContentDevice) {
|
||||
return FeatureStatus::Failed;
|
||||
}
|
||||
|
||||
// InitializeD2D() will abort early if the compositor device did not support
|
||||
@@ -2076,9 +2253,14 @@ gfxWindowsPlatform::AttemptD3D11ContentDeviceCreation()
|
||||
// binding the parent and child processes to different GPUs. As a safety net,
|
||||
// we re-check texture sharing against the newly created D3D11 content device.
|
||||
// If it fails, we won't use Direct2D.
|
||||
if (XRE_IsContentProcess() && !DoesD3D11TextureSharingWork(mD3D11ContentDevice)) {
|
||||
mD3D11ContentDevice = nullptr;
|
||||
return false;
|
||||
if (XRE_IsContentProcess()) {
|
||||
if (!DoesD3D11TextureSharingWork(mD3D11ContentDevice)) {
|
||||
mD3D11ContentDevice = nullptr;
|
||||
return FeatureStatus::Failed;
|
||||
}
|
||||
|
||||
DebugOnly<bool> ok = ContentAdapterIsParentAdapter(mD3D11ContentDevice);
|
||||
MOZ_ASSERT(ok);
|
||||
}
|
||||
|
||||
mD3D11ContentDevice->SetExceptionMode(0);
|
||||
@@ -2088,10 +2270,10 @@ gfxWindowsPlatform::AttemptD3D11ContentDeviceCreation()
|
||||
multi->SetMultithreadProtected(TRUE);
|
||||
|
||||
Factory::SetDirect3D11Device(mD3D11ContentDevice);
|
||||
return true;
|
||||
return FeatureStatus::Available;
|
||||
}
|
||||
|
||||
void
|
||||
FeatureStatus
|
||||
gfxWindowsPlatform::AttemptD3D11ImageBridgeDeviceCreation()
|
||||
{
|
||||
HRESULT hr = E_INVALIDARG;
|
||||
@@ -2102,18 +2284,23 @@ gfxWindowsPlatform::AttemptD3D11ImageBridgeDeviceCreation()
|
||||
mFeatureLevels.Elements(), mFeatureLevels.Length(),
|
||||
D3D11_SDK_VERSION, getter_AddRefs(mD3D11ImageBridgeDevice), nullptr, nullptr);
|
||||
} MOZ_SEH_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
|
||||
return;
|
||||
return FeatureStatus::Crashed;
|
||||
}
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return;
|
||||
if (FAILED(hr) || !mD3D11ImageBridgeDevice) {
|
||||
return FeatureStatus::Failed;
|
||||
}
|
||||
|
||||
mD3D11ImageBridgeDevice->SetExceptionMode(0);
|
||||
if (!DoesD3D11AlphaTextureSharingWork(mD3D11ImageBridgeDevice)) {
|
||||
mD3D11ImageBridgeDevice = nullptr;
|
||||
return;
|
||||
return FeatureStatus::Failed;
|
||||
}
|
||||
|
||||
if (XRE_IsContentProcess()) {
|
||||
ContentAdapterIsParentAdapter(mD3D11ImageBridgeDevice);
|
||||
}
|
||||
return FeatureStatus::Available;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2153,6 +2340,15 @@ gfxWindowsPlatform::InitializeDevices()
|
||||
if (mD3D11Status == FeatureStatus::Available) {
|
||||
InitializeD2D();
|
||||
}
|
||||
|
||||
// Usually we want D2D in order to use DWrite, but if the users have it
|
||||
// forced, we'll let them have it, as unsupported configuration.
|
||||
if (gfxPrefs::DirectWriteFontRenderingForceEnabled() &&
|
||||
IsFeatureStatusFailure(mD2DStatus) &&
|
||||
!mDWriteFactory) {
|
||||
gfxCriticalNote << "Attempting DWrite without D2D support";
|
||||
InitDWriteSupport();
|
||||
}
|
||||
}
|
||||
|
||||
FeatureStatus
|
||||
@@ -2223,31 +2419,43 @@ gfxWindowsPlatform::InitializeD3D11()
|
||||
if (XRE_IsParentProcess()) {
|
||||
// First try to create a hardware accelerated device.
|
||||
if (canUseHardware) {
|
||||
AttemptD3D11DeviceCreation();
|
||||
mD3D11Status = AttemptD3D11DeviceCreation();
|
||||
if (mD3D11Status == FeatureStatus::Crashed) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// If that failed, see if we can use WARP.
|
||||
if (!mD3D11Device && CanUseWARP()) {
|
||||
AttemptWARPDeviceCreation();
|
||||
if (!mD3D11Device) {
|
||||
if (!CanUseWARP()) {
|
||||
mD3D11Status = FeatureStatus::Blocked;
|
||||
return;
|
||||
}
|
||||
mD3D11Status = AttemptWARPDeviceCreation();
|
||||
}
|
||||
|
||||
// If we still have no device by now, exit.
|
||||
if (!mD3D11Device) {
|
||||
// Nothing more we can do.
|
||||
mD3D11Status = FeatureStatus::Failed;
|
||||
MOZ_ASSERT(IsFeatureStatusFailure(mD3D11Status));
|
||||
return;
|
||||
}
|
||||
|
||||
// Either device creation function should have returned Available.
|
||||
MOZ_ASSERT(mD3D11Status == FeatureStatus::Available);
|
||||
} else {
|
||||
// Child processes do not need a compositor, but they do need to know
|
||||
// whether the parent process is using WARP and whether or not texture
|
||||
// sharing works.
|
||||
mIsWARP = !canUseHardware;
|
||||
mCompositorD3D11TextureSharingWorks = GetParentDevicePrefs().d3d11TextureSharingWorks();
|
||||
mD3D11Status = FeatureStatus::Available;
|
||||
}
|
||||
|
||||
mD3D11Status = FeatureStatus::Available;
|
||||
|
||||
if (CanUseD3D11ImageBridge()) {
|
||||
AttemptD3D11ImageBridgeDeviceCreation();
|
||||
if (AttemptD3D11ImageBridgeDeviceCreation() == FeatureStatus::Crashed) {
|
||||
DisableD3D11AfterCrash();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// We leak these everywhere and we need them our entire runtime anyway, let's
|
||||
@@ -2256,6 +2464,22 @@ gfxWindowsPlatform::InitializeD3D11()
|
||||
d3d11Module.disown();
|
||||
}
|
||||
|
||||
void
|
||||
gfxWindowsPlatform::DisableD3D11AfterCrash()
|
||||
{
|
||||
mD3D11Status = FeatureStatus::Crashed;
|
||||
ResetD3D11Devices();
|
||||
}
|
||||
|
||||
void
|
||||
gfxWindowsPlatform::ResetD3D11Devices()
|
||||
{
|
||||
mD3D11Device = nullptr;
|
||||
mD3D11ContentDevice = nullptr;
|
||||
mD3D11ImageBridgeDevice = nullptr;
|
||||
Factory::SetDirect3D11Device(nullptr);
|
||||
}
|
||||
|
||||
static bool
|
||||
IsD2DBlacklisted()
|
||||
{
|
||||
@@ -2303,6 +2527,12 @@ gfxWindowsPlatform::CheckD2DSupport()
|
||||
if (!IsVistaOrLater()) {
|
||||
return FeatureStatus::Unavailable;
|
||||
}
|
||||
|
||||
// Normally we don't use D2D content drawing when using WARP. However if
|
||||
// WARP is force-enabled, we will let Direct2D use WARP as well.
|
||||
if (mIsWARP && !gfxPrefs::LayersD3D11ForceWARP()) {
|
||||
return FeatureStatus::Blocked;
|
||||
}
|
||||
return FeatureStatus::Available;
|
||||
}
|
||||
|
||||
@@ -2331,6 +2561,7 @@ gfxWindowsPlatform::InitializeD2D()
|
||||
// Initialize D2D 1.0.
|
||||
VerifyD2DDevice(gfxPrefs::Direct2DForceEnabled());
|
||||
if (!mD3D10Device) {
|
||||
mDWriteFactory = nullptr;
|
||||
mD2DStatus = FeatureStatus::Failed;
|
||||
return;
|
||||
}
|
||||
@@ -2356,11 +2587,6 @@ gfxWindowsPlatform::CheckD2D1Support()
|
||||
if (!gfxPrefs::Direct2DUse1_1()) {
|
||||
return FeatureStatus::Disabled;
|
||||
}
|
||||
// Normally we don't use D2D content drawing when using WARP. However if
|
||||
// WARP is force-enabled, we will let Direct2D use WARP as well.
|
||||
if (mIsWARP && !gfxPrefs::LayersD3D11ForceWARP()) {
|
||||
return FeatureStatus::Blocked;
|
||||
}
|
||||
return FeatureStatus::Available;
|
||||
}
|
||||
|
||||
@@ -2374,56 +2600,58 @@ gfxWindowsPlatform::InitializeD2D1()
|
||||
return;
|
||||
}
|
||||
|
||||
if (!AttemptD3D11ContentDeviceCreation()) {
|
||||
mD2D1Status = FeatureStatus::Failed;
|
||||
mD2D1Status = AttemptD3D11ContentDeviceCreation();
|
||||
if (IsFeatureStatusFailure(mD2D1Status)) {
|
||||
if (mD2D1Status == FeatureStatus::Crashed) {
|
||||
DisableD3D11AfterCrash();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
mD2D1Status = FeatureStatus::Available;
|
||||
MOZ_ASSERT(mD2D1Status == FeatureStatus::Available);
|
||||
d2d1_1.SetSuccessful();
|
||||
}
|
||||
|
||||
bool
|
||||
gfxWindowsPlatform::CreateD3D11DecoderDeviceHelper(
|
||||
IDXGIAdapter1* aAdapter, RefPtr<ID3D11Device>& aDevice, HRESULT& aResOut)
|
||||
{
|
||||
MOZ_SEH_TRY{
|
||||
aResOut =
|
||||
sD3D11CreateDeviceFn(
|
||||
aAdapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr,
|
||||
D3D11_CREATE_DEVICE_VIDEO_SUPPORT,
|
||||
mFeatureLevels.Elements(), mFeatureLevels.Length(),
|
||||
D3D11_SDK_VERSION, getter_AddRefs(aDevice), nullptr, nullptr);
|
||||
|
||||
} MOZ_SEH_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
already_AddRefed<ID3D11Device>
|
||||
gfxWindowsPlatform::CreateD3D11DecoderDevice()
|
||||
{
|
||||
nsModuleHandle d3d11Module(LoadLibrarySystem32(L"d3d11.dll"));
|
||||
decltype(D3D11CreateDevice)* d3d11CreateDevice = (decltype(D3D11CreateDevice)*)
|
||||
GetProcAddress(d3d11Module, "D3D11CreateDevice");
|
||||
|
||||
if (!d3d11CreateDevice) {
|
||||
if (!sD3D11CreateDeviceFn) {
|
||||
// We should just be on Windows Vista or XP in this case.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsTArray<D3D_FEATURE_LEVEL> featureLevels;
|
||||
if (IsWin8OrLater()) {
|
||||
featureLevels.AppendElement(D3D_FEATURE_LEVEL_11_1);
|
||||
}
|
||||
featureLevels.AppendElement(D3D_FEATURE_LEVEL_11_0);
|
||||
featureLevels.AppendElement(D3D_FEATURE_LEVEL_10_1);
|
||||
featureLevels.AppendElement(D3D_FEATURE_LEVEL_10_0);
|
||||
featureLevels.AppendElement(D3D_FEATURE_LEVEL_9_3);
|
||||
|
||||
RefPtr<IDXGIAdapter1> adapter = GetDXGIAdapter();
|
||||
|
||||
if (!adapter) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
HRESULT hr = E_INVALIDARG;
|
||||
|
||||
RefPtr<ID3D11Device> device;
|
||||
|
||||
MOZ_SEH_TRY{
|
||||
hr = d3d11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr,
|
||||
D3D11_CREATE_DEVICE_VIDEO_SUPPORT,
|
||||
featureLevels.Elements(), featureLevels.Length(),
|
||||
D3D11_SDK_VERSION, getter_AddRefs(device), nullptr, nullptr);
|
||||
} MOZ_SEH_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
|
||||
HRESULT hr;
|
||||
if (!CreateD3D11DecoderDeviceHelper(adapter, device, hr)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (FAILED(hr) || !DoesD3D11DeviceWork(device)) {
|
||||
if (FAILED(hr) || !device || !DoesD3D11DeviceWork(device)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -2453,8 +2681,8 @@ public:
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(D3DVsyncDisplay)
|
||||
public:
|
||||
D3DVsyncDisplay()
|
||||
: mVsyncEnabledLock("D3DVsyncEnabledLock")
|
||||
, mPrevVsync(TimeStamp::Now())
|
||||
: mPrevVsync(TimeStamp::Now())
|
||||
, mVsyncEnabledLock("D3DVsyncEnabledLock")
|
||||
, mVsyncEnabled(false)
|
||||
{
|
||||
mVsyncThread = new base::Thread("WindowsVsyncThread");
|
||||
@@ -2782,4 +3010,12 @@ gfxWindowsPlatform::GetDeviceInitData(DeviceInitData* aOut)
|
||||
aOut->useD3D11WARP() = mIsWARP;
|
||||
aOut->useD2D() = (GetD2DStatus() == FeatureStatus::Available);
|
||||
aOut->useD2D1() = (GetD2D1Status() == FeatureStatus::Available);
|
||||
|
||||
if (mD3D11Device) {
|
||||
DXGI_ADAPTER_DESC desc;
|
||||
if (!GetDxgiDesc(mD3D11Device, &desc)) {
|
||||
return;
|
||||
}
|
||||
aOut->adapter() = DxgiAdapterDesc::From(desc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
*/
|
||||
#include "cairo-win32.h"
|
||||
|
||||
#include "gfxCrashReporterUtils.h"
|
||||
#include "gfxFontUtils.h"
|
||||
#include "gfxWindowsSurface.h"
|
||||
#include "gfxFont.h"
|
||||
@@ -252,6 +253,9 @@ public:
|
||||
|
||||
// Create a D3D11 device to be used for DXVA decoding.
|
||||
already_AddRefed<ID3D11Device> CreateD3D11DecoderDevice();
|
||||
bool CreateD3D11DecoderDeviceHelper(
|
||||
IDXGIAdapter1* aAdapter, RefPtr<ID3D11Device>& aDevice,
|
||||
HRESULT& aResOut);
|
||||
|
||||
mozilla::layers::ReadbackManagerD3D11* GetReadbackManager();
|
||||
|
||||
@@ -320,11 +324,26 @@ private:
|
||||
mozilla::gfx::FeatureStatus CheckD3D11Support(bool* aCanUseHardware);
|
||||
mozilla::gfx::FeatureStatus CheckD2DSupport();
|
||||
mozilla::gfx::FeatureStatus CheckD2D1Support();
|
||||
void AttemptD3D11DeviceCreation();
|
||||
void AttemptWARPDeviceCreation();
|
||||
void AttemptD3D11ImageBridgeDeviceCreation();
|
||||
bool AttemptD3D11ContentDeviceCreation();
|
||||
|
||||
mozilla::gfx::FeatureStatus AttemptD3D11DeviceCreation();
|
||||
bool AttemptD3D11DeviceCreationHelper(
|
||||
IDXGIAdapter1* aAdapter, HRESULT& aResOut);
|
||||
|
||||
mozilla::gfx::FeatureStatus AttemptWARPDeviceCreation();
|
||||
bool AttemptWARPDeviceCreationHelper(
|
||||
mozilla::ScopedGfxFeatureReporter& aReporterWARP, HRESULT& aResOut);
|
||||
|
||||
mozilla::gfx::FeatureStatus AttemptD3D11ImageBridgeDeviceCreation();
|
||||
|
||||
mozilla::gfx::FeatureStatus AttemptD3D11ContentDeviceCreation();
|
||||
bool AttemptD3D11ContentDeviceCreationHelper(
|
||||
IDXGIAdapter1* aAdapter, HRESULT& aResOut);
|
||||
|
||||
bool CanUseD3D11ImageBridge();
|
||||
bool ContentAdapterIsParentAdapter(ID3D11Device* device);
|
||||
|
||||
void DisableD3D11AfterCrash();
|
||||
void ResetD3D11Devices();
|
||||
|
||||
IDXGIAdapter1 *GetDXGIAdapter();
|
||||
bool IsDeviceReset(HRESULT hr, DeviceResetReason* aReason);
|
||||
|
||||
@@ -530,6 +530,7 @@ public:
|
||||
|
||||
float TextZoom() { return mTextZoom; }
|
||||
void SetTextZoom(float aZoom) {
|
||||
MOZ_ASSERT(aZoom > 0.0f, "invalid zoom factor");
|
||||
if (aZoom == mTextZoom)
|
||||
return;
|
||||
|
||||
@@ -1105,26 +1106,26 @@ protected:
|
||||
, mMinimumFontSize(0)
|
||||
, mDefaultVariableFont(mozilla::eFamily_serif, NS_FONT_STYLE_NORMAL,
|
||||
NS_FONT_WEIGHT_NORMAL,
|
||||
NS_FONT_STRETCH_NORMAL, 0, 0)
|
||||
NS_FONT_STRETCH_NORMAL, 0)
|
||||
, mDefaultFixedFont(mozilla::eFamily_monospace, NS_FONT_STYLE_NORMAL,
|
||||
NS_FONT_WEIGHT_NORMAL,
|
||||
NS_FONT_STRETCH_NORMAL, 0, 0)
|
||||
NS_FONT_STRETCH_NORMAL, 0)
|
||||
, mDefaultSerifFont(mozilla::eFamily_serif, NS_FONT_STYLE_NORMAL,
|
||||
NS_FONT_WEIGHT_NORMAL,
|
||||
NS_FONT_STRETCH_NORMAL, 0, 0)
|
||||
NS_FONT_STRETCH_NORMAL, 0)
|
||||
, mDefaultSansSerifFont(mozilla::eFamily_sans_serif,
|
||||
NS_FONT_STYLE_NORMAL,
|
||||
NS_FONT_WEIGHT_NORMAL,
|
||||
NS_FONT_STRETCH_NORMAL, 0, 0)
|
||||
NS_FONT_STRETCH_NORMAL, 0)
|
||||
, mDefaultMonospaceFont(mozilla::eFamily_monospace, NS_FONT_STYLE_NORMAL,
|
||||
NS_FONT_WEIGHT_NORMAL,
|
||||
NS_FONT_STRETCH_NORMAL, 0, 0)
|
||||
NS_FONT_STRETCH_NORMAL, 0)
|
||||
, mDefaultCursiveFont(mozilla::eFamily_cursive, NS_FONT_STYLE_NORMAL,
|
||||
NS_FONT_WEIGHT_NORMAL,
|
||||
NS_FONT_STRETCH_NORMAL, 0, 0)
|
||||
NS_FONT_STRETCH_NORMAL, 0)
|
||||
, mDefaultFantasyFont(mozilla::eFamily_fantasy, NS_FONT_STYLE_NORMAL,
|
||||
NS_FONT_WEIGHT_NORMAL,
|
||||
NS_FONT_STRETCH_NORMAL, 0, 0)
|
||||
NS_FONT_STRETCH_NORMAL, 0)
|
||||
{}
|
||||
|
||||
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
|
||||
|
||||
@@ -10195,7 +10195,7 @@ void ReflowCountMgr::PaintCount(const char* aName,
|
||||
// We don't care about the document language or user fonts here;
|
||||
// just get a default Latin font.
|
||||
nsFont font(eFamily_serif, NS_FONT_STYLE_NORMAL,
|
||||
NS_FONT_WEIGHT_NORMAL, NS_FONT_STRETCH_NORMAL, 0,
|
||||
NS_FONT_WEIGHT_NORMAL, NS_FONT_STRETCH_NORMAL,
|
||||
nsPresContext::CSSPixelsToAppUnits(11));
|
||||
RefPtr<nsFontMetrics> fm;
|
||||
aPresContext->DeviceContext()->GetMetricsFor(font,
|
||||
|
||||
@@ -1711,8 +1711,8 @@ BuildTextRunsScanner::ContinueTextRunAcrossFrames(nsTextFrame* aFrame1, nsTextFr
|
||||
const nsStyleFont* fontStyle2 = sc2->StyleFont();
|
||||
nscoord letterSpacing1 = LetterSpacing(aFrame1);
|
||||
nscoord letterSpacing2 = LetterSpacing(aFrame2);
|
||||
return fontStyle1->mFont.BaseEquals(fontStyle2->mFont) &&
|
||||
sc1->StyleFont()->mLanguage == sc2->StyleFont()->mLanguage &&
|
||||
return fontStyle1->mFont == fontStyle2->mFont &&
|
||||
fontStyle1->mLanguage == fontStyle2->mLanguage &&
|
||||
textStyle1->mTextTransform == textStyle2->mTextTransform &&
|
||||
nsLayoutUtils::GetTextRunFlagsForStyle(sc1, fontStyle1, textStyle1, letterSpacing1) ==
|
||||
nsLayoutUtils::GetTextRunFlagsForStyle(sc2, fontStyle2, textStyle2, letterSpacing2);
|
||||
|
||||
@@ -34,9 +34,9 @@ pref(bidi.numeral,2) == bug441782-2.html bug441782-2-ref.html
|
||||
pref(bidi.numeral,3) == bug441782-2.html bug441782-2-ref.html
|
||||
pref(bidi.numeral,4) == bug441782-2.html bug441782-2-ref.html
|
||||
pref(bidi.numeral,0) != bug441782-3.html bug441782-3-ref.html
|
||||
fails-if(winWidget&&!layersGPUAccelerated) pref(bidi.numeral,1) == bug441782-3.html bug441782-3-ref.html
|
||||
fails-if(winWidget&&!layersGPUAccelerated) pref(bidi.numeral,2) == bug441782-3.html bug441782-3-ref.html
|
||||
fails-if(winWidget&&!layersGPUAccelerated) pref(bidi.numeral,3) == bug441782-3.html bug441782-3-ref.html
|
||||
fails-if(winWidget&&!layersGPUAccelerated) fuzzy-if(winWidget&&!d2d&&d3d11,13,1) pref(bidi.numeral,1) == bug441782-3.html bug441782-3-ref.html
|
||||
fails-if(winWidget&&!layersGPUAccelerated) fuzzy-if(winWidget&&!d2d&&d3d11,13,1) pref(bidi.numeral,2) == bug441782-3.html bug441782-3-ref.html
|
||||
fails-if(winWidget&&!layersGPUAccelerated) fuzzy-if(winWidget&&!d2d&&d3d11,13,1) pref(bidi.numeral,3) == bug441782-3.html bug441782-3-ref.html
|
||||
pref(bidi.numeral,4) == bug441782-3.html bug441782-3-ref.html
|
||||
pref(bidi.numeral,0) != bug441782-4.html bug441782-4-ref.html
|
||||
pref(bidi.numeral,1) == bug441782-4.html bug441782-4-ref.html
|
||||
|
||||
@@ -1660,8 +1660,8 @@ fuzzy-if(d2d&&/^Windows\x20NT\x206\.2/.test(http.oscpu),1,559) == 633344-1.html
|
||||
== 634232-1.html 634232-1-ref.html
|
||||
fails-if(Android&&AndroidVersion<17&&AndroidVersion!=10) == 635302-1.html 635302-1-ref.html
|
||||
fuzzy(1,68) fuzzy-if(gtkWidget,1,70) skip-if(B2G||Mulet) fails-if(Android) == 635373-1.html 635373-1-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
|
||||
skip-if(B2G||Mulet) random-if(d2d) fails-if(Android) fuzzy-if(winWidget&&!d2d,1,61) == 635373-2.html 635373-2-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
|
||||
skip-if(B2G||Mulet) random-if(d2d) fails-if(Android) fuzzy-if(winWidget&&!d2d,1,60) == 635373-3.html 635373-3-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
|
||||
skip-if(B2G||Mulet) random-if(d2d) fails-if(Android) fuzzy-if(winWidget&&!d2d,20,118) == 635373-2.html 635373-2-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
|
||||
skip-if(B2G||Mulet) random-if(d2d) fails-if(Android) fuzzy-if(winWidget&&!d2d,20,116) == 635373-3.html 635373-3-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
|
||||
HTTP(..) == 635639-1.html 635639-1-ref.html
|
||||
HTTP(..) == 635639-2.html 635639-2-ref.html
|
||||
random == 637597-1.html 637597-1-ref.html # bug 637597 was never really fixed!
|
||||
|
||||
@@ -24,7 +24,7 @@ HTTP(..) load ligature-with-space-1.html
|
||||
== line-editing-1c.html line-editing-1-ref.html
|
||||
== line-editing-1d.html line-editing-1-ref.html
|
||||
== line-editing-1e.html line-editing-1-ref.html
|
||||
fails-if(cocoaWidget||(winWidget&&!/^Windows\x20NT\x205\.1/.test(http.oscpu))) HTTP(..) == lineheight-metrics-1.html lineheight-metrics-1-ref.html # bug 657864
|
||||
fails-if(cocoaWidget||(winWidget&&d2d&&layersGPUAccelerated)) HTTP(..) == lineheight-metrics-1.html lineheight-metrics-1-ref.html # bug 657864
|
||||
HTTP(..) == lineheight-metrics-2a.html lineheight-metrics-2-ref.html
|
||||
HTTP(..) == lineheight-metrics-2b.html lineheight-metrics-2-ref.html
|
||||
== lineheight-percentage-1.html lineheight-percentage-1-ref.html
|
||||
|
||||
@@ -3414,7 +3414,6 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext,
|
||||
systemFont.systemFont = fontStyle.systemFont;
|
||||
systemFont.weight = fontStyle.weight;
|
||||
systemFont.stretch = fontStyle.stretch;
|
||||
systemFont.decorations = NS_FONT_DECORATION_NONE;
|
||||
systemFont.size =
|
||||
NSFloatPixelsToAppUnits(fontStyle.size,
|
||||
aPresContext->DeviceContext()->
|
||||
|
||||
@@ -804,9 +804,9 @@ enum class FillMode : uint32_t;
|
||||
|
||||
// See nsStyleText, nsStyleFont
|
||||
#define NS_STYLE_TEXT_DECORATION_LINE_NONE 0
|
||||
#define NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE NS_FONT_DECORATION_UNDERLINE
|
||||
#define NS_STYLE_TEXT_DECORATION_LINE_OVERLINE NS_FONT_DECORATION_OVERLINE
|
||||
#define NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH NS_FONT_DECORATION_LINE_THROUGH
|
||||
#define NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE 0x01
|
||||
#define NS_STYLE_TEXT_DECORATION_LINE_OVERLINE 0x02
|
||||
#define NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH 0x04
|
||||
#define NS_STYLE_TEXT_DECORATION_LINE_BLINK 0x08
|
||||
#define NS_STYLE_TEXT_DECORATION_LINE_PREF_ANCHORS 0x10
|
||||
// OVERRIDE_ALL does not occur in stylesheets; it only comes from HTML
|
||||
|
||||
@@ -173,6 +173,7 @@ nsChangeHint nsStyleFont::CalcDifference(const nsStyleFont& aOther) const
|
||||
MOZ_ASSERT(mAllowZoom == aOther.mAllowZoom,
|
||||
"expected mAllowZoom to be the same on both nsStyleFonts");
|
||||
if (mSize != aOther.mSize ||
|
||||
mFont != aOther.mFont ||
|
||||
mLanguage != aOther.mLanguage ||
|
||||
mExplicitLanguage != aOther.mExplicitLanguage ||
|
||||
mMathVariant != aOther.mMathVariant ||
|
||||
@@ -181,11 +182,6 @@ nsChangeHint nsStyleFont::CalcDifference(const nsStyleFont& aOther) const
|
||||
return NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
|
||||
nsChangeHint hint = CalcFontDifference(mFont, aOther.mFont);
|
||||
if (hint) {
|
||||
return hint;
|
||||
}
|
||||
|
||||
// XXX Should any of these cause a non-nsChangeHint_NeutralChange change?
|
||||
if (mGenericID != aOther.mGenericID ||
|
||||
mScriptLevel != aOther.mScriptLevel ||
|
||||
@@ -201,13 +197,17 @@ nsChangeHint nsStyleFont::CalcDifference(const nsStyleFont& aOther) const
|
||||
/* static */ nscoord
|
||||
nsStyleFont::ZoomText(nsPresContext *aPresContext, nscoord aSize)
|
||||
{
|
||||
return nscoord(float(aSize) * aPresContext->TextZoom());
|
||||
// aSize can be negative (e.g.: calc(-1px)) so we can't assert that here.
|
||||
// The caller is expected deal with that.
|
||||
return NSCoordSaturatingMultiply(aSize, aPresContext->TextZoom());
|
||||
}
|
||||
|
||||
/* static */ nscoord
|
||||
nsStyleFont::UnZoomText(nsPresContext *aPresContext, nscoord aSize)
|
||||
{
|
||||
return nscoord(float(aSize) / aPresContext->TextZoom());
|
||||
// aSize can be negative (e.g.: calc(-1px)) so we can't assert that here.
|
||||
// The caller is expected deal with that.
|
||||
return NSCoordSaturatingMultiply(aSize, 1.0 / aPresContext->TextZoom());
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<nsIAtom>
|
||||
@@ -225,36 +225,6 @@ nsStyleFont::GetLanguage(nsPresContext* aPresContext)
|
||||
return language.forget();
|
||||
}
|
||||
|
||||
nsChangeHint nsStyleFont::CalcFontDifference(const nsFont& aFont1, const nsFont& aFont2)
|
||||
{
|
||||
if ((aFont1.size == aFont2.size) &&
|
||||
(aFont1.sizeAdjust == aFont2.sizeAdjust) &&
|
||||
(aFont1.style == aFont2.style) &&
|
||||
(aFont1.weight == aFont2.weight) &&
|
||||
(aFont1.stretch == aFont2.stretch) &&
|
||||
(aFont1.smoothing == aFont2.smoothing) &&
|
||||
(aFont1.fontlist == aFont2.fontlist) &&
|
||||
(aFont1.kerning == aFont2.kerning) &&
|
||||
(aFont1.synthesis == aFont2.synthesis) &&
|
||||
(aFont1.variantAlternates == aFont2.variantAlternates) &&
|
||||
(aFont1.alternateValues == aFont2.alternateValues) &&
|
||||
(aFont1.featureValueLookup == aFont2.featureValueLookup) &&
|
||||
(aFont1.variantCaps == aFont2.variantCaps) &&
|
||||
(aFont1.variantEastAsian == aFont2.variantEastAsian) &&
|
||||
(aFont1.variantLigatures == aFont2.variantLigatures) &&
|
||||
(aFont1.variantNumeric == aFont2.variantNumeric) &&
|
||||
(aFont1.variantPosition == aFont2.variantPosition) &&
|
||||
(aFont1.fontFeatureSettings == aFont2.fontFeatureSettings) &&
|
||||
(aFont1.languageOverride == aFont2.languageOverride) &&
|
||||
(aFont1.systemFont == aFont2.systemFont)) {
|
||||
if ((aFont1.decorations == aFont2.decorations)) {
|
||||
return NS_STYLE_HINT_NONE;
|
||||
}
|
||||
return nsChangeHint_RepaintFrame;
|
||||
}
|
||||
return NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
|
||||
static bool IsFixedData(const nsStyleSides& aSides, bool aEnumOK)
|
||||
{
|
||||
NS_FOR_CSS_SIDES(side) {
|
||||
|
||||
@@ -117,9 +117,18 @@ struct nsStyleFont {
|
||||
nsChangeHint_ReflowChangesSizeOrPosition |
|
||||
nsChangeHint_ClearAncestorIntrinsics;
|
||||
}
|
||||
static nsChangeHint CalcFontDifference(const nsFont& aFont1, const nsFont& aFont2);
|
||||
|
||||
/**
|
||||
* Return aSize multiplied by the current text zoom factor (in aPresContext).
|
||||
* aSize is allowed to be negative, but the caller is expected to deal with
|
||||
* negative results. The result is clamped to nscoord_MIN .. nscoord_MAX.
|
||||
*/
|
||||
static nscoord ZoomText(nsPresContext* aPresContext, nscoord aSize);
|
||||
/**
|
||||
* Return aSize divided by the current text zoom factor (in aPresContext).
|
||||
* aSize is allowed to be negative, but the caller is expected to deal with
|
||||
* negative results. The result is clamped to nscoord_MIN .. nscoord_MAX.
|
||||
*/
|
||||
static nscoord UnZoomText(nsPresContext* aPresContext, nscoord aSize);
|
||||
static already_AddRefed<nsIAtom> GetLanguage(nsPresContext* aPresContext);
|
||||
|
||||
|
||||
@@ -623,6 +623,8 @@ function BuildConditionSandbox(aURL) {
|
||||
|
||||
sandbox.layersGPUAccelerated =
|
||||
gWindowUtils.layerManagerType != "Basic";
|
||||
sandbox.d3d11 =
|
||||
gWindowUtils.layerManagerType == "Direct3D 11";
|
||||
sandbox.layersOpenGL =
|
||||
gWindowUtils.layerManagerType == "OpenGL";
|
||||
sandbox.layersOMTC =
|
||||
|
||||
@@ -490,12 +490,12 @@ nsTextBoxFrame::DrawText(nsRenderingContext& aRenderingContext,
|
||||
// (We don't apply this rule to the access-key underline because we only
|
||||
// find out where that is as a side effect of drawing the text, in the
|
||||
// general case -- see below.)
|
||||
if (decorations & (NS_FONT_DECORATION_OVERLINE |
|
||||
NS_FONT_DECORATION_UNDERLINE)) {
|
||||
if (decorations & (NS_STYLE_TEXT_DECORATION_LINE_OVERLINE |
|
||||
NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE)) {
|
||||
fontMet->GetUnderline(offset, size);
|
||||
gfxFloat offsetPixel = presContext->AppUnitsToGfxUnits(offset);
|
||||
gfxFloat sizePixel = presContext->AppUnitsToGfxUnits(size);
|
||||
if ((decorations & NS_FONT_DECORATION_UNDERLINE) &&
|
||||
if ((decorations & NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE) &&
|
||||
underStyle != NS_STYLE_TEXT_DECORATION_STYLE_NONE) {
|
||||
nsCSSRendering::PaintDecorationLine(this, *drawTarget,
|
||||
ToRect(dirtyRect), underColor,
|
||||
@@ -504,7 +504,7 @@ nsTextBoxFrame::DrawText(nsRenderingContext& aRenderingContext,
|
||||
NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE, underStyle,
|
||||
vertical);
|
||||
}
|
||||
if ((decorations & NS_FONT_DECORATION_OVERLINE) &&
|
||||
if ((decorations & NS_STYLE_TEXT_DECORATION_LINE_OVERLINE) &&
|
||||
overStyle != NS_STYLE_TEXT_DECORATION_STYLE_NONE) {
|
||||
nsCSSRendering::PaintDecorationLine(this, *drawTarget,
|
||||
ToRect(dirtyRect), overColor,
|
||||
@@ -584,7 +584,7 @@ nsTextBoxFrame::DrawText(nsRenderingContext& aRenderingContext,
|
||||
|
||||
// Strikeout is drawn on top of the text, per
|
||||
// http://www.w3.org/TR/CSS21/zindex.html point 7.2.1.4.1.1.
|
||||
if ((decorations & NS_FONT_DECORATION_LINE_THROUGH) &&
|
||||
if ((decorations & NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH) &&
|
||||
strikeStyle != NS_STYLE_TEXT_DECORATION_STYLE_NONE) {
|
||||
fontMet->GetStrikeout(offset, size);
|
||||
gfxFloat offsetPixel = presContext->AppUnitsToGfxUnits(offset);
|
||||
|
||||
@@ -3735,15 +3735,16 @@ nsTreeBodyFrame::PaintText(int32_t aRowIndex,
|
||||
|
||||
nscoord offset;
|
||||
nscoord size;
|
||||
if (decorations & (NS_FONT_DECORATION_OVERLINE | NS_FONT_DECORATION_UNDERLINE)) {
|
||||
if (decorations & (NS_STYLE_TEXT_DECORATION_LINE_OVERLINE |
|
||||
NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE)) {
|
||||
fontMet->GetUnderline(offset, size);
|
||||
if (decorations & NS_FONT_DECORATION_OVERLINE) {
|
||||
if (decorations & NS_STYLE_TEXT_DECORATION_LINE_OVERLINE) {
|
||||
nsRect r(textRect.x, textRect.y, textRect.width, size);
|
||||
Rect devPxRect =
|
||||
NSRectToSnappedRect(r, appUnitsPerDevPixel, *drawTarget);
|
||||
drawTarget->FillRect(devPxRect, color);
|
||||
}
|
||||
if (decorations & NS_FONT_DECORATION_UNDERLINE) {
|
||||
if (decorations & NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE) {
|
||||
nsRect r(textRect.x, textRect.y + baseline - offset,
|
||||
textRect.width, size);
|
||||
Rect devPxRect =
|
||||
@@ -3751,7 +3752,7 @@ nsTreeBodyFrame::PaintText(int32_t aRowIndex,
|
||||
drawTarget->FillRect(devPxRect, color);
|
||||
}
|
||||
}
|
||||
if (decorations & NS_FONT_DECORATION_LINE_THROUGH) {
|
||||
if (decorations & NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH) {
|
||||
fontMet->GetStrikeout(offset, size);
|
||||
nsRect r(textRect.x, textRect.y + baseline - offset, textRect.width, size);
|
||||
Rect devPxRect =
|
||||
|
||||
@@ -720,7 +720,7 @@ pref("gfx.font_rendering.wordcache.maxentries", 10000);
|
||||
pref("gfx.font_rendering.graphite.enabled", true);
|
||||
|
||||
#ifdef XP_WIN
|
||||
pref("gfx.font_rendering.directwrite.enabled", false);
|
||||
pref("gfx.font_rendering.directwrite.force-enabled", false);
|
||||
pref("gfx.font_rendering.directwrite.use_gdi_table_loading", true);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ EXTRA_JS_MODULES['services-common'] += [
|
||||
'hawkclient.js',
|
||||
'hawkrequest.js',
|
||||
'logmanager.js',
|
||||
'storageservice.js',
|
||||
'stringbundle.js',
|
||||
'tokenserverclient.js',
|
||||
'utils.js',
|
||||
|
||||
@@ -8,5 +8,4 @@
|
||||
pref("services.common.log.logger.rest.request", "Debug");
|
||||
pref("services.common.log.logger.rest.response", "Debug");
|
||||
|
||||
pref("services.common.storageservice.sendVersionInfo", true);
|
||||
pref("services.common.log.logger.tokenserverclient", "Debug");
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -81,9 +81,9 @@ class SyncTestCommands(MachCommandBase):
|
||||
'-r', '%s/components/httpd.manifest' % self.bindir,
|
||||
'-m',
|
||||
'-s',
|
||||
'-e', 'const _TESTING_MODULES_DIR = "%s/_tests/modules";' % topobjdir,
|
||||
'-f', '%s/testing/xpcshell/head.js' % topsrcdir,
|
||||
'-e', 'const _SERVER_ADDR = "%s";' % hostname,
|
||||
'-e', 'const _TESTING_MODULES_DIR = "%s/_tests/modules";' % topobjdir,
|
||||
'-e', 'const SERVER_PORT = "%s";' % port,
|
||||
'-e', 'const INCLUDE_FILES = [%s];' % ', '.join(head_paths),
|
||||
'-e', '_register_protocol_handlers();',
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
Cu.import("resource://services-common/storageservice.js");
|
||||
|
||||
function run_test() {
|
||||
initTestLogging("Trace");
|
||||
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
add_test(function test_bso_constructor() {
|
||||
_("Ensure created BSO instances are initialized properly.");
|
||||
|
||||
let bso = new BasicStorageObject();
|
||||
do_check_eq(bso.id, null);
|
||||
do_check_eq(bso.collection, null);
|
||||
do_check_attribute_count(bso.data, 0);
|
||||
do_check_eq(bso.payload, null);
|
||||
do_check_eq(bso.modified, null);
|
||||
do_check_eq(bso.sortindex, 0);
|
||||
do_check_eq(bso.ttl, null);
|
||||
|
||||
bso = new BasicStorageObject("foobar");
|
||||
do_check_eq(bso.id, "foobar");
|
||||
do_check_eq(bso.collection, null);
|
||||
do_check_attribute_count(bso.data, 0);
|
||||
|
||||
bso = new BasicStorageObject("foo", "coll");
|
||||
do_check_eq(bso.id, "foo");
|
||||
do_check_eq(bso.collection, "coll");
|
||||
do_check_attribute_count(bso.data, 0);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
add_test(function test_bso_attributes() {
|
||||
_("Ensure attribute getters and setters work.");
|
||||
|
||||
let bso = new BasicStorageObject("foobar");
|
||||
bso.payload = "pay";
|
||||
do_check_eq(bso.payload, "pay");
|
||||
|
||||
bso.modified = 35423;
|
||||
do_check_eq(bso.modified, 35423);
|
||||
|
||||
bso.sortindex = 10;
|
||||
do_check_eq(bso.sortindex, 10);
|
||||
|
||||
bso.ttl = 60;
|
||||
do_check_eq(bso.ttl, 60);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
add_test(function test_bso_deserialize() {
|
||||
_("Ensure that deserialize() works.");
|
||||
|
||||
_("A simple working test.");
|
||||
let json = '{"id": "foobar", "payload": "pay", "modified": 1223145532}';
|
||||
let bso = new BasicStorageObject();
|
||||
bso.deserialize(json);
|
||||
do_check_neq(bso, null);
|
||||
do_check_eq(bso.id, "foobar");
|
||||
do_check_eq(bso.payload, "pay");
|
||||
do_check_eq(bso.modified, 1223145532);
|
||||
|
||||
_("Invalid JSON.");
|
||||
json = '{id: "foobar}';
|
||||
bso = new BasicStorageObject();
|
||||
try {
|
||||
bso.deserialize(json);
|
||||
do_check_true(false);
|
||||
} catch (ex) {
|
||||
do_check_eq(ex.name, "SyntaxError");
|
||||
}
|
||||
|
||||
_("Invalid key in JSON.");
|
||||
json = '{"id": "foo", "payload": "pay", "BADKEY": "irrelevant"}';
|
||||
bso = new BasicStorageObject();
|
||||
try {
|
||||
bso.deserialize(json);
|
||||
do_check_true(false);
|
||||
} catch (ex) {
|
||||
do_check_eq(ex.name, "Error");
|
||||
do_check_eq(ex.message.indexOf("Invalid key"), 0);
|
||||
}
|
||||
|
||||
_("Loading native JS objects works.");
|
||||
bso = new BasicStorageObject();
|
||||
bso.deserialize({id: "foo", payload: "pay"});
|
||||
do_check_neq(bso, null);
|
||||
do_check_eq(bso.id, "foo");
|
||||
do_check_eq(bso.payload, "pay");
|
||||
|
||||
_("Passing invalid type is caught.");
|
||||
bso = new BasicStorageObject();
|
||||
try {
|
||||
bso.deserialize(["foo", "bar"]);
|
||||
do_check_true(false);
|
||||
} catch (ex) {
|
||||
do_check_eq(ex.name, "Error");
|
||||
}
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
add_test(function test_bso_toJSON() {
|
||||
_("Ensure JSON serialization works.");
|
||||
|
||||
let bso = new BasicStorageObject();
|
||||
do_check_attribute_count(bso.toJSON(), 0);
|
||||
|
||||
bso.id = "foo";
|
||||
bso.payload = "pay";
|
||||
let json = bso.toJSON();
|
||||
let original = json;
|
||||
|
||||
do_check_attribute_count(original, 2);
|
||||
do_check_eq(original.id, "foo");
|
||||
do_check_eq(original.payload, "pay");
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
@@ -34,12 +34,6 @@ skip-if = toolkit == 'gonk'
|
||||
[test_restrequest.js]
|
||||
[test_tokenauthenticatedrequest.js]
|
||||
|
||||
# Storage service APIs
|
||||
[test_storageservice_bso.js]
|
||||
[test_storageservice_client.js]
|
||||
# Bug 969624: Intermittent fail on Android 2.3 emulator
|
||||
skip-if = os == "android" && android_version == "10"
|
||||
|
||||
[test_tokenserverclient.js]
|
||||
skip-if = os == "android"
|
||||
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
[Canvas test: 2d.gradient.interpolate.overlap]
|
||||
expected:
|
||||
if not debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL
|
||||
if debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL
|
||||
if debug and (os == "win") and (version == "10.0.10240") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "win") and (version == "10.0.10240") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
|
||||
|
||||
+2
@@ -4,5 +4,7 @@
|
||||
expected:
|
||||
if not debug and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): FAIL
|
||||
if debug and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): FAIL
|
||||
if not debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL
|
||||
if debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL
|
||||
if os == "mac": FAIL
|
||||
|
||||
|
||||
+2
-1
@@ -5,5 +5,6 @@
|
||||
if (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): FAIL
|
||||
if (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL
|
||||
if debug and (os == "win") and (version == "10.0.10240") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "win") and (version == "10.0.10240") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
|
||||
|
||||
@@ -5,5 +5,4 @@
|
||||
if (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): FAIL
|
||||
if (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL
|
||||
|
||||
|
||||
@@ -4,5 +4,6 @@
|
||||
expected:
|
||||
if not debug and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): FAIL
|
||||
if debug and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): FAIL
|
||||
if (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL
|
||||
if os == "mac": FAIL
|
||||
|
||||
|
||||
+3
-1
@@ -3,5 +3,7 @@
|
||||
[arcTo() curves in the right kind of shape]
|
||||
expected:
|
||||
if not debug and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): FAIL
|
||||
if os == "mac": FAIL
|
||||
if debug and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): FAIL
|
||||
if (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL
|
||||
if os == "mac": FAIL
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
[Canvas test: 2d.path.rect.zero.3]
|
||||
expected:
|
||||
if not debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL
|
||||
if debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL
|
||||
if debug and (os == "win") and (version == "10.0.10240") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "win") and (version == "10.0.10240") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): FAIL
|
||||
if not debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL
|
||||
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "mac") and (version == "OS X 10.10.2") and (processor == "x86") and (bits == 32): FAIL
|
||||
if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): FAIL
|
||||
if debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if debug and (os == "win") and (version == "10.0.10240") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "win") and (version == "10.0.10240") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
|
||||
|
||||
+5
-3
@@ -5,7 +5,9 @@
|
||||
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): FAIL
|
||||
if not debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL
|
||||
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "mac") and (version == "OS X 10.10.2") and (processor == "x86") and (bits == 32): FAIL
|
||||
if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): FAIL
|
||||
if debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if debug and (os == "win") and (version == "10.0.10240") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "win") and (version == "10.0.10240") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
|
||||
|
||||
+5
-3
@@ -5,7 +5,9 @@
|
||||
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): FAIL
|
||||
if not debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL
|
||||
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "mac") and (version == "OS X 10.10.2") and (processor == "x86") and (bits == 32): FAIL
|
||||
if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): FAIL
|
||||
if debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if debug and (os == "win") and (version == "10.0.10240") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "win") and (version == "10.0.10240") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): FAIL
|
||||
if not debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL
|
||||
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "mac") and (version == "OS X 10.10.2") and (processor == "x86") and (bits == 32): FAIL
|
||||
if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): FAIL
|
||||
if debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if debug and (os == "win") and (version == "10.0.10240") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "win") and (version == "10.0.10240") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): FAIL
|
||||
if not debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL
|
||||
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "mac") and (version == "OS X 10.10.2") and (processor == "x86") and (bits == 32): FAIL
|
||||
if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): FAIL
|
||||
if debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if debug and (os == "win") and (version == "10.0.10240") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "win") and (version == "10.0.10240") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
[Stroke line widths are scaled by the current transformation matrix]
|
||||
expected:
|
||||
if not debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL
|
||||
if debug and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): FAIL
|
||||
if debug and (os == "win") and (version == "10.0.10240") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
if not debug and (os == "win") and (version == "10.0.10240") and (processor == "x86_64") and (bits == 64): FAIL
|
||||
|
||||
|
||||
@@ -12,8 +12,13 @@ XPIDL_SOURCES += [
|
||||
|
||||
XPIDL_MODULE = 'alerts'
|
||||
|
||||
EXPORTS += [
|
||||
'nsAlertsUtils.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'nsAlertsService.cpp',
|
||||
'nsAlertsUtils.cpp',
|
||||
'nsXULAlerts.cpp',
|
||||
]
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ NS_IMETHODIMP nsAlertsService::ShowAlertNotification(const nsAString & aImageUrl
|
||||
// Use XUL notifications as a fallback if above methods have failed.
|
||||
rv = mXULAlerts.ShowAlertNotification(aImageUrl, aAlertTitle, aAlertText, aAlertTextClickable,
|
||||
aAlertCookie, aAlertListener, aAlertName,
|
||||
aBidi, aLang, aInPrivateBrowsing);
|
||||
aBidi, aLang, aPrincipal, aInPrivateBrowsing);
|
||||
return rv;
|
||||
#endif // !MOZ_WIDGET_ANDROID
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/* 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 "nsAlertsUtils.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsXPIDLString.h"
|
||||
|
||||
/* static */
|
||||
bool
|
||||
nsAlertsUtils::IsActionablePrincipal(nsIPrincipal* aPrincipal)
|
||||
{
|
||||
return aPrincipal &&
|
||||
!nsContentUtils::IsSystemOrExpandedPrincipal(aPrincipal) &&
|
||||
!aPrincipal->GetIsNullPrincipal();
|
||||
}
|
||||
|
||||
/* static */
|
||||
void
|
||||
nsAlertsUtils::GetSourceHostPort(nsIPrincipal* aPrincipal,
|
||||
nsAString& aHostPort)
|
||||
{
|
||||
if (!IsActionablePrincipal(aPrincipal)) {
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIURI> principalURI;
|
||||
if (NS_WARN_IF(NS_FAILED(
|
||||
aPrincipal->GetURI(getter_AddRefs(principalURI))))) {
|
||||
return;
|
||||
}
|
||||
if (!principalURI) {
|
||||
return;
|
||||
}
|
||||
nsAutoCString hostPort;
|
||||
if (NS_WARN_IF(NS_FAILED(principalURI->GetHostPort(hostPort)))) {
|
||||
return;
|
||||
}
|
||||
CopyUTF8toUTF16(hostPort, aHostPort);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/* 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/. */
|
||||
|
||||
#ifndef nsAlertsUtils_h
|
||||
#define nsAlertsUtils_h
|
||||
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsAlertsUtils final
|
||||
{
|
||||
private:
|
||||
nsAlertsUtils() = delete;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Indicates whether an alert from |aPrincipal| should include the source
|
||||
* string and action buttons. Returns false if |aPrincipal| is |nullptr|, or
|
||||
* a system, expanded, or null principal.
|
||||
*/
|
||||
static bool
|
||||
IsActionablePrincipal(nsIPrincipal* aPrincipal);
|
||||
|
||||
/**
|
||||
* Sets |aHostPort| to the host and port from |aPrincipal|'s URI, or an
|
||||
* empty string if |aPrincipal| is not actionable.
|
||||
*/
|
||||
static void
|
||||
GetSourceHostPort(nsIPrincipal* aPrincipal, nsAString& aHostPort);
|
||||
};
|
||||
#endif /* nsAlertsUtils_h */
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsAlertsUtils.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
@@ -44,7 +45,8 @@ nsXULAlerts::ShowAlertNotification(const nsAString& aImageUrl, const nsAString&
|
||||
const nsAString& aAlertText, bool aAlertTextClickable,
|
||||
const nsAString& aAlertCookie, nsIObserver* aAlertListener,
|
||||
const nsAString& aAlertName, const nsAString& aBidi,
|
||||
const nsAString& aLang, bool aInPrivateBrowsing)
|
||||
const nsAString& aLang, nsIPrincipal* aPrincipal,
|
||||
bool aInPrivateBrowsing)
|
||||
{
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||
|
||||
@@ -134,6 +136,16 @@ nsXULAlerts::ShowAlertNotification(const nsAString& aImageUrl, const nsAString&
|
||||
rv = argsArray->AppendElement(ifptr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// The source contains the host and port of the site that sent the
|
||||
// notification. It is empty for system alerts.
|
||||
nsCOMPtr<nsISupportsString> scriptableAlertSource (do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID));
|
||||
NS_ENSURE_TRUE(scriptableAlertSource, NS_ERROR_FAILURE);
|
||||
nsAutoString source;
|
||||
nsAlertsUtils::GetSourceHostPort(aPrincipal, source);
|
||||
scriptableAlertSource->SetData(source);
|
||||
rv = argsArray->AppendElement(scriptableAlertSource);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> newWindow;
|
||||
nsAutoCString features("chrome,dialog=yes,titlebar=no,popup=yes");
|
||||
if (aInPrivateBrowsing) {
|
||||
|
||||
@@ -25,7 +25,8 @@ public:
|
||||
const nsAString& aAlertText, bool aAlertTextClickable,
|
||||
const nsAString& aAlertCookie, nsIObserver* aAlertListener,
|
||||
const nsAString& aAlertName, const nsAString& aBidi,
|
||||
const nsAString& aLang, bool aInPrivateBrowsing);
|
||||
const nsAString& aLang, nsIPrincipal* aPrincipal,
|
||||
bool aInPrivateBrowsing);
|
||||
|
||||
nsresult CloseAlert(const nsAString& aAlertName);
|
||||
protected:
|
||||
|
||||
@@ -3,14 +3,20 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#alertBox[animate] {
|
||||
animation-duration: 12s;
|
||||
animation-fill-mode: both;
|
||||
animation-name: alert-animation;
|
||||
}
|
||||
|
||||
#alertBox[animate]:hover {
|
||||
#alertBox[animate]:not([clicked]):not([closing]):hover {
|
||||
animation-play-state: paused;
|
||||
}
|
||||
|
||||
#alertBox:not([hasOrigin]) > box > #alertTextBox > #alertFooter,
|
||||
#alertImage:not([src]) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.alertText {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,8 @@
|
||||
// -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
|
||||
|
||||
/* 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/. */
|
||||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
const Cc = Components.classes;
|
||||
|
||||
var windowMediator = Cc["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Ci.nsIWindowMediator);
|
||||
var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||
|
||||
/*
|
||||
* This indicates from which corner of the screen alerts slide in,
|
||||
@@ -32,6 +24,9 @@ const NS_ALERT_LEFT = 2;
|
||||
const NS_ALERT_TOP = 4;
|
||||
|
||||
const WINDOW_MARGIN = 10;
|
||||
const BODY_TEXT_LIMIT = 200;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var gOrigin = 0; // Default value: alert from bottom right.
|
||||
var gReplacedWindow = null;
|
||||
@@ -52,15 +47,54 @@ function prefillAlertInfo() {
|
||||
// arguments[7] --> lang
|
||||
// arguments[8] --> replaced alert window (nsIDOMWindow)
|
||||
// arguments[9] --> an optional callback listener (nsIObserver)
|
||||
|
||||
document.getElementById('alertTime').setAttribute('value', (new Date).getTime());
|
||||
// arguments[10] -> the nsIURI.hostPort of the origin, optional
|
||||
|
||||
switch (window.arguments.length) {
|
||||
default:
|
||||
case 11: {
|
||||
if (window.arguments[10]) {
|
||||
let alertBox = document.getElementById("alertBox");
|
||||
alertBox.setAttribute("hasOrigin", true);
|
||||
|
||||
let hostPort = window.arguments[10];
|
||||
const ALERT_BUNDLE = Services.strings.createBundle(
|
||||
"chrome://alerts/locale/alert.properties");
|
||||
const BRAND_BUNDLE = Services.strings.createBundle(
|
||||
"chrome://branding/locale/brand.properties");
|
||||
const BRAND_NAME = BRAND_BUNDLE.GetStringFromName("brandShortName");
|
||||
let label = document.getElementById("alertSourceLabel");
|
||||
label.setAttribute("value",
|
||||
ALERT_BUNDLE.formatStringFromName("source.label",
|
||||
[hostPort],
|
||||
1));
|
||||
let doNotDisturbMenuItem = document.getElementById("doNotDisturbMenuItem");
|
||||
doNotDisturbMenuItem.setAttribute("label",
|
||||
ALERT_BUNDLE.formatStringFromName("doNotDisturb.label",
|
||||
[BRAND_NAME],
|
||||
1));
|
||||
let disableForOrigin = document.getElementById("disableForOriginMenuItem");
|
||||
disableForOrigin.setAttribute("label",
|
||||
ALERT_BUNDLE.formatStringFromName("webActions.disableForOrigin.label",
|
||||
[hostPort],
|
||||
1));
|
||||
let openSettings = document.getElementById("openSettingsMenuItem");
|
||||
openSettings.setAttribute("label",
|
||||
ALERT_BUNDLE.GetStringFromName("webActions.settings.label"));
|
||||
}
|
||||
}
|
||||
case 10:
|
||||
gAlertListener = window.arguments[9];
|
||||
case 9:
|
||||
gReplacedWindow = window.arguments[8];
|
||||
case 8:
|
||||
if (window.arguments[7]) {
|
||||
document.getElementById("alertTitleLabel").setAttribute("lang", window.arguments[7]);
|
||||
document.getElementById("alertTextLabel").setAttribute("lang", window.arguments[7]);
|
||||
}
|
||||
case 7:
|
||||
if (window.arguments[6]) {
|
||||
document.getElementById("alertNotification").style.direction = window.arguments[6];
|
||||
}
|
||||
case 6:
|
||||
gOrigin = window.arguments[5];
|
||||
case 5:
|
||||
@@ -68,16 +102,44 @@ function prefillAlertInfo() {
|
||||
case 4:
|
||||
gAlertTextClickable = window.arguments[3];
|
||||
if (gAlertTextClickable) {
|
||||
document.getElementById('alertNotification').setAttribute('clickable', true);
|
||||
document.getElementById('alertTextLabel').setAttribute('clickable', true);
|
||||
document.getElementById("alertNotification").setAttribute("clickable", true);
|
||||
document.getElementById("alertTextLabel").setAttribute("clickable", true);
|
||||
}
|
||||
case 3:
|
||||
document.getElementById('alertTextLabel').textContent = window.arguments[2];
|
||||
if (window.arguments[2]) {
|
||||
document.getElementById("alertBox").setAttribute("hasBodyText", true);
|
||||
let bodyText = window.arguments[2];
|
||||
let bodyTextLabel = document.getElementById("alertTextLabel");
|
||||
|
||||
if (bodyText.length > BODY_TEXT_LIMIT) {
|
||||
bodyTextLabel.setAttribute("tooltiptext", bodyText);
|
||||
|
||||
let ellipsis = "\u2026";
|
||||
try {
|
||||
ellipsis = Services.prefs.getComplexValue("intl.ellipsis",
|
||||
Ci.nsIPrefLocalizedString).data;
|
||||
} catch (e) { }
|
||||
|
||||
// Copied from nsContextMenu.js' formatSearchContextItem().
|
||||
// If the JS character after our truncation point is a trail surrogate,
|
||||
// include it in the truncated string to avoid splitting a surrogate pair.
|
||||
let truncLength = BODY_TEXT_LIMIT;
|
||||
let truncChar = bodyText[BODY_TEXT_LIMIT].charCodeAt(0);
|
||||
if (truncChar >= 0xDC00 && truncChar <= 0xDFFF) {
|
||||
truncLength++;
|
||||
}
|
||||
|
||||
bodyText = bodyText.substring(0, truncLength) +
|
||||
ellipsis;
|
||||
}
|
||||
bodyTextLabel.textContent = bodyText;
|
||||
}
|
||||
case 2:
|
||||
document.getElementById('alertTitleLabel').setAttribute('value', window.arguments[1]);
|
||||
document.getElementById("alertTitleLabel").setAttribute("value", window.arguments[1]);
|
||||
case 1:
|
||||
if (window.arguments[0]) {
|
||||
document.getElementById('alertImage').setAttribute('src', window.arguments[0]);
|
||||
document.getElementById("alertBox").setAttribute("hasImage", true);
|
||||
document.getElementById("alertImage").setAttribute("src", window.arguments[0]);
|
||||
}
|
||||
case 0:
|
||||
break;
|
||||
@@ -85,12 +147,7 @@ function prefillAlertInfo() {
|
||||
}
|
||||
|
||||
function onAlertLoad() {
|
||||
const ALERT_DURATION_IMMEDIATE_MIN = 4000;
|
||||
const ALERT_DURATION_IMMEDIATE_MAX = 60000;
|
||||
let alertDurationImmediate = Services.prefs.getIntPref("alerts.durationImmediate", ALERT_DURATION_IMMEDIATE_MIN);
|
||||
alertDurationImmediate = alertDurationImmediate >= ALERT_DURATION_IMMEDIATE_MIN
|
||||
&& alertDurationImmediate <= ALERT_DURATION_IMMEDIATE_MAX
|
||||
? alertDurationImmediate : ALERT_DURATION_IMMEDIATE_MIN;
|
||||
const ALERT_DURATION_IMMEDIATE = 12000;
|
||||
let alertTextBox = document.getElementById("alertTextBox");
|
||||
let alertImageBox = document.getElementById("alertImageBox");
|
||||
alertImageBox.style.minHeight = alertTextBox.scrollHeight + "px";
|
||||
@@ -108,19 +165,26 @@ function onAlertLoad() {
|
||||
window.addEventListener("XULAlertClose", function() { window.close(); });
|
||||
|
||||
if (Services.prefs.getBoolPref("alerts.disableSlidingEffect")) {
|
||||
setTimeout(function() { window.close(); }, alertDurationImmediate);
|
||||
return;
|
||||
setTimeout(function() { window.close(); }, ALERT_DURATION_IMMEDIATE);
|
||||
} else {
|
||||
let alertBox = document.getElementById("alertBox");
|
||||
alertBox.addEventListener("animationend", function hideAlert(event) {
|
||||
if (event.animationName == "alert-animation" ||
|
||||
event.animationName == "alert-clicked-animation" ||
|
||||
event.animationName == "alert-closing-animation") {
|
||||
alertBox.removeEventListener("animationend", hideAlert, false);
|
||||
window.close();
|
||||
}
|
||||
}, false);
|
||||
alertBox.setAttribute("animate", true);
|
||||
}
|
||||
|
||||
let alertBox = document.getElementById("alertBox");
|
||||
alertBox.addEventListener("animationend", function hideAlert(event) {
|
||||
if (event.animationName == "alert-animation") {
|
||||
alertBox.removeEventListener("animationend", hideAlert, false);
|
||||
window.close();
|
||||
}
|
||||
}, false);
|
||||
alertBox.style.animationDuration = Math.round(alertDurationImmediate / 1000).toString() + "s";
|
||||
alertBox.setAttribute("animate", true);
|
||||
let alertSettings = document.getElementById("alertSettings");
|
||||
alertSettings.addEventListener("focus", onAlertSettingsFocus);
|
||||
alertSettings.addEventListener("click", onAlertSettingsClick);
|
||||
|
||||
let ev = new CustomEvent("AlertActive", {bubbles: true, cancelable: true});
|
||||
document.documentElement.dispatchEvent(ev);
|
||||
|
||||
if (gAlertListener) {
|
||||
gAlertListener.observe(null, "alertshow", gAlertCookie);
|
||||
@@ -132,7 +196,7 @@ function moveWindowToReplace(aReplacedAlert) {
|
||||
|
||||
// Move windows that come after the replaced alert if the height is different.
|
||||
if (heightDelta != 0) {
|
||||
let windows = windowMediator.getEnumerator('alert:alert');
|
||||
let windows = Services.wm.getEnumerator("alert:alert");
|
||||
while (windows.hasMoreElements()) {
|
||||
let alertWindow = windows.getNext();
|
||||
// boolean to determine if the alert window is after the replaced alert.
|
||||
@@ -162,7 +226,7 @@ function moveWindowToEnd() {
|
||||
screen.availTop + screen.availHeight - window.outerHeight;
|
||||
|
||||
// Position the window at the end of all alerts.
|
||||
let windows = windowMediator.getEnumerator('alert:alert');
|
||||
let windows = Services.wm.getEnumerator("alert:alert");
|
||||
while (windows.hasMoreElements()) {
|
||||
let alertWindow = windows.getNext();
|
||||
let alertWindowTime = Number(
|
||||
@@ -193,7 +257,7 @@ function onAlertBeforeUnload() {
|
||||
if (!gIsReplaced) {
|
||||
// Move other alert windows to fill the gap left by closing alert.
|
||||
let heightDelta = window.outerHeight + WINDOW_MARGIN;
|
||||
let windows = windowMediator.getEnumerator('alert:alert');
|
||||
let windows = Services.wm.getEnumerator("alert:alert");
|
||||
while (windows.hasMoreElements()) {
|
||||
let alertWindow = windows.getNext();
|
||||
if (alertWindow != window) {
|
||||
@@ -220,5 +284,51 @@ function onAlertClick() {
|
||||
gAlertListener.observe(null, "alertclickcallback", gAlertCookie);
|
||||
}
|
||||
|
||||
window.close();
|
||||
let alertBox = document.getElementById("alertBox");
|
||||
if (alertBox.getAttribute("animate") == "true") {
|
||||
// Closed when the animation ends.
|
||||
alertBox.setAttribute("clicked", "true");
|
||||
} else {
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
|
||||
function doNotDisturb() {
|
||||
const alertService = Cc["@mozilla.org/alerts-service;1"]
|
||||
.getService(Ci.nsIAlertsService)
|
||||
.QueryInterface(Ci.nsIAlertsDoNotDisturb);
|
||||
alertService.manualDoNotDisturb = true;
|
||||
onAlertClose();
|
||||
}
|
||||
|
||||
function disableForOrigin() {
|
||||
gAlertListener.observe(null, "alertdisablecallback", gAlertCookie);
|
||||
onAlertClose();
|
||||
}
|
||||
|
||||
function onAlertSettingsFocus(event) {
|
||||
event.target.removeAttribute("focusedViaMouse");
|
||||
}
|
||||
|
||||
function onAlertSettingsClick(event) {
|
||||
// XXXjaws Hack used to remove the focus-ring only
|
||||
// from mouse interaction, but focus-ring drawing
|
||||
// should only be enabled when interacting via keyboard.
|
||||
event.target.setAttribute("focusedViaMouse", true);
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
function openSettings() {
|
||||
gAlertListener.observe(null, "alertsettingscallback", gAlertCookie);
|
||||
onAlertClose();
|
||||
}
|
||||
|
||||
function onAlertClose() {
|
||||
let alertBox = document.getElementById("alertBox");
|
||||
if (alertBox.getAttribute("animate") == "true") {
|
||||
// Closed when the animation ends.
|
||||
alertBox.setAttribute("closing", "true");
|
||||
} else {
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
windowtype="alert:alert"
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml"
|
||||
xhtml:role="alert"
|
||||
role="alert"
|
||||
pack="start"
|
||||
onload="onAlertLoad();"
|
||||
onclick="onAlertClick();"
|
||||
@@ -23,26 +23,41 @@
|
||||
|
||||
<script type="application/javascript" src="chrome://global/content/alerts/alert.js"/>
|
||||
|
||||
<box id="alertBox" class="alertBox">
|
||||
<label id="alertTime" value="" hidden="true"/>
|
||||
<vbox id="alertBox" class="alertBox">
|
||||
<box id="alertTitleBox">
|
||||
<label id="alertTitleLabel" class="alertTitle plain" crop="end"/>
|
||||
<vbox class="alertCloseBox">
|
||||
<toolbarbutton class="alertCloseButton close-icon"
|
||||
tooltiptext="&closeAlert.tooltip;"
|
||||
onclick="event.stopPropagation();"
|
||||
oncommand="onAlertClose();"/>
|
||||
</vbox>
|
||||
</box>
|
||||
<box>
|
||||
<hbox id="alertImageBox" class="alertImageBox" align="center" pack="center">
|
||||
<image id="alertImage"/>
|
||||
</hbox>
|
||||
|
||||
<vbox id="alertTextBox" class="alertTextBox">
|
||||
<label id="alertTitleLabel" class="alertTitle plain"/>
|
||||
<label id="alertTextLabel" class="alertText plain"/>
|
||||
<spacer flex="1"/>
|
||||
<box id="alertFooter">
|
||||
<label id="alertSourceLabel" class="alertSource plain"/>
|
||||
<button type="menu" id="alertSettings" tooltiptext="&settings.label;">
|
||||
<menupopup position="after_end">
|
||||
<menuitem id="doNotDisturbMenuItem"
|
||||
oncommand="doNotDisturb();"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="disableForOriginMenuItem"
|
||||
oncommand="disableForOrigin();"/>
|
||||
<menuitem id="openSettingsMenuItem"
|
||||
oncommand="openSettings();"/>
|
||||
</menupopup>
|
||||
</button>
|
||||
</box>
|
||||
</vbox>
|
||||
</box>
|
||||
|
||||
<vbox class="alertCloseBox">
|
||||
<toolbarbutton class="alertCloseButton close-icon"
|
||||
tooltiptext="&closeAlert.tooltip;"
|
||||
onclick="event.stopPropagation();"
|
||||
oncommand="close();"/>
|
||||
</vbox>
|
||||
</box>
|
||||
</vbox>
|
||||
|
||||
<!-- This method is called inline because we want to make sure we establish the width
|
||||
and height of the alert before we fire the onload handler. -->
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[DEFAULT]
|
||||
skip-if = buildapp == 'b2g'
|
||||
skip-if = buildapp == 'b2g' || buildapp == 'mulet'
|
||||
|
||||
# Synchronous tests like test_alerts.html must come before
|
||||
# asynchronous tests like test_alerts_noobserve.html!
|
||||
@@ -8,3 +8,5 @@ skip-if = toolkit == 'android'
|
||||
[test_alerts_noobserve.html]
|
||||
skip-if = (toolkit == 'android' && processor == 'x86') #x86 only
|
||||
[test_multiple_alerts.html]
|
||||
[test_principal.html]
|
||||
skip-if = toolkit == 'android'
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
var observer = {
|
||||
alertShow: false,
|
||||
observe: function (aSubject, aTopic, aData) {
|
||||
if (aTopic == "alertclickcallback") {
|
||||
is(aData, "foobarcookie", "Checking whether the alert cookie was passed correctly");
|
||||
if (aTopic == "alertclickcallback") {
|
||||
todo(false, "Did someone click the notification while running mochitests? (Please don't.)");
|
||||
} else if (aTopic == "alertshow") {
|
||||
ok(!this.alertShow, "Alert should not be shown more than once");
|
||||
@@ -31,7 +32,6 @@ var observer = {
|
||||
is(aTopic, "alertfinished", "Checking the topic for a finished notification");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
is(aData, "foobarcookie", "Checking whether the alert cookie was passed correctly");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -62,9 +62,10 @@ function runTest() {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
notifier.showAlertNotification(null, "Notification test",
|
||||
"Surprise! I'm here to test notifications!",
|
||||
false, "foobarcookie", observer, alertname);
|
||||
false, "foobarcookie", observer, alertName);
|
||||
ok(true, "showAlertNotification() succeeded. Waiting for notification...");
|
||||
if (MAC) {
|
||||
|
||||
if (SpecialPowers.Services.appinfo.OS == "Darwin") {
|
||||
// Notifications are native on OS X 10.8 and later, and when they are they
|
||||
// persist in the Notification Center. We need to close explicitly to avoid a hang.
|
||||
// This also works for XUL notifications when running this test on OS X < 10.8.
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for Bug 1202933</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p id="display"></p>
|
||||
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
const Cc = SpecialPowers.Cc;
|
||||
const Ci = SpecialPowers.Ci;
|
||||
const Services = SpecialPowers.Services;
|
||||
|
||||
const notifier = Cc["@mozilla.org/alerts-service;1"]
|
||||
.getService(Ci.nsIAlertsService);
|
||||
|
||||
function notify(alertName, principal) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var source;
|
||||
function observe(subject, topic, data) {
|
||||
if (topic == "alertclickcallback") {
|
||||
reject(new Error("Alerts should not be clicked during test"));
|
||||
} else if (topic == "alertshow") {
|
||||
var alertWindows = Services.wm.getEnumerator("alert:alert");
|
||||
ok(alertWindows.hasMoreElements(), "Should show alert");
|
||||
var alertWindow = alertWindows.getNext();
|
||||
source = alertWindow.document.getElementById("alertSourceLabel").getAttribute("value");
|
||||
} else {
|
||||
is(topic, "alertfinished", "Should hide alert");
|
||||
resolve(source);
|
||||
}
|
||||
}
|
||||
notifier.showAlertNotification(null, "Notification test",
|
||||
"Surprise! I'm here to test notifications!",
|
||||
false, alertName, observe, alertName,
|
||||
null, null, null, principal);
|
||||
if (SpecialPowers.Services.appinfo.OS == "Darwin") {
|
||||
notifier.closeAlert(alertName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function* testNoPrincipal() {
|
||||
var source = yield notify("noPrincipal", null);
|
||||
ok(!source, "Should omit source without principal");
|
||||
}
|
||||
|
||||
function* testSystemPrincipal() {
|
||||
var principal = Services.scriptSecurityManager.getSystemPrincipal();
|
||||
var source = yield notify("systemPrincipal", principal);
|
||||
ok(!source, "Should omit source for system principal");
|
||||
}
|
||||
|
||||
function* testExpandedPrincipal() {
|
||||
var principal = Services.scriptSecurityManager.createExpandedPrincipal([], 0);
|
||||
var source = yield notify("expandedPrincipal", principal);
|
||||
ok(!source, "Should omit source for expanded principal");
|
||||
}
|
||||
|
||||
function* testNullPrincipal() {
|
||||
var principal = Services.scriptSecurityManager.createNullPrincipal({});
|
||||
var source = yield notify("nullPrincipal", principal);
|
||||
ok(!source, "Should omit source for null principal");
|
||||
}
|
||||
|
||||
function* testNodePrincipal() {
|
||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
var source = yield notify("nodePrincipal", principal);
|
||||
|
||||
var stringBundle = Services.strings.createBundle(
|
||||
"chrome://alerts/locale/alert.properties"
|
||||
);
|
||||
var localizedSource = stringBundle.formatStringFromName(
|
||||
"source.label", [principal.URI.hostPort], 1);
|
||||
is(source, localizedSource, "Should include source for node principal");
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
if (!("@mozilla.org/alerts-service;1" in Cc)) {
|
||||
todo(false, "Alerts service does not exist in this application");
|
||||
return;
|
||||
}
|
||||
|
||||
if ("@mozilla.org/system-alerts-service;1" in Cc) {
|
||||
todo(false, "Native alerts service exists in this application");
|
||||
return;
|
||||
}
|
||||
|
||||
ok(true, "Alerts service exists in this application");
|
||||
|
||||
ok(!Services.wm.getEnumerator("alert:alert").hasMoreElements(),
|
||||
"Alerts should not be present at the start of the test.");
|
||||
|
||||
add_task(testNoPrincipal);
|
||||
add_task(testSystemPrincipal);
|
||||
add_task(testExpandedPrincipal);
|
||||
add_task(testNullPrincipal);
|
||||
add_task(testNodePrincipal);
|
||||
}
|
||||
|
||||
runTest();
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,3 +3,4 @@
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<!ENTITY closeAlert.tooltip "Close this notification">
|
||||
<!ENTITY settings.label "Settings">
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# 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/.
|
||||
|
||||
# LOCALIZATION NOTE(closeButton.title): Used as the close button text for web notifications on OS X.
|
||||
# This should ideally match the string that OS X uses for the close button on alert-type
|
||||
# notifications. OS X will truncate the value if it's too long.
|
||||
closeButton.title = Close
|
||||
# LOCALIZATION NOTE(actionButton.label): Used as the button label to provide more actions on OS X notifications. OS X will truncate this if it's too long.
|
||||
actionButton.label = …
|
||||
# LOCALIZATION NOTE(webActions.disableForOrigin.label): %S is replaced
|
||||
# with the hostname origin of the notification.
|
||||
webActions.disableForOrigin.label = Disable notifications from %S
|
||||
|
||||
# LOCALIZATION NOTE(source.label): Used to show the URL of the site that
|
||||
# sent the notification (e.g., "via mozilla.org"). "%1$S" is the source host
|
||||
# and port.
|
||||
source.label=via %1$S
|
||||
webActions.settings.label = Notification settings
|
||||
|
||||
# LOCALIZATION NOTE(doNotDisturb.label): %S is replaced with the
|
||||
# brandShortName of the application.
|
||||
doNotDisturb.label = Do not disturb me until I restart %S
|
||||
@@ -1,5 +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/.
|
||||
|
||||
general=General Notification
|
||||
@@ -169,7 +169,7 @@
|
||||
locale/@AB_CD@/mozapps/xpinstall/xpinstallConfirm.properties (%chrome/mozapps/extensions/xpinstallConfirm.properties)
|
||||
% locale alerts @AB_CD@ %locale/@AB_CD@/alerts/
|
||||
locale/@AB_CD@/alerts/alert.dtd (%chrome/alerts/alert.dtd)
|
||||
locale/@AB_CD@/alerts/notificationNames.properties (%chrome/alerts/notificationNames.properties)
|
||||
locale/@AB_CD@/alerts/alert.properties (%chrome/alerts/alert.properties)
|
||||
% locale cookie @AB_CD@ %locale/@AB_CD@/cookie/
|
||||
locale/@AB_CD@/cookie/cookieAcceptDialog.dtd (%chrome/cookie/cookieAcceptDialog.dtd)
|
||||
locale/@AB_CD@/cookie/cookieAcceptDialog.properties (%chrome/cookie/cookieAcceptDialog.properties)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
== Styles specific to the alerts dialog.
|
||||
======================================================================= */
|
||||
|
||||
@import url("chrome://global/skin/");
|
||||
@import url("chrome://global/skin/alerts/alert-common.css");
|
||||
|
||||
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
|
||||
|
||||
@@ -15,48 +15,6 @@
|
||||
background-color: -moz-Dialog;
|
||||
}
|
||||
|
||||
.alertImageBox {
|
||||
padding: 8px 0;
|
||||
width: 64px;
|
||||
background-image: linear-gradient(rgba(255,255,255,0.7), rgba(255,255,255,0.6));
|
||||
-moz-border-end: 1px solid rgba(0,0,0,.1);
|
||||
}
|
||||
|
||||
.alertTextBox {
|
||||
padding: 8px;
|
||||
-moz-padding-start: 16px;
|
||||
width: 255px;
|
||||
}
|
||||
|
||||
.alertTextBox,
|
||||
.alertCloseBox {
|
||||
background-image: linear-gradient(rgba(255,255,255,0.2), rgba(255,255,255,0.1));
|
||||
}
|
||||
|
||||
#alertNotification[clickable="true"]:hover .alertTextBox,
|
||||
#alertNotification[clickable="true"]:hover .alertCloseBox {
|
||||
background-image: linear-gradient(rgba(255,255,255,0.4), rgba(255,255,255,0.3));
|
||||
}
|
||||
|
||||
.alertTitle {
|
||||
font-weight: bold;
|
||||
font-size: 110%;
|
||||
}
|
||||
|
||||
#alertImage {
|
||||
max-width: 48px;
|
||||
max-height: 48px;
|
||||
list-style-image: url(chrome://global/skin/alerts/notification-48.png);
|
||||
}
|
||||
|
||||
#alertNotification[clickable="true"] {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
label {
|
||||
cursor: inherit;
|
||||
}
|
||||
|
||||
.alertCloseButton {
|
||||
-moz-appearance: none;
|
||||
height: 16px;
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.5 KiB |
@@ -34,7 +34,6 @@ toolkit.jar:
|
||||
+ skin/classic/global/toolbarbutton.css
|
||||
+ skin/classic/global/tree.css
|
||||
+ skin/classic/global/alerts/alert.css (alerts/alert.css)
|
||||
+ skin/classic/global/alerts/notification-48.png (alerts/notification-48.png)
|
||||
+ skin/classic/global/console/console.css (console/console.css)
|
||||
+ skin/classic/global/console/console.png (console/console.png)
|
||||
+ skin/classic/global/console/console-toolbar.png (console/console-toolbar.png)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
== Styles specific to the alerts dialog.
|
||||
======================================================================= */
|
||||
|
||||
@import url("chrome://global/skin/");
|
||||
@import url("chrome://global/skin/alerts/alert-common.css");
|
||||
|
||||
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
|
||||
|
||||
@@ -15,73 +15,11 @@
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.alertBox {
|
||||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
background-color: rgba(240,240,240,0.93);
|
||||
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.3);
|
||||
}
|
||||
|
||||
.alertImageBox {
|
||||
padding: 8px 0;
|
||||
width: 64px;
|
||||
background-image: linear-gradient(rgba(255,255,255,0.7), rgba(255,255,255,0.6));
|
||||
-moz-border-end: 1px solid rgba(0,0,0,.08);
|
||||
}
|
||||
|
||||
.alertTitle,
|
||||
.alertTextBox {
|
||||
text-shadow: 0 1px white;
|
||||
}
|
||||
|
||||
.alertTextBox {
|
||||
padding: 8px;
|
||||
-moz-padding-start: 16px;
|
||||
width: 255px;
|
||||
}
|
||||
|
||||
.alertTextBox,
|
||||
.alertCloseBox {
|
||||
background-image: linear-gradient(rgba(255,255,255,0.2), rgba(255,255,255,0.1));
|
||||
}
|
||||
|
||||
#alertNotification[clickable="true"]:hover .alertTextBox,
|
||||
#alertNotification[clickable="true"]:hover .alertCloseBox {
|
||||
background-image: linear-gradient(rgba(255,255,255,0.4), rgba(255,255,255,0.3));
|
||||
}
|
||||
|
||||
.alertTitle {
|
||||
font-weight: bold;
|
||||
font-size: 110%;
|
||||
}
|
||||
|
||||
#alertImage {
|
||||
max-width: 48px;
|
||||
max-height: 48px;
|
||||
list-style-image: url(chrome://global/skin/alerts/notification-48.png);
|
||||
}
|
||||
|
||||
#alertNotification[clickable="true"] {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
label {
|
||||
cursor: inherit;
|
||||
}
|
||||
|
||||
@keyframes alert-animation {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
6.25% {
|
||||
opacity: 1;
|
||||
}
|
||||
93.75% {
|
||||
opacity: 1;
|
||||
}
|
||||
to {
|
||||
opacity: 0;
|
||||
}
|
||||
#alertBox {
|
||||
border: 1px solid ThreeDShadow;
|
||||
border-radius: 1px;
|
||||
background-color: -moz-Dialog;
|
||||
color: -moz-DialogText;
|
||||
}
|
||||
|
||||
.alertCloseButton {
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.5 KiB |
@@ -59,7 +59,6 @@ toolkit.jar:
|
||||
* skin/classic/global/viewbuttons.css
|
||||
skin/classic/global/wizard.css
|
||||
skin/classic/global/alerts/alert.css (alerts/alert.css)
|
||||
skin/classic/global/alerts/notification-48.png (alerts/notification-48.png)
|
||||
skin/classic/global/arrow/arrow-dn-dis.gif (arrow/arrow-dn-dis.gif)
|
||||
skin/classic/global/arrow/arrow-dn-dis.png (arrow/arrow-dn-dis.png)
|
||||
skin/classic/global/arrow/arrow-dn-sharp.gif (arrow/arrow-dn-sharp.gif)
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
/* 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/. */
|
||||
|
||||
/* ===== alert.css =====================================================
|
||||
== Shared styles specific to the alerts dialog.
|
||||
======================================================================= */
|
||||
|
||||
@import url("chrome://global/skin/");
|
||||
|
||||
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
|
||||
|
||||
#alertBox[hasBodyText] > #alertTextBox,
|
||||
#alertBox[hasOrigin] > #alertTitleBox {
|
||||
border-bottom: 1px solid ThreeDShadow;
|
||||
}
|
||||
|
||||
#alertBox[animate] {
|
||||
animation-timing-function: cubic-bezier(.12,1.23,.48,1.09);
|
||||
}
|
||||
|
||||
#alertBox[animate][clicked] {
|
||||
animation-duration: .6s;
|
||||
animation-name: alert-clicked-animation;
|
||||
}
|
||||
|
||||
/* This is used if the close button is clicked
|
||||
before the animation has finished. */
|
||||
#alertBox[animate][closing] {
|
||||
animation-duration: .6s;
|
||||
animation-name: alert-closing-animation;
|
||||
}
|
||||
|
||||
@keyframes alert-animation {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
5% {
|
||||
opacity: 1;
|
||||
}
|
||||
95% {
|
||||
opacity: 1;
|
||||
}
|
||||
to {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes alert-clicked-animation {
|
||||
to {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes alert-closing-animation {
|
||||
to {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
#alertImage {
|
||||
width: 64px;
|
||||
}
|
||||
|
||||
.alertTextBox {
|
||||
padding-top: 8px;
|
||||
padding-inline-start: 8px;
|
||||
/* The text box width is increased to make up for the lack of image when one
|
||||
is not provided. 319px is the text box width when a picture is present,
|
||||
255px, plus the width of the image, 64px. */
|
||||
width: 319px;
|
||||
}
|
||||
|
||||
#alertBox[hasImage] > box > #alertTextBox {
|
||||
width: 255px;
|
||||
}
|
||||
|
||||
#alertTextLabel {
|
||||
padding-inline-end: 8px;
|
||||
}
|
||||
|
||||
.alertTitle {
|
||||
-moz-box-flex: 1;
|
||||
font-weight: bold;
|
||||
padding: 6px 8px;
|
||||
width: 255px;
|
||||
}
|
||||
|
||||
#alertFooter {
|
||||
-moz-box-align: end;
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
|
||||
#alertSourceLabel {
|
||||
-moz-box-flex: 1;
|
||||
font-size: 83.334%;
|
||||
color: GrayText;
|
||||
}
|
||||
|
||||
#alertSettings {
|
||||
-moz-appearance: none;
|
||||
background-color: transparent;
|
||||
border-width: 0;
|
||||
border-radius: 20px;
|
||||
min-width: 0;
|
||||
list-style-image: url("chrome://mozapps/skin/extensions/utilities.svg#utilities");
|
||||
margin-inline-end: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
#alertSettings > .button-box {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#alertSettings:hover,
|
||||
#alertSettings[open] {
|
||||
list-style-image: url("chrome://mozapps/skin/extensions/utilities.svg#utilities-inverted");
|
||||
}
|
||||
|
||||
#alertSettings:hover {
|
||||
background-color: rgb(128,128,128);
|
||||
}
|
||||
|
||||
#alertSettings[open],
|
||||
#alertSettings:hover:active {
|
||||
background-color: rgb(102,102,102);
|
||||
}
|
||||
|
||||
#alertSettings[focusedViaMouse]:-moz-focusring > .button-box {
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
#alertSettings > .button-box > .button-menu-dropmarker,
|
||||
#alertSettings > .button-box > .box-inherit > .button-text {
|
||||
display: none;
|
||||
}
|
||||
@@ -1,11 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
x="0"
|
||||
y="0"
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 16 16">
|
||||
<!-- 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/. -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16">
|
||||
<style>
|
||||
use:not(:target) {
|
||||
display: none;
|
||||
@@ -16,10 +13,14 @@
|
||||
use[id$="-native"] {
|
||||
fill: GrayText;
|
||||
}
|
||||
use[id$="-inverted"] {
|
||||
fill: #ddd;
|
||||
}
|
||||
</style>
|
||||
<defs style="display: none;">
|
||||
<defs>
|
||||
<path id="utilities-shape" d="m11.5,13.9l-.6-1.5c.3-.2 .5-.4 .8-.6 .2-.2 .4-.5 .6-.7l1.5,.6c.3,.1 .6,0 .7-.3l.4-1c.1-.3 0-.6-.3-.7l-1.5-.6c.1-.6 .1-1.3 0-2l1.5-.6c.3-.1 .4-.4 .3-.7l-.4-1c-.1-.3-.4-.4-.7-.3l-1.5,.6c-.2-.3-.4-.5-.6-.8-.2-.1-.5-.3-.7-.5l.6-1.5c.1-.3 0-.6-.3-.7l-.9-.4c-.3-.1-.6,0-.7,.3l-.6,1.5c-.6-.1-1.3-.1-2,0l-.6-1.5c-.1-.3-.4-.4-.7-.3l-1,.4c-.2,.1-.3,.4-.2,.6l.6,1.5c-.3,.3-.5,.5-.8,.7-.2,.3-.4,.5-.6,.8l-1.5-.7c-.3-.1-.6,0-.7,.3l-.4,.9c-.1,.3 0,.6 .3,.7l1.5,.7c-.1,.6-.1,1.3 0,1.9l-1.5,.6c-.3,.1-.4,.4-.3,.7l.4,1c.1,.3 .4,.4 .7,.3l1.5-.6c.2,.3 .4,.5 .6,.8 .2,.2 .5,.4 .7,.6l-.6,1.5c-.1,.3 0,.6 .3,.7l1,.4c.3,.1 .6,0 .7-.3l.6-1.5c.6,.1 1.3,.1 2,0l.6,1.5c.1,.3 .4,.4 .7,.3l1-.4c.1-.1 .3-.4 .1-.7zm-5.1-4.2c-.9-.9-.9-2.4 0-3.3 .9-.9 2.4-.9 3.3,0 .9,.9 .9,2.4 0,3.3-.9,.9-2.4,.9-3.3,0z"/>
|
||||
</defs>
|
||||
<use id="utilities" xlink:href="#utilities-shape"/>
|
||||
<use id="utilities-native" xlink:href="#utilities-shape"/>
|
||||
<use id="utilities-inverted" xlink:href="#utilities-shape"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.6 KiB |
@@ -0,0 +1,40 @@
|
||||
# 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/.
|
||||
|
||||
# This is not a complete / proper jar manifest. It is included by the
|
||||
# actual theme-specific manifests, so that shared resources need only
|
||||
# be specified once. As a result, the source file paths are relative
|
||||
# to the location of the actual manifest.
|
||||
|
||||
skin/classic/global/about.css (../../shared/about.css)
|
||||
skin/classic/global/aboutCache.css (../../shared/aboutCache.css)
|
||||
skin/classic/global/aboutCacheEntry.css (../../shared/aboutCacheEntry.css)
|
||||
skin/classic/global/aboutMemory.css (../../shared/aboutMemory.css)
|
||||
skin/classic/global/aboutReader.css (../../shared/aboutReader.css)
|
||||
skin/classic/global/aboutReaderContent.css (../../shared/aboutReaderContent.css)
|
||||
* skin/classic/global/aboutReaderControls.css (../../shared/aboutReaderControls.css)
|
||||
skin/classic/global/aboutSupport.css (../../shared/aboutSupport.css)
|
||||
skin/classic/global/appPicker.css (../../shared/appPicker.css)
|
||||
skin/classic/global/config.css (../../shared/config.css)
|
||||
skin/classic/global/icons/warning.svg (../../shared/incontent-icons/warning.svg)
|
||||
skin/classic/global/alerts/alert-common.css (../../shared/alert-common.css)
|
||||
skin/classic/global/menu/shared-menu-check@2x.png (../../shared/menu-check@2x.png)
|
||||
skin/classic/global/menu/shared-menu-check.png (../../shared/menu-check.png)
|
||||
skin/classic/global/menu/shared-menu-check-active.svg (../../shared/menu-check-active.svg)
|
||||
skin/classic/global/menu/shared-menu-check-black.svg (../../shared/menu-check-black.svg)
|
||||
skin/classic/global/menu/shared-menu-check-hover.svg (../../shared/menu-check-hover.svg)
|
||||
skin/classic/global/in-content/check.svg (../../shared/in-content/check.svg)
|
||||
skin/classic/global/in-content/check-partial.svg (../../shared/in-content/check-partial.svg)
|
||||
skin/classic/global/in-content/dropdown.svg (../../shared/in-content/dropdown.svg)
|
||||
skin/classic/global/in-content/help-glyph.svg (../../shared/in-content/help-glyph.svg)
|
||||
skin/classic/global/in-content/radio.svg (../../shared/in-content/radio.svg)
|
||||
skin/classic/global/reader/pocket.svg (../../shared/reader/pocket.svg)
|
||||
skin/classic/global/reader/RM-Add-24x24.svg (../../shared/reader/RM-Add-24x24.svg)
|
||||
skin/classic/global/reader/RM-Close-24x24.svg (../../shared/reader/RM-Close-24x24.svg)
|
||||
skin/classic/global/reader/RM-Delete-24x24.svg (../../shared/reader/RM-Delete-24x24.svg)
|
||||
skin/classic/global/reader/RM-Minus-24x24.svg (../../shared/reader/RM-Minus-24x24.svg)
|
||||
skin/classic/global/reader/RM-Plus-24x24.svg (../../shared/reader/RM-Plus-24x24.svg)
|
||||
skin/classic/global/reader/RM-Reading-List-24x24.svg (../../shared/reader/RM-Reading-List-24x24.svg)
|
||||
skin/classic/global/reader/RM-Type-Controls-24x24.svg (../../shared/reader/RM-Type-Controls-24x24.svg)
|
||||
skin/classic/global/reader/RM-Type-Controls-Arrow.svg (../../shared/reader/RM-Type-Controls-Arrow.svg)
|
||||
@@ -6,71 +6,15 @@
|
||||
== Styles specific to the alerts dialog.
|
||||
======================================================================= */
|
||||
|
||||
@import url("chrome://global/skin/");
|
||||
@import url("chrome://global/skin/alerts/alert-common.css");
|
||||
|
||||
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
|
||||
|
||||
.alertBox {
|
||||
border: 1px solid threedshadow;
|
||||
border-radius: 3px;
|
||||
#alertBox {
|
||||
border: 1px solid ThreeDShadow;
|
||||
border-radius: 1px;
|
||||
background-color: -moz-Dialog;
|
||||
}
|
||||
|
||||
.alertImageBox {
|
||||
padding: 8px 0;
|
||||
width: 64px;
|
||||
background-image: linear-gradient(rgba(255,255,255,0.7), rgba(255,255,255,0.6));
|
||||
-moz-border-end: 1px solid rgba(0,0,0,.1);
|
||||
}
|
||||
|
||||
.alertTextBox {
|
||||
padding: 8px;
|
||||
-moz-padding-start: 16px;
|
||||
width: 255px;
|
||||
}
|
||||
|
||||
.alertTextBox,
|
||||
.alertCloseBox {
|
||||
background-image: linear-gradient(rgba(255,255,255,0.2), rgba(255,255,255,0.1));
|
||||
}
|
||||
|
||||
#alertNotification[clickable="true"]:hover .alertTextBox,
|
||||
#alertNotification[clickable="true"]:hover .alertCloseBox {
|
||||
background-image: linear-gradient(rgba(255,255,255,0.4), rgba(255,255,255,0.3));
|
||||
}
|
||||
|
||||
.alertTitle {
|
||||
font-weight: bold;
|
||||
font-size: 110%;
|
||||
}
|
||||
|
||||
#alertImage {
|
||||
max-width: 48px;
|
||||
max-height: 48px;
|
||||
list-style-image: url(chrome://global/skin/alerts/notification-48.png);
|
||||
}
|
||||
|
||||
#alertNotification[clickable="true"] {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
label {
|
||||
cursor: inherit;
|
||||
}
|
||||
|
||||
@keyframes alert-animation {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
6.25% {
|
||||
opacity: 1;
|
||||
}
|
||||
93.75% {
|
||||
opacity: 1;
|
||||
}
|
||||
to {
|
||||
opacity: 0;
|
||||
}
|
||||
color: -moz-DialogText;
|
||||
}
|
||||
|
||||
.alertCloseButton {
|
||||
@@ -78,3 +22,16 @@ label {
|
||||
padding: 4px 2px;
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
@media (-moz-windows-default-theme) {
|
||||
#alertBox[hasBodyText] > #alertTextBox,
|
||||
#alertBox[hasOrigin] > #alertTitleBox {
|
||||
border-bottom-color: rgba(107,107,107,.4);
|
||||
}
|
||||
|
||||
#alertBox {
|
||||
border-color: rgba(107,107,107,.4);
|
||||
background-color: rgba(255,255,255,.9);
|
||||
color: rgba(0,0,0,.9);
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.5 KiB |
@@ -59,7 +59,6 @@ toolkit.jar:
|
||||
* skin/classic/global/tree.css
|
||||
skin/classic/global/wizard.css
|
||||
skin/classic/global/alerts/alert.css (alerts/alert.css)
|
||||
skin/classic/global/alerts/notification-48.png (alerts/notification-48.png)
|
||||
skin/classic/global/arrow/arrow-dn.gif (arrow/arrow-dn.gif)
|
||||
skin/classic/global/arrow/arrow-dn-dis.gif (arrow/arrow-dn-dis.gif)
|
||||
skin/classic/global/arrow/arrow-dn-hov.gif (arrow/arrow-dn-hov.gif)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
@@ -15,6 +15,10 @@
|
||||
|
||||
@class mozNotificationCenterDelegate;
|
||||
|
||||
#if !defined(MAC_OS_X_VERSION_10_8) || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8)
|
||||
typedef NSInteger NSUserNotificationActivationType;
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class OSXNotificationInfo;
|
||||
@@ -33,7 +37,8 @@ public:
|
||||
|
||||
nsresult Init();
|
||||
void CloseAlertCocoaString(NSString *aAlertName);
|
||||
void OnClick(NSString *aAlertName);
|
||||
void OnActivate(NSString *aAlertName, NSUserNotificationActivationType aActivationType,
|
||||
unsigned long long aAdditionalActionIndex);
|
||||
void ShowPendingNotification(OSXNotificationInfo *osxni);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
@@ -7,14 +7,17 @@
|
||||
#import <AppKit/AppKit.h>
|
||||
#include "imgIRequest.h"
|
||||
#include "imgIContainer.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "imgLoader.h"
|
||||
#import "nsCocoaUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsObjCExceptions.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIContentPolicy.h"
|
||||
#include "nsAlertsUtils.h"
|
||||
#include "imgRequestProxy.h"
|
||||
|
||||
using namespace mozilla;
|
||||
@@ -28,9 +31,20 @@ static NSString * const NSUserNotificationDefaultSoundName = @"DefaultSoundName"
|
||||
enum {
|
||||
NSUserNotificationActivationTypeNone = 0,
|
||||
NSUserNotificationActivationTypeContentsClicked = 1,
|
||||
NSUserNotificationActivationTypeActionButtonClicked = 2
|
||||
NSUserNotificationActivationTypeActionButtonClicked = 2,
|
||||
};
|
||||
#endif
|
||||
|
||||
#if !defined(MAC_OS_X_VERSION_10_9) || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9)
|
||||
enum {
|
||||
NSUserNotificationActivationTypeReplied = 3,
|
||||
};
|
||||
#endif
|
||||
|
||||
#if !defined(MAC_OS_X_VERSION_10_10) || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_10)
|
||||
enum {
|
||||
NSUserNotificationActivationTypeAdditionalActionClicked = 4
|
||||
};
|
||||
typedef NSInteger NSUserNotificationActivationType;
|
||||
#endif
|
||||
|
||||
@protocol FakeNSUserNotification <NSObject>
|
||||
@@ -92,7 +106,10 @@ typedef NSInteger NSUserNotificationActivationType;
|
||||
- (void)userNotificationCenter:(id<FakeNSUserNotificationCenter>)center
|
||||
didActivateNotification:(id<FakeNSUserNotification>)notification
|
||||
{
|
||||
mOSXNC->OnClick([[notification userInfo] valueForKey:@"name"]);
|
||||
NSNumber *alternateActionIndex = [(NSObject*)notification valueForKey:@"_alternateActionIndex"];
|
||||
mOSXNC->OnActivate([[notification userInfo] valueForKey:@"name"],
|
||||
notification.activationType,
|
||||
[alternateActionIndex unsignedLongLongValue]);
|
||||
}
|
||||
|
||||
- (BOOL)userNotificationCenter:(id<FakeNSUserNotificationCenter>)center
|
||||
@@ -112,10 +129,23 @@ typedef NSInteger NSUserNotificationActivationType;
|
||||
}
|
||||
}
|
||||
|
||||
// This is an undocumented method that we need to be notified if a user clicks the close button.
|
||||
- (void)userNotificationCenter:(id<FakeNSUserNotificationCenter>)center
|
||||
didDismissAlert:(id<FakeNSUserNotification>)notification
|
||||
{
|
||||
NSString *name = [[notification userInfo] valueForKey:@"name"];
|
||||
mOSXNC->CloseAlertCocoaString(name);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
enum {
|
||||
OSXNotificationActionDisable = 0,
|
||||
OSXNotificationActionSettings = 1,
|
||||
};
|
||||
|
||||
class OSXNotificationInfo {
|
||||
private:
|
||||
~OSXNotificationInfo();
|
||||
@@ -213,13 +243,59 @@ OSXNotificationCenter::ShowAlertNotification(const nsAString & aImageUrl, const
|
||||
|
||||
Class unClass = NSClassFromString(@"NSUserNotification");
|
||||
id<FakeNSUserNotification> notification = [[unClass alloc] init];
|
||||
notification.title = [NSString stringWithCharacters:(const unichar *)aAlertTitle.BeginReading()
|
||||
length:aAlertTitle.Length()];
|
||||
notification.informativeText = [NSString stringWithCharacters:(const unichar *)aAlertText.BeginReading()
|
||||
length:aAlertText.Length()];
|
||||
notification.title = nsCocoaUtils::ToNSString(aAlertTitle);
|
||||
|
||||
nsAutoString hostPort;
|
||||
nsAlertsUtils::GetSourceHostPort(aPrincipal, hostPort);
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
nsCOMPtr<nsIStringBundleService> sbs = do_GetService(NS_STRINGBUNDLE_CONTRACTID);
|
||||
sbs->CreateBundle("chrome://alerts/locale/alert.properties", getter_AddRefs(bundle));
|
||||
|
||||
if (!hostPort.IsEmpty() && bundle) {
|
||||
const char16_t* formatStrings[] = { hostPort.get() };
|
||||
nsXPIDLString notificationSource;
|
||||
bundle->FormatStringFromName(MOZ_UTF16("source.label"),
|
||||
formatStrings,
|
||||
ArrayLength(formatStrings),
|
||||
getter_Copies(notificationSource));
|
||||
notification.subtitle = nsCocoaUtils::ToNSString(notificationSource);
|
||||
}
|
||||
|
||||
notification.informativeText = nsCocoaUtils::ToNSString(aAlertText);
|
||||
notification.soundName = NSUserNotificationDefaultSoundName;
|
||||
notification.hasActionButton = NO;
|
||||
NSString *alertName = [NSString stringWithCharacters:(const unichar *)aAlertName.BeginReading() length:aAlertName.Length()];
|
||||
|
||||
// If this is not an application/extension alert, show additional actions dealing with permissions.
|
||||
if (nsAlertsUtils::IsActionablePrincipal(aPrincipal)) {
|
||||
if (bundle) {
|
||||
nsXPIDLString closeButtonTitle, actionButtonTitle, disableButtonTitle, settingsButtonTitle;
|
||||
bundle->GetStringFromName(MOZ_UTF16("closeButton.title"),
|
||||
getter_Copies(closeButtonTitle));
|
||||
bundle->GetStringFromName(MOZ_UTF16("actionButton.label"),
|
||||
getter_Copies(actionButtonTitle));
|
||||
if (!hostPort.IsEmpty()) {
|
||||
const char16_t* formatStrings[] = { hostPort.get() };
|
||||
bundle->FormatStringFromName(MOZ_UTF16("webActions.disableForOrigin.label"),
|
||||
formatStrings,
|
||||
ArrayLength(formatStrings),
|
||||
getter_Copies(disableButtonTitle));
|
||||
}
|
||||
bundle->GetStringFromName(MOZ_UTF16("webActions.settings.label"),
|
||||
getter_Copies(settingsButtonTitle));
|
||||
|
||||
notification.hasActionButton = YES;
|
||||
notification.otherButtonTitle = nsCocoaUtils::ToNSString(closeButtonTitle);
|
||||
notification.actionButtonTitle = nsCocoaUtils::ToNSString(actionButtonTitle);
|
||||
[(NSObject*)notification setValue:@(YES) forKey:@"_showsButtons"];
|
||||
[(NSObject*)notification setValue:@(YES) forKey:@"_alwaysShowAlternateActionMenu"];
|
||||
[(NSObject*)notification setValue:@[
|
||||
nsCocoaUtils::ToNSString(disableButtonTitle),
|
||||
nsCocoaUtils::ToNSString(settingsButtonTitle)
|
||||
]
|
||||
forKey:@"_alternateActionButtonTitles"];
|
||||
}
|
||||
}
|
||||
NSString *alertName = nsCocoaUtils::ToNSString(aAlertName);
|
||||
// Don't let an alert name be more than MAX_NOTIFICATION_NAME_LEN characters.
|
||||
// More than that shouldn't be necessary and userInfo (assigned to below) has
|
||||
// a length limit of 16k on OS X 10.11. Exception thrown if limit exceeded.
|
||||
@@ -282,7 +358,7 @@ OSXNotificationCenter::CloseAlert(const nsAString& aAlertName,
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
NSString *alertName = [NSString stringWithCharacters:(const unichar *)aAlertName.BeginReading() length:aAlertName.Length()];
|
||||
NSString *alertName = nsCocoaUtils::ToNSString(aAlertName);
|
||||
CloseAlertCocoaString(alertName);
|
||||
return NS_OK;
|
||||
|
||||
@@ -323,7 +399,9 @@ OSXNotificationCenter::CloseAlertCocoaString(NSString *aAlertName)
|
||||
}
|
||||
|
||||
void
|
||||
OSXNotificationCenter::OnClick(NSString *aAlertName)
|
||||
OSXNotificationCenter::OnActivate(NSString *aAlertName,
|
||||
NSUserNotificationActivationType aActivationType,
|
||||
unsigned long long aAdditionalActionIndex)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
@@ -335,7 +413,25 @@ OSXNotificationCenter::OnClick(NSString *aAlertName)
|
||||
OSXNotificationInfo *osxni = mActiveAlerts[i];
|
||||
if ([aAlertName isEqualToString:osxni->mName]) {
|
||||
if (osxni->mObserver) {
|
||||
osxni->mObserver->Observe(nullptr, "alertclickcallback", osxni->mCookie.get());
|
||||
switch (aActivationType) {
|
||||
case NSUserNotificationActivationTypeAdditionalActionClicked:
|
||||
case NSUserNotificationActivationTypeActionButtonClicked:
|
||||
switch (aAdditionalActionIndex) {
|
||||
case OSXNotificationActionDisable:
|
||||
osxni->mObserver->Observe(nullptr, "alertdisablecallback", osxni->mCookie.get());
|
||||
break;
|
||||
case OSXNotificationActionSettings:
|
||||
osxni->mObserver->Observe(nullptr, "alertsettingscallback", osxni->mCookie.get());
|
||||
break;
|
||||
default:
|
||||
NS_WARNING("Unknown NSUserNotification additional action clicked");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
osxni->mObserver->Observe(nullptr, "alertclickcallback", osxni->mCookie.get());
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3138,7 +3138,7 @@ GLPresenter::EndFrame()
|
||||
// in our native NSView (it is set in |draggingEntered:|). It is unset when the
|
||||
// drag session ends for this view, either with the mouse exiting or when a drop
|
||||
// occurs in this view.
|
||||
NSPasteboardWrapper* globalDragPboard = nil;
|
||||
NSPasteboard* globalDragPboard = nil;
|
||||
|
||||
// gLastDragView and gLastDragMouseDownEvent are used to communicate information
|
||||
// to the drag service during drag invocation (starting a drag in from the view).
|
||||
@@ -5723,8 +5723,7 @@ PanGestureTypeForEvent(NSEvent* aEvent)
|
||||
// Set the global drag pasteboard that will be used for this drag session.
|
||||
// This will be set back to nil when the drag session ends (mouse exits
|
||||
// the view or a drop happens within the view).
|
||||
globalDragPboard =
|
||||
[[NSPasteboardWrapper alloc] initWithPasteboard:[sender draggingPasteboard]];
|
||||
globalDragPboard = [[sender draggingPasteboard] retain];
|
||||
|
||||
return [self doDragAction:eDragEnter sender:sender];
|
||||
|
||||
|
||||
@@ -149,9 +149,11 @@ nsCocoaDebugUtils::PrintStackTrace()
|
||||
void
|
||||
nsCocoaDebugUtils::PrintAddress(void* aAddress)
|
||||
{
|
||||
char* ownerName = "unknown";
|
||||
char* addressString = "unknown + 0";
|
||||
bool stringsNeedRelease = false;
|
||||
const char* ownerName = "unknown";
|
||||
const char* addressString = "unknown + 0";
|
||||
|
||||
char* allocatedOwnerName = nullptr;
|
||||
char* allocatedAddressString = nullptr;
|
||||
|
||||
CSSymbolOwnerRef owner = {0};
|
||||
CSSymbolicatorRef symbolicator = GetSymbolicatorRef();
|
||||
@@ -163,16 +165,14 @@ nsCocoaDebugUtils::PrintAddress(void* aAddress)
|
||||
kCSNow);
|
||||
}
|
||||
if (!CSIsNull(owner)) {
|
||||
ownerName = GetOwnerNameInt(aAddress, owner);
|
||||
addressString = GetAddressStringInt(aAddress, owner);
|
||||
stringsNeedRelease = true;
|
||||
ownerName = allocatedOwnerName = GetOwnerNameInt(aAddress, owner);
|
||||
addressString = allocatedAddressString = GetAddressStringInt(aAddress, owner);
|
||||
}
|
||||
DebugLogInt(false, " (%s) %s", ownerName, addressString);
|
||||
|
||||
if (stringsNeedRelease) {
|
||||
free(ownerName);
|
||||
free(addressString);
|
||||
}
|
||||
free(allocatedOwnerName);
|
||||
free(allocatedAddressString);
|
||||
|
||||
ReleaseSymbolicator();
|
||||
}
|
||||
|
||||
@@ -241,6 +241,9 @@ nsCocoaDebugUtils::GetAddressStringInt(void* aAddress, CSTypeRef aOwner)
|
||||
addressName = CSSymbolGetName(symbol);
|
||||
CSRange range = CSSymbolGetRange(symbol);
|
||||
addressOffset = (unsigned long long) aAddress - range.location;
|
||||
} else {
|
||||
addressOffset = (unsigned long long)
|
||||
aAddress - CSSymbolOwnerGetBaseAddress(owner);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,4 +283,3 @@ nsCocoaDebugUtils::ReleaseSymbolicator()
|
||||
CSRelease(sSymbolicator);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -272,7 +272,6 @@ void nsCocoaUtils::HideOSChromeOnScreen(bool aShouldHide)
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
|
||||
#define NS_APPSHELLSERVICE_CONTRACTID "@mozilla.org/appshell/appShellService;1"
|
||||
nsIWidget* nsCocoaUtils::GetHiddenWindowWidget()
|
||||
{
|
||||
|
||||
@@ -15,16 +15,6 @@ extern NSString* const kCorePboardType_url;
|
||||
extern NSString* const kCorePboardType_urld;
|
||||
extern NSString* const kCorePboardType_urln;
|
||||
|
||||
@interface NSPasteboardWrapper : NSObject
|
||||
{
|
||||
NSPasteboard* mPasteboard;
|
||||
NSArray* mFilenames;
|
||||
}
|
||||
- (id)initWithPasteboard:(NSPasteboard*)aPasteboard;
|
||||
- (id)propertyListForType:(NSString*)aType;
|
||||
- (NSPasteboard*)pasteboard;
|
||||
@end
|
||||
|
||||
class nsDragService : public nsBaseDragService
|
||||
{
|
||||
public:
|
||||
@@ -50,6 +40,11 @@ private:
|
||||
NSImage* ConstructDragImage(nsIDOMNode* aDOMNode,
|
||||
nsIntRect* aDragRect,
|
||||
nsIScriptableRegion* aRegion);
|
||||
bool IsValidType(NSString* availableType, bool allowFileURL);
|
||||
NSString* GetStringForType(NSPasteboardItem* item, const NSString* type,
|
||||
bool allowFileURL = false);
|
||||
NSString* GetTitleForURL(NSPasteboardItem* item);
|
||||
NSString* GetFilePath(NSPasteboardItem* item);
|
||||
|
||||
nsCOMPtr<nsISupportsArray> mDataItems; // only valid for a drag started within gecko
|
||||
NSView* mNativeDragView;
|
||||
|
||||
+131
-82
@@ -35,7 +35,7 @@ extern PRLogModuleInfo* sCocoaLog;
|
||||
|
||||
extern void EnsureLogInitialized();
|
||||
|
||||
extern NSPasteboardWrapper* globalDragPboard;
|
||||
extern NSPasteboard* globalDragPboard;
|
||||
extern NSView* gLastDragView;
|
||||
extern NSEvent* gLastDragMouseDownEvent;
|
||||
extern bool gUserCancelledDrag;
|
||||
@@ -48,46 +48,7 @@ NSString* const kWildcardPboardType = @"MozillaWildcard";
|
||||
NSString* const kCorePboardType_url = @"CorePasteboardFlavorType 0x75726C20"; // 'url ' url
|
||||
NSString* const kCorePboardType_urld = @"CorePasteboardFlavorType 0x75726C64"; // 'urld' desc
|
||||
NSString* const kCorePboardType_urln = @"CorePasteboardFlavorType 0x75726C6E"; // 'urln' title
|
||||
|
||||
@implementation NSPasteboardWrapper
|
||||
- (id)initWithPasteboard:(NSPasteboard*)aPasteboard
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
mPasteboard = [aPasteboard retain];
|
||||
mFilenames = nil;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)propertyListForType:(NSString *)aType
|
||||
{
|
||||
if (![aType isEqualToString:NSFilenamesPboardType]) {
|
||||
return [mPasteboard propertyListForType:aType];
|
||||
}
|
||||
|
||||
if (!mFilenames) {
|
||||
mFilenames = [[mPasteboard propertyListForType:aType] retain];
|
||||
}
|
||||
|
||||
return mFilenames;
|
||||
}
|
||||
|
||||
- (NSPasteboard*) pasteboard
|
||||
{
|
||||
return mPasteboard;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[mPasteboard release];
|
||||
mPasteboard = nil;
|
||||
|
||||
[mFilenames release];
|
||||
mFilenames = nil;
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
@end
|
||||
NSString* const kUTTypeURLName = @"public.url-name";
|
||||
|
||||
nsDragService::nsDragService()
|
||||
{
|
||||
@@ -270,6 +231,78 @@ nsDragService::ConstructDragImage(nsIDOMNode* aDOMNode,
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
}
|
||||
|
||||
bool
|
||||
nsDragService::IsValidType(NSString* availableType, bool allowFileURL)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
// Prevent exposing fileURL for non-fileURL type.
|
||||
// We need URL provided by dropped webloc file, but don't need file's URL.
|
||||
// kUTTypeFileURL is returned by [NSPasteboard availableTypeFromArray:] for
|
||||
// kUTTypeURL, since it conforms to kUTTypeURL.
|
||||
if (!allowFileURL && [availableType isEqualToString:(id)kUTTypeFileURL]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK(false);
|
||||
}
|
||||
|
||||
NSString*
|
||||
nsDragService::GetStringForType(NSPasteboardItem* item, const NSString* type,
|
||||
bool allowFileURL)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
|
||||
NSString* availableType = [item availableTypeFromArray:[NSArray arrayWithObjects:(id)type, nil]];
|
||||
if (availableType && IsValidType(availableType, allowFileURL)) {
|
||||
return [item stringForType:(id)availableType];
|
||||
}
|
||||
|
||||
return nil;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
}
|
||||
|
||||
NSString*
|
||||
nsDragService::GetTitleForURL(NSPasteboardItem* item)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
|
||||
NSString* name = GetStringForType(item, (const NSString*)kUTTypeURLName);
|
||||
if (name) {
|
||||
return name;
|
||||
}
|
||||
|
||||
NSString* filePath = GetFilePath(item);
|
||||
if (filePath) {
|
||||
return [filePath lastPathComponent];
|
||||
}
|
||||
|
||||
return nil;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
}
|
||||
|
||||
NSString*
|
||||
nsDragService::GetFilePath(NSPasteboardItem* item)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
|
||||
NSString* urlString = GetStringForType(item, (const NSString*)kUTTypeFileURL, true);
|
||||
if (urlString) {
|
||||
NSURL* url = [NSURL URLWithString:urlString];
|
||||
if (url) {
|
||||
return [url path];
|
||||
}
|
||||
}
|
||||
|
||||
return nil;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
}
|
||||
|
||||
// We can only invoke NSView's 'dragImage:at:offset:event:pasteboard:source:slideBack:' from
|
||||
// within NSView's 'mouseDown:' or 'mouseDragged:'. Luckily 'mouseDragged' is always on the
|
||||
// stack when InvokeDragSession gets called.
|
||||
@@ -403,12 +436,23 @@ nsDragService::GetData(nsITransferable* aTransferable, uint32_t aItemIndex)
|
||||
|
||||
MOZ_LOG(sCocoaLog, LogLevel::Info, ("nsDragService::GetData: looking for clipboard data of type %s\n", flavorStr.get()));
|
||||
|
||||
if (flavorStr.EqualsLiteral(kFileMime)) {
|
||||
NSArray* pFiles = [globalDragPboard propertyListForType:NSFilenamesPboardType];
|
||||
if (!pFiles || [pFiles count] < (aItemIndex + 1))
|
||||
continue;
|
||||
NSArray* droppedItems = [globalDragPboard pasteboardItems];
|
||||
if (!droppedItems) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSString* filePath = [pFiles objectAtIndex:aItemIndex];
|
||||
uint32_t itemCount = [droppedItems count];
|
||||
if (aItemIndex >= itemCount) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSPasteboardItem* item = [droppedItems objectAtIndex:aItemIndex];
|
||||
if (!item) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (flavorStr.EqualsLiteral(kFileMime)) {
|
||||
NSString* filePath = GetFilePath(item);
|
||||
if (!filePath)
|
||||
continue;
|
||||
|
||||
@@ -431,16 +475,26 @@ nsDragService::GetData(nsITransferable* aTransferable, uint32_t aItemIndex)
|
||||
break;
|
||||
}
|
||||
|
||||
NSString *pboardType = NSStringPboardType;
|
||||
|
||||
if (nsClipboard::IsStringType(flavorStr, &pboardType) ||
|
||||
flavorStr.EqualsLiteral(kURLMime) ||
|
||||
flavorStr.EqualsLiteral(kURLDataMime) ||
|
||||
flavorStr.EqualsLiteral(kURLDescriptionMime)) {
|
||||
NSString* pString = [[globalDragPboard pasteboard] stringForType:pboardType];
|
||||
if (!pString)
|
||||
continue;
|
||||
|
||||
NSString* pString = nil;
|
||||
if (flavorStr.EqualsLiteral(kUnicodeMime)) {
|
||||
pString = GetStringForType(item, (const NSString*)kUTTypeUTF8PlainText);
|
||||
} else if (flavorStr.EqualsLiteral(kHTMLMime)) {
|
||||
pString = GetStringForType(item, (const NSString*)kUTTypeHTML);
|
||||
} else if (flavorStr.EqualsLiteral(kURLMime)) {
|
||||
pString = GetStringForType(item, (const NSString*)kUTTypeURL);
|
||||
if (pString) {
|
||||
NSString* title = GetTitleForURL(item);
|
||||
if (!title) {
|
||||
title = pString;
|
||||
}
|
||||
pString = [NSString stringWithFormat:@"%@\n%@", pString, title];
|
||||
}
|
||||
} else if (flavorStr.EqualsLiteral(kURLDataMime)) {
|
||||
pString = GetStringForType(item, (const NSString*)kUTTypeURL);
|
||||
} else if (flavorStr.EqualsLiteral(kURLDescriptionMime)) {
|
||||
pString = GetTitleForURL(item);
|
||||
}
|
||||
if (pString) {
|
||||
NSData* stringData = [pString dataUsingEncoding:NSUnicodeStringEncoding];
|
||||
unsigned int dataLength = [stringData length];
|
||||
void* clipboardDataPtr = malloc(dataLength);
|
||||
@@ -533,22 +587,24 @@ nsDragService::IsDataFlavorSupported(const char *aDataFlavor, bool *_retval)
|
||||
}
|
||||
}
|
||||
|
||||
NSString *pboardType = nil;
|
||||
|
||||
const NSString* type = nil;
|
||||
bool allowFileURL = false;
|
||||
if (dataFlavor.EqualsLiteral(kFileMime)) {
|
||||
NSString* availableType = [[globalDragPboard pasteboard] availableTypeFromArray:[NSArray arrayWithObject:NSFilenamesPboardType]];
|
||||
if (availableType && [availableType isEqualToString:NSFilenamesPboardType])
|
||||
*_retval = true;
|
||||
type = (const NSString*)kUTTypeFileURL;
|
||||
allowFileURL = true;
|
||||
} else if (dataFlavor.EqualsLiteral(kUnicodeMime)) {
|
||||
type = (const NSString*)kUTTypeUTF8PlainText;
|
||||
} else if (dataFlavor.EqualsLiteral(kHTMLMime)) {
|
||||
type = (const NSString*)kUTTypeHTML;
|
||||
} else if (dataFlavor.EqualsLiteral(kURLMime) ||
|
||||
dataFlavor.EqualsLiteral(kURLDataMime)) {
|
||||
type = (const NSString*)kUTTypeURL;
|
||||
} else if (dataFlavor.EqualsLiteral(kURLDescriptionMime)) {
|
||||
type = (const NSString*)kUTTypeURLName;
|
||||
}
|
||||
else if (dataFlavor.EqualsLiteral(kURLMime)) {
|
||||
NSString* availableType = [[globalDragPboard pasteboard] availableTypeFromArray:[NSArray arrayWithObject:kCorePboardType_url]];
|
||||
if (availableType && [availableType isEqualToString:kCorePboardType_url])
|
||||
*_retval = true;
|
||||
}
|
||||
else if (nsClipboard::IsStringType(dataFlavor, &pboardType)) {
|
||||
NSString* availableType = [[globalDragPboard pasteboard] availableTypeFromArray:[NSArray arrayWithObject:pboardType]];
|
||||
if (availableType && [availableType isEqualToString:pboardType])
|
||||
*_retval = true;
|
||||
NSString* availableType = [globalDragPboard availableTypeFromArray:[NSArray arrayWithObjects:(id)type, nil]];
|
||||
if (availableType && IsValidType(availableType, allowFileURL)) {
|
||||
*_retval = true;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@@ -569,18 +625,11 @@ nsDragService::GetNumDropItems(uint32_t* aNumItems)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// if there is a clipboard and there is something on it, then there is at least 1 item
|
||||
NSArray* clipboardTypes = [[globalDragPboard pasteboard] types];
|
||||
if (globalDragPboard && [clipboardTypes count] > 0)
|
||||
*aNumItems = 1;
|
||||
else
|
||||
return NS_OK;
|
||||
|
||||
// if there is a list of files, send the number of files in that list
|
||||
NSArray* fileNames = [globalDragPboard propertyListForType:NSFilenamesPboardType];
|
||||
if (fileNames)
|
||||
*aNumItems = [fileNames count];
|
||||
|
||||
NSArray* droppedItems = [globalDragPboard pasteboardItems];
|
||||
if (droppedItems) {
|
||||
*aNumItems = [droppedItems count];
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
@@ -121,7 +121,7 @@ NSView* nsFilePicker::GetAccessoryView()
|
||||
nsresult rv = sbs->CreateBundle("chrome://global/locale/filepicker.properties", getter_AddRefs(bundle));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsXPIDLString locaLabel;
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("formatLabel").get(),
|
||||
bundle->GetStringFromName(MOZ_UTF16("formatLabel"),
|
||||
getter_Copies(locaLabel));
|
||||
if (locaLabel) {
|
||||
label = [NSString stringWithCharacters:reinterpret_cast<const unichar*>(locaLabel.get())
|
||||
|
||||
Reference in New Issue
Block a user