📄 render_object.h
字号:
* 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); // 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 <div style="height:25px"> 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(); } /** * 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() : overflowHeight(); } /** * 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(); } // IE extensions, heavily used in ECMA virtual short offsetWidth() const { return width(); } virtual int offsetHeight() const { return height(); } 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, QColor& underline, QColor& overline, QColor& linethrough, bool quirksMode=false); enum BorderSide { BSTop, BSBottom, BSLeft, BSRight }; void drawBorder(QPainter *p, int x1, int y1, int x2, int y2, BorderSide s, QColor c, const QColor& textcolor, EBorderStyle style, int adjbw1, int adjbw2, bool invalidisInvert = false); // Used by collapsed border tables. virtual void collectBorders(QValueList<CollapsedBorderValue>& borderStyles); // force a complete repaint virtual void repaint(bool immediate = false) { if(m_parent) m_parent->repaint(immediate); } virtual void repaintRectangle(int x, int y, int w, int h, bool immediate = false, 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 containsFloat(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; } // recursively invalidate current layout // unused: void invalidateLayout(); virtual void calcVerticalMargins() {} void removeFromObjectLists(); virtual void deleteInlineBoxes(RenderArena* arena=0) {(void)arena;} virtual void detach( ); const QFont &font(bool firstLine) const { return style( firstLine )->font(); } const QFontMetrics &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 QPixmap &, const QRect&, CachedImage *);protected: virtual void selectionStartEnd(int& spos, int& epos); virtual QRect viewRect() const; void remove(); void invalidateVerticalPositions(); 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_replaced : 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_containsPageBreak : 1; // ### we have 16 + 23 bits. Cut 4 and save 32 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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -