| 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 15 matching lines...) Expand all Loading... |
| 26 #include "core/editing/PositionWithAffinity.h" | 26 #include "core/editing/PositionWithAffinity.h" |
| 27 #include "core/rendering/InlineFlowBox.h" | 27 #include "core/rendering/InlineFlowBox.h" |
| 28 #include "core/rendering/RenderBoxModelObject.h" | 28 #include "core/rendering/RenderBoxModelObject.h" |
| 29 #include "core/rendering/RenderLineBoxList.h" | 29 #include "core/rendering/RenderLineBoxList.h" |
| 30 | 30 |
| 31 namespace blink { | 31 namespace blink { |
| 32 | 32 |
| 33 class RenderInline : public RenderBoxModelObject { | 33 class RenderInline : public RenderBoxModelObject { |
| 34 public: | 34 public: |
| 35 explicit RenderInline(Element*); | 35 explicit RenderInline(Element*); |
| 36 virtual void trace(Visitor*) OVERRIDE; | 36 virtual void trace(Visitor*) override; |
| 37 | 37 |
| 38 static RenderInline* createAnonymous(Document*); | 38 static RenderInline* createAnonymous(Document*); |
| 39 | 39 |
| 40 RenderObject* firstChild() const { ASSERT(children() == virtualChildren());
return children()->firstChild(); } | 40 RenderObject* firstChild() const { ASSERT(children() == virtualChildren());
return children()->firstChild(); } |
| 41 RenderObject* lastChild() const { ASSERT(children() == virtualChildren()); r
eturn children()->lastChild(); } | 41 RenderObject* lastChild() const { ASSERT(children() == virtualChildren()); r
eturn children()->lastChild(); } |
| 42 | 42 |
| 43 // If you have a RenderInline, use firstChild or lastChild instead. | 43 // If you have a RenderInline, use firstChild or lastChild instead. |
| 44 void slowFirstChild() const WTF_DELETED_FUNCTION; | 44 void slowFirstChild() const WTF_DELETED_FUNCTION; |
| 45 void slowLastChild() const WTF_DELETED_FUNCTION; | 45 void slowLastChild() const WTF_DELETED_FUNCTION; |
| 46 | 46 |
| 47 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0)
OVERRIDE; | 47 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0)
override; |
| 48 | 48 |
| 49 Element* node() const { return toElement(RenderBoxModelObject::node()); } | 49 Element* node() const { return toElement(RenderBoxModelObject::node()); } |
| 50 | 50 |
| 51 virtual LayoutUnit marginLeft() const OVERRIDE FINAL; | 51 virtual LayoutUnit marginLeft() const override final; |
| 52 virtual LayoutUnit marginRight() const OVERRIDE FINAL; | 52 virtual LayoutUnit marginRight() const override final; |
| 53 virtual LayoutUnit marginTop() const OVERRIDE FINAL; | 53 virtual LayoutUnit marginTop() const override final; |
| 54 virtual LayoutUnit marginBottom() const OVERRIDE FINAL; | 54 virtual LayoutUnit marginBottom() const override final; |
| 55 virtual LayoutUnit marginBefore(const RenderStyle* otherStyle = 0) const OVE
RRIDE FINAL; | 55 virtual LayoutUnit marginBefore(const RenderStyle* otherStyle = 0) const ove
rride final; |
| 56 virtual LayoutUnit marginAfter(const RenderStyle* otherStyle = 0) const OVER
RIDE FINAL; | 56 virtual LayoutUnit marginAfter(const RenderStyle* otherStyle = 0) const over
ride final; |
| 57 virtual LayoutUnit marginStart(const RenderStyle* otherStyle = 0) const OVER
RIDE FINAL; | 57 virtual LayoutUnit marginStart(const RenderStyle* otherStyle = 0) const over
ride final; |
| 58 virtual LayoutUnit marginEnd(const RenderStyle* otherStyle = 0) const OVERRI
DE FINAL; | 58 virtual LayoutUnit marginEnd(const RenderStyle* otherStyle = 0) const overri
de final; |
| 59 | 59 |
| 60 virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedO
ffset) const OVERRIDE FINAL; | 60 virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedO
ffset) const override final; |
| 61 virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const OVERRID
E; | 61 virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const overrid
e; |
| 62 | 62 |
| 63 virtual LayoutSize offsetFromContainer(const RenderObject*, const LayoutPoin
t&, bool* offsetDependsOnPoint = 0) const OVERRIDE FINAL; | 63 virtual LayoutSize offsetFromContainer(const RenderObject*, const LayoutPoin
t&, bool* offsetDependsOnPoint = 0) const override final; |
| 64 | 64 |
| 65 IntRect linesBoundingBox() const; | 65 IntRect linesBoundingBox() const; |
| 66 LayoutRect linesVisualOverflowBoundingBox() const; | 66 LayoutRect linesVisualOverflowBoundingBox() const; |
| 67 | 67 |
| 68 InlineFlowBox* createAndAppendInlineFlowBox(); | 68 InlineFlowBox* createAndAppendInlineFlowBox(); |
| 69 | 69 |
| 70 void dirtyLineBoxes(bool fullLayout); | 70 void dirtyLineBoxes(bool fullLayout); |
| 71 | 71 |
| 72 RenderLineBoxList* lineBoxes() { return &m_lineBoxes; } | 72 RenderLineBoxList* lineBoxes() { return &m_lineBoxes; } |
| 73 const RenderLineBoxList* lineBoxes() const { return &m_lineBoxes; } | 73 const RenderLineBoxList* lineBoxes() const { return &m_lineBoxes; } |
| 74 | 74 |
| 75 InlineFlowBox* firstLineBox() const { return m_lineBoxes.firstLineBox(); } | 75 InlineFlowBox* firstLineBox() const { return m_lineBoxes.firstLineBox(); } |
| 76 InlineFlowBox* lastLineBox() const { return m_lineBoxes.lastLineBox(); } | 76 InlineFlowBox* lastLineBox() const { return m_lineBoxes.lastLineBox(); } |
| 77 InlineBox* firstLineBoxIncludingCulling() const { return alwaysCreateLineBox
es() ? firstLineBox() : culledInlineFirstLineBox(); } | 77 InlineBox* firstLineBoxIncludingCulling() const { return alwaysCreateLineBox
es() ? firstLineBox() : culledInlineFirstLineBox(); } |
| 78 InlineBox* lastLineBoxIncludingCulling() const { return alwaysCreateLineBoxe
s() ? lastLineBox() : culledInlineLastLineBox(); } | 78 InlineBox* lastLineBoxIncludingCulling() const { return alwaysCreateLineBoxe
s() ? lastLineBox() : culledInlineLastLineBox(); } |
| 79 | 79 |
| 80 virtual RenderBoxModelObject* virtualContinuation() const OVERRIDE FINAL { r
eturn continuation(); } | 80 virtual RenderBoxModelObject* virtualContinuation() const override final { r
eturn continuation(); } |
| 81 RenderInline* inlineElementContinuation() const; | 81 RenderInline* inlineElementContinuation() const; |
| 82 | 82 |
| 83 virtual void updateDragState(bool dragOn) OVERRIDE FINAL; | 83 virtual void updateDragState(bool dragOn) override final; |
| 84 | 84 |
| 85 LayoutSize offsetForInFlowPositionedInline(const RenderBox& child) const; | 85 LayoutSize offsetForInFlowPositionedInline(const RenderBox& child) const; |
| 86 | 86 |
| 87 virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& addit
ionalOffset, const RenderLayerModelObject* paintContainer) const OVERRIDE FINAL; | 87 virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& addit
ionalOffset, const RenderLayerModelObject* paintContainer) const override final; |
| 88 | 88 |
| 89 using RenderBoxModelObject::continuation; | 89 using RenderBoxModelObject::continuation; |
| 90 using RenderBoxModelObject::setContinuation; | 90 using RenderBoxModelObject::setContinuation; |
| 91 | 91 |
| 92 bool alwaysCreateLineBoxes() const { return alwaysCreateLineBoxesForRenderIn
line(); } | 92 bool alwaysCreateLineBoxes() const { return alwaysCreateLineBoxesForRenderIn
line(); } |
| 93 void setAlwaysCreateLineBoxes(bool alwaysCreateLineBoxes = true) { setAlways
CreateLineBoxesForRenderInline(alwaysCreateLineBoxes); } | 93 void setAlwaysCreateLineBoxes(bool alwaysCreateLineBoxes = true) { setAlways
CreateLineBoxesForRenderInline(alwaysCreateLineBoxes); } |
| 94 void updateAlwaysCreateLineBoxes(bool fullLayout); | 94 void updateAlwaysCreateLineBoxes(bool fullLayout); |
| 95 | 95 |
| 96 virtual LayoutRect localCaretRect(InlineBox*, int, LayoutUnit* extraWidthToE
ndOfLine) OVERRIDE FINAL; | 96 virtual LayoutRect localCaretRect(InlineBox*, int, LayoutUnit* extraWidthToE
ndOfLine) override final; |
| 97 | 97 |
| 98 bool hitTestCulledInline(const HitTestRequest&, HitTestResult&, const HitTes
tLocation& locationInContainer, const LayoutPoint& accumulatedOffset); | 98 bool hitTestCulledInline(const HitTestRequest&, HitTestResult&, const HitTes
tLocation& locationInContainer, const LayoutPoint& accumulatedOffset); |
| 99 | 99 |
| 100 protected: | 100 protected: |
| 101 virtual void willBeDestroyed() OVERRIDE; | 101 virtual void willBeDestroyed() override; |
| 102 | 102 |
| 103 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OV
ERRIDE; | 103 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) ov
erride; |
| 104 | 104 |
| 105 virtual void computeSelfHitTestRects(Vector<LayoutRect>& rects, const Layout
Point& layerOffset) const OVERRIDE; | 105 virtual void computeSelfHitTestRects(Vector<LayoutRect>& rects, const Layout
Point& layerOffset) const override; |
| 106 | 106 |
| 107 private: | 107 private: |
| 108 virtual RenderObjectChildList* virtualChildren() OVERRIDE FINAL { return chi
ldren(); } | 108 virtual RenderObjectChildList* virtualChildren() override final { return chi
ldren(); } |
| 109 virtual const RenderObjectChildList* virtualChildren() const OVERRIDE FINAL
{ return children(); } | 109 virtual const RenderObjectChildList* virtualChildren() const override final
{ return children(); } |
| 110 const RenderObjectChildList* children() const { return &m_children; } | 110 const RenderObjectChildList* children() const { return &m_children; } |
| 111 RenderObjectChildList* children() { return &m_children; } | 111 RenderObjectChildList* children() { return &m_children; } |
| 112 | 112 |
| 113 virtual const char* renderName() const OVERRIDE; | 113 virtual const char* renderName() const override; |
| 114 | 114 |
| 115 virtual bool isRenderInline() const OVERRIDE FINAL { return true; } | 115 virtual bool isRenderInline() const override final { return true; } |
| 116 | 116 |
| 117 LayoutRect culledInlineVisualOverflowBoundingBox() const; | 117 LayoutRect culledInlineVisualOverflowBoundingBox() const; |
| 118 InlineBox* culledInlineFirstLineBox() const; | 118 InlineBox* culledInlineFirstLineBox() const; |
| 119 InlineBox* culledInlineLastLineBox() const; | 119 InlineBox* culledInlineLastLineBox() const; |
| 120 | 120 |
| 121 template<typename GeneratorContext> | 121 template<typename GeneratorContext> |
| 122 void generateLineBoxRects(GeneratorContext& yield) const; | 122 void generateLineBoxRects(GeneratorContext& yield) const; |
| 123 template<typename GeneratorContext> | 123 template<typename GeneratorContext> |
| 124 void generateCulledLineBoxRects(GeneratorContext& yield, const RenderInline*
container) const; | 124 void generateCulledLineBoxRects(GeneratorContext& yield, const RenderInline*
container) const; |
| 125 | 125 |
| 126 void addChildToContinuation(RenderObject* newChild, RenderObject* beforeChil
d); | 126 void addChildToContinuation(RenderObject* newChild, RenderObject* beforeChil
d); |
| 127 virtual void addChildIgnoringContinuation(RenderObject* newChild, RenderObje
ct* beforeChild = 0) OVERRIDE FINAL; | 127 virtual void addChildIgnoringContinuation(RenderObject* newChild, RenderObje
ct* beforeChild = 0) override final; |
| 128 | 128 |
| 129 void splitInlines(RenderBlock* fromBlock, RenderBlock* toBlock, RenderBlock*
middleBlock, | 129 void splitInlines(RenderBlock* fromBlock, RenderBlock* toBlock, RenderBlock*
middleBlock, |
| 130 RenderObject* beforeChild, RenderBoxModelObject* oldCont); | 130 RenderObject* beforeChild, RenderBoxModelObject* oldCont); |
| 131 void splitFlow(RenderObject* beforeChild, RenderBlock* newBlockBox, | 131 void splitFlow(RenderObject* beforeChild, RenderBlock* newBlockBox, |
| 132 RenderObject* newChild, RenderBoxModelObject* oldCont); | 132 RenderObject* newChild, RenderBoxModelObject* oldCont); |
| 133 | 133 |
| 134 virtual void layout() OVERRIDE FINAL { ASSERT_NOT_REACHED(); } // Do nothing
for layout() | 134 virtual void layout() override final { ASSERT_NOT_REACHED(); } // Do nothing
for layout() |
| 135 | 135 |
| 136 virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE FINAL; | 136 virtual void paint(PaintInfo&, const LayoutPoint&) override final; |
| 137 | 137 |
| 138 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct
ion) OVERRIDE FINAL; | 138 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct
ion) override final; |
| 139 | 139 |
| 140 virtual LayerType layerTypeRequired() const OVERRIDE { return isRelPositione
d() || createsGroup() || hasClipPath() || style()->shouldCompositeForCurrentAnim
ations() ? NormalLayer : NoLayer; } | 140 virtual LayerType layerTypeRequired() const override { return isRelPositione
d() || createsGroup() || hasClipPath() || style()->shouldCompositeForCurrentAnim
ations() ? NormalLayer : NoLayer; } |
| 141 | 141 |
| 142 virtual LayoutUnit offsetLeft() const OVERRIDE FINAL; | 142 virtual LayoutUnit offsetLeft() const override final; |
| 143 virtual LayoutUnit offsetTop() const OVERRIDE FINAL; | 143 virtual LayoutUnit offsetTop() const override final; |
| 144 virtual LayoutUnit offsetWidth() const OVERRIDE FINAL { return linesBounding
Box().width(); } | 144 virtual LayoutUnit offsetWidth() const override final { return linesBounding
Box().width(); } |
| 145 virtual LayoutUnit offsetHeight() const OVERRIDE FINAL { return linesBoundin
gBox().height(); } | 145 virtual LayoutUnit offsetHeight() const override final { return linesBoundin
gBox().height(); } |
| 146 | 146 |
| 147 virtual LayoutRect clippedOverflowRectForPaintInvalidation(const RenderLayer
ModelObject* paintInvalidationContainer, const PaintInvalidationState* = 0) cons
t OVERRIDE; | 147 virtual LayoutRect clippedOverflowRectForPaintInvalidation(const RenderLayer
ModelObject* paintInvalidationContainer, const PaintInvalidationState* = 0) cons
t override; |
| 148 virtual LayoutRect rectWithOutlineForPaintInvalidation(const RenderLayerMode
lObject* paintInvalidationContainer, LayoutUnit outlineWidth, const PaintInvalid
ationState* = 0) const OVERRIDE FINAL; | 148 virtual LayoutRect rectWithOutlineForPaintInvalidation(const RenderLayerMode
lObject* paintInvalidationContainer, LayoutUnit outlineWidth, const PaintInvalid
ationState* = 0) const override final; |
| 149 virtual void mapRectToPaintInvalidationBacking(const RenderLayerModelObject*
paintInvalidationContainer, LayoutRect&, const PaintInvalidationState*) const O
VERRIDE FINAL; | 149 virtual void mapRectToPaintInvalidationBacking(const RenderLayerModelObject*
paintInvalidationContainer, LayoutRect&, const PaintInvalidationState*) const o
verride final; |
| 150 | 150 |
| 151 virtual void mapLocalToContainer(const RenderLayerModelObject* paintInvalida
tionContainer, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool*
wasFixed = 0, const PaintInvalidationState* = 0) const OVERRIDE; | 151 virtual void mapLocalToContainer(const RenderLayerModelObject* paintInvalida
tionContainer, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool*
wasFixed = 0, const PaintInvalidationState* = 0) const override; |
| 152 | 152 |
| 153 virtual PositionWithAffinity positionForPoint(const LayoutPoint&) OVERRIDE F
INAL; | 153 virtual PositionWithAffinity positionForPoint(const LayoutPoint&) override f
inal; |
| 154 | 154 |
| 155 virtual IntRect borderBoundingBox() const OVERRIDE FINAL | 155 virtual IntRect borderBoundingBox() const override final |
| 156 { | 156 { |
| 157 IntRect boundingBox = linesBoundingBox(); | 157 IntRect boundingBox = linesBoundingBox(); |
| 158 return IntRect(0, 0, boundingBox.width(), boundingBox.height()); | 158 return IntRect(0, 0, boundingBox.width(), boundingBox.height()); |
| 159 } | 159 } |
| 160 | 160 |
| 161 virtual InlineFlowBox* createInlineFlowBox(); // Subclassed by SVG and Ruby | 161 virtual InlineFlowBox* createInlineFlowBox(); // Subclassed by SVG and Ruby |
| 162 | 162 |
| 163 virtual void dirtyLinesFromChangedChild(RenderObject* child) OVERRIDE FINAL
{ m_lineBoxes.dirtyLinesFromChangedChild(this, child); } | 163 virtual void dirtyLinesFromChangedChild(RenderObject* child) override final
{ m_lineBoxes.dirtyLinesFromChangedChild(this, child); } |
| 164 | 164 |
| 165 virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositio
nMode = PositionOnContainingLine) const OVERRIDE FINAL; | 165 virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositio
nMode = PositionOnContainingLine) const override final; |
| 166 virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode
, LinePositionMode = PositionOnContainingLine) const OVERRIDE FINAL; | 166 virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode
, LinePositionMode = PositionOnContainingLine) const override final; |
| 167 | 167 |
| 168 virtual void childBecameNonInline(RenderObject* child) OVERRIDE FINAL; | 168 virtual void childBecameNonInline(RenderObject* child) override final; |
| 169 | 169 |
| 170 virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&) OVERRID
E FINAL; | 170 virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&) overrid
e final; |
| 171 | 171 |
| 172 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) OVERRIDE FINA
L; | 172 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) override fina
l; |
| 173 | 173 |
| 174 virtual void addAnnotatedRegions(Vector<AnnotatedRegionValue>&) OVERRIDE FIN
AL; | 174 virtual void addAnnotatedRegions(Vector<AnnotatedRegionValue>&) override fin
al; |
| 175 | 175 |
| 176 virtual void updateFromStyle() OVERRIDE FINAL; | 176 virtual void updateFromStyle() override final; |
| 177 | 177 |
| 178 RenderInline* clone() const; | 178 RenderInline* clone() const; |
| 179 | 179 |
| 180 RenderBoxModelObject* continuationBefore(RenderObject* beforeChild); | 180 RenderBoxModelObject* continuationBefore(RenderObject* beforeChild); |
| 181 | 181 |
| 182 RenderObjectChildList m_children; | 182 RenderObjectChildList m_children; |
| 183 RenderLineBoxList m_lineBoxes; // All of the line boxes created for this i
nline flow. For example, <i>Hello<br>world.</i> will have two <i> line boxes. | 183 RenderLineBoxList m_lineBoxes; // All of the line boxes created for this i
nline flow. For example, <i>Hello<br>world.</i> will have two <i> line boxes. |
| 184 }; | 184 }; |
| 185 | 185 |
| 186 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderInline, isRenderInline()); | 186 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderInline, isRenderInline()); |
| 187 | 187 |
| 188 } // namespace blink | 188 } // namespace blink |
| 189 | 189 |
| 190 #endif // RenderInline_h | 190 #endif // RenderInline_h |
| OLD | NEW |