| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 static LayoutInline* createAnonymous(Document*); | 38 static LayoutInline* createAnonymous(Document*); |
| 39 | 39 |
| 40 LayoutObject* firstChild() const { ASSERT(children() == virtualChildren());
return children()->firstChild(); } | 40 LayoutObject* firstChild() const { ASSERT(children() == virtualChildren());
return children()->firstChild(); } |
| 41 LayoutObject* lastChild() const { ASSERT(children() == virtualChildren()); r
eturn children()->lastChild(); } | 41 LayoutObject* lastChild() const { ASSERT(children() == virtualChildren()); r
eturn children()->lastChild(); } |
| 42 | 42 |
| 43 // If you have a LayoutInline, use firstChild or lastChild instead. | 43 // If you have a LayoutInline, use firstChild or lastChild instead. |
| 44 void slowFirstChild() const = delete; | 44 void slowFirstChild() const = delete; |
| 45 void slowLastChild() const = delete; | 45 void slowLastChild() const = delete; |
| 46 | 46 |
| 47 virtual void addChild(LayoutObject* newChild, LayoutObject* beforeChild = nu
llptr) override; | 47 void addChild(LayoutObject* newChild, LayoutObject* beforeChild = nullptr) o
verride; |
| 48 | 48 |
| 49 Element* node() const { return toElement(LayoutBoxModelObject::node()); } | 49 Element* node() const { return toElement(LayoutBoxModelObject::node()); } |
| 50 | 50 |
| 51 virtual LayoutRectOutsets marginBoxOutsets() const override final; | 51 LayoutRectOutsets marginBoxOutsets() const final; |
| 52 virtual LayoutUnit marginLeft() const override final; | 52 LayoutUnit marginLeft() const final; |
| 53 virtual LayoutUnit marginRight() const override final; | 53 LayoutUnit marginRight() const final; |
| 54 virtual LayoutUnit marginTop() const override final; | 54 LayoutUnit marginTop() const final; |
| 55 virtual LayoutUnit marginBottom() const override final; | 55 LayoutUnit marginBottom() const final; |
| 56 virtual LayoutUnit marginBefore(const ComputedStyle* otherStyle = nullptr) c
onst override final; | 56 LayoutUnit marginBefore(const ComputedStyle* otherStyle = nullptr) const fin
al; |
| 57 virtual LayoutUnit marginAfter(const ComputedStyle* otherStyle = nullptr) co
nst override final; | 57 LayoutUnit marginAfter(const ComputedStyle* otherStyle = nullptr) const fina
l; |
| 58 virtual LayoutUnit marginStart(const ComputedStyle* otherStyle = nullptr) co
nst override final; | 58 LayoutUnit marginStart(const ComputedStyle* otherStyle = nullptr) const fina
l; |
| 59 virtual LayoutUnit marginEnd(const ComputedStyle* otherStyle = nullptr) cons
t override final; | 59 LayoutUnit marginEnd(const ComputedStyle* otherStyle = nullptr) const final; |
| 60 | 60 |
| 61 virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedO
ffset) const override final; | 61 void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedOffset) c
onst final; |
| 62 virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const overrid
e; | 62 void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const override; |
| 63 | 63 |
| 64 virtual LayoutSize offsetFromContainer(const LayoutObject*, const LayoutPoin
t&, bool* offsetDependsOnPoint = nullptr) const override final; | 64 LayoutSize offsetFromContainer(const LayoutObject*, const LayoutPoint&, bool
* offsetDependsOnPoint = nullptr) const final; |
| 65 | 65 |
| 66 IntRect linesBoundingBox() const; | 66 IntRect linesBoundingBox() const; |
| 67 LayoutRect linesVisualOverflowBoundingBox() const; | 67 LayoutRect linesVisualOverflowBoundingBox() const; |
| 68 | 68 |
| 69 InlineFlowBox* createAndAppendInlineFlowBox(); | 69 InlineFlowBox* createAndAppendInlineFlowBox(); |
| 70 | 70 |
| 71 void dirtyLineBoxes(bool fullLayout); | 71 void dirtyLineBoxes(bool fullLayout); |
| 72 | 72 |
| 73 LineBoxList* lineBoxes() { return &m_lineBoxes; } | 73 LineBoxList* lineBoxes() { return &m_lineBoxes; } |
| 74 const LineBoxList* lineBoxes() const { return &m_lineBoxes; } | 74 const LineBoxList* lineBoxes() const { return &m_lineBoxes; } |
| 75 | 75 |
| 76 InlineFlowBox* firstLineBox() const { return m_lineBoxes.firstLineBox(); } | 76 InlineFlowBox* firstLineBox() const { return m_lineBoxes.firstLineBox(); } |
| 77 InlineFlowBox* lastLineBox() const { return m_lineBoxes.lastLineBox(); } | 77 InlineFlowBox* lastLineBox() const { return m_lineBoxes.lastLineBox(); } |
| 78 InlineBox* firstLineBoxIncludingCulling() const { return alwaysCreateLineBox
es() ? firstLineBox() : culledInlineFirstLineBox(); } | 78 InlineBox* firstLineBoxIncludingCulling() const { return alwaysCreateLineBox
es() ? firstLineBox() : culledInlineFirstLineBox(); } |
| 79 InlineBox* lastLineBoxIncludingCulling() const { return alwaysCreateLineBoxe
s() ? lastLineBox() : culledInlineLastLineBox(); } | 79 InlineBox* lastLineBoxIncludingCulling() const { return alwaysCreateLineBoxe
s() ? lastLineBox() : culledInlineLastLineBox(); } |
| 80 | 80 |
| 81 virtual LayoutBoxModelObject* virtualContinuation() const override final { r
eturn continuation(); } | 81 LayoutBoxModelObject* virtualContinuation() const final { return continuatio
n(); } |
| 82 LayoutInline* inlineElementContinuation() const; | 82 LayoutInline* inlineElementContinuation() const; |
| 83 | 83 |
| 84 virtual void updateDragState(bool dragOn) override final; | 84 void updateDragState(bool dragOn) final; |
| 85 | 85 |
| 86 LayoutSize offsetForInFlowPositionedInline(const LayoutBox& child) const; | 86 LayoutSize offsetForInFlowPositionedInline(const LayoutBox& child) const; |
| 87 | 87 |
| 88 virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& addit
ionalOffset) const override final; | 88 void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& additionalOff
set) const final; |
| 89 | 89 |
| 90 using LayoutBoxModelObject::continuation; | 90 using LayoutBoxModelObject::continuation; |
| 91 using LayoutBoxModelObject::setContinuation; | 91 using LayoutBoxModelObject::setContinuation; |
| 92 | 92 |
| 93 bool alwaysCreateLineBoxes() const { return alwaysCreateLineBoxesForLayoutIn
line(); } | 93 bool alwaysCreateLineBoxes() const { return alwaysCreateLineBoxesForLayoutIn
line(); } |
| 94 void setAlwaysCreateLineBoxes(bool alwaysCreateLineBoxes = true) { setAlways
CreateLineBoxesForLayoutInline(alwaysCreateLineBoxes); } | 94 void setAlwaysCreateLineBoxes(bool alwaysCreateLineBoxes = true) { setAlways
CreateLineBoxesForLayoutInline(alwaysCreateLineBoxes); } |
| 95 void updateAlwaysCreateLineBoxes(bool fullLayout); | 95 void updateAlwaysCreateLineBoxes(bool fullLayout); |
| 96 | 96 |
| 97 virtual LayoutRect localCaretRect(InlineBox*, int, LayoutUnit* extraWidthToE
ndOfLine) override final; | 97 LayoutRect localCaretRect(InlineBox*, int, LayoutUnit* extraWidthToEndOfLine
) final; |
| 98 | 98 |
| 99 bool hitTestCulledInline(HitTestResult&, const HitTestLocation& locationInCo
ntainer, const LayoutPoint& accumulatedOffset); | 99 bool hitTestCulledInline(HitTestResult&, const HitTestLocation& locationInCo
ntainer, const LayoutPoint& accumulatedOffset); |
| 100 | 100 |
| 101 virtual const char* name() const override { return "LayoutInline"; } | 101 const char* name() const override { return "LayoutInline"; } |
| 102 | 102 |
| 103 protected: | 103 protected: |
| 104 virtual void willBeDestroyed() override; | 104 void willBeDestroyed() override; |
| 105 | 105 |
| 106 virtual void styleDidChange(StyleDifference, const ComputedStyle* oldStyle)
override; | 106 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override
; |
| 107 | 107 |
| 108 virtual void computeSelfHitTestRects(Vector<LayoutRect>& rects, const Layout
Point& layerOffset) const override; | 108 void computeSelfHitTestRects(Vector<LayoutRect>& rects, const LayoutPoint& l
ayerOffset) const override; |
| 109 | 109 |
| 110 virtual void invalidateDisplayItemClients(const LayoutBoxModelObject& paintI
nvalidationContainer) const override; | 110 void invalidateDisplayItemClients(const LayoutBoxModelObject& paintInvalidat
ionContainer) const override; |
| 111 | 111 |
| 112 private: | 112 private: |
| 113 virtual LayoutObjectChildList* virtualChildren() override final { return chi
ldren(); } | 113 LayoutObjectChildList* virtualChildren() final { return children(); } |
| 114 virtual const LayoutObjectChildList* virtualChildren() const override final
{ return children(); } | 114 const LayoutObjectChildList* virtualChildren() const final { return children
(); } |
| 115 const LayoutObjectChildList* children() const { return &m_children; } | 115 const LayoutObjectChildList* children() const { return &m_children; } |
| 116 LayoutObjectChildList* children() { return &m_children; } | 116 LayoutObjectChildList* children() { return &m_children; } |
| 117 | 117 |
| 118 virtual bool isLayoutInline() const override final { return true; } | 118 bool isLayoutInline() const final { return true; } |
| 119 | 119 |
| 120 LayoutRect culledInlineVisualOverflowBoundingBox() const; | 120 LayoutRect culledInlineVisualOverflowBoundingBox() const; |
| 121 InlineBox* culledInlineFirstLineBox() const; | 121 InlineBox* culledInlineFirstLineBox() const; |
| 122 InlineBox* culledInlineLastLineBox() const; | 122 InlineBox* culledInlineLastLineBox() const; |
| 123 | 123 |
| 124 template<typename GeneratorContext> | 124 template<typename GeneratorContext> |
| 125 void generateLineBoxRects(GeneratorContext& yield) const; | 125 void generateLineBoxRects(GeneratorContext& yield) const; |
| 126 template<typename GeneratorContext> | 126 template<typename GeneratorContext> |
| 127 void generateCulledLineBoxRects(GeneratorContext& yield, const LayoutInline*
container) const; | 127 void generateCulledLineBoxRects(GeneratorContext& yield, const LayoutInline*
container) const; |
| 128 | 128 |
| 129 void addChildToContinuation(LayoutObject* newChild, LayoutObject* beforeChil
d); | 129 void addChildToContinuation(LayoutObject* newChild, LayoutObject* beforeChil
d); |
| 130 virtual void addChildIgnoringContinuation(LayoutObject* newChild, LayoutObje
ct* beforeChild = nullptr) override final; | 130 void addChildIgnoringContinuation(LayoutObject* newChild, LayoutObject* befo
reChild = nullptr) final; |
| 131 | 131 |
| 132 void moveChildrenToIgnoringContinuation(LayoutInline* to, LayoutObject* star
tChild); | 132 void moveChildrenToIgnoringContinuation(LayoutInline* to, LayoutObject* star
tChild); |
| 133 | 133 |
| 134 void splitInlines(LayoutBlock* fromBlock, LayoutBlock* toBlock, LayoutBlock*
middleBlock, | 134 void splitInlines(LayoutBlock* fromBlock, LayoutBlock* toBlock, LayoutBlock*
middleBlock, |
| 135 LayoutObject* beforeChild, LayoutBoxModelObject* oldCont); | 135 LayoutObject* beforeChild, LayoutBoxModelObject* oldCont); |
| 136 void splitFlow(LayoutObject* beforeChild, LayoutBlock* newBlockBox, | 136 void splitFlow(LayoutObject* beforeChild, LayoutBlock* newBlockBox, |
| 137 LayoutObject* newChild, LayoutBoxModelObject* oldCont); | 137 LayoutObject* newChild, LayoutBoxModelObject* oldCont); |
| 138 | 138 |
| 139 virtual void layout() override final { ASSERT_NOT_REACHED(); } // Do nothing
for layout() | 139 void layout() final { ASSERT_NOT_REACHED(); } // Do nothing for layout() |
| 140 | 140 |
| 141 virtual void paint(const PaintInfo&, const LayoutPoint&) override final; | 141 void paint(const PaintInfo&, const LayoutPoint&) final; |
| 142 | 142 |
| 143 virtual bool nodeAtPoint(HitTestResult&, const HitTestLocation& locationInCo
ntainer, const LayoutPoint& accumulatedOffset, HitTestAction) override final; | 143 bool nodeAtPoint(HitTestResult&, const HitTestLocation& locationInContainer,
const LayoutPoint& accumulatedOffset, HitTestAction) final; |
| 144 | 144 |
| 145 virtual DeprecatedPaintLayerType layerTypeRequired() const override { return
isRelPositioned() || createsGroup() || hasClipPath() || style()->shouldComposit
eForCurrentAnimations() || style()->hasCompositorProxy() ? NormalDeprecatedPaint
Layer : NoDeprecatedPaintLayer; } | 145 DeprecatedPaintLayerType layerTypeRequired() const override { return isRelPo
sitioned() || createsGroup() || hasClipPath() || style()->shouldCompositeForCurr
entAnimations() || style()->hasCompositorProxy() ? NormalDeprecatedPaintLayer :
NoDeprecatedPaintLayer; } |
| 146 | 146 |
| 147 virtual LayoutUnit offsetLeft() const override final; | 147 LayoutUnit offsetLeft() const final; |
| 148 virtual LayoutUnit offsetTop() const override final; | 148 LayoutUnit offsetTop() const final; |
| 149 virtual LayoutUnit offsetWidth() const override final { return linesBounding
Box().width(); } | 149 LayoutUnit offsetWidth() const final { return linesBoundingBox().width(); } |
| 150 virtual LayoutUnit offsetHeight() const override final { return linesBoundin
gBox().height(); } | 150 LayoutUnit offsetHeight() const final { return linesBoundingBox().height();
} |
| 151 | 151 |
| 152 virtual LayoutRect absoluteClippedOverflowRect() const override; | 152 LayoutRect absoluteClippedOverflowRect() const override; |
| 153 virtual LayoutRect clippedOverflowRectForPaintInvalidation(const LayoutBoxMo
delObject* paintInvalidationContainer, const PaintInvalidationState* = nullptr)
const override; | 153 LayoutRect clippedOverflowRectForPaintInvalidation(const LayoutBoxModelObjec
t* paintInvalidationContainer, const PaintInvalidationState* = nullptr) const ov
erride; |
| 154 virtual LayoutRect rectWithOutlineForPaintInvalidation(const LayoutBoxModelO
bject* paintInvalidationContainer, LayoutUnit outlineWidth, const PaintInvalidat
ionState* = nullptr) const override final; | 154 LayoutRect rectWithOutlineForPaintInvalidation(const LayoutBoxModelObject* p
aintInvalidationContainer, LayoutUnit outlineWidth, const PaintInvalidationState
* = nullptr) const final; |
| 155 virtual void mapRectToPaintInvalidationBacking(const LayoutBoxModelObject* p
aintInvalidationContainer, LayoutRect&, const PaintInvalidationState*) const ove
rride final; | 155 void mapRectToPaintInvalidationBacking(const LayoutBoxModelObject* paintInva
lidationContainer, LayoutRect&, const PaintInvalidationState*) const final; |
| 156 | 156 |
| 157 // This method differs from clippedOverflowRectForPaintInvalidation in that
it includes | 157 // This method differs from clippedOverflowRectForPaintInvalidation in that
it includes |
| 158 // the rects for culled inline boxes, which aren't necessary for paint inval
idation. | 158 // the rects for culled inline boxes, which aren't necessary for paint inval
idation. |
| 159 LayoutRect clippedOverflowRect(const LayoutBoxModelObject*, const PaintInval
idationState* = nullptr) const; | 159 LayoutRect clippedOverflowRect(const LayoutBoxModelObject*, const PaintInval
idationState* = nullptr) const; |
| 160 | 160 |
| 161 virtual void mapLocalToContainer(const LayoutBoxModelObject* paintInvalidati
onContainer, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool* wa
sFixed = 0, const PaintInvalidationState* = nullptr) const override; | 161 void mapLocalToContainer(const LayoutBoxModelObject* paintInvalidationContai
ner, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool* wasFixed =
0, const PaintInvalidationState* = nullptr) const override; |
| 162 | 162 |
| 163 virtual PositionWithAffinity positionForPoint(const LayoutPoint&) override f
inal; | 163 PositionWithAffinity positionForPoint(const LayoutPoint&) final; |
| 164 | 164 |
| 165 virtual IntRect borderBoundingBox() const override final | 165 IntRect borderBoundingBox() const final |
| 166 { | 166 { |
| 167 IntRect boundingBox = linesBoundingBox(); | 167 IntRect boundingBox = linesBoundingBox(); |
| 168 return IntRect(0, 0, boundingBox.width(), boundingBox.height()); | 168 return IntRect(0, 0, boundingBox.width(), boundingBox.height()); |
| 169 } | 169 } |
| 170 | 170 |
| 171 virtual InlineFlowBox* createInlineFlowBox(); // Subclassed by SVG and Ruby | 171 virtual InlineFlowBox* createInlineFlowBox(); // Subclassed by SVG and Ruby |
| 172 | 172 |
| 173 virtual void dirtyLinesFromChangedChild(LayoutObject* child) override final
{ m_lineBoxes.dirtyLinesFromChangedChild(this, child); } | 173 void dirtyLinesFromChangedChild(LayoutObject* child) final { m_lineBoxes.dir
tyLinesFromChangedChild(this, child); } |
| 174 | 174 |
| 175 virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositio
nMode = PositionOnContainingLine) const override final; | 175 LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode =
PositionOnContainingLine) const final; |
| 176 virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode
, LinePositionMode = PositionOnContainingLine) const override final; | 176 int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePo
sitionMode = PositionOnContainingLine) const final; |
| 177 | 177 |
| 178 virtual void childBecameNonInline(LayoutObject* child) override final; | 178 void childBecameNonInline(LayoutObject* child) final; |
| 179 | 179 |
| 180 virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&) overrid
e final; | 180 void updateHitTestResult(HitTestResult&, const LayoutPoint&) final; |
| 181 | 181 |
| 182 virtual void imageChanged(WrappedImagePtr, const IntRect* = nullptr) overrid
e final; | 182 void imageChanged(WrappedImagePtr, const IntRect* = nullptr) final; |
| 183 | 183 |
| 184 virtual void addAnnotatedRegions(Vector<AnnotatedRegionValue>&) override fin
al; | 184 void addAnnotatedRegions(Vector<AnnotatedRegionValue>&) final; |
| 185 | 185 |
| 186 virtual void updateFromStyle() override final; | 186 void updateFromStyle() final; |
| 187 | 187 |
| 188 LayoutInline* clone() const; | 188 LayoutInline* clone() const; |
| 189 | 189 |
| 190 LayoutBoxModelObject* continuationBefore(LayoutObject* beforeChild); | 190 LayoutBoxModelObject* continuationBefore(LayoutObject* beforeChild); |
| 191 | 191 |
| 192 LayoutObjectChildList m_children; | 192 LayoutObjectChildList m_children; |
| 193 LineBoxList m_lineBoxes; // All of the line boxes created for this inline fl
ow. For example, <i>Hello<br>world.</i> will have two <i> line boxes. | 193 LineBoxList m_lineBoxes; // All of the line boxes created for this inline fl
ow. For example, <i>Hello<br>world.</i> will have two <i> line boxes. |
| 194 }; | 194 }; |
| 195 | 195 |
| 196 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutInline, isLayoutInline()); | 196 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutInline, isLayoutInline()); |
| 197 | 197 |
| 198 } // namespace blink | 198 } // namespace blink |
| 199 | 199 |
| 200 #endif // LayoutInline_h | 200 #endif // LayoutInline_h |
| OLD | NEW |