Merge autoland to mozilla-central. a=merge

This commit is contained in:
Iulian Moraru 2022-05-09 07:16:36 +03:00
Родитель a60f80e1c7 3c244c325c
Коммит c4c1adbae8
17 изменённых файлов: 180 добавлений и 94 удалений

Просмотреть файл

@ -26,6 +26,10 @@ prefs =
# Integration tests:
[browser_dbg-integration-reloading-compressed-sourcemaps.js]
[browser_dbg-integration-reloading-uncompressed-sourcemaps.js]
skip-if =
os == 'linux' && bits == 64 && !debug # Bug 1767070
os == 'mac' && os_version == '10.15' # Bug 1767070
win10_2004 && bits == 64 # Bug 1767070
# Feature tests:
[browser_dbg-features-asm.js]

Просмотреть файл

@ -1450,10 +1450,11 @@ void BrowserParent::UpdateVsyncParentVsyncDispatcher() {
}
if (nsCOMPtr<nsIWidget> widget = GetWidget()) {
if (RefPtr<VsyncDispatcher> vsyncDispatcher =
widget->GetVsyncDispatcher()) {
mVsyncParent->UpdateVsyncDispatcher(vsyncDispatcher);
RefPtr<VsyncDispatcher> vsyncDispatcher = widget->GetVsyncDispatcher();
if (!vsyncDispatcher) {
vsyncDispatcher = gfxPlatform::GetPlatform()->GetGlobalVsyncDispatcher();
}
mVsyncParent->UpdateVsyncDispatcher(vsyncDispatcher);
}
}

Просмотреть файл

