Skip to main content

Rendering bug:animation applets overlap with other divs when page scrolling

15 replies [Last post]
stevpan
Offline
Joined: 2007-12-22
Points: 0

Hi! all.

I saw people discussing the similar issue on this blog several month ago.
http://www.psynixis.com/blog/2009/09/08/javafx-applets-%E2%80%93-current...

Today, I finally filed a bug report and tested a javascript hack workaround,. Hope it will be helpful to web developers and jdk developers. This issue affects all J2SE6+ plugins.

In my testing, animation applets always overlap with other html elements when scrolling in browser. IMHO, it's a major bug in both applet and javafx applet as it makes animation can only work smoothly in an unscrollable page (most web pages are scrollable today).

Not only display of other html elements are damaged, the display of top-line and horizontal scroll bar in IE 7 can also be damaged by a scrolling animation applet. This issue can be alleviated by slowing down the scrolling speed in some cases.

Conditions for reproducing

1. Some combinations of Browser/OS
This issue happens in IE7/XP, iE7/Vista, Firefox 3.5/Vista.
From my testing, This issue does not appear in Chrome and Firefox 3.5/XP.

2. An animation applet that updates the screen frequently.
E.g. the javafx mediabox player: http://javafx.com/samples/MediaBox/index.html

3. Scrolling the page up and down rapidly
After scrolling my applet in browser up and down several times, I find that the neighboring divs will be covered by the applet. After the end of scrolling, the neighboring divs do not refresh and recover to its orginal content automatically.

Screenshots of rendering error:

javafx overlapping in Firefox 3.5/Vista:
scrollbar error in IE7/XP:

see attach1, attach2

More screenshots

1. applet overlapping in Firefox 3.5/Vista: http://xfiledialog.googlecode.com/files/overlap_in_firefox3.5_Vista.jpg

2. applet overlapping in IE7/Vista: http://xfiledialog.googlecode.com/files/overlap_in_IE7_vista.jpg

3. applet overlapping in IE7/XP: http://xfiledialog.googlecode.com/files/overlap_in_IE7_XP.JPG

I guess that it's caused by the syncrhonization issue between the applet plugin and the browser. As the neighboring divs do not know that their content has just been covered by the applet during scrolling, they do not redraw automatically.

workaround 1:
a Javascript hack:

Two extra text divs are added into the page: one just before the applet and one just after the applet. The two extra div's height is 100px. The two divs will be forced to redraw each time when the page is scrolling.

To detect page scrolling event, the javascript function setInterval is used to measure the scrolling position periodically. this workaround has been tested successfully with IE6/IE7/Firefox 3/3.5 under Windows Xp/Vista.

Workaround 2:

Use Google chrome browser. Only chrome can avoid this issue completely.

Hope this bug report could be accepted finally.

Message was edited by: stevpan

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
stevpan
Offline
Joined: 2007-12-22
Points: 0

Is it this bugreport?
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6670586

No, the overlapping issue is different from that bug. My issue happens in both XP and Vista. Besides my Vista's Aero is turned off automatically due to the slow graphic card (Intel 82865). .

stevpan
Offline
Joined: 2007-12-22
Points: 0

The overlapping issue is different from the following bug too.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6333613
This known bug could be corrected by setting noerasebackground property.

Sun knew these two bugs years ago, it's hard to believe that the latest samples on javafx.com will make the same mistake.

The fact is: a lot of people have reported the overlapping issue (similar to mine ) when they tried the javafx.com. Even Mac users have met the similar issue.
see discussion on: http://www.psynixis.com/blog/2009/09/08/javafx-applets-%E2%80%93-current...

Is it related to the ancient bug 4250240 (1999) "scrolling problem using java 1.2 plug in under internet explorer 4 and 5."?
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4250240

demonduck
Offline
Joined: 2008-03-14
Points: 0

Are you beginning to see a pattern?

stevpan
Offline
Joined: 2007-12-22
Points: 0

Yes, I see.

Actually, my bugreport should have already been reported by others several years ago. Perhaps it had been reported but not been accepted to Sun bugdatabase.
.

stevpan
Offline
Joined: 2007-12-22
Points: 0

A similar bug report (under Mac)
http://www.psynixis.com/blog/2009/09/04/testing-javafx-applet-deployment...

Joe Nuxoll wrote:
Works for me, but… (Mac 10.5.8, Safari 4.0.3 – had to install JavaFX first)
The triangles bounce, but the window flickers terribly on scroll and the lines draw outside of the applet box and stay there (while scrolling).
Posted 04 Sep 2009 at 6:17 pm
=============

[b]the lines draw outside of the applet box and stay there (while scrolling)[/b]

That's exactly the same bug of this post. The applet destroyed the neighboring html elements while scrolling. The damaged div remains and do not recover to its original content.

stevpan
Offline
Joined: 2007-12-22
Points: 0

Thanks a lot for your quick response.

