summaryrefslogtreecommitdiffstats
path: root/dom/canvas/DrawTargetWebgl.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
commitdef92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch)
tree2ef34b9ad8bb9a9220e05d60352558b15f513894 /dom/canvas/DrawTargetWebgl.cpp
parentAdding debian version 125.0.3-1. (diff)
downloadfirefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz
firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/canvas/DrawTargetWebgl.cpp')
-rw-r--r--dom/canvas/DrawTargetWebgl.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/dom/canvas/DrawTargetWebgl.cpp b/dom/canvas/DrawTargetWebgl.cpp
index eae6dd78f3..fdc45cc842 100644
--- a/dom/canvas/DrawTargetWebgl.cpp
+++ b/dom/canvas/DrawTargetWebgl.cpp
@@ -21,6 +21,7 @@
#include "mozilla/gfx/Swizzle.h"
#include "mozilla/layers/ImageDataSerializer.h"
#include "mozilla/layers/RemoteTextureMap.h"
+#include "mozilla/widget/ScreenManager.h"
#include "skia/include/core/SkPixmap.h"
#include "nsContentUtils.h"
@@ -325,6 +326,11 @@ void SharedContextWebgl::UnlinkGlyphCaches() {
void SharedContextWebgl::OnMemoryPressure() { mShouldClearCaches = true; }
+void SharedContextWebgl::ClearCaches() {
+ OnMemoryPressure();
+ ClearCachesIfNecessary();
+}
+
// Clear out the entire list of texture handles from any source.
void SharedContextWebgl::ClearAllTextures() {
while (!mTextureHandles.isEmpty()) {
@@ -852,10 +858,14 @@ bool DrawTargetWebgl::CanCreate(const IntSize& aSize, SurfaceFormat aFormat) {
// In addition, allow acceleration up to this size even if the screen is
// smaller. A lot content expects this size to work well. See Bug 999841
static const int32_t kScreenPixels = 980 * 480;
- IntSize screenSize = gfxPlatform::GetPlatform()->GetScreenSize();
- if (aSize.width * aSize.height >
- std::max(screenSize.width * screenSize.height, kScreenPixels)) {
- return false;
+
+ if (RefPtr<widget::Screen> screen =
+ widget::ScreenManager::GetSingleton().GetPrimaryScreen()) {
+ LayoutDeviceIntSize screenSize = screen->GetRect().Size();
+ if (aSize.width * aSize.height >
+ std::max(screenSize.width * screenSize.height, kScreenPixels)) {
+ return false;
+ }
}
}