⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 renderobject.h

📁 linux下开源浏览器WebKit的源码,市面上的很多商用浏览器都是移植自WebKit
💻 H
📖 第 1 页 / 共 3 页
字号:
    /**     * Returns the local coordinates of the caret within this render object.     * @param caretOffset zero-based offset determining position within the render object.     * @param extraWidthToEndOfLine optional out arg to give extra width to end of line -     * useful for character range rect computations     */    virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0);    virtual void calcVerticalMargins() { }    bool isTopMarginQuirk() const { return m_topMarginQuirk; }    bool isBottomMarginQuirk() const { return m_bottomMarginQuirk; }    void setTopMarginQuirk(bool b = true) { m_topMarginQuirk = b; }    void setBottomMarginQuirk(bool b = true) { m_bottomMarginQuirk = b; }    // 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;    virtual void destroy();    // 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; }    virtual int caretMinOffset() const;    virtual int caretMaxOffset() const;    virtual unsigned caretMaxRenderedOffset() const;    virtual int previousOffset(int current) const;    virtual int previousOffsetForBackwardDeletion(int current) const;    virtual int nextOffset(int current) const;    virtual void imageChanged(CachedImage*, const IntRect* = 0);    virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) { }    virtual bool willRenderImage(CachedImage*);    virtual void selectionStartEnd(int& spos, int& epos) const;    RenderObject* paintingRootForChildren(PaintInfo& paintInfo) const    {        // if we're the painting root, kids draw normally, and see root of 0        return (!paintInfo.paintingRoot || paintInfo.paintingRoot == this) ? 0 : paintInfo.paintingRoot;    }    bool shouldPaintWithinRoot(PaintInfo& paintInfo) const    {        return !paintInfo.paintingRoot || paintInfo.paintingRoot == this;    }    bool hasOverrideSize() const { return m_hasOverrideSize; }    void setHasOverrideSize(bool b) { m_hasOverrideSize = b; }        void remove() { if (parent()) parent()->removeChild(this); }    AnimationController* animation() const;    bool visibleToHitTesting() const { return style()->visibility() == VISIBLE && style()->pointerEvents() != PE_NONE; }    // Map points and quads through elements, potentially via 3d transforms. You should never need to call these directly; use    // localToAbsolute/absoluteToLocal methods instead.    virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&) const;    virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const;    TransformationMatrix transformFromContainer(const RenderObject* container, const IntSize& offsetInContainer) const;        virtual void addFocusRingRects(GraphicsContext*, int /*tx*/, int /*ty*/) { };    IntRect absoluteOutlineBounds() const    {        return outlineBoundsForRepaint(0);    }    bool replacedHasOverflow() const { return m_replacedHasOverflow; }    void setReplacedHasOverflow(bool b = true) { m_replacedHasOverflow = b; }    protected:    // Overrides should call the superclass at the end    virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);    // Overrides should call the superclass at the start    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);    void paintOutline(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*);    void addPDFURLRect(GraphicsContext*, const IntRect&);    virtual IntRect viewRect() const;    void adjustRectForOutlineAndShadow(IntRect&) const;    void arenaDelete(RenderArena*, void* objectBase);    virtual IntRect outlineBoundsForRepaint(RenderBoxModelObject* /*repaintContainer*/) const { return IntRect(); }    class LayoutRepainter {    public:        LayoutRepainter(RenderObject& object, bool checkForRepaint, const IntRect* oldBounds = 0)            : m_object(object)            , m_repaintContainer(0)            , m_checkForRepaint(checkForRepaint)        {            if (m_checkForRepaint) {                m_repaintContainer = m_object.containerForRepaint();                m_oldBounds = oldBounds ? *oldBounds : m_object.clippedOverflowRectForRepaint(m_repaintContainer);                m_oldOutlineBox = m_object.outlineBoundsForRepaint(m_repaintContainer);            }        }                // Return true if it repainted.        bool repaintAfterLayout()        {            return m_checkForRepaint ? m_object.repaintAfterLayoutIfNeeded(m_repaintContainer, m_oldBounds, m_oldOutlineBox) : false;        }                bool checkForRepaint() const { return m_checkForRepaint; }            private:        RenderObject& m_object;        RenderBoxModelObject* m_repaintContainer;        IntRect m_oldBounds;        IntRect m_oldOutlineBox;        bool m_checkForRepaint;    };    private:    RenderStyle* firstLineStyleSlowCase() const;    StyleDifference adjustStyleDifference(StyleDifference, unsigned contextSensitiveProperties) const;        RefPtr<RenderStyle> m_style;    Node* m_node;    RenderObject* m_parent;    RenderObject* m_previous;    RenderObject* m_next;#ifndef NDEBUG    bool m_hasAXObject;    bool m_setNeedsLayoutForbidden : 1;#endif    // 32 bits have been used here. THERE ARE NO FREE BITS AVAILABLE.    bool m_needsLayout               : 1;    bool m_needsPositionedMovementLayout :1;    bool m_normalChildNeedsLayout    : 1;    bool m_posChildNeedsLayout       : 1;    bool m_prefWidthsDirty           : 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_isText                    : 1;    bool m_isBox                     : 1;    bool m_inline                    : 1;    bool m_replaced                  : 1;    bool m_isDragging                : 1;    bool m_hasLayer                  : 1;    bool m_hasOverflowClip           : 1;    bool m_hasTransform              : 1;    bool m_hasReflection             : 1;    bool m_hasOverrideSize           : 1;    public:    bool m_hasCounterNodeMap         : 1;    bool m_everHadLayout             : 1;private:    // These bitfields are moved here from subclasses to pack them together    // from RenderBlock    bool m_childrenInline : 1;    bool m_topMarginQuirk : 1;    bool m_bottomMarginQuirk : 1;    bool m_hasMarkupTruncation : 1;    unsigned m_selectionState : 3; // SelectionState    bool m_hasColumns : 1;        // from RenderTableCell    bool m_cellWidthChanged : 1;    // from RenderReplaced    bool m_replacedHasOverflow : 1;private:    // Store state between styleWillChange and styleDidChange    static bool s_affectsParentBlock;};inline bool RenderObject::documentBeingDestroyed() const{    return !document()->renderer();}inline void RenderObject::setNeedsLayout(bool b, bool markParents){    bool alreadyNeededLayout = m_needsLayout;    m_needsLayout = b;    if (b) {        ASSERT(!isSetNeedsLayoutForbidden());        if (!alreadyNeededLayout) {            if (markParents)                markContainingBlocksForLayout();            if (hasLayer())                setLayerNeedsFullRepaint();        }    } else {        m_everHadLayout = true;        m_posChildNeedsLayout = false;        m_normalChildNeedsLayout = false;        m_needsPositionedMovementLayout = false;    }}inline void RenderObject::setChildNeedsLayout(bool b, bool markParents){    bool alreadyNeededLayout = m_normalChildNeedsLayout;    m_normalChildNeedsLayout = b;    if (b) {        ASSERT(!isSetNeedsLayoutForbidden());        if (!alreadyNeededLayout && markParents)            markContainingBlocksForLayout();    } else {        m_posChildNeedsLayout = false;        m_normalChildNeedsLayout = false;        m_needsPositionedMovementLayout = false;    }}inline void RenderObject::setNeedsPositionedMovementLayout(){    bool alreadyNeededLayout = needsLayout();    m_needsPositionedMovementLayout = true;    if (!alreadyNeededLayout) {        markContainingBlocksForLayout();        if (hasLayer())            setLayerNeedsFullRepaint();    }}inline bool objectIsRelayoutBoundary(const RenderObject *obj) {    // FIXME: In future it may be possible to broaden this condition in order to improve performance.    // Table cells are excluded because even when their CSS height is fixed, their height()    // may depend on their contents.    return obj->isTextControl()        || obj->hasOverflowClip() && !obj->style()->width().isIntrinsicOrAuto() && !obj->style()->height().isIntrinsicOrAuto() && !obj->style()->height().isPercent() && !obj->isTableCell()#if ENABLE(SVG)           || obj->isSVGRoot()#endif           ;}inline void RenderObject::markContainingBlocksForLayout(bool scheduleRelayout, RenderObject* newRoot){    ASSERT(!scheduleRelayout || !newRoot);    RenderObject* o = container();    RenderObject* last = this;    while (o) {        if (!last->isText() && (last->style()->position() == FixedPosition || last->style()->position() == AbsolutePosition)) {            if ((last->style()->top().isAuto() && last->style()->bottom().isAuto()) || last->style()->top().isStatic()) {                RenderObject* parent = last->parent();                if (!parent->normalChildNeedsLayout()) {                    parent->setChildNeedsLayout(true, false);                    if (parent != newRoot)                        parent->markContainingBlocksForLayout(scheduleRelayout, newRoot);                }            }            if (o->m_posChildNeedsLayout)                return;            o->m_posChildNeedsLayout = true;            ASSERT(!o->isSetNeedsLayoutForbidden());        } else {            if (o->m_normalChildNeedsLayout)                return;            o->m_normalChildNeedsLayout = true;            ASSERT(!o->isSetNeedsLayoutForbidden());        }        if (o == newRoot)            return;        last = o;        if (scheduleRelayout && objectIsRelayoutBoundary(last))            break;        o = o->container();    }    if (scheduleRelayout)        last->scheduleRelayout();}} // namespace WebCore#ifndef NDEBUG// Outside the WebCore namespace for ease of invocation from gdb.void showTree(const WebCore::RenderObject*);#endif#endif // RenderObject_h

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -