Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit 6f898f0

Browse files
MortimerGorobluemarvin
authored andcommitted
Only capture screenshots if the first paint is ready (#2304)
1 parent 2333f6e commit 6f898f0

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/WindowWidget.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ public void setFirstDrawCallback(Runnable aRunnable) {
978978

979979
@Override
980980
public boolean isFirstPaintReady() {
981-
return mWidgetPlacement.composited;
981+
return mWidgetPlacement != null && mWidgetPlacement.composited;
982982
}
983983

984984
@Override
@@ -1536,7 +1536,9 @@ public void onPageStart(@NonNull GeckoSession geckoSession, @NonNull String s) {
15361536
public void onPageStop(@NonNull GeckoSession aSession, boolean b) {
15371537
if (mCaptureOnPageStop || !mSession.hasCapturedBitmap()) {
15381538
mCaptureOnPageStop = false;
1539-
captureImage();
1539+
if (isFirstPaintReady()) {
1540+
captureImage();
1541+
}
15401542
}
15411543
}
15421544

app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/Windows.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,9 @@ public void onTabsClicked() {
973973

974974
// Capture active session snapshots when showing the tabs menu
975975
for (WindowWidget window: getCurrentWindows()) {
976-
window.captureImage();
976+
if (window.isFirstPaintReady()) {
977+
window.captureImage();
978+
}
977979
}
978980
}
979981

0 commit comments

Comments
 (0)