HTML::Renderer::Mapper Class Reference

#include <Mapper.hpp>

List of all members.


Detailed Description

The mapper is used to map a DOM tree to one or multiple (rendered) box(es).

Each box is stored in a linear array, as the hierarchical structure is not needed anymore. Each box have a reference on the mapper, so they can obtain the previous and next box without having to deal with the DOM structure directly.

The mapper is able to locate a box from its UID too with a fast lookup


Public Member Functions

const bool areFloatBoxInContainer (Box *container) const
 Are there any float in the container.
const uint32 findBottomChildrenPos (Box *box, bool blockLevelOnly=true, bool setIteration=true) const
 Find the bottom children position.
const uint32 findLeftChildrenPos (Box *box, bool blockLevelOnly=true) const
 Find the left children position.
const uint32 findRightChildrenPos (Box *box, bool blockLevelOnly=true) const
 Find the right children position.
const uint32 findTopChildrenPos (Box *box, bool blockLevelOnly=true, bool setIteration=true) const
 Find the top children position.
bool generateBoxes ()
 Generate the boxes, and put them inside the corresponding arrays This method follow http://www.w3.org/TR/REC-CSS2/visuren.html#box-gen.
bool generateBoxHierarchy ()
 Generate the boxes hierarchy from the given DOM tree, and put them inside the corresponding arrays This method follow http://www.w3.org/TR/REC-CSS2/visuren.html#box-gen.
CSS::FontgetBolderFont (CSS::Font *font) const
 Get a bolder font than the given font.
CSS::FontgetColouredFont (CSS::Font *font, const CSS::Colour &color) const
 Get an coloured font derived from the given font.
const uint32 getCurrentIteration () const
 Get the current rendering iteration.
CSS::FontgetDefaultFont () const
 Get the default font.
CSS::DisplayMode::Type getDisplayStyleFor (const BoxHierarchy *box) const
 Get the display style for the given box hierarchy.
const int32 getFloatBottom (Box *container) const
 Get the current bottom float position for the given container.
const int32 getFloatLeft (Box *container) const
 Get the current left float position for the given container.
const int32 getFloatRight (Box *container) const
 Get the current right float position for the given container.
HTML::Renderer::Allocators::BaseAllocatorgetHierarchyAllocator ()
 Return the currently used hierarchy allocator.
CSS::FontgetItalicFont (CSS::Font *font) const
 Get an italic font derived from the given font.
uint32 getMinimumHeightOf (Box *box) const
 Get the minimum width of the given element.
uint32 getMinimumWidthOf (Box *box) const
 Get the minimum width of the given element.
CSS::FontgetMonospaceFont (CSS::Font *font) const
 Get an monospaced font derived from the given font.
BoxgetRenderedBox (const uint32 index)
 Get the boxes to render them.
uint32 getRenderedHeightOf (Box *box) const
 Get the rendering height of the given element.
uint32 getRenderedWidthOf (Box *box) const
 Get the rendering width of the given element.
const BoxHierarchygetRootHierarchy () const
 Get the root box hierarchy.
CSS::FontgetScaledFont (CSS::Font *font, const float scale) const
 Get a scaled font than the given font.
uint32 getSplitLimitsOf (Box *box, const int32 boxLeft, const int32 boxRight, const int32 top, const int32 left, int32 &right, int32 &bottom) const
 Get the split limits of the given element.
bool getStyleFor (const BoxHierarchy *box, CSS::StyleImplement &style) const
 Get the style for the given box hierarchy.
TableLayoutgetTableLayout (Box *box) const
 Get the table layout for the given box.
BoxgetViewportBox ()
 Get the viewport box.
const uint32 getViewportHeight () const
 Get the viewport height.
const uint32 getViewportWidth () const
 Get the viewport width.
bool getWidthsOf (Box *box, int32 &minWidth, int32 &maxWidth) const
 Get the minimum and maximum width for a given box.
const bool hasBlockLevelChildren (const Box *box) const
 Are there any block level children in this container ?