@ -22,6 +22,10 @@ VsyncParent::VsyncParent()
void VsyncParent::UpdateVsyncDispatcher(
const RefPtr<VsyncDispatcher>& aVsyncDispatcher) {
if (aVsyncDispatcher == mVsyncDispatcher) {
return;
}
if (mObservingVsync && mVsyncDispatcher) {
mVsyncDispatcher->RemoveVsyncObserver(this);
}

Просмотреть файл

@ -37,11 +37,10 @@ mozilla::LazyLogModule gMediaParentLog("MediaParent");
namespace mozilla::media {
StaticMutex sOriginKeyStoreMutex;
static OriginKeyStore* sOriginKeyStore = nullptr;
StaticMutex sOriginKeyStoreStsMutex;
class OriginKeyStore : public nsISupports {
NS_DECL_THREADSAFE_ISUPPORTS
class OriginKeyStore {
NS_INLINE_DECL_REFCOUNTING(OriginKeyStore);
class OriginKey {
public:
static const size_t DecodedLength = 18;
@ -375,28 +374,29 @@ class OriginKeyStore : public nsISupports {
};
private:
static OriginKeyStore* sOriginKeyStore;
virtual ~OriginKeyStore() {
StaticMutexAutoLock lock(sOriginKeyStoreMutex);
MOZ_ASSERT(NS_IsMainThread());
sOriginKeyStore = nullptr;
LOG(("%s", __FUNCTION__));
}
public:
static OriginKeyStore* Get() {
static RefPtr<OriginKeyStore> Get() {
MOZ_ASSERT(NS_IsMainThread());
StaticMutexAutoLock lock(sOriginKeyStoreMutex);
if (!sOriginKeyStore) {
sOriginKeyStore = new OriginKeyStore();
}
return sOriginKeyStore;
return RefPtr(sOriginKeyStore);
}
// Only accessed on StreamTS thread
OriginKeysLoader mOriginKeys;
OriginKeysTable mPrivateBrowsingOriginKeys;
// Only accessed on StreamTS threads
OriginKeysLoader mOriginKeys GUARDED_BY(sOriginKeyStoreStsMutex);
OriginKeysTable mPrivateBrowsingOriginKeys
GUARDED_BY(sOriginKeyStoreStsMutex);
};
NS_IMPL_ISUPPORTS0(OriginKeyStore)
OriginKeyStore* OriginKeyStore::sOriginKeyStore = nullptr;
template <class Super>
mozilla::ipc::IPCResult Parent<Super>::RecvGetPrincipalKey(
@ -429,23 +429,19 @@ mozilla::ipc::IPCResult Parent<Super>::RecvGetPrincipalKey(
InvokeAsync(
taskQueue, __func__,
[that, profileDir, aPrincipalInfo, aPersist]() {
[this, that, profileDir, aPrincipalInfo, aPersist]() {
MOZ_ASSERT(!NS_IsMainThread());
StaticMutexAutoLock lock(sOriginKeyStoreMutex);
if (!sOriginKeyStore) {
return PrincipalKeyPromise::CreateAndReject(NS_ERROR_FAILURE,
__func__);
}
sOriginKeyStore->mOriginKeys.SetProfileDir(profileDir);
StaticMutexAutoLock lock(sOriginKeyStoreStsMutex);
mOriginKeyStore->mOriginKeys.SetProfileDir(profileDir);
nsresult rv;
nsAutoCString result;
if (IsPrincipalInfoPrivate(aPrincipalInfo)) {
rv = sOriginKeyStore->mPrivateBrowsingOriginKeys.GetPrincipalKey(
rv = mOriginKeyStore->mPrivateBrowsingOriginKeys.GetPrincipalKey(
aPrincipalInfo, result);
} else {
rv = sOriginKeyStore->mOriginKeys.GetPrincipalKey(aPrincipalInfo,
rv = mOriginKeyStore->mOriginKeys.GetPrincipalKey(aPrincipalInfo,
result, aPersist);
}
@ -482,19 +478,17 @@ mozilla::ipc::IPCResult Parent<Super>::RecvSanitizeOriginKeys(
nsCOMPtr<nsIEventTarget> sts =
do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID);
MOZ_ASSERT(sts);
RefPtr<Parent<Super>> that(this);
rv = sts->Dispatch(
NewRunnableFrom(
[profileDir, aSinceWhen, aOnlyPrivateBrowsing]() -> nsresult {
[this, that, profileDir, aSinceWhen, aOnlyPrivateBrowsing]() {
MOZ_ASSERT(!NS_IsMainThread());
StaticMutexAutoLock lock(sOriginKeyStoreMutex);
if (!sOriginKeyStore) {
return NS_ERROR_FAILURE;
}
sOriginKeyStore->mPrivateBrowsingOriginKeys.Clear(aSinceWhen);
StaticMutexAutoLock lock(sOriginKeyStoreStsMutex);
mOriginKeyStore->mPrivateBrowsingOriginKeys.Clear(aSinceWhen);
if (!aOnlyPrivateBrowsing) {
sOriginKeyStore->mOriginKeys.SetProfileDir(profileDir);
sOriginKeyStore->mOriginKeys.Clear(aSinceWhen);
mOriginKeyStore->mOriginKeys.SetProfileDir(profileDir);
mOriginKeyStore->mOriginKeys.Clear(aSinceWhen);
}
return NS_OK;
}),
@ -520,6 +514,8 @@ Parent<Super>::Parent()
template <class Super>
Parent<Super>::~Parent() {
NS_ReleaseOnMainThread("Parent<Super>::mOriginKeyStore",
mOriginKeyStore.forget());
LOG(("~media::Parent: %p", this));
}

Просмотреть файл

@ -259,6 +259,8 @@ skip-if =
scheme = https
[test_imagecache.html]
[test_imagecache_max_age.html]
skip-if =
os == 'linux' && bits == 64 && !debug && asan && os_version == '18.04' # Bug 1585668
[test_importscript.html]
[test_install_event.html]
[test_install_event_gc.html]

Просмотреть файл

@ -588,6 +588,10 @@ impl FontKeyMap {
self.0.write().unwrap()
}
pub fn keys(&self) -> Vec<FontKey> {
self.lock().key_map.keys().cloned().collect()
}
pub fn map_key(&self, font_key: &FontKey) -> FontKey {
match self.lock().key_map.get(font_key) {
Some(mapped) => mapped.font_key,
@ -757,6 +761,10 @@ impl FontInstanceKeyMap {
self.0.write().unwrap()
}
pub fn keys(&self) -> Vec<FontInstanceKey> {
self.lock().key_map.keys().cloned().collect()
}
pub fn map_key(&self, key: &FontInstanceKey) -> FontInstanceKey {
match self.lock().key_map.get(key).and_then(|weak| weak.upgrade()) {
Some(mapped) => mapped.instance_key,
@ -842,6 +850,11 @@ impl FontInstanceMap {
self.0.write().unwrap()
}
///
pub fn clear(&mut self) {
self.lock_mut().clear();
}
///
pub fn get_font_instance_data(&self, key: FontInstanceKey) -> Option<FontInstanceData> {
match self.lock().get(&key) {
@ -861,11 +874,6 @@ impl FontInstanceMap {
}
}
/// Replace the shared map with the provided map.
pub fn set_map(&mut self, map: FontInstanceMapLocked) {
*self.lock_mut() = map;
}
///
pub fn get_font_instance(&self, instance_key: FontInstanceKey) -> Option<Arc<BaseFontInstance>> {
let instance_map = self.lock();
@ -873,8 +881,7 @@ impl FontInstanceMap {
}
///
pub fn add_font_instance(&mut self, instance: Arc<BaseFontInstance>,
) {
pub fn add_font_instance(&mut self, instance: Arc<BaseFontInstance>) {
self.lock_mut().insert(instance.instance_key, instance);
}
@ -897,11 +904,6 @@ impl FontInstanceMap {
pub fn clear_namespace(&mut self, namespace: IdNamespace) {
self.lock_mut().retain(|key, _| key.0 != namespace);
}
///
pub fn clone_map(&self) -> FontInstanceMapLocked {
self.lock().clone()
}
}
/// Shared font resources that may need to be passed between multiple threads

Просмотреть файл

@ -1829,7 +1829,7 @@ struct PlainImageTemplate {
#[cfg_attr(feature = "replay", derive(Deserialize))]
pub struct PlainResources {
font_templates: FastHashMap<FontKey, PlainFontTemplate>,
font_instances: FastHashMap<FontInstanceKey, Arc<BaseFontInstance>>,
font_instances: Vec<BaseFontInstance>,
image_templates: FastHashMap<ImageKey, PlainImageTemplate>,
}
@ -1987,36 +1987,66 @@ impl ResourceCache {
}
}
let mut font_templates = FastHashMap::default();
let mut font_remap = FastHashMap::default();
// Generate a map from duplicate font keys to their template.
for key in res.fonts.font_keys.keys() {
let shared_key = res.fonts.font_keys.map_key(&key);
let template = match res.fonts.templates.get_font(&shared_key) {
Some(template) => template,
None => {
debug!("Failed serializing font template {:?}", key);
continue;
}
};
let plain_font = match template {
FontTemplate::Raw(arc, index) => {
PlainFontTemplate {
data: font_paths[&arc.as_ptr()].clone(),
index,
}
}
#[cfg(not(target_os = "macos"))]
FontTemplate::Native(native) => {
PlainFontTemplate {
data: native.path.to_string_lossy().to_string(),
index: native.index,
}
}
#[cfg(target_os = "macos")]
FontTemplate::Native(native) => {
PlainFontTemplate {
data: native.name,
index: 0,
}
}
};
font_templates.insert(key, plain_font);
// Generate a reverse map from a shared key to a representive key.
font_remap.insert(shared_key, key);
}
let mut font_instances = Vec::new();
// Build a list of duplicate instance keys.
for instance_key in res.fonts.instance_keys.keys() {
let shared_key = res.fonts.instance_keys.map_key(&instance_key);
let instance = match res.fonts.instances.get_font_instance(shared_key) {
Some(instance) => instance,
None => {
debug!("Failed serializing font instance {:?}", instance_key);
continue;
}
};
// Target the instance towards a representive duplicate font key. The font key will be
// de-duplicated on load to an appropriate shared key.
font_instances.push(BaseFontInstance {
font_key: font_remap.get(&instance.font_key).cloned().unwrap_or(instance.font_key),
instance_key,
..(*instance).clone()
});
}
let resources = PlainResources {
font_templates: res.fonts.templates
.lock()
.iter()
.map(|(key, template)| {
(*key, match *template {
FontTemplate::Raw(ref arc, index) => {
PlainFontTemplate {
data: font_paths[&arc.as_ptr()].clone(),
index,
}
}
#[cfg(not(target_os = "macos"))]
FontTemplate::Native(ref native) => {
PlainFontTemplate {
data: native.path.to_string_lossy().to_string(),
index: native.index,
}
}
#[cfg(target_os = "macos")]
FontTemplate::Native(ref native) => {
PlainFontTemplate {
data: native.name.clone(),
index: 0,
}
}
})
})
.collect(),
font_instances: res.fonts.instances.clone_map(),
font_templates,
font_instances,
image_templates: res.image_templates.images
.iter()
.map(|(key, template)| {
@ -2097,7 +2127,7 @@ impl ResourceCache {
self.glyph_rasterizer.reset();
let res = &mut self.resources;
res.fonts.templates.clear();
res.fonts.instances.set_map(resources.font_instances);
res.fonts.instances.clear();
res.image_templates.images.clear();
info!("\tfont templates...");
@ -2126,8 +2156,23 @@ impl ResourceCache {
};
let template = FontTemplate::Raw(arc, plain_template.index);
self.glyph_rasterizer.add_font(key, template.clone());
res.fonts.templates.add_font(key, template);
// Only add the template if this is the first time it has been seen.
if let Some(shared_key) = res.fonts.font_keys.add_key(&key, &template) {
self.glyph_rasterizer.add_font(shared_key, template.clone());
res.fonts.templates.add_font(shared_key, template);
}
}
info!("\tfont instances...");
for instance in resources.font_instances {
// Target the instance to a shared font key.
let base = BaseFontInstance {
font_key: res.fonts.font_keys.map_key(&instance.font_key),
..instance
};
if let Some(shared_instance) = res.fonts.instance_keys.add_key(base) {
res.fonts.instances.add_font_instance(shared_instance);
}
}
info!("\timage templates...");

Просмотреть файл

@ -2456,6 +2456,7 @@ impl<'a> SceneBuilder<'a> {
stacking_context.composite_ops.filters,
stacking_context.composite_ops.filter_primitives,
stacking_context.composite_ops.filter_datas,
None,
);
// Same for mix-blend-mode, except we can skip if this primitive is the first in the parent
@ -3615,6 +3616,7 @@ impl<'a> SceneBuilder<'a> {
filters,
filter_primitives,
filter_datas,
Some(false),
);
// Clip the backdrop filter to the outline of the backdrop-filter prim. If this is
@ -3661,6 +3663,7 @@ impl<'a> SceneBuilder<'a> {
mut filter_ops: Vec<Filter>,
mut filter_primitives: Vec<FilterPrimitive>,
filter_datas: Vec<FilterData>,
should_inflate_override: Option<bool>,
) -> PictureChainBuilder {
// TODO(cbrewster): Currently CSS and SVG filters live side by side in WebRender, but unexpected results will
// happen if they are used simulataneously. Gecko only provides either filter ops or filter primitives.
@ -3704,7 +3707,18 @@ impl<'a> SceneBuilder<'a> {
if filter.is_noop() {
continue;
} else {
PictureCompositeMode::Filter(filter.clone())
let mut filter = filter.clone();
// backdrop-filter spec says that blurs should assume edgeMode=Duplicate
// We can do this by not inflating the bounds, which means the blur
// shader will duplicate pixels outside the sample rect
if let Some(should_inflate_override) = should_inflate_override {
if let Filter::Blur { ref mut should_inflate, .. } = filter {
*should_inflate = should_inflate_override;
}
}
PictureCompositeMode::Filter(filter)
}
}
};

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 25 KiB

После

Ширина:  |  Высота:  |  Размер: 109 KiB

Просмотреть файл

@ -0,0 +1,10 @@
# Verify that blurs on backdrop-filters use edgeMode=duplicate
---
root:
items:
- type: rect
bounds: 0 0 400 400
color: red
- type: rect
bounds: 100 100 200 200
color: blue

Просмотреть файл

@ -0,0 +1,17 @@
# Verify that blurs on backdrop-filters use edgeMode=duplicate
---
root:
items:
- type: stacking-context
backdrop-root: true
bounds: 0 0 0 0
items:
- type: rect
bounds: 0 0 400 400
color: red
- type: rect
bounds: 100 100 200 200
color: blue
- type: backdrop-filter
bounds: 100 100 200 200
filters: ["blur(10,10)"]

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 42 KiB

После

Ширина:  |  Высота:  |  Размер: 52 KiB

Просмотреть файл

@ -69,6 +69,7 @@ fuzzy(1,1) platform(linux,mac) == svg-filter-drop-shadow-perspective.yaml svg-fi
#platform(linux,mac) == backdrop-filter-overlap.yaml backdrop-filter-overlap.png
#platform(linux,mac) == backdrop-filter-blur-across-tiles.yaml backdrop-filter-blur-across-tiles.png
#platform(linux,mac) == backdrop-filter-drop-shadow.yaml backdrop-filter-drop-shadow.png
#== backdrop-filter-blur-edge-mode.yaml backdrop-filter-blur-edge-mode-ref.yaml
platform(linux,max) == svg-filter-offset.yaml svg-filter-offset-ref.yaml
skip_on(android,device) == fuzzy(1,100) svg-filter-composite.yaml svg-filter-composite-ref.yaml
skip_on(android,device) == filter-mix-blend-scaling.yaml filter-mix-blend-scaling-ref.yaml

Просмотреть файл

@ -13319,11 +13319,6 @@
value: 0.0000001f
mirror: always
- name: widget.swipe.success-threshold
type: float
value: 0.25f
mirror: always
- name: widget.swipe.success-velocity-contribution
type: float
value: 0.05f

Просмотреть файл

@ -65,10 +65,10 @@ def main(output):
elif buildconfig.substs["MOZ_BUILD_APP"] == "mobile/android":
dumps_locations += ["services/settings/dumps/"]
elif buildconfig.substs["MOZ_BUILD_APP"] == "comm/mail":
dumps_locations += ["mozilla/services/settings/dumps/"]
dumps_locations += ["mail/app/settings/dumps/"]
dumps_locations += ["services/settings/dumps/"]
dumps_locations += ["comm/mail/app/settings/dumps/"]
elif buildconfig.substs["MOZ_BUILD_APP"] == "comm/suite":
dumps_locations += ["mozilla/services/settings/dumps/"]
dumps_locations += ["services/settings/dumps/"]
remotesettings_dumps = {}
for dumps_location in dumps_locations:

Просмотреть файл

@ -21,6 +21,7 @@
// These values were tweaked to make the physics feel similar to the native
// swipe.
static const double kSpringForce = 250.0;
static const double kSwipeSuccessThreshold = 0.25;
namespace mozilla {
@ -97,8 +98,7 @@ bool SwipeTracker::ComputeSwipeSuccess() const {
return (mGestureAmount * targetValue +
mCurrentVelocity * targetValue *
StaticPrefs::widget_swipe_success_velocity_contribution()) >=
StaticPrefs::widget_swipe_success_threshold();
kSwipeSuccessThreshold;
}
nsEventStatus SwipeTracker::ProcessEvent(const PanGestureInput& aEvent) {

Просмотреть файл

@ -137,7 +137,6 @@ add_task(async () => {
["browser.gesture.swipe.eight", "Browser:ForwardOrForwardDuplicate"],
["widget.disable-swipe-tracker", false],
["widget.swipe.velocity-twitch-tolerance", 0.0000001],
["widget.swipe.success-threshold", 0.25],
["widget.swipe.success-velocity-contribution", 0.5],
],
});
@ -252,7 +251,6 @@ add_task(async () => {
["browser.gesture.swipe.eight", "Browser:ForwardOrForwardDuplicate"],
["widget.disable-swipe-tracker", false],
["widget.swipe.velocity-twitch-tolerance", 0.0000001],
["widget.swipe.success-threshold", 0.25],
// Set the velocity-contribution to 0 so we can exactly control the
// values in the swipe tracker via the delta in the events that we send.
["widget.swipe.success-velocity-contribution", 0.0],
@ -351,7 +349,6 @@ add_task(async () => {
["browser.gesture.swipe.eight", "Browser:ForwardOrForwardDuplicate"],
["widget.disable-swipe-tracker", false],
["widget.swipe.velocity-twitch-tolerance", 0.0000001],
["widget.swipe.success-threshold", 0.25],
// Set the velocity-contribution to 0 so we can exactly control the
// values in the swipe tracker via the delta in the events that we send.
["widget.swipe.success-velocity-contribution", 0.0],
@ -449,7 +446,6 @@ add_task(async () => {
["browser.gesture.swipe.eight", "Browser:ForwardOrForwardDuplicate"],
["widget.disable-swipe-tracker", false],
["widget.swipe.velocity-twitch-tolerance", 0.0000001],
["widget.swipe.success-threshold", 0.25],
// Set the velocity-contribution to 0 so we can exactly control the
// values in the swipe tracker via the delta in the events that we send.
["widget.swipe.success-velocity-contribution", 0.0],
@ -510,7 +506,6 @@ add_task(async () => {
["browser.gesture.swipe.eight", "Browser:ForwardOrForwardDuplicate"],
["widget.disable-swipe-tracker", false],
["widget.swipe.velocity-twitch-tolerance", 0.0000001],
["widget.swipe.success-threshold", 0.25],
// Set the velocity-contribution to 0 so we can exactly control the
// values in the swipe tracker via the delta in the events that we send.
["widget.swipe.success-velocity-contribution", 0.0],