ngeorga / flying-saucer

Automatically exported from code.google.com/p/flying-saucer
0 stars 0 forks source link

"position:fixed" as a style is missing support #41

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
*** This issue was imported from http://java.net/jira/browse/XHTMLRENDERER-338

It was reported by aneesh2004 on 14.10.2010 18:17:54 +0200 and last updated in 
the previous bug tracker on 14.10.2010 18:19:05 +0200

Found in
Operating System: All
Platform: All

The priority for this issue at migration was Major.
The original issue had attachments to it; see comments below.

Original description: 
I have some xhtml with a body and a single div inside the body. The div has a 
style that uses. "position"fixed". The xhtml is
*************
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "resources/dtds/xhtml1-
strict.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
    <head>
        <title></title>
        <meta charset='utf-8' />
    </head>
    <body style='background-color:#000000;'>
        <div style='position:fixed; top:0pt; 
left:0pt;width:720.0pt;height:540.0pt;'>
            <div

style='top:30.0pt;left:54.0pt;width:612.0pt;height:90.0pt;position:fixed;z-
index:10;top:30.0pt;left:54.0pt;width:612.0pt;height:90.0pt;position:fixed;z-
index:10;text-align:center;padding-top:3.6250393pt;padding-
bottom:3.6250393pt;padding-left:7.25pt;padding-right:7.25pt;'>
                <div style='text-align:center;line-
height:100%;'>
                    <span>
                        <span
                            style='font-
family:Arial;color:#ffff00;font-size:44pt;line-height:100%;'>Keep It 
Simple</span>
                    </span>
                </div>
            </div>

        </div>
    </body>
</html>
*************

When I try to load this xhtml document and create an image using from it

*******
BufferedImage buff = new BufferedImage(width, height,
                BufferedImage.TYPE_INT_RGB);
Graphics2D g = (Graphics2D) buff.getGraphics();
g.setBackground(Color.white);
g.clearRect(0, 0, width, height);
Graphics2DRenderer g2r = new Graphics2DRenderer();
g2r.getSharedContext().setDPI(dpi);
g2r.setDocument(s1, this.baseUrl);
g2r.layout(g, new Dimension(width, height));
g2r.render(g);
g.dispose();
*****
When I save this image, I see that the image has a white background and has 
nothing but a black box towards the top. I have tried this on other documents 
that use "position:fixed" and they have the same output.

When I replace "position:fixed" with  "position:absolute" and rerun my tests, 
the image is exactly the way the original xhtml shows up in browsers. So looks 
like positon:absolute is handled perfectly and position:fixed is missing 
support.

Original issue reported on code.google.com by pdoubl...@gmail.com on 16 Feb 2011 at 9:47

GoogleCodeExporter commented 8 years ago
Attachment by aneesh2004 on 14.10.2010 18:19:05 +0200:  sheet1.xml, size 922 
bytes
Download: http://java.net/jira/secure/attachment/27422/sheet1.xml

Original comment by pdoubl...@gmail.com on 16 Feb 2011 at 9:47

GoogleCodeExporter commented 8 years ago
aneesh2004 wrote on 14.10.2010 18:19:05 +0200:
Created an attachment (id=121)
input xhtml

Original comment by pdoubl...@gmail.com on 16 Feb 2011 at 9:47