* outlineObjects; // used to list which outlines should be painted by a block with inline children
};
virtual void paint( PaintInfo& i, int tx, int ty);
void paintBorder(TQPainter *p, int _tx, int _ty, int w, int h, const RenderStyle* style, bool begin=true, bool end=true);
void paintOutline(TQPainter *p, int _tx, int _ty, int w, int h, const RenderStyle* style);
virtual void paintBoxDecorations(PaintInfo&, int /*_tx*/, int /*_ty*/) {}
virtual void paintBackgroundExtended(TQPainter* /*p*/, const TQColor& /*c*/, const BackgroundLayer */*bgLayer*/,
int /*clipy*/, int /*cliph*/, int /*_tx*/, int /*_ty*/,
int /*w*/, int /*height*/, int /*bleft*/, int /*bright*/, int /*pleft*/, int /*pright*/ ) {}
/*
* This function calculates the minimum & maximum width that the object
* can be set to.
*
* when the Element calls setMinMaxKnown(true), calcMinMaxWidth() will
* be no longer called.
*
* when a element has a fixed size, m_minWidth and m_maxWidth should be
* set to the same value. This has the special meaning that m_width,
* tqcontains the actual value.
*
* assumes calcMinMaxWidth has already been called for all children.
*/
virtual void calcMinMaxWidth() { }
/*
* Does the min max width recalculations after changes.
*/
void recalcMinMaxWidths();
/*
* Calculates the actual width of the object (only for non inline
* objects)
*/
virtual void calcWidth() {}
/*
* Calculates the actual width of the object (only for non inline
* objects)
*/
virtual void calcHeight() {}
/*
* This function should cause the Element to calculate its
* width and height and the tqlayout of its content
*
* when the Element calls setNeedsLayout(false), tqlayout() is no
* longer called during retqlayouts, as long as there is no
* style sheet change. When that occurs, m_needsLayout will be
* set to true and the Element receives tqlayout() calls
* again.
*/
virtual void tqlayout() = 0;
/* This function performs a tqlayout only if one is needed. */
void tqlayoutIfNeeded() { if (needsLayout()) tqlayout(); }
// used for element state updates that can not be fixed with a
// tqrepaint and do not need a retqlayout
virtual void updateFromElement() {}
// Called immediately after render-object is inserted
virtual void attach() { m_attached = true; }
bool attached() { return m_attached; }
// The corresponding closing element has been parsed. ### remove me
virtual void close() { }
virtual int availableHeight() const { return 0; }
// Whether or not the element shrinks to its max width (rather than filling the width
// of a containing block). HTML4 buttons, legends, and floating/compact elements do this.
bool sizesToMaxWidth() const;
/*
* NeesPageClear indicates the object crossed a page-break but could not break itself and now
* needs to be moved clear by its parent.
*/
void setNeedsPageClear(bool b = true) { m_needsPageClear = b; }
virtual bool needsPageClear() const { return m_needsPageClear; }
/*
* ContainsPageBreak indicates the object tqcontains a clean page-break.
* ### should be removed and tqreplaced with (crossesPageBreak && !needsPageClear)
*/
void setContainsPageBreak(bool b = true) { m_tqcontainsPageBreak = b; }
virtual bool tqcontainsPageBreak() const { return m_tqcontainsPageBreak; }
virtual int pageTopAfter(int y) const { if (parent()) return parent()->pageTopAfter(y); else return 0; }
virtual int crossesPageBreak(int top, int bottom) const
{ if (parent()) return parent()->crossesPageBreak(top, bottom); else return 0; }
// Checks if a page-break before child is possible at the given page-break level
// false means the child should attempt the break self.
virtual bool canClear(RenderObject */*child*/, PageBreakLevel level)
{ if (parent()) return parent()->canClear(this, level); else return false; }
void setAfterPageBreak(bool b = true) { m_afterPageBreak = b; };
void setBeforePageBreak(bool b = true) { m_beforePageBreak = b; };
virtual bool afterPageBreak() const { return m_afterPageBreak; }
virtual bool beforePageBreak() const { return m_beforePageBreak; }
// does a query on the rendertree and tqfinds the innernode
// and overURL for the given position
// if readonly == false, it will recalc hover styles accordingly
class NodeInfo
{
friend class RenderImage;
friend class RenderFlow;
friend class RenderInline;
friend class RenderText;
friend class RenderWidget;
friend class RenderObject;
friend class RenderFrameSet;
friend class RenderLayer;
friend class DOM::HTMLAreaElementImpl;
public:
NodeInfo(bool readonly, bool active)
: m_innerNode(0), m_innerNonSharedNode(0), m_innerURLElement(0), m_readonly(readonly), m_active(active)
{ }
DOM::NodeImpl* innerNode() const { return m_innerNode; }
DOM::NodeImpl* innerNonSharedNode() const { return m_innerNonSharedNode; }
DOM::NodeImpl* URLElement() const { return m_innerURLElement; }
bool readonly() const { return m_readonly; }
bool active() const { return m_active; }
private:
void setInnerNode(DOM::NodeImpl* n) { m_innerNode = n; }
void setInnerNonSharedNode(DOM::NodeImpl* n) { m_innerNonSharedNode = n; }
void setURLElement(DOM::NodeImpl* n) { m_innerURLElement = n; }
DOM::NodeImpl* m_innerNode;
DOM::NodeImpl* m_innerNonSharedNode;
DOM::NodeImpl* m_innerURLElement;
bool m_readonly;
bool m_active;
};
/** tqcontains stateful information for a checkSelectionPoint call
*/
struct SelPointState {
/** last node that was before the current position */
DOM::NodeImpl *m_lastNode;
/** offset of last node */
long m_lastOffset;
/** true when the last node had the result SelectionAfterInLine */
bool m_afterInLine;
SelPointState() : m_lastNode(0), m_lastOffset(0), m_afterInLine(false)
{}
};
virtual FindSelectionResult checkSelectionPoint( int _x, int _y, int _tx, int _ty,
DOM::NodeImpl*&, int & offset,
SelPointState & );
virtual bool nodeAtPoint(NodeInfo& info, int x, int y, int tx, int ty, HitTestAction, bool inside = false);
void setInnerNode(NodeInfo& info);
// set the style of the object.
virtual void setStyle(RenderStyle *style);
// returns the containing block level element for this element.
RenderBlock *containingBlock() const;
// return just the width of the containing block
virtual short containingBlockWidth() const;
// return just the height of the containing block
virtual int containingBlockHeight() const;
// size of the content area (box size minus padding/border)
virtual short contentWidth() const { return 0; }
virtual int contentHeight() const { return 0; }
// intrinsic extend of tqreplaced elements. undefined otherwise
virtual short intrinsicWidth() const { return 0; }
virtual int intrinsicHeight() const { return 0; }
// relative to parent node
virtual void setPos( int /*xPos*/, int /*yPos*/ ) { }
virtual void setWidth( int /*width*/ ) { }
virtual void setHeight( int /*height*/ ) { }
virtual int xPos() const { return 0; }
virtual int yPos() const { return 0; }
/** the position of the object from where it begins drawing, including
* its negative overflow
*/
int effectiveXPos() const { return xPos() + (hasOverflowClip() ? 0 : overflowLeft()); }
/** the position of the object from where it begins drawing, including
* its negative overflow
*/
int effectiveYPos() const { return yPos() + (hasOverflowClip() ? -borderTopExtra() : kMin(overflowTop(), -borderTopExtra())); }
/** Leftmost coordinate of this inline element relative to containing
* block. Always zero for non-inline elements.
*/
virtual int inlineXPos() const { return 0; }
/** Topmost coordinate of this inline element relative to containing
* block. Always zero for non-inline elements.
*/
virtual int inlineYPos() const { return 0; }
// calculate client position of box
virtual bool absolutePosition(int &/*xPos*/, int &/*yPos*/, bool fixed = false) const;
// width and height are without margins but include paddings and borders
virtual short width() const { return 0; }
virtual int height() const { return 0; }
// The height of a block when you include overflow spillage out of
// the bottom of the block (e.g., a that
// has a 100px tall image inside it would have an overflow height
// of borderTop() + paddingTop() + 100px.
virtual int overflowHeight() const { return height(); }
virtual int overflowWidth() const { return width(); }
// how much goes over the left hand side (0 or a negative number)
virtual int overflowTop() const { return 0; }
virtual int overflowLeft() const { return 0; }
/**
* Returns the height that is effectively considered when contemplating the
* object as a whole -- usually the overflow height, or the height if clipped.
*/
int effectiveHeight() const { return hasOverflowClip() ? height() + borderTopExtra() + borderBottomExtra() :
kMax(overflowHeight() - overflowTop(), height() + borderTopExtra() + borderBottomExtra()); }
/**
* Returns the width that is effectively considered when contemplating the
* object as a whole -- usually the overflow width, or the width if clipped.
*/
int effectiveWidth() const { return hasOverflowClip() ? width() : overflowWidth() - overflowLeft(); }
// IE extensions, heavily used in ECMA
virtual short offsetWidth() const { return width(); }
virtual int offsetHeight() const { return height() + borderTopExtra() + borderBottomExtra(); }
virtual int offsetLeft() const;
virtual int offsetTop() const;
virtual RenderObject* offsetParent() const;
short clientWidth() const;
int clientHeight() const;
short scrollWidth() const;
int scrollHeight() const;
virtual bool isSelfCollapsingBlock() const { return false; }
short collapsedMarginTop() const { return maxTopMargin(true)-maxTopMargin(false); }
short collapsedMarginBottom() const { return maxBottomMargin(true)-maxBottomMargin(false); }
virtual bool isTopMarginQuirk() const { return false; }
virtual bool isBottomMarginQuirk() const { return false; }
virtual short maxTopMargin(bool positive) const
{ return positive ? kMax( int( marginTop() ), 0 ) : - kMin( int( marginTop() ), 0 ); }
virtual short maxBottomMargin(bool positive) const
{ return positive ? kMax( int( marginBottom() ), 0 ) : - kMin( int( marginBottom() ), 0 ); }
virtual short marginTop() const { return 0; }
virtual short marginBottom() const { return 0; }
virtual short marginLeft() const { return 0; }
virtual short marginRight() const { return 0; }
virtual int paddingTop() const;
virtual int paddingBottom() const;
virtual int paddingLeft() const;
virtual int paddingRight() const;
virtual int borderTop() const { return style()->borderTopWidth(); }
virtual int borderBottom() const { return style()->borderBottomWidth(); }
virtual int borderLeft() const { return style()->borderLeftWidth(); }
virtual int borderRight() const { return style()->borderRightWidth(); }
virtual short minWidth() const { return 0; }
virtual int maxWidth() const { return 0; }
RenderStyle* style() const { return m_style; }
RenderStyle* style( bool firstLine ) const {
RenderStyle *s = m_style;
if( firstLine && hasFirstLine() ) {
RenderStyle *pseudoStyle = style()->getPseudoStyle(RenderStyle::FIRST_LINE);
if ( pseudoStyle )
s = pseudoStyle;
}
return s;
}
void getTextDecorationColors(int decorations, TQColor& underline, TQColor& overline,
TQColor& linethrough, bool quirksMode=false);
enum BorderSide {
BSTop, BSBottom, BSLeft, BSRight
};
void drawBorder(TQPainter *p, int x1, int y1, int x2, int y2, BorderSide s,
TQColor c, const TQColor& textcolor, EBorderStyle style,
int adjbw1, int adjbw2, bool invalidisInvert = false);
// Used by collapsed border tables.
virtual void collectBorders(TQValueList& borderStyles);
// force a complete tqrepaint
virtual void tqrepaint(Priority p = NormalPriority) { if(m_parent) m_parent->tqrepaint(p); }
virtual void tqrepaintRectangle(int x, int y, int w, int h, Priority p=NormalPriority, bool f=false);
virtual unsigned int length() const { return 1; }
virtual bool isHidden() const { return isFloating() || isPositioned(); }
// Special objects are objects that are neither really inline nor blocklevel
bool isFloatingOrPositioned() const { return (isFloating() || isPositioned()); };
virtual bool hasOverhangingFloats() const { return false; }
virtual bool hasFloats() const { return false; }
virtual bool tqcontainsFloat(RenderObject* /*o*/) const { return false; }
virtual void markAllDescendantsWithFloatsForLayout(RenderObject* /*floatToRemove*/ = 0) {}
bool flowAroundFloats() const;
bool usesLineWidth() const;
// positioning of inline children (bidi)
virtual void position(InlineBox*, int, int, bool) {}
// virtual void position(int, int, int, int, int, bool, bool, int) {}
// Applied as a "slop" to dirty rect checks during the outline painting phase's dirty-rect checks.
int maximalOutlineSize(PaintAction p) const;
enum SelectionState {
SelectionNone,
SelectionStart,
SelectionInside,
SelectionEnd,
SelectionBoth
};
virtual SelectionState selectionState() const { return SelectionNone;}
virtual void setSelectionState(SelectionState) {}
/**
* Flags which influence the appearence and position
* @param CFOverride input overrides existing character, caret should be
* cover the whole character
* @param CFOutside coordinates are to be interpreted outside of the
* render object
* @param CFOutsideEnd coordinates are to be interpreted at the outside
* end of the render object (only valid if CFOutside is also set)
*/
enum CaretFlags { CFOverride = 0x01, CFOutside = 0x02, CFOutsideEnd = 0x04 };
/**
* Returns the content coordinates of the caret within this render object.
* @param offset zero-based offset determining position within the render object.
* @param flags combination of enum CaretFlags
* @param _x returns the left coordinate
* @param _y returns the top coordinate
* @param width returns the caret's width
* @param height returns the caret's height
*/
virtual void caretPos(int offset, int flags, int &_x, int &_y, int &width, int &height);
// returns the lowest position of the lowest object in that particular object.
// This 'height' is relative to the topleft of the margin box of the object.
// Implemented in RenderFlow.
virtual int lowestPosition(bool /*includeOverflowInterior*/=true, bool /*includeSelf*/=true) const { return 0; }
virtual int rightmostPosition(bool /*includeOverflowInterior*/=true, bool /*includeSelf*/=true) const { return 0; }
virtual int leftmostPosition(bool /*includeOverflowInterior*/=true, bool /*includeSelf*/=true) const { return 0; }
virtual int highestPosition(bool /*includeOverflowInterior*/=true, bool /*includeSelf*/=true) const { return 0; }
// recursively tqinvalidate current tqlayout
// unused: void tqinvalidateLayout();
virtual void calcVerticalMargins() {}
void removeFromObjectLists();
virtual void deleteInlineBoxes(RenderArena* arena=0) {(void)arena;}
virtual void detach( );
void setDoNotDelete(bool b) { m_doNotDelete = b; }
bool doNotDelete() const { return m_doNotDelete; }
const TQFont &font(bool firstLine) const {
return style( firstLine )->font();
}
const TQFontMetrics &fontMetrics(bool firstLine) const {
return style( firstLine )->fontMetrics();
}
/** returns the lowest possible value the caret offset may have to
* still point to a valid position.
*
* Returns 0 by default.
*/
virtual long minOffset() const { return 0; }
/** returns the highest possible value the caret offset may have to
* still point to a valid position.
*
* Returns 0 by default, as generic elements are considered to have no
* width.
*/
virtual long maxOffset() const { return 0; }
virtual void setPixmap(const TQPixmap &, const TQRect&, CachedImage *);
TQRegion visibleFlowRegion(int x, int y) const;
protected:
virtual void selectionStartEnd(int& spos, int& epos);
virtual TQRect viewRect() const;
void remove();
void tqinvalidateVerticalPositions();
bool attemptDirectLayerTranslation();
void updateWidgetMasks();
virtual void removeLeftoverAnonymousBoxes();
void arenaDelete(RenderArena *arena);
private:
RenderStyle* m_style;
DOM::NodeImpl* m_node;
RenderObject *m_parent;
RenderObject *m_previous;
RenderObject *m_next;
short m_verticalPosition;
bool m_needsLayout : 1;
bool m_normalChildNeedsLayout : 1;
bool m_markedForRepaint : 1;
bool m_posChildNeedsLayout : 1;
bool m_minMaxKnown : 1;
bool m_floating : 1;
bool m_positioned : 1;
bool m_overhangingContents : 1;
bool m_relPositioned : 1;
bool m_paintBackground : 1; // if the box has something to paint in the
// background painting phase (background, border, etc)
bool m_isAnonymous : 1;
bool m_recalcMinMax : 1;
bool m_isText : 1;
bool m_inline : 1;
bool m_attached : 1;
bool m_tqreplaced : 1;
bool m_mouseInside : 1;
bool m_hasFirstLine : 1;
bool m_isSelectionBorder : 1;
bool m_isRoot : 1;
bool m_beforePageBreak : 1;
bool m_afterPageBreak : 1;
bool m_needsPageClear : 1;
bool m_tqcontainsPageBreak : 1;
bool m_hasOverflowClip : 1;
bool m_doNotDelete : 1; // This object should not be auto-deleted
// ### we have 16 + 26 bits.
void arenaDelete(RenderArena *arena, void *objectBase);
friend class RenderLayer;
friend class RenderListItem;
friend class RenderContainer;
friend class RenderCanvas;
};
enum VerticalPositionHint {
PositionTop = -0x4000,
PositionBottom = 0x4000,
PositionUndefined = 0x3fff
};
} //namespace
#endif