Bug 1154013 - When the vibrant region of a window changes, composite synchronously so that the window contents and the vibrancy update atomically. r=mattwoodrow

Differential Revision: https://phabricator.services.mozilla.com/D40556

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Markus Stange 2019-08-16 14:01:13 +00:00
Родитель a81ab33ba7
Коммит 92ccc6d8f0
3 изменённых файлов: 20 добавлений и 15 удалений

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

@ -67,8 +67,9 @@ class VibrancyManager {
* or remove existing ones as needed.
* @param aType The vibrancy type to use in the region.
* @param aRegion The vibrant area, in device pixels.
* @return Whether the region changed.
*/
void UpdateVibrantRegion(VibrancyType aType, const LayoutDeviceIntRegion& aRegion);
bool UpdateVibrantRegion(VibrancyType aType, const LayoutDeviceIntRegion& aRegion);
bool HasVibrantRegions() { return !mVibrantRegions.IsEmpty(); }

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

@ -12,14 +12,13 @@
using namespace mozilla;
void VibrancyManager::UpdateVibrantRegion(VibrancyType aType,
bool VibrancyManager::UpdateVibrantRegion(VibrancyType aType,
const LayoutDeviceIntRegion& aRegion) {
if (aRegion.IsEmpty()) {
mVibrantRegions.Remove(uint32_t(aType));
return;
return mVibrantRegions.Remove(uint32_t(aType));
}
auto& vr = *mVibrantRegions.LookupOrAdd(uint32_t(aType));
vr.UpdateRegion(aRegion, mCoordinateConverter, mContainerView, ^() {
return vr.UpdateRegion(aRegion, mCoordinateConverter, mContainerView, ^() {
return this->CreateEffectView(aType);
});
}

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

@ -2480,16 +2480,21 @@ void nsChildView::UpdateVibrancy(const nsTArray<ThemeGeometry>& aThemeGeometries
sourceListSelectionRegion, activeSourceListSelectionRegion);
auto& vm = EnsureVibrancyManager();
vm.UpdateVibrantRegion(VibrancyType::LIGHT, vibrantLightRegion);
vm.UpdateVibrantRegion(VibrancyType::DARK, vibrantDarkRegion);
vm.UpdateVibrantRegion(VibrancyType::MENU, menuRegion);
vm.UpdateVibrantRegion(VibrancyType::TOOLTIP, tooltipRegion);
vm.UpdateVibrantRegion(VibrancyType::HIGHLIGHTED_MENUITEM, highlightedMenuItemRegion);
vm.UpdateVibrantRegion(VibrancyType::SHEET, sheetRegion);
vm.UpdateVibrantRegion(VibrancyType::SOURCE_LIST, sourceListRegion);
vm.UpdateVibrantRegion(VibrancyType::SOURCE_LIST_SELECTION, sourceListSelectionRegion);
vm.UpdateVibrantRegion(VibrancyType::ACTIVE_SOURCE_LIST_SELECTION,
activeSourceListSelectionRegion);
bool changed = false;
changed |= vm.UpdateVibrantRegion(VibrancyType::LIGHT, vibrantLightRegion);
changed |= vm.UpdateVibrantRegion(VibrancyType::DARK, vibrantDarkRegion);
changed |= vm.UpdateVibrantRegion(VibrancyType::MENU, menuRegion);
changed |= vm.UpdateVibrantRegion(VibrancyType::TOOLTIP, tooltipRegion);
changed |= vm.UpdateVibrantRegion(VibrancyType::HIGHLIGHTED_MENUITEM, highlightedMenuItemRegion);
changed |= vm.UpdateVibrantRegion(VibrancyType::SHEET, sheetRegion);
changed |= vm.UpdateVibrantRegion(VibrancyType::SOURCE_LIST, sourceListRegion);
changed |= vm.UpdateVibrantRegion(VibrancyType::SOURCE_LIST_SELECTION, sourceListSelectionRegion);
changed |= vm.UpdateVibrantRegion(VibrancyType::ACTIVE_SOURCE_LIST_SELECTION,
activeSourceListSelectionRegion);
if (changed) {
SuspendAsyncCATransactions();
}
}
NSColor* nsChildView::VibrancyFillColorForThemeGeometryType(