| 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 * |
| 11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
| 15 * | 15 * |
| 16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
| 17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
| 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
| 20 * | 20 * |
| 21 */ | 21 */ |
| 22 | 22 |
| 23 #ifndef RenderInline_h | 23 #ifndef RenderInline_h |
| 24 #define RenderInline_h | 24 #define RenderInline_h |
| 25 | 25 |
| 26 #include "core/editing/PositionWithAffinity.h" | 26 #include "core/editing/PositionWithAffinity.h" |
| 27 #include "core/layout/LayoutBoxModelObject.h" |
| 27 #include "core/layout/line/InlineFlowBox.h" | 28 #include "core/layout/line/InlineFlowBox.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 LayoutBoxModelObject { |
| 34 public: | 34 public: |
| 35 explicit RenderInline(Element*); | 35 explicit RenderInline(Element*); |
| 36 | 36 |
| 37 static RenderInline* createAnonymous(Document*); | 37 static RenderInline* createAnonymous(Document*); |
| 38 | 38 |
| 39 LayoutObject* firstChild() const { ASSERT(children() == virtualChildren());
return children()->firstChild(); } | 39 LayoutObject* firstChild() const { ASSERT(children() == virtualChildren());
return children()->firstChild(); } |
| 40 LayoutObject* lastChild() const { ASSERT(children() == virtualChildren()); r
eturn children()->lastChild(); } | 40 LayoutObject* lastChild() const { ASSERT(children() == virtualChildren()); r
eturn children()->lastChild(); } |
| 41 | 41 |
| 42 // If you have a RenderInline, use firstChild or lastChild instead. | 42 // If you have a RenderInline, use firstChild or lastChild instead. |
| 43 void slowFirstChild() const = delete; | 43 void slowFirstChild() const = delete; |
| 44 void slowLastChild() const = delete; | 44 void slowLastChild() const = delete; |
| 45 | 45 |
| 46 virtual void addChild(LayoutObject* newChild, LayoutObject* beforeChild = 0)
override; | 46 virtual void addChild(LayoutObject* newChild, LayoutObject* beforeChild = 0)
override; |
| 47 | 47 |
| 48 Element* node() const { return toElement(RenderBoxModelObject::node()); } | 48 Element* node() const { return toElement(LayoutBoxModelObject::node()); } |
| 49 | 49 |
| 50 virtual LayoutRectOutsets marginBoxOutsets() const override final; | 50 virtual LayoutRectOutsets marginBoxOutsets() const override final; |
| 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 LayoutStyle* otherStyle = 0) const ove
rride final; | 55 virtual LayoutUnit marginBefore(const LayoutStyle* otherStyle = 0) const ove
rride final; |
| 56 virtual LayoutUnit marginAfter(const LayoutStyle* otherStyle = 0) const over
ride final; | 56 virtual LayoutUnit marginAfter(const LayoutStyle* otherStyle = 0) const over
ride final; |
| 57 virtual LayoutUnit marginStart(const LayoutStyle* otherStyle = 0) const over
ride final; | 57 virtual LayoutUnit marginStart(const LayoutStyle* otherStyle = 0) const over
ride final; |
| 58 virtual LayoutUnit marginEnd(const LayoutStyle* otherStyle = 0) const overri
de final; | 58 virtual LayoutUnit marginEnd(const LayoutStyle* otherStyle = 0) const overri
de final; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 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 LayoutBoxModelObject* 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 override final; | 87 virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& addit
ionalOffset) const override final; |
| 88 | 88 |
| 89 using RenderBoxModelObject::continuation; | 89 using LayoutBoxModelObject::continuation; |
| 90 using RenderBoxModelObject::setContinuation; | 90 using LayoutBoxModelObject::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: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 124 void generateLineBoxRects(GeneratorContext& yield) const; | 124 void generateLineBoxRects(GeneratorContext& yield) const; |
| 125 template<typename GeneratorContext> | 125 template<typename GeneratorContext> |
| 126 void generateCulledLineBoxRects(GeneratorContext& yield, const RenderInline*
container) const; | 126 void generateCulledLineBoxRects(GeneratorContext& yield, const RenderInline*
container) const; |
| 127 | 127 |
| 128 void addChildToContinuation(LayoutObject* newChild, LayoutObject* beforeChil
d); | 128 void addChildToContinuation(LayoutObject* newChild, LayoutObject* beforeChil
d); |
| 129 virtual void addChildIgnoringContinuation(LayoutObject* newChild, LayoutObje
ct* beforeChild = 0) override final; | 129 virtual void addChildIgnoringContinuation(LayoutObject* newChild, LayoutObje
ct* beforeChild = 0) override final; |
| 130 | 130 |
| 131 void moveChildrenToIgnoringContinuation(RenderInline* to, LayoutObject* star
tChild); | 131 void moveChildrenToIgnoringContinuation(RenderInline* to, LayoutObject* star
tChild); |
| 132 | 132 |
| 133 void splitInlines(RenderBlock* fromBlock, RenderBlock* toBlock, RenderBlock*
middleBlock, | 133 void splitInlines(RenderBlock* fromBlock, RenderBlock* toBlock, RenderBlock*
middleBlock, |
| 134 LayoutObject* beforeChild, RenderBoxModelObject* oldCont); | 134 LayoutObject* beforeChild, LayoutBoxModelObject* oldCont); |
| 135 void splitFlow(LayoutObject* beforeChild, RenderBlock* newBlockBox, | 135 void splitFlow(LayoutObject* beforeChild, RenderBlock* newBlockBox, |
| 136 LayoutObject* newChild, RenderBoxModelObject* oldCont); | 136 LayoutObject* newChild, LayoutBoxModelObject* oldCont); |
| 137 | 137 |
| 138 virtual void layout() override final { ASSERT_NOT_REACHED(); } // Do nothing
for layout() | 138 virtual void layout() override final { ASSERT_NOT_REACHED(); } // Do nothing
for layout() |
| 139 | 139 |
| 140 virtual void paint(const PaintInfo&, const LayoutPoint&) override final; | 140 virtual void paint(const PaintInfo&, const LayoutPoint&) override final; |
| 141 | 141 |
| 142 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct
ion) override final; | 142 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct
ion) override final; |
| 143 | 143 |
| 144 virtual LayerType layerTypeRequired() const override { return isRelPositione
d() || createsGroup() || hasClipPath() || style()->shouldCompositeForCurrentAnim
ations() ? NormalLayer : NoLayer; } | 144 virtual LayerType layerTypeRequired() const override { return isRelPositione
d() || createsGroup() || hasClipPath() || style()->shouldCompositeForCurrentAnim
ations() ? NormalLayer : NoLayer; } |
| 145 | 145 |
| 146 virtual LayoutUnit offsetLeft() const override final; | 146 virtual LayoutUnit offsetLeft() const override final; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&) overrid
e final; | 179 virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&) overrid
e final; |
| 180 | 180 |
| 181 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) override fina
l; | 181 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) override fina
l; |
| 182 | 182 |
| 183 virtual void addAnnotatedRegions(Vector<AnnotatedRegionValue>&) override fin
al; | 183 virtual void addAnnotatedRegions(Vector<AnnotatedRegionValue>&) override fin
al; |
| 184 | 184 |
| 185 virtual void updateFromStyle() override final; | 185 virtual void updateFromStyle() override final; |
| 186 | 186 |
| 187 RenderInline* clone() const; | 187 RenderInline* clone() const; |
| 188 | 188 |
| 189 RenderBoxModelObject* continuationBefore(LayoutObject* beforeChild); | 189 LayoutBoxModelObject* continuationBefore(LayoutObject* beforeChild); |
| 190 | 190 |
| 191 LayoutObjectChildList m_children; | 191 LayoutObjectChildList m_children; |
| 192 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. | 192 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. |
| 193 }; | 193 }; |
| 194 | 194 |
| 195 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(RenderInline, isRenderInline()); | 195 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(RenderInline, isRenderInline()); |
| 196 | 196 |
| 197 } // namespace blink | 197 } // namespace blink |
| 198 | 198 |
| 199 #endif // RenderInline_h | 199 #endif // RenderInline_h |
| OLD | NEW |