Frederic Leitenberger
Frederic Leitenberger

Reputation: 2019

JxBrowser matchMedia() different behavior in Heavyweight and Lightweight mode

I was running the http://browserbench.org/MotionMark/ benchmark in JxBrowser 6.14 in Heavyweight & Lightweight mode, when i noticed, that the iframe used by the benchmark gets a different size for the two modes:

My Frame size: 1000x800

Heavyweight iframe: 900x600 The Benchmark says at the end: "on a medium screen (laptop, tablet)" The <body> is flagged with the class medium.

Lightweight iframe: 568x320 The Benchmark says at the end: "on a small screen(phone)"

The <body> is flagged with the class small.

The code of the website responsible for this difference is this:

determineCanvasSize: function() {
    var match = window.matchMedia("(max-device-width: 760px)");
    if (match.matches) {
        document.body.classList.add("small");
        return;
    }

    match = window.matchMedia("(max-device-width: 1600px)");
    if (match.matches) {
        document.body.classList.add("medium");
        return;
    }

    match = window.matchMedia("(max-width: 1600px)");
    if (match.matches) {
        document.body.classList.add("medium");
        return;
    }

    document.body.classList.add("large");
},

So apparently these matchMedia() queries behave differently in Lightweight mode and Heavyweight mode.

But why should they?

And what could be a solution?

Upvotes: 0

Views: 200

Answers (1)

Vladimir
Vladimir

Reputation: 2277

I'm not aware how this benchmark works, but I know that heavyweight and lightweight rendering modes in JxBrowser are too completely different modes that have their own advantages and limitations. Maybe the issue you see is one of them. As far as I know in the lightweight rendering mode (off-screen) WebGL might work differently because different render techniques are used in Chromium engine in this case.

Could you please let me know how I can check that the benchmark works differently in both rendering modes? Do I just need to run it in a Java frame with 1000x800 with only embedded BrowserView?

Upvotes: 0

Related Questions