I've tested it when the D3D pipeline was turned off. The issue still occurs in IE7, Firefox. I turned off the d3d by setting in Java panel (see in attach 1) as well as in a jnlp file.

part of my jnlp file:

href="http://java.sun.com/products/autodl/j2se" java_arguments=" " />


So far the only working way is the ugly javascript hack.

stevpan
Offline
Joined: 2007-12-22
Points: 0

1. This issue happens in the default Java rendering pipleline as well as in the D3D pipeline. As the default pipeline uses GDI/DirectX at the same time, it'll be affected too.

It seems that this issue is not planned to be fixed until in next generation plugin.

2. The rendering artifacts (overlapping) can be suppressed greatly by dropping frames when page scrolling. The applet can drop frames when it detects page scrolling with getLocationOnScreen. It's not accurate but valid in most cases.

3. The last resort is the javascript hack. Two empty text divs are added just before and after the applet. After page scrolling, the two divs are forced to redraw with javascript. The page scrolling event is detected with "document.body.scrollTop", "scrollLeft" in a javascript loop.

With the above two methods, the rendering issue could be prevented.

Hope this issue could be solved in Java 7 finally.

Message was edited by: stevpan

stevpan
Offline
Joined: 2007-12-22
Points: 0

Thanks for Sun developers who reviewed it.
This bug report has been included in Sun bugdatabase. Perhaps it will be finally be fixed in future.

This bug (6921944). could be vote on this page:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6921944

trembovetski
Offline
Joined: 2003-12-31
Points: 0

Thans for the detailed report.

This is indeed a known issue with the Direct3D pipeline on Windows platform. I don't have the bug id handy unfortunately. The cause is a known Windows bug: the hardware surface (window) with accelerated Direct3D rendering is supposed to be clipped by its parent, but sometimes the window manager appears to have issues keeping up. (you can look up on mixing Direct3D and GDI rendering - in this case the browser is GDI application, but Java is using Direct3D in one of browser's children windows).

One work around is to disable Direct3D pipeline (-Dsun.java2d.d3d=false).

This will only be resolved with the next version of the plugin which will not use window parenting for placing Java content into a browser page.

Dmitri

demonduck
Offline
Joined: 2008-03-14
Points: 0

> Thans for the detailed report.
>
> This is indeed a known issue with the Direct3D
> pipeline on Windows platform. I don't have the bug id
> handy unfortunately. The cause is a known Windows
> bug: the hardware surface (window) with accelerated
> Direct3D rendering is supposed to be clipped by its
> parent, but sometimes the window manager appears to
> have issues keeping up. (you can look up on mixing
> Direct3D and GDI rendering - in this case the browser
> is GDI application, but Java is using Direct3D in one
> of browser's children windows).
>
> One work around is to disable Direct3D pipeline
> (-Dsun.java2d.d3d=false).
>
> This will only be resolved with the next version of
> the plugin which will not use window parenting for
> placing Java content into a browser page.
>
> Dmitri

You mean like this ---

Sorry, that doesn't work either. Thank you for your prompt response :-)

stevpan
Offline
Joined: 2007-12-22
Points: 0


==============
From Sun Java doc. It's said that only RIA applets deployed through JNLP can access these secure properties: e.g., sun.java2d.noddraw, sun.java2d.d3d.

It seems that these properties can only be set in a jnlp file, not in a traditional applet tag.

However, rendering artifacts still appear even I define them in a JNLP file.

demonduck
Offline
Joined: 2008-03-14
Points: 0

>
> ==============
> From Sun Java doc. It's said that only RIA applets
> deployed through JNLP can access these secure
> properties: e.g., sun.java2d.noddraw,
> sun.java2d.d3d.
>
> It seems that these properties can only be set in a
> jnlp file, not in a traditional applet tag.
>
> However, rendering artifacts still appear even I
> define them in a JNLP file.

Also you have to be riding a unicycle and juggling while singing "99 bottles of beer on the wall". And be left handed.

stevpan
Offline
Joined: 2007-12-22
Points: 0

Sun has suggested to use -Dsun.awt.noerasebackground=true to prevent rendering artifacts/flickering issue while scrolling an applet in a browse

see:
http://java.sun.com/javase/6/webnotes/trouble/TSG-Desktop/html/plugin.html

This method is valid for rendering artifacts inside an applet, however, it's not valid for the overlapping issue of animation applets. in my testing.

demonduck
Offline
Joined: 2008-03-14
Points: 0

Yeah well if I add it to the JVM arguments in the control panel, it negates the JVM arguments I've set in the web page.

And it doesn't stop the flicker --

Brilliant!

demonduck
Offline
Joined: 2008-03-14
Points: 0

Good work!

I reported the same thing in Sept. '09.

http://forums.java.net/jive/thread.jspa?threadID=67091&tstart=0

As usual the ever diligent Java Dev Team couldn't be aroused from their comatose state long enough to even reply.

You've done a Man's work sir! But don't hold your breath waiting for this to be fixed.