Bug 1293043 - Do not shrink favicons down to 16x16. r=aklotz

By this change, icons will never be shrunk to a smaller size. Windows will do
it appropriately.

Internet Explorer's icon handler will not paint the white background if the
icon is large enough. I'm also replicating the behavior.

--HG--
extra : source : 56eb23aaff3a5a0dbca8e41c534307c30e7351f4
This commit is contained in:
Masatoshi Kimura 2019-02-23 13:32:12 +09:00
Родитель b350324259
Коммит fb147aebf9
1 изменённых файлов: 11 добавлений и 5 удалений

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

@ -1193,10 +1193,11 @@ AsyncFaviconDataReady::OnComplete(nsIURI* aFaviconURI, uint32_t aDataLen,
RefPtr<DataSourceSurface> dataSurface;
IntSize size;
if (mURLShortcut) {
// Create a 48x48 surface and paint the icon into the central 16x16 rect.
size.width = 48;
size.height = 48;
if (mURLShortcut &&
(surface->GetSize().width < 48 || surface->GetSize().height < 48)) {
// Create a 48x48 surface and paint the icon into the central rect.
size.width = std::max(surface->GetSize().width, 48);
size.height = std::max(surface->GetSize().height, 48);
dataSurface =
Factory::CreateDataSourceSurface(size, SurfaceFormat::B8G8R8A8);
NS_ENSURE_TRUE(dataSurface, NS_ERROR_FAILURE);
@ -1216,7 +1217,12 @@ AsyncFaviconDataReady::OnComplete(nsIURI* aFaviconURI, uint32_t aDataLen,
}
dt->FillRect(Rect(0, 0, size.width, size.height),
ColorPattern(Color(1.0f, 1.0f, 1.0f, 1.0f)));
dt->DrawSurface(surface, Rect(16, 16, 16, 16),
IntPoint point;
point.x = (size.width - surface->GetSize().width) / 2;
point.y = (size.height - surface->GetSize().height) / 2;
dt->DrawSurface(surface,
Rect(point.x, point.y, surface->GetSize().width,
surface->GetSize().height),
Rect(Point(0, 0), Size(surface->GetSize().width,
surface->GetSize().height)));