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

📄 renderobject.h

📁 linux下开源浏览器WebKit的源码,市面上的很多商用浏览器都是移植自WebKit
💻 H
📖 第 1 页 / 共 3 页
字号:
    bool isText() const  { return m_isText; }    bool isBox() const { return m_isBox; }    bool isInline() const { return m_inline; }  // inline object    bool isRunIn() const { return style()->display() == RUN_IN; } // run-in object    bool isDragging() const { return m_isDragging; }    bool isReplaced() const { return m_replaced; } // a "replaced" element (see CSS)        bool hasLayer() const { return m_hasLayer; }        bool hasBoxDecorations() const { return m_paintBackground; }    bool mustRepaintBackgroundOrBorder() const;    bool needsLayout() const { return m_needsLayout || m_normalChildNeedsLayout || m_posChildNeedsLayout || m_needsPositionedMovementLayout; }    bool selfNeedsLayout() const { return m_needsLayout; }    bool needsPositionedMovementLayout() const { return m_needsPositionedMovementLayout; }    bool needsPositionedMovementLayoutOnly() const { return m_needsPositionedMovementLayout && !m_needsLayout && !m_normalChildNeedsLayout && !m_posChildNeedsLayout; }    bool posChildNeedsLayout() const { return m_posChildNeedsLayout; }    bool normalChildNeedsLayout() const { return m_normalChildNeedsLayout; }        bool prefWidthsDirty() const { return m_prefWidthsDirty; }    bool isSelectionBorder() const;    bool hasClip() const { return isPositioned() && style()->hasClip(); }    bool hasOverflowClip() const { return m_hasOverflowClip; }    bool hasTransform() const { return m_hasTransform; }    bool hasMask() const { return style() && style()->hasMask(); }    void drawLineForBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2, BoxSide,                            Color, const Color& textcolor, EBorderStyle, int adjbw1, int adjbw2);    void drawArcForBoxSide(GraphicsContext*, int x, int y, float thickness, IntSize radius, int angleStart,                           int angleSpan, BoxSide, Color, const Color& textcolor, EBorderStyle, bool firstCorner);public:    // The pseudo element style can be cached or uncached.  Use the cached method if the pseudo element doesn't respect    // any pseudo classes (and therefore has no concept of changing state).    RenderStyle* getCachedPseudoStyle(PseudoId, RenderStyle* parentStyle = 0) const;    PassRefPtr<RenderStyle> getUncachedPseudoStyle(PseudoId, RenderStyle* parentStyle = 0) const;        virtual void updateDragState(bool dragOn);    RenderView* view() const;    // Returns true if this renderer is rooted, and optionally returns the hosting view (the root of the hierarchy).    bool isRooted(RenderView** = 0);    Node* node() const { return m_isAnonymous ? 0 : m_node; }    Document* document() const { return m_node->document(); }    void setNode(Node* node) { m_node = node; }    bool hasOutlineAnnotation() const;    bool hasOutline() const { return style()->hasOutline() || hasOutlineAnnotation(); }   /**     * returns the object containing this one. can be different from parent for     * positioned elements     */    RenderObject* container() const;    virtual RenderObject* hoverAncestor() const { return parent(); }    // IE Extension that can be called on any RenderObject.  See the implementation for the details.    RenderBoxModelObject* offsetParent() const;    void markContainingBlocksForLayout(bool scheduleRelayout = true, RenderObject* newRoot = 0);    void setNeedsLayout(bool b, bool markParents = true);    void setChildNeedsLayout(bool b, bool markParents = true);    void setNeedsPositionedMovementLayout();    void setPrefWidthsDirty(bool, bool markParents = true);    void invalidateContainerPrefWidths();        void setNeedsLayoutAndPrefWidthsRecalc()    {        setNeedsLayout(true);        setPrefWidthsDirty(true);    }    void setPositioned(bool b = true)  { m_positioned = b;  }    void setRelPositioned(bool b = true) { m_relPositioned = b; }    void setFloating(bool b = true) { m_floating = b; }    void setInline(bool b = true) { m_inline = b; }    void setHasBoxDecorations(bool b = true) { m_paintBackground = b; }    void setIsText() { m_isText = true; }    void setIsBox() { m_isBox = true; }    void setReplaced(bool b = true) { m_replaced = b; }    void setHasOverflowClip(bool b = true) { m_hasOverflowClip = b; }    void setHasLayer(bool b = true) { m_hasLayer = b; }    void setHasTransform(bool b = true) { m_hasTransform = b; }    void setHasReflection(bool b = true) { m_hasReflection = b; }    void scheduleRelayout();    void updateFillImages(const FillLayer*, const FillLayer*);    void updateImage(StyleImage*, StyleImage*);    // for discussion of lineHeight see CSS2 spec    virtual int lineHeight(bool firstLine, bool isRootLineBox = false) const;    // for the vertical-align property of inline elements    // the offset of baseline from the top of the object.    virtual int baselinePosition(bool firstLine, bool isRootLineBox = false) const;    /*     * Paint the object and its children, clipped by (x|y|w|h).     * (tx|ty) is the calculated position of the parent     */    struct PaintInfo {        PaintInfo(GraphicsContext* newContext, const IntRect& newRect, PaintPhase newPhase, bool newForceBlackText,                  RenderObject* newPaintingRoot, ListHashSet<RenderInline*>* newOutlineObjects)            : context(newContext)            , rect(newRect)            , phase(newPhase)            , forceBlackText(newForceBlackText)            , paintingRoot(newPaintingRoot)            , outlineObjects(newOutlineObjects)        {        }        GraphicsContext* context;        IntRect rect;        PaintPhase phase;        bool forceBlackText;        RenderObject* paintingRoot; // used to draw just one element and its visual kids        ListHashSet<RenderInline*>* outlineObjects; // used to list outlines that should be painted by a block with inline children    };    virtual void paint(PaintInfo&, int tx, int ty);    // Recursive function that computes the size and position of this object and all its descendants.    virtual void layout();    /* This function performs a layout only if one is needed. */    void layoutIfNeeded() { if (needsLayout()) layout(); }    // Called when a positioned object moves but doesn't necessarily change size.  A simplified layout is attempted    // that just updates the object's position. If the size does change, the object remains dirty.    virtual void tryLayoutDoingPositionedMovementOnly() { }        // used for element state updates that cannot be fixed with a    // repaint and do not need a relayout    virtual void updateFromElement() { }#if ENABLE(DASHBOARD_SUPPORT)    virtual void addDashboardRegions(Vector<DashboardRegionValue>&);    void collectDashboardRegions(Vector<DashboardRegionValue>&);#endif    bool hitTest(const HitTestRequest&, HitTestResult&, const IntPoint&, int tx, int ty, HitTestFilter = HitTestAll);    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);    virtual void updateHitTestResult(HitTestResult&, const IntPoint&);    VisiblePosition positionForCoordinates(int x, int y);    virtual VisiblePosition positionForPoint(const IntPoint&);    virtual void dirtyLinesFromChangedChild(RenderObject*);    // Called to update a style that is allowed to trigger animations.    // FIXME: Right now this will typically be called only when updating happens from the DOM on explicit elements.    // We don't yet handle generated content animation such as first-letter or before/after (we'll worry about this later).    void setAnimatableStyle(PassRefPtr<RenderStyle>);    // Set the style of the object and update the state of the object accordingly.    virtual void setStyle(PassRefPtr<RenderStyle>);    // Updates only the local style ptr of the object.  Does not update the state of the object,    // and so only should be called when the style is known not to have changed (or from setStyle).    void setStyleInternal(PassRefPtr<RenderStyle>);    // returns the containing block level element for this element.    RenderBlock* containingBlock() const;    // Convert the given local point to absolute coordinates    // FIXME: Temporary. If useTransforms is true, take transforms into account. Eventually localToAbsolute() will always be transform-aware.    FloatPoint localToAbsolute(FloatPoint localPoint = FloatPoint(), bool fixed = false, bool useTransforms = false) const;    FloatPoint absoluteToLocal(FloatPoint, bool fixed = false, bool useTransforms = false) const;    // Convert a local quad to absolute coordinates, taking transforms into account.    FloatQuad localToAbsoluteQuad(const FloatQuad& quad, bool fixed = false) const    {        return localToContainerQuad(quad, 0, fixed);    }    // Convert a local quad into the coordinate system of container, taking transforms into account.    FloatQuad localToContainerQuad(const FloatQuad&, RenderBoxModelObject* repaintContainer, bool fixed = false) const;    // Return the offset from the container() renderer (excluding transforms)    virtual IntSize offsetFromContainer(RenderObject*) const;    virtual void absoluteRectsForRange(Vector<IntRect>&, unsigned startOffset = 0, unsigned endOffset = UINT_MAX, bool useSelectionHeight = false);        virtual void absoluteRects(Vector<IntRect>&, int, int, bool = true) { }    // FIXME: useTransforms should go away eventually    IntRect absoluteBoundingBoxRect(bool useTransforms = false);    // Build an array of quads in absolute coords for line boxes    virtual void absoluteQuadsForRange(Vector<FloatQuad>&, unsigned startOffset = 0, unsigned endOffset = UINT_MAX, bool useSelectionHeight = false);    virtual void absoluteQuads(Vector<FloatQuad>&, bool /*topLevel*/ = true) { }    // the rect that will be painted if this object is passed as the paintingRoot    IntRect paintingRootRect(IntRect& topLevelRect);    virtual int minPrefWidth() const { return 0; }    virtual int maxPrefWidth() const { return 0; }    RenderStyle* style() const { return m_style.get(); }    RenderStyle* firstLineStyle() const { return document()->usesFirstLineRules() ? firstLineStyleSlowCase() : style(); }    RenderStyle* style(bool firstLine) const { return firstLine ? firstLineStyle() : style(); }        // Anonymous blocks that are part of of a continuation chain will return their inline continuation's outline style instead.    // This is typically only relevant when repainting.    virtual RenderStyle* outlineStyleForRepaint() const { return style(); }        void getTextDecorationColors(int decorations, Color& underline, Color& overline,                                 Color& linethrough, bool quirksMode = false);    // Return the RenderBox in the container chain which is responsible for painting this object, or 0    // if painting is root-relative. This is the container that should be passed to the 'forRepaint'    // methods.    RenderBoxModelObject* containerForRepaint() const;    // Actually do the repaint of rect r for this object which has been computed in the coordinate space    // of repaintContainer. If repaintContainer is 0, repaint via the view.    void repaintUsingContainer(RenderBoxModelObject* repaintContainer, const IntRect& r, bool immediate = false);        // 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 IntRect&, bool immediate = false);    // Repaint only if our old bounds and new bounds are different.    bool repaintAfterLayoutIfNeeded(RenderBoxModelObject* repaintContainer, const IntRect& oldBounds, const IntRect& oldOutlineBox);    // Repaint only if the object moved.    virtual void repaintDuringLayoutIfMoved(const IntRect& rect);    // Called to repaint a block's floats.    virtual void repaintOverhangingFloats(bool paintAllDescendants = false);    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.    IntRect absoluteClippedOverflowRect()    {        return clippedOverflowRectForRepaint(0);    }    virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer);        virtual IntRect rectWithOutlineForRepaint(RenderBoxModelObject* repaintContainer, int outlineWidth);    // Given a rect in the object's coordinate space, compute a rect suitable for repainting    // that rect in view coordinates.    void computeAbsoluteRepaintRect(IntRect& r, bool fixed = false)    {        return computeRectForRepaint(0, r, fixed);    }    // Given a rect in the object's coordinate space, compute a rect suitable for repainting    // that rect in the coordinate space of repaintContainer.    virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false);    virtual unsigned int length() const { return 1; }    bool isFloatingOrPositioned() const { return (isFloating() || isPositioned()); }    bool isTransparent() const { return style()->opacity() < 1.0f; }    float opacity() const { return style()->opacity(); }    bool hasReflection() const { return m_hasReflection; }    // Applied as a "slop" to dirty rect checks during the outline painting phase's dirty-rect checks.    int maximalOutlineSize(PaintPhase) const;    void setHasMarkupTruncation(bool b = true) { m_hasMarkupTruncation = b; }    bool hasMarkupTruncation() const { return m_hasMarkupTruncation; }    enum SelectionState {        SelectionNone, // The object is not selected.        SelectionStart, // The object either contains the start of a selection run or is the start of a run        SelectionInside, // The object is fully encompassed by a selection run        SelectionEnd, // The object either contains the end of a selection run or is the end of a run        SelectionBoth // The object contains an entire run or is the sole selected object in that run    };    // The current selection state for an object.  For blocks, the state refers to the state of the leaf    // descendants (as described above in the SelectionState enum declaration).    SelectionState selectionState() const { return static_cast<SelectionState>(m_selectionState);; }    // Sets the selection state for an object.    virtual void setSelectionState(SelectionState state) { m_selectionState = state; }    // A single rectangle that encompasses all of the selected objects within this object.  Used to determine the tightest    // possible bounding box for the selection.    IntRect selectionRect(bool clipToVisibleContent = true) { return selectionRectForRepaint(0, clipToVisibleContent); }    virtual IntRect selectionRectForRepaint(RenderBoxModelObject* /*repaintContainer*/, bool /*clipToVisibleContent*/ = true) { return IntRect(); }    // Whether or not an object can be part of the leaf elements of the selection.    virtual bool canBeSelectionLeaf() const { return false; }    // Whether or not a block has selected children.    bool hasSelectedChildren() const { return m_selectionState != SelectionNone; }    // Obtains the selection colors that should be used when painting a selection.    Color selectionBackgroundColor() const;    Color selectionForegroundColor() const;    // Whether or not a given block needs to paint selection gaps.    virtual bool shouldPaintSelectionGaps() const { return false; }    Node* draggableNode(bool dhtmlOK, bool uaOK, int x, int y, bool& dhtmlWillDrag) const;

⌨️ 快捷键说明

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