bool isFormBasedElement (const BoxHierarchy *box) const
 Check if the element is a Form based element.
bool isLinkElement (const BoxHierarchy *box) const
 Check if the element is a link.
 Mapper (const DOM::Node *_root, HTML::Renderer::Allocators::BaseAllocator &allocator, const uint32 viewWidth, const uint32 viewHeight, RequiredRendererImplementation *ri)
 The only constructor.
void resizedTo (const uint32 width, const uint32 height)
 A viewport resize has been done, so handle it, increment the iteration count.
const bool shouldBeSeenAsBlock (Box *box) const
 Should this box be seen as block ? This is used for non-compliant web page where block level element are included into inline level element (like div in a span) In that case, the renderer will display wrong inline based block.
 ~Mapper ()
 The destructor delete the style objects used inside the boxes.


Constructor & Destructor Documentation

HTML::Renderer::Mapper::Mapper ( const DOM::Node _root,
HTML::Renderer::Allocators::BaseAllocator allocator,
const uint32  viewWidth,
const uint32  viewHeight,
RequiredRendererImplementation ri 
) [inline]

The only constructor.

The renderer must provide callbacks in its own RequiredRendererImplementation overload

Parameters:
root The root node of the DOM tree
allocator The box hierarchy allocator (used to create/change the box hierarchy)
viewWidth The viewport width
viewHeight The viewport height
ri The required renderer implementation object pointer

HTML::Renderer::Mapper::~Mapper (  ) 

The destructor delete the style objects used inside the boxes.


Member Function Documentation

const bool HTML::Renderer::Mapper::areFloatBoxInContainer ( Box container  )  const [inline]

Are there any float in the container.

Todo:
implement container parsing

const uint32 HTML::Renderer::Mapper::findBottomChildrenPos ( Box box,
bool  blockLevelOnly = true,
bool  setIteration = true 
) const

Find the bottom children position.

const uint32 HTML::Renderer::Mapper::findLeftChildrenPos ( Box box,
bool  blockLevelOnly = true 
) const

Find the left children position.

const uint32 HTML::Renderer::Mapper::findRightChildrenPos ( Box box,
bool  blockLevelOnly = true 
) const

Find the right children position.

const uint32 HTML::Renderer::Mapper::findTopChildrenPos ( Box box,
bool  blockLevelOnly = true,
bool  setIteration = true 
) const

Find the top children position.

bool HTML::Renderer::Mapper::generateBoxes (  ) 

Generate the boxes, and put them inside the corresponding arrays This method follow http://www.w3.org/TR/REC-CSS2/visuren.html#box-gen.

Returns:
true on success

bool HTML::Renderer::Mapper::generateBoxHierarchy (  ) 

Generate the boxes hierarchy from the given DOM tree, and put them inside the corresponding arrays This method follow http://www.w3.org/TR/REC-CSS2/visuren.html#box-gen.

Returns:
true on success

CSS::Font* HTML::Renderer::Mapper::getBolderFont ( CSS::Font font  )  const [inline]

Get a bolder font than the given font.

CSS::Font* HTML::Renderer::Mapper::getColouredFont ( CSS::Font font,
const CSS::Colour color 
) const [inline]

Get an coloured font derived from the given font.

const uint32 HTML::Renderer::Mapper::getCurrentIteration (  )  const [inline]

Get the current rendering iteration.

CSS::Font* HTML::Renderer::Mapper::getDefaultFont (  )  const [inline]

Get the default font.

CSS::DisplayMode::Type HTML::Renderer::Mapper::getDisplayStyleFor ( const BoxHierarchy box  )  const

Get the display style for the given box hierarchy.

Todo:
Implement true CSS rule matching here, and not default style sheet like it is now
See also:
http://www.w3.org/TR/REC-CSS2/sample.html

const int32 HTML::Renderer::Mapper::getFloatBottom ( Box container  )  const [inline]

Get the current bottom float position for the given container.

Todo:
implement container parsing to extract all floats in there

const int32 HTML::Renderer::Mapper::getFloatLeft ( Box container  )  const [inline]

Get the current left float position for the given container.

Todo:
implement container parsing to extract all floats in there

const int32 HTML::Renderer::Mapper::getFloatRight ( Box container  )  const [inline]

Get the current right float position for the given container.

Todo:
implement container parsing to extract all floats in there

HTML::Renderer::Allocators::BaseAllocator& HTML::Renderer::Mapper::getHierarchyAllocator (  )  [inline]

Return the currently used hierarchy allocator.

CSS::Font* HTML::Renderer::Mapper::getItalicFont ( CSS::Font font  )  const [inline]

Get an italic font derived from the given font.

uint32 HTML::Renderer::Mapper::getMinimumHeightOf ( Box box  )  const [inline]

Get the minimum width of the given element.

uint32 HTML::Renderer::Mapper::getMinimumWidthOf ( Box box  )  const [inline]

Get the minimum width of the given element.

CSS::Font* HTML::Renderer::Mapper::getMonospaceFont ( CSS::Font font  )  const [inline]

Get an monospaced font derived from the given font.

Box* HTML::Renderer::Mapper::getRenderedBox ( const uint32  index  )  [inline]

Get the boxes to render them.

uint32 HTML::Renderer::Mapper::getRenderedHeightOf ( Box box  )  const [inline]

Get the rendering height of the given element.

uint32 HTML::Renderer::Mapper::getRenderedWidthOf ( Box box  )  const [inline]

Get the rendering width of the given element.

const BoxHierarchy* HTML::Renderer::Mapper::getRootHierarchy (  )  const [inline]

Get the root box hierarchy.

CSS::Font* HTML::Renderer::Mapper::getScaledFont ( CSS::Font font,
const float  scale 
) const [inline]

Get a scaled font than the given font.

uint32 HTML::Renderer::Mapper::getSplitLimitsOf ( Box box,
const int32  boxLeft,
const int32  boxRight,
const int32  top,
const int32  left,
int32 &  right,
int32 &  bottom 
) const [inline]

Get the split limits of the given element.

bool HTML::Renderer::Mapper::getStyleFor ( const BoxHierarchy box,
CSS::StyleImplement style 
) const

Get the style for the given box hierarchy.

Todo:
Implement true CSS rule matching here, and not default style sheet like it is now
See also:
http://www.w3.org/TR/REC-CSS2/sample.html

TableLayout * HTML::Renderer::Mapper::getTableLayout ( Box box  )  const

Get the table layout for the given box.

Box* HTML::Renderer::Mapper::getViewportBox (  )  [inline]

Get the viewport box.

const uint32 HTML::Renderer::Mapper::getViewportHeight (  )  const [inline]

Get the viewport height.

const uint32 HTML::Renderer::Mapper::getViewportWidth (  )  const [inline]

Get the viewport width.

bool HTML::Renderer::Mapper::getWidthsOf ( Box box,
int32 &  minWidth,
int32 &  maxWidth 
) const [inline]

Get the minimum and maximum width for a given box.

const bool HTML::Renderer::Mapper::hasBlockLevelChildren ( const Box box  )  const

Are there any block level children in this container ?

bool HTML::Renderer::Mapper::isFormBasedElement ( const BoxHierarchy box  )  const [inline]

Check if the element is a Form based element.

bool HTML::Renderer::Mapper::isLinkElement ( const BoxHierarchy box  )  const [inline]

Check if the element is a link.

void HTML::Renderer::Mapper::resizedTo ( const uint32  width,
const uint32  height 
)

A viewport resize has been done, so handle it, increment the iteration count.

const bool HTML::Renderer::Mapper::shouldBeSeenAsBlock ( Box box  )  const

Should this box be seen as block ? This is used for non-compliant web page where block level element are included into inline level element (like div in a span) In that case, the renderer will display wrong inline based block.


The documentation for this class was generated from the following files:

(C) An X-Ryl669 project 2007

This document describes Unlimited Zooming Interface source code. UZI stands for Unlimited Zooming Interface, and source code license is