📄 render_object.h
字号:
int clientHeight() const; // scrollWidth/scrollHeight will be the same as clientWidth/clientHeight unless the // object has overflow:hidden/scroll/auto specified and also has overflow. int scrollWidth() const; int scrollHeight() const; // The following seven functions are used to implement collapsing margins. // All objects know their maximal positive and negative margins. The // formula for computing a collapsed margin is |maxPosMargin|-|maxNegmargin|. // For a non-collapsing, e.g., a leaf element, this formula will simply return // the margin of the element. Blocks override the maxTopMargin and maxBottomMargin // methods. virtual bool isSelfCollapsingBlock() const { return false; } virtual short collapsedMarginTop() const { return maxTopMargin(true)-maxTopMargin(false); } virtual 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 { if (positive) if (marginTop() > 0) return marginTop(); else return 0; else if (marginTop() < 0) return 0 - marginTop(); else return 0; } virtual short maxBottomMargin(bool positive) const { if (positive) if (marginBottom() > 0) return marginBottom(); else return 0; else if (marginBottom() < 0) return 0 - marginBottom(); else return 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 since table cells override 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 void absoluteRects(QValueList<QRect>& rects, int _tx, int _ty); // the rect that will be painted if this object is passed as the paintingRoot QRect paintingRootRect(QRect& topLevelRect);#if APPLE_CHANGES virtual void addFocusRingRects(QPainter *painter, int _tx, int _ty);#endif virtual int minWidth() const { return 0; } virtual int maxWidth() const { return 0; } RenderStyle* style() const { return m_style; } RenderStyle* style( bool firstLine ) const; 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); virtual void setTable(RenderTable*) {}; // Used by collapsed border tables. virtual void collectBorders(QValueList<CollapsedBorderValue>& borderStyles); // Repaint the entire object. Called when, e.g., the color of a border changes, or when a border // style changes. void repaint(bool immediate = false); // Repaint a specific subrectangle within a given object. The rect |r| is in the object's coordinate space. void repaintRectangle(const QRect& r, bool immediate = false); // Repaint only if our old bounds and new bounds are different. bool repaintAfterLayoutIfNeeded(const QRect& oldBounds, const QRect& oldFullBounds); // Repaint only if the object moved. virtual void repaintDuringLayoutIfMoved(int oldX, int oldY); // Called to repaint a block's floats. virtual void repaintFloatingDescendants(); // Called before layout to repaint all dirty children (with selfNeedsLayout() set). virtual void repaintObjectsBeforeLayout(); bool checkForRepaintDuringLayout() const; // Returns the rect that should be repainted whenever this object changes. The rect is in the view's // coordinate space. This method deals with outlines and overflow. virtual QRect getAbsoluteRepaintRect(); QRect getAbsoluteRepaintRectWithOutline(int ow); virtual void getAbsoluteRepaintRectIncludingFloats(QRect& bounds, QRect& boundsWithChildren); // Given a rect in the object's coordinate space, this method converts the rectangle to the view's // coordinate space. virtual void computeAbsoluteRepaintRect(QRect& r, bool f=false); virtual unsigned int length() const { return 1; } bool isFloatingOrPositioned() const { return (isFloating() || isPositioned()); }; virtual bool containsFloats() { return false; } virtual bool containsFloat(RenderObject* o) { return false; } virtual bool hasOverhangingFloats() { return false; } bool avoidsFloats() const; bool usesLineWidth() const; // positioning of inline children (bidi) virtual void position(InlineBox*, int, int, bool) {} // 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) {} bool shouldSelect() const; DOM::NodeImpl* draggableNode(bool dhtmlOK, bool uaOK, bool& dhtmlWillDrag) const; /** * Returns the content coordinates of the caret within this render object. * @param offset zero-based offset determining position within the render object. * @param override @p true if input overrides existing characters, * @p false if it inserts them. The width of the caret depends on this one. * @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, bool override, int &_x, int &_y, int &width, int &height); 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 void calcVerticalMargins() {} void removeFromObjectLists(); // When performing a global document tear-down, the renderer of the document is cleared. We use this // as a hook to detect the case of document destruction and don't waste time doing unnecessary work. bool documentBeingDestroyed() const { return !document()->renderer(); } virtual void detach(); const QFont &font(bool firstLine) const { return style( firstLine )->font(); } const QFontMetrics &fontMetrics(bool firstLine) const { return style( firstLine )->fontMetrics(); } // Virtual function helpers for CSS3 Flexible Box Layout virtual bool isFlexibleBox() const { return false; } virtual bool isFlexingChildren() const { return false; } virtual bool isStretchingChildren() const { return false; } // Convenience, to avoid repeating the code to dig down to get this. QChar backslashAsCurrencySymbol() const; virtual long caretMinOffset() const; virtual long caretMaxOffset() const; virtual unsigned long caretMaxRenderedOffset() const; virtual void setPixmap(const QPixmap&, const QRect&, CachedImage *);protected: virtual void selectionStartEnd(int& spos, int& epos); virtual void printBoxDecorations(QPainter* /*p*/, int /*_x*/, int /*_y*/, int /*_w*/, int /*_h*/, int /*_tx*/, int /*_ty*/) {} virtual QRect viewRect() const; void remove(); void invalidateVerticalPositions(); short getVerticalPosition( bool firstLine ) const; virtual void removeLeftoverAnonymousBoxes(); void arenaDelete(RenderArena *arena); RenderObject *paintingRootForChildren(PaintInfo &i) const { // if we're the painting root, kids draw normally, and see root of 0 return (!i.paintingRoot || i.paintingRoot == this) ? 0 : i.paintingRoot; } bool shouldPaintWithinRoot(PaintInfo &i) const { return !i.paintingRoot || i.paintingRoot == this; }private: RenderStyle* m_style; DOM::NodeImpl* m_node; RenderObject *m_parent; RenderObject *m_previous; RenderObject *m_next; mutable short m_verticalPosition; bool m_needsLayout : 1; bool m_normalChildNeedsLayout : 1; bool m_posChildNeedsLayout : 1; bool m_minMaxKnown : 1; bool m_floating : 1; bool m_positioned : 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_isDragging : 1; bool m_isSelectionBorder : 1; bool m_hasOverflowClip : 1; void arenaDelete(RenderArena *arena, void *objectBase); // note: do not add unnecessary bitflags, we have 32 bit already! 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 + -