mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1229237 (part 4) - Make ThemeGeometry::mRect a LayoutDeviceIntRect. r=botond.
This commit is contained in:
parent
086ae9a5bb
commit
7bb1055535
@ -2223,7 +2223,9 @@ RegisterThemeGeometry(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
|||||||
nsIFrame* displayRoot = nsLayoutUtils::GetDisplayRootFrame(aFrame);
|
nsIFrame* displayRoot = nsLayoutUtils::GetDisplayRootFrame(aFrame);
|
||||||
nsRect borderBox(aFrame->GetOffsetTo(displayRoot), aFrame->GetSize());
|
nsRect borderBox(aFrame->GetOffsetTo(displayRoot), aFrame->GetSize());
|
||||||
aBuilder->RegisterThemeGeometry(aType,
|
aBuilder->RegisterThemeGeometry(aType,
|
||||||
borderBox.ToNearestPixels(aFrame->PresContext()->AppUnitsPerDevPixel()));
|
LayoutDeviceIntRect::FromUnknownRect(
|
||||||
|
borderBox.ToNearestPixels(
|
||||||
|
aFrame->PresContext()->AppUnitsPerDevPixel())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,7 +601,7 @@ public:
|
|||||||
* for the themed widget
|
* for the themed widget
|
||||||
*/
|
*/
|
||||||
void RegisterThemeGeometry(uint8_t aWidgetType,
|
void RegisterThemeGeometry(uint8_t aWidgetType,
|
||||||
const nsIntRect& aRect) {
|
const mozilla::LayoutDeviceIntRect& aRect) {
|
||||||
if (mIsPaintingToWindow) {
|
if (mIsPaintingToWindow) {
|
||||||
mThemeGeometries.AppendElement(ThemeGeometry(aWidgetType, aRect));
|
mThemeGeometries.AppendElement(ThemeGeometry(aWidgetType, aRect));
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,8 @@ public:
|
|||||||
* @param aType The vibrancy type to use in the region.
|
* @param aType The vibrancy type to use in the region.
|
||||||
* @param aRegion The vibrant area, in device pixels.
|
* @param aRegion The vibrant area, in device pixels.
|
||||||
*/
|
*/
|
||||||
void UpdateVibrantRegion(VibrancyType aType, const nsIntRegion& aRegion);
|
void UpdateVibrantRegion(VibrancyType aType,
|
||||||
|
const LayoutDeviceIntRegion& aRegion);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear the vibrant areas that we know about.
|
* Clear the vibrant areas that we know about.
|
||||||
@ -102,7 +103,7 @@ public:
|
|||||||
// The following are only public because otherwise ClearVibrantRegionFunc
|
// The following are only public because otherwise ClearVibrantRegionFunc
|
||||||
// can't see them.
|
// can't see them.
|
||||||
struct VibrantRegion {
|
struct VibrantRegion {
|
||||||
nsIntRegion region;
|
LayoutDeviceIntRegion region;
|
||||||
nsTArray<NSView*> effectViews;
|
nsTArray<NSView*> effectViews;
|
||||||
};
|
};
|
||||||
void ClearVibrantRegion(const VibrantRegion& aVibrantRegion) const;
|
void ClearVibrantRegion(const VibrantRegion& aVibrantRegion) const;
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
|
||||||
void
|
void
|
||||||
VibrancyManager::UpdateVibrantRegion(VibrancyType aType, const nsIntRegion& aRegion)
|
VibrancyManager::UpdateVibrantRegion(VibrancyType aType,
|
||||||
|
const LayoutDeviceIntRegion& aRegion)
|
||||||
{
|
{
|
||||||
auto& vr = *mVibrantRegions.LookupOrAdd(uint32_t(aType));
|
auto& vr = *mVibrantRegions.LookupOrAdd(uint32_t(aType));
|
||||||
if (vr.region == aRegion) {
|
if (vr.region == aRegion) {
|
||||||
@ -27,12 +28,12 @@ VibrancyManager::UpdateVibrantRegion(VibrancyType aType, const nsIntRegion& aReg
|
|||||||
vr.effectViews.SwapElements(viewsToRecycle);
|
vr.effectViews.SwapElements(viewsToRecycle);
|
||||||
// vr.effectViews is now empty.
|
// vr.effectViews is now empty.
|
||||||
|
|
||||||
nsIntRegionRectIterator iter(aRegion);
|
LayoutDeviceIntRegion::RectIterator iter(aRegion);
|
||||||
const nsIntRect* iterRect = nullptr;
|
const LayoutDeviceIntRect* iterRect = nullptr;
|
||||||
for (size_t i = 0; (iterRect = iter.Next()) || i < viewsToRecycle.Length(); ++i) {
|
for (size_t i = 0; (iterRect = iter.Next()) || i < viewsToRecycle.Length(); ++i) {
|
||||||
if (iterRect) {
|
if (iterRect) {
|
||||||
NSView* view = nil;
|
NSView* view = nil;
|
||||||
NSRect rect = mCoordinateConverter.UntypedDevPixelsToCocoaPoints(*iterRect);
|
NSRect rect = mCoordinateConverter.DevPixelsToCocoaPoints(*iterRect);
|
||||||
if (i < viewsToRecycle.Length()) {
|
if (i < viewsToRecycle.Length()) {
|
||||||
view = viewsToRecycle[i];
|
view = viewsToRecycle[i];
|
||||||
[view setFrame:rect];
|
[view setFrame:rect];
|
||||||
@ -70,9 +71,9 @@ VibrancyManager::ClearVibrantRegion(const VibrantRegion& aVibrantRegion) const
|
|||||||
{
|
{
|
||||||
[[NSColor clearColor] set];
|
[[NSColor clearColor] set];
|
||||||
|
|
||||||
nsIntRegionRectIterator iter(aVibrantRegion.region);
|
LayoutDeviceIntRegion::RectIterator iter(aVibrantRegion.region);
|
||||||
while (const nsIntRect* rect = iter.Next()) {
|
while (const LayoutDeviceIntRect* rect = iter.Next()) {
|
||||||
NSRectFill(mCoordinateConverter.UntypedDevPixelsToCocoaPoints(*rect));
|
NSRectFill(mCoordinateConverter.DevPixelsToCocoaPoints(*rect));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2405,7 +2405,7 @@ FindFirstRectOfType(const nsTArray<nsIWidget::ThemeGeometry>& aThemeGeometries,
|
|||||||
for (uint32_t i = 0; i < aThemeGeometries.Length(); ++i) {
|
for (uint32_t i = 0; i < aThemeGeometries.Length(); ++i) {
|
||||||
const nsIWidget::ThemeGeometry& g = aThemeGeometries[i];
|
const nsIWidget::ThemeGeometry& g = aThemeGeometries[i];
|
||||||
if (g.mType == aThemeGeometryType) {
|
if (g.mType == aThemeGeometryType) {
|
||||||
return LayoutDeviceIntRect::FromUnknownRect(g.mRect);
|
return g.mRect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return LayoutDeviceIntRect();
|
return LayoutDeviceIntRect();
|
||||||
@ -2446,11 +2446,11 @@ nsChildView::UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometri
|
|||||||
[win placeFullScreenButton:[mView convertRect:DevPixelsToCocoaPoints(fullScreenButtonRect) toView:nil]];
|
[win placeFullScreenButton:[mView convertRect:DevPixelsToCocoaPoints(fullScreenButtonRect) toView:nil]];
|
||||||
}
|
}
|
||||||
|
|
||||||
static nsIntRegion
|
static LayoutDeviceIntRegion
|
||||||
GatherThemeGeometryRegion(const nsTArray<nsIWidget::ThemeGeometry>& aThemeGeometries,
|
GatherThemeGeometryRegion(const nsTArray<nsIWidget::ThemeGeometry>& aThemeGeometries,
|
||||||
nsITheme::ThemeGeometryType aThemeGeometryType)
|
nsITheme::ThemeGeometryType aThemeGeometryType)
|
||||||
{
|
{
|
||||||
nsIntRegion region;
|
LayoutDeviceIntRegion region;
|
||||||
for (size_t i = 0; i < aThemeGeometries.Length(); ++i) {
|
for (size_t i = 0; i < aThemeGeometries.Length(); ++i) {
|
||||||
const nsIWidget::ThemeGeometry& g = aThemeGeometries[i];
|
const nsIWidget::ThemeGeometry& g = aThemeGeometries[i];
|
||||||
if (g.mType == aThemeGeometryType) {
|
if (g.mType == aThemeGeometryType) {
|
||||||
@ -2489,17 +2489,17 @@ nsChildView::UpdateVibrancy(const nsTArray<ThemeGeometry>& aThemeGeometries)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIntRegion sheetRegion =
|
LayoutDeviceIntRegion sheetRegion =
|
||||||
GatherThemeGeometryRegion(aThemeGeometries, nsNativeThemeCocoa::eThemeGeometryTypeSheet);
|
GatherThemeGeometryRegion(aThemeGeometries, nsNativeThemeCocoa::eThemeGeometryTypeSheet);
|
||||||
nsIntRegion vibrantLightRegion =
|
LayoutDeviceIntRegion vibrantLightRegion =
|
||||||
GatherThemeGeometryRegion(aThemeGeometries, nsNativeThemeCocoa::eThemeGeometryTypeVibrancyLight);
|
GatherThemeGeometryRegion(aThemeGeometries, nsNativeThemeCocoa::eThemeGeometryTypeVibrancyLight);
|
||||||
nsIntRegion vibrantDarkRegion =
|
LayoutDeviceIntRegion vibrantDarkRegion =
|
||||||
GatherThemeGeometryRegion(aThemeGeometries, nsNativeThemeCocoa::eThemeGeometryTypeVibrancyDark);
|
GatherThemeGeometryRegion(aThemeGeometries, nsNativeThemeCocoa::eThemeGeometryTypeVibrancyDark);
|
||||||
nsIntRegion menuRegion =
|
LayoutDeviceIntRegion menuRegion =
|
||||||
GatherThemeGeometryRegion(aThemeGeometries, nsNativeThemeCocoa::eThemeGeometryTypeMenu);
|
GatherThemeGeometryRegion(aThemeGeometries, nsNativeThemeCocoa::eThemeGeometryTypeMenu);
|
||||||
nsIntRegion tooltipRegion =
|
LayoutDeviceIntRegion tooltipRegion =
|
||||||
GatherThemeGeometryRegion(aThemeGeometries, nsNativeThemeCocoa::eThemeGeometryTypeTooltip);
|
GatherThemeGeometryRegion(aThemeGeometries, nsNativeThemeCocoa::eThemeGeometryTypeTooltip);
|
||||||
nsIntRegion highlightedMenuItemRegion =
|
LayoutDeviceIntRegion highlightedMenuItemRegion =
|
||||||
GatherThemeGeometryRegion(aThemeGeometries, nsNativeThemeCocoa::eThemeGeometryTypeHighlightedMenuItem);
|
GatherThemeGeometryRegion(aThemeGeometries, nsNativeThemeCocoa::eThemeGeometryTypeHighlightedMenuItem);
|
||||||
|
|
||||||
MakeRegionsNonOverlapping(sheetRegion, vibrantLightRegion, vibrantDarkRegion,
|
MakeRegionsNonOverlapping(sheetRegion, vibrantLightRegion, vibrantDarkRegion,
|
||||||
|
@ -344,9 +344,10 @@ class nsIWidget : public nsISupports {
|
|||||||
// nsITheme::ThemeGeometryTypeForWidget.
|
// nsITheme::ThemeGeometryTypeForWidget.
|
||||||
nsITheme::ThemeGeometryType mType;
|
nsITheme::ThemeGeometryType mType;
|
||||||
// The device-pixel rect within the window for the themed widget
|
// The device-pixel rect within the window for the themed widget
|
||||||
nsIntRect mRect;
|
LayoutDeviceIntRect mRect;
|
||||||
|
|
||||||
ThemeGeometry(nsITheme::ThemeGeometryType aType, const nsIntRect& aRect)
|
ThemeGeometry(nsITheme::ThemeGeometryType aType,
|
||||||
|
const LayoutDeviceIntRect& aRect)
|
||||||
: mType(aType)
|
: mType(aType)
|
||||||
, mRect(aRect)
|
, mRect(aRect)
|
||||||
{ }
|
{ }
|
||||||
|
@ -3757,7 +3757,7 @@ nsWindow::UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries)
|
|||||||
if (!IsWin10OrLater()) {
|
if (!IsWin10OrLater()) {
|
||||||
for (size_t i = 0; i < aThemeGeometries.Length(); i++) {
|
for (size_t i = 0; i < aThemeGeometries.Length(); i++) {
|
||||||
if (aThemeGeometries[i].mType == nsNativeThemeWin::eThemeGeometryTypeWindowButtons) {
|
if (aThemeGeometries[i].mType == nsNativeThemeWin::eThemeGeometryTypeWindowButtons) {
|
||||||
nsIntRect bounds = aThemeGeometries[i].mRect;
|
LayoutDeviceIntRect bounds = aThemeGeometries[i].mRect;
|
||||||
clearRegion.Or(clearRegion, nsIntRect(bounds.X(), bounds.Y(), bounds.Width(), bounds.Height() - 2.0));
|
clearRegion.Or(clearRegion, nsIntRect(bounds.X(), bounds.Y(), bounds.Width(), bounds.Height() - 2.0));
|
||||||
clearRegion.Or(clearRegion, nsIntRect(bounds.X() + 1.0, bounds.YMost() - 2.0, bounds.Width() - 1.0, 1.0));
|
clearRegion.Or(clearRegion, nsIntRect(bounds.X() + 1.0, bounds.YMost() - 2.0, bounds.Width() - 1.0, 1.0));
|
||||||
clearRegion.Or(clearRegion, nsIntRect(bounds.X() + 2.0, bounds.YMost() - 1.0, bounds.Width() - 3.0, 1.0));
|
clearRegion.Or(clearRegion, nsIntRect(bounds.X() + 2.0, bounds.YMost() - 1.0, bounds.Width() - 3.0, 1.0));
|
||||||
|
Loading…
Reference in New Issue
Block a user