📄 renderbox.h
字号:
} virtual IntSize intrinsicSize() const { return IntSize(); } // Whether or not the element shrinks to its intrinsic width (rather than filling the width // of a containing block). HTML4 buttons, <select>s, <input>s, legends, and floating/compact elements do this. bool sizesToIntrinsicWidth(WidthType) const; virtual bool stretchesToMinIntrinsicWidth() const { return false; } int calcWidthUsing(WidthType, int containerWidth); int calcHeightUsing(const Length& height); int calcReplacedWidthUsing(Length width) const; int calcReplacedHeightUsing(Length height) const; virtual int calcReplacedWidth(bool includeMaxWidth = true) const; virtual int calcReplacedHeight() const; int calcPercentageHeight(const Length& height); // Block flows subclass availableWidth to handle multi column layout (shrinking the width available to children when laying out.) virtual int availableWidth() const { return contentWidth(); } virtual int availableHeight() const; int availableHeightUsing(const Length&) const; void calcVerticalMargins(); virtual int verticalScrollbarWidth() const; int horizontalScrollbarHeight() const; virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1.0f); virtual bool canBeProgramaticallyScrolled(bool) const; virtual void autoscroll(); virtual void stopAutoscroll() { } virtual void panScroll(const IntPoint&); bool hasAutoVerticalScrollbar() const { return hasOverflowClip() && (style()->overflowY() == OAUTO || style()->overflowY() == OOVERLAY); } bool hasAutoHorizontalScrollbar() const { return hasOverflowClip() && (style()->overflowX() == OAUTO || style()->overflowX() == OOVERLAY); } bool scrollsOverflow() const { return scrollsOverflowX() || scrollsOverflowY(); } bool scrollsOverflowX() const { return hasOverflowClip() && (style()->overflowX() == OSCROLL || hasAutoHorizontalScrollbar()); } bool scrollsOverflowY() const { return hasOverflowClip() && (style()->overflowY() == OSCROLL || hasAutoVerticalScrollbar()); } virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0); virtual IntRect overflowClipRect(int tx, int ty); IntRect clipRect(int tx, int ty); virtual bool hasControlClip() const { return false; } virtual IntRect controlClipRect(int /*tx*/, int /*ty*/) const { return IntRect(); } bool pushContentsClip(PaintInfo&, int tx, int ty); void popContentsClip(PaintInfo&, PaintPhase originalPhase, int tx, int ty); virtual void paintObject(PaintInfo&, int /*tx*/, int /*ty*/) { ASSERT_NOT_REACHED(); } virtual void paintBoxDecorations(PaintInfo&, int tx, int ty); virtual void paintMask(PaintInfo& paintInfo, int tx, int ty); virtual void imageChanged(WrappedImagePtr, const IntRect* = 0); // Called when a positioned object moves but doesn't change size. A simplified layout is done // that just updates the object's position. virtual void tryLayoutDoingPositionedMovementOnly() { int oldWidth = width(); calcWidth(); // If we shrink to fit our width may have changed, so we still need full layout. if (oldWidth != width()) return; calcHeight(); setNeedsLayout(false); } IntRect maskClipRect(); virtual VisiblePosition positionForPoint(const IntPoint&); void removeFloatingOrPositionedChildFromBlockLists(); virtual int firstLineBoxBaseline() const { return -1; } virtual int lastLineBoxBaseline() const { return -1; } bool shrinkToAvoidFloats() const; virtual bool avoidsFloats() const;#if ENABLE(SVG) virtual TransformationMatrix localTransform() const;#endifprotected: virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); virtual void updateBoxModelInfoFromStyle(); void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, int clipY, int clipHeight, int tx, int ty, int width, int height, CompositeOperator = CompositeSourceOver); void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, int clipY, int clipHeight, int tx, int ty, int width, int height, CompositeOperator = CompositeSourceOver); void paintMaskImages(const PaintInfo&, int clipY, int clipHeight, int tx, int ty, int width, int height);#if PLATFORM(MAC) void paintCustomHighlight(int tx, int ty, const AtomicString& type, bool behindText);#endif void calcAbsoluteHorizontal(); virtual bool shouldCalculateSizeAsReplaced() const { return isReplaced() && !isInlineBlockOrInlineTable(); } virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&) const; virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const;private: bool includeVerticalScrollbarSize() const { return hasOverflowClip() && (style()->overflowY() == OSCROLL || style()->overflowY() == OAUTO); } bool includeHorizontalScrollbarSize() const { return hasOverflowClip() && (style()->overflowX() == OSCROLL || style()->overflowX() == OAUTO); } void paintRootBoxDecorations(PaintInfo&, int tx, int ty); // Returns true if we did a full repaint bool repaintLayerRectsForImage(WrappedImagePtr image, const FillLayer* layers, bool drawingBackground); int containingBlockWidthForPositioned(const RenderBoxModelObject* containingBlock) const; int containingBlockHeightForPositioned(const RenderBoxModelObject* containingBlock) const; void calcAbsoluteVertical(); void calcAbsoluteHorizontalValues(Length width, const RenderBoxModelObject* cb, TextDirection containerDirection, int containerWidth, int bordersPlusPadding, Length left, Length right, Length marginLeft, Length marginRight, int& widthValue, int& marginLeftValue, int& marginRightValue, int& xPos); void calcAbsoluteVerticalValues(Length height, const RenderBoxModelObject* cb, int containerHeight, int bordersPlusPadding, Length top, Length bottom, Length marginTop, Length marginBottom, int& heightValue, int& marginTopValue, int& marginBottomValue, int& yPos); void calcAbsoluteVerticalReplaced(); void calcAbsoluteHorizontalReplaced(); // This function calculates the minimum and maximum preferred widths for an object. // These values are used in shrink-to-fit layout systems. // These include tables, positioned objects, floats and flexible boxes. virtual void calcPrefWidths() { setPrefWidthsDirty(false); }protected: bool isAfterContent(RenderObject* child) const;private: // The width/height of the contents + borders + padding. The x/y location is relative to our container (which is not always our parent). IntRect m_frameRect;protected: int m_marginLeft; int m_marginRight; int m_marginTop; int m_marginBottom; // The preferred width of the element if it were to break its lines at every possible opportunity. int m_minPrefWidth; // The preferred width of the element if it never breaks any lines at all. int m_maxPrefWidth; // For inline replaced elements, the inline box that owns us. InlineBox* m_inlineBoxWrapper;private: // Used to store state between styleWillChange and styleDidChange static bool s_hadOverflowClip;};inline RenderBox* toRenderBox(RenderObject* o){ ASSERT(!o || o->isBox()); return static_cast<RenderBox*>(o);}inline const RenderBox* toRenderBox(const RenderObject* o){ ASSERT(!o || o->isBox()); return static_cast<const RenderBox*>(o);}// This will catch anyone doing an unnecessary cast.void toRenderBox(const RenderBox*);inline RenderBox* RenderBox::previousSiblingBox() const{ return toRenderBox(previousSibling());}inline RenderBox* RenderBox::nextSiblingBox() const{ return toRenderBox(nextSibling());}inline RenderBox* RenderBox::parentBox() const{ return toRenderBox(parent());}inline RenderBox* RenderBox::firstChildBox() const{ return toRenderBox(firstChild());}inline RenderBox* RenderBox::lastChildBox() const{ return toRenderBox(lastChild());}} // namespace WebCore#endif // RenderBox_h
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -