зеркало из https://github.com/mozilla/gecko-dev.git
Bug 765805 (3/3) - Update thumbnails for tabs added while the sidebar is open [r=sriram]
This commit is contained in:
Родитель
34ae538ae2
Коммит
e187e61263
|
@ -746,9 +746,17 @@ abstract public class GeckoApp
|
|||
GeckoAppShell.sendEventToGecko(GeckoEvent.createScreenshotEvent(tab.getId(), 0, 0, 0, 0, 0, 0, dw, dh, dw, dh, GeckoAppShell.SCREENSHOT_THUMBNAIL, tab.getThumbnailBuffer()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void handleThumbnailData(Tab tab, ByteBuffer data) {
|
||||
if (shouldUpdateThumbnail(tab)) {
|
||||
Bitmap b = tab.getThumbnailBitmap();
|
||||
b.copyPixelsFromBuffer(data);
|
||||
processThumbnail(tab, b, null);
|
||||
}
|
||||
}
|
||||
|
||||
void processThumbnail(Tab thumbnailTab, Bitmap bitmap, byte[] compressed) {
|
||||
if (Tabs.getInstance().isSelectedTab(thumbnailTab)) {
|
||||
if (shouldUpdateThumbnail(thumbnailTab)) {
|
||||
if (compressed == null) {
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 0, bos);
|
||||
|
@ -765,6 +773,10 @@ abstract public class GeckoApp
|
|||
}
|
||||
}
|
||||
|
||||
private boolean shouldUpdateThumbnail(Tab tab) {
|
||||
return (Tabs.getInstance().isSelectedTab(tab) || mTabsPanel.isShown());
|
||||
}
|
||||
|
||||
void updatePopups(final Tab tab) {
|
||||
mDoorHangerPopup.updatePopup();
|
||||
}
|
||||
|
|
|
@ -1589,7 +1589,7 @@ public class GeckoAppShell
|
|||
int x, int y,
|
||||
int w, int h,
|
||||
boolean isFullScreen)
|
||||
{
|
||||
{
|
||||
ImmutableViewportMetrics pluginViewport;
|
||||
|
||||
Log.i(LOGTAG, "addPluginView:" + view + " @ x:" + x + " y:" + y + " w:" + w + " h:" + h + " fullscreen: " + isFullScreen);
|
||||
|
@ -2423,11 +2423,7 @@ class ScreenshotHandler {
|
|||
}
|
||||
case GeckoAppShell.SCREENSHOT_THUMBNAIL:
|
||||
{
|
||||
if (Tabs.getInstance().isSelectedTab(tab)) {
|
||||
Bitmap b = tab.getThumbnailBitmap();
|
||||
b.copyPixelsFromBuffer(data);
|
||||
GeckoApp.mAppContext.processThumbnail(tab, b, null);
|
||||
}
|
||||
GeckoApp.mAppContext.handleThumbnailData(tab, data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче