Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 329633

Summary: Add Image Support for DocBook Items
Product: z_Archived Reporter: David Carver <d_a_carver>
Component: MylynAssignee: Project Inbox <vex.core-inbox>
Status: CLOSED MOVED QA Contact:
Severity: normal    
Priority: P3 CC: florian
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description David Carver CLA 2010-11-07 12:28:39 EST
Now that the image support has been checked into the core.  Need to update the Vex DocBook stylesheets so they use those new elements.

I'll work on providing adding support for this functionality.
Comment 1 David Carver CLA 2010-11-07 15:51:27 EST
I found some additional issues, and a partial fix.   Vex does not seem to be setting the Inline Block height correctly.

InlineElementBox private constructor, the following change will honor any height CSS attribute:


		// background image
		if (styles.hasBackgroundImage() && !styles.getDisplay().equalsIgnoreCase(CSS.NONE)) {
			Float height = styles.getElementHeight();
			Integer intHeight = height.intValue();
			if (height == 0) {
				intHeight = styles.getLineHeight();
			}
			ImageBox imageBox = ImageBox.createWithHeight(getElement(), context, intHeight);
			if (imageBox != null)
				childList.add(imageBox);
		}


With this one can add:

  height: 480px

To an image element, and the height will be adjusted to that size for the inline element.

However, either offsets need to be recalculated, or the height of the box parent box and offset need to be recalculated, as the items will overwrite the background image.

We need a way that a minimum image height can be set, and the offset for the rest of the document adjusted appropriately.

So it should be something like

Figure
  Inline Image
RestOfText
Comment 2 David Carver CLA 2010-11-07 15:52:32 EST
BTW, I see the image tag is already there, but it displays really really small with out the above changes.
Comment 3 Florian Thienel CLA 2010-11-07 16:57:58 EST
(In reply to comment #2)
> BTW, I see the image tag is already there, but it displays really really small
> with out the above changes.
Can you give me some simple test data (at least the docbook element structure you are using) to see the effect of very small images?

My intention was that inline images should fit into the line with the surrounding text. The main use case for inline images that I can think of is to put icons and similar things into the text. Some thing like:

The quick brown [fox-icon] jumps over the lazy [dog-icon]

For illustrations I would rather use a block element like <figure> to include the image.
Comment 4 David Carver CLA 2010-11-07 18:10:01 EST
(In reply to comment #3)
> 
> The quick brown [fox-icon] jumps over the lazy [dog-icon]
> 
> For illustrations I would rather use a block element like <figure> to include
> the image.

Correct, and that is the structure that is causing the problems.  You can add the following to a DocBook file to see the tiny images:



<?xml version='1.0'?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "file:/home/dcarver/OpenSource/workspace/runtime-EclipseApplication/TestDocBookProject/TestImage.xml">
<article>
  <title>Test Article with Images</title>
  <section>
    <title>This is a Heading</title>
    <para>Here is a paragraph.</para>
    <para>
      <figure>
        <title>A Ttitle for a Figure</title>
        <mediaobject><imageobject>
        <imagedata fileref="images/SomeImage.png"/></imageobject></mediaobject>
      </figure>
    </para>
  </section>
</article>


A figure, contains a mediaobject, which contains an imageobject, which contains imagedata.

The imagedata is defined as inline in the current CSS stylesheet.
Comment 5 David Carver CLA 2010-11-07 18:21:00 EST
Okay, I did some testing, if you change in the DocBook css stylesheet, imagedata to use display: block it works as expected in the current document structure.

According to DocBook: The definitive Guide, imagedata can be displayed as either inline, or block depending on the content.   The graphic element should always be displayed as block.
Comment 6 David Carver CLA 2010-11-07 20:35:35 EST
(In reply to comment #5)
> Okay, I did some testing, if you change in the DocBook css stylesheet,
> imagedata to use display: block it works as expected in the current document
> structure.
> 
> According to DocBook: The definitive Guide, imagedata can be displayed as
> either inline, or block depending on the content.   The graphic element should
> always be displayed as block.

I went ahead and made a small change to the style sheet for now, to have imagedata render as a block instead of inline.  We may need to add specifics for particular uses.
Comment 7 Florian Thienel CLA 2011-11-09 17:36:52 EST
Moved to Mylyn Docs Vex.
Comment 8 Eclipse Webmaster CLA 2022-11-15 11:45:08 EST
Mylyn has been restructured, and our issue tracking has moved to GitHub [1].

We are closing ~14K Bugzilla issues to give the new team a fresh start. If you feel that this issue is still relevant, please create a new one on GitHub.

[1] https://github.com/orgs/eclipse-mylyn