balbuenac / flying-saucer

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

Image element with relative sizing does not resize #71

Open GoogleCodeExporter opened 9 years ago

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

It was reported by wjase on 03.10.2008 07:06:59 +0200 and last updated in the 
previous bug tracker on 09.03.2009 20:55:15 +0100

Found in
Operating System: All
Platform: All

The priority for this issue at migration was Major.

Original description: 
I created an instance of XHTMLPanel with an image whose width was set to 100%.
Although the initial layout is correct, when the panel is resized, the image
size doesn't change. I have implemented a workaround by adding a component
listener and then calling setDocument each time a resize event is dispatched.

(although if i drag resize too much i get a heap excepetion)

Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap 
space
    at
com.sun.org.apache.xerces.internal.util.XMLStringBuffer.append(XMLStringBuffer.j
ava:205)
    at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.refresh(XMLDocume
ntScannerImpl.java:1501)
    at
com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.invokeListeners(XMLEnti
tyScanner.java:2070)
    at
com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.scanName(XMLEntityScann
er.java:701)
    at
com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.skipSeparator(XMLDTDSc
annerImpl.java:2060)
    at
com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.scanAttlistDecl(XMLDTD
ScannerImpl.java:1212)
    at
com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.scanDecls(XMLDTDScanne
rImpl.java:1983)
    at
com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.scanDTDExternalSubset(
XMLDTDScannerImpl.java:320)
    at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatc
h(XMLDocumentScannerImpl.java:1185)
    at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XM
LDocumentScannerImpl.java:1075)
    at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next
(XMLDocumentScannerImpl.java:993)
    at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentS
cannerImpl.java:647)
    at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocum
entScannerImpl.java:140)
    at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocum
ent(XMLDocumentFragmentScannerImpl.java:508)
    at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configu
ration.java:807)
    at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configu
ration.java:737)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
    at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXPa
rser.java:1205)
    at
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(T
ransformerImpl.java:637)
    at
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Transform
erImpl.java:708)
    at
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Transform
erImpl.java:313)
    at
org.xhtmlrenderer.resource.XMLResource$XMLResourceBuilder.createXMLResource(XMLR
esource.java:189)
    at org.xhtmlrenderer.resource.XMLResource.load(XMLResource.java:75)
    at org.xhtmlrenderer.swing.BasicPanel.setDocumentFromString(BasicPanel.java:335)
    at
com.cybernostics.joeymail.util.HTMLViewPanel$1.componentResized(HTMLViewPanel.ja
va:64)
    at java.awt.AWTEventMulticaster.componentResized(AWTEventMulticaster.java:143)
    at java.awt.Component.processComponentEvent(Component.java:5960)
    at java.awt.Component.processEvent(Component.java:5914)
    at java.awt.Container.processEvent(Container.java:2023)
    at java.awt.Component.dispatchEventImpl(Component.java:4501)
    at java.awt.Container.dispatchEventImpl(Container.java:2081)
    at java.awt.Component.dispatchEvent(Component.java:4331)

Here's a small xhtml to reproduce 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<title>Resize Example</title>
<style type="text/css">
body {
font-family: "Comic Sans MS" sans-serif;
background-repeat:repeat;
}
img.joeydwg {
border: 10px solid #822d0e;
width: 100%;
min-width: 100%;
margin: 20 20 20 20;
}

</style>
</head>
<body>
<img class="joeydwg" src="file:///c:/temp/dwg.gif" alt="drawing"
width="100%" />
</body>
</html>

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

GoogleCodeExporter commented 9 years ago
pdoubleya wrote on 09.03.2009 20:55:15 +0100:
This is a bug (obviously) with no good workaround, unfortunately the fix would
require too much work before R9. We currently scale once, on image load, and
cache the image. We can fix this along with the issue related to multiple images
on one page with different sizes.

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