Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Side by Side Diff: third_party/WebKit/WebCore/rendering/RenderInline.h

Issue 21184: WebKit merge 40722:40785 (part 1) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * This file is part of the render object implementation for KHTML. 2 * This file is part of the render object implementation for KHTML.
3 * 3 *
4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
5 * (C) 1999 Antti Koivisto (koivisto@kde.org) 5 * (C) 1999 Antti Koivisto (koivisto@kde.org)
6 * Copyright (C) 2003 Apple Computer, Inc. 6 * Copyright (C) 2003 Apple Computer, Inc.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version. 11 * version 2 of the License, or (at your option) any later version.
12 * 12 *
13 * This library is distributed in the hope that it will be useful, 13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details. 16 * Library General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU Library General Public License 18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to 19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA. 21 * Boston, MA 02110-1301, USA.
22 * 22 *
23 */ 23 */
24 24
25 #ifndef RenderInline_h 25 #ifndef RenderInline_h
26 #define RenderInline_h 26 #define RenderInline_h
27 27
28 #include "RenderBox.h" 28 #include "RenderBoxModelObject.h"
29 #include "RenderLineBoxList.h" 29 #include "RenderLineBoxList.h"
30 30
31 namespace WebCore { 31 namespace WebCore {
32 32
33 class Position; 33 class Position;
34 34
35 class RenderInline : public RenderBox { 35 class RenderInline : public RenderBoxModelObject {
36 public: 36 public:
37 RenderInline(Node*); 37 RenderInline(Node*);
38 virtual ~RenderInline(); 38 virtual ~RenderInline();
39 39
40 virtual RenderObjectChildList* virtualChildren() { return children(); } 40 virtual RenderObjectChildList* virtualChildren() { return children(); }
41 virtual const RenderObjectChildList* virtualChildren() const { return childr en(); } 41 virtual const RenderObjectChildList* virtualChildren() const { return childr en(); }
42 const RenderObjectChildList* children() const { return &m_children; } 42 const RenderObjectChildList* children() const { return &m_children; }
43 RenderObjectChildList* children() { return &m_children; } 43 RenderObjectChildList* children() { return &m_children; }
44 44
45 virtual void destroy(); 45 virtual void destroy();
46 46
47 virtual const char* renderName() const; 47 virtual const char* renderName() const;
48 48
49 virtual bool isRenderInline() const { return true; } 49 virtual bool isRenderInline() const { return true; }
50 50
51 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) ; 51 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) ;
52 void addChildToContinuation(RenderObject* newChild, RenderObject* beforeChil d); 52 void addChildToContinuation(RenderObject* newChild, RenderObject* beforeChil d);
53 virtual void addChildIgnoringContinuation(RenderObject* newChild, RenderObje ct* beforeChild = 0); 53 virtual void addChildIgnoringContinuation(RenderObject* newChild, RenderObje ct* beforeChild = 0);
54 54
55 void splitInlines(RenderBlock* fromBlock, RenderBlock* toBlock, RenderBlock* middleBlock, 55 void splitInlines(RenderBlock* fromBlock, RenderBlock* toBlock, RenderBlock* middleBlock,
56 RenderObject* beforeChild, RenderBox* oldCont); 56 RenderObject* beforeChild, RenderBoxModelObject* oldCont);
57 void splitFlow(RenderObject* beforeChild, RenderBlock* newBlockBox, 57 void splitFlow(RenderObject* beforeChild, RenderBlock* newBlockBox,
58 RenderObject* newChild, RenderBox* oldCont); 58 RenderObject* newChild, RenderBoxModelObject* oldCont);
59 59
60 virtual void layout() { ASSERT_NOT_REACHED(); } // Do nothing for layout() 60 virtual void layout() { ASSERT_NOT_REACHED(); } // Do nothing for layout()
61 61
62 virtual void paint(PaintInfo&, int tx, int ty); 62 virtual void paint(PaintInfo&, int tx, int ty);
63 63
64 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y , int tx, int ty, HitTestAction); 64 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y , int tx, int ty, HitTestAction);
65 65
66 virtual bool requiresLayer() const { return isRelPositioned() || isTranspare nt() || hasMask(); } 66 virtual bool requiresLayer() const { return isRelPositioned() || isTranspare nt() || hasMask(); }
67 67
68 virtual int offsetLeft() const; 68 virtual int offsetLeft() const;
69 virtual int offsetTop() const; 69 virtual int offsetTop() const;
70 virtual int offsetWidth() const { return linesBoundingBox().width(); } 70 virtual int offsetWidth() const { return linesBoundingBox().width(); }
71 virtual int offsetHeight() const { return linesBoundingBox().height(); } 71 virtual int offsetHeight() const { return linesBoundingBox().height(); }
72 72
73 // Just ignore top/bottom margins on RenderInlines.
74 virtual int marginTop() const { return 0; }
75 virtual int marginBottom() const { return 0; }
76 virtual int marginLeft() const;
77 virtual int marginRight() const;
78
73 virtual void absoluteRects(Vector<IntRect>&, int tx, int ty, bool topLevel = true); 79 virtual void absoluteRects(Vector<IntRect>&, int tx, int ty, bool topLevel = true);
74 virtual void absoluteQuads(Vector<FloatQuad>&, bool topLevel = true); 80 virtual void absoluteQuads(Vector<FloatQuad>&, bool topLevel = true);
75 81
76 virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintC ontainer); 82 virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintC ontainer);
77 virtual IntRect rectWithOutlineForRepaint(RenderBoxModelObject* repaintConta iner, int outlineWidth); 83 virtual IntRect rectWithOutlineForRepaint(RenderBoxModelObject* repaintConta iner, int outlineWidth);
84 virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, I ntRect& rect, bool fixed);
78 85
79 virtual VisiblePosition positionForCoordinates(int x, int y); 86 virtual VisiblePosition positionForCoordinates(int x, int y);
80 87
81 IntRect linesBoundingBox() const; 88 IntRect linesBoundingBox() const;
82 89
83 virtual IntRect borderBoundingBox() const 90 virtual IntRect borderBoundingBox() const
84 { 91 {
85 IntRect boundingBox = linesBoundingBox(); 92 IntRect boundingBox = linesBoundingBox();
86 return IntRect(0, 0, boundingBox.width(), boundingBox.height()); 93 return IntRect(0, 0, boundingBox.width(), boundingBox.height());
87 } 94 }
88 95
89 virtual InlineBox* createInlineBox(bool makePlaceHolderBox, bool isRootLineB ox, bool isOnlyRun=false); 96 virtual InlineBox* createInlineBox(bool makePlaceHolderBox, bool isRootLineB ox, bool isOnlyRun=false);
90 virtual void dirtyLineBoxes(bool fullLayout, bool isRootLineBox = false); 97 virtual void dirtyLineBoxes(bool fullLayout, bool isRootLineBox = false);
91 virtual void dirtyLinesFromChangedChild(RenderObject* child) { m_lineBoxes.d irtyLinesFromChangedChild(this, child); } 98 virtual void dirtyLinesFromChangedChild(RenderObject* child) { m_lineBoxes.d irtyLinesFromChangedChild(this, child); }
92 99
93 RenderLineBoxList* lineBoxes() { return &m_lineBoxes; } 100 RenderLineBoxList* lineBoxes() { return &m_lineBoxes; }
94 const RenderLineBoxList* lineBoxes() const { return &m_lineBoxes; } 101 const RenderLineBoxList* lineBoxes() const { return &m_lineBoxes; }
95 102
96 InlineFlowBox* firstLineBox() const { return m_lineBoxes.firstLineBox(); } 103 InlineFlowBox* firstLineBox() const { return m_lineBoxes.firstLineBox(); }
97 InlineFlowBox* lastLineBox() const { return m_lineBoxes.lastLineBox(); } 104 InlineFlowBox* lastLineBox() const { return m_lineBoxes.lastLineBox(); }
98 105
99 virtual int lineHeight(bool firstLine, bool isRootLineBox = false) const; 106 virtual int lineHeight(bool firstLine, bool isRootLineBox = false) const;
100 107
101 RenderBox* continuation() const { return m_continuation; } 108 RenderBoxModelObject* continuation() const { return m_continuation; }
102 RenderInline* inlineContinuation() const; 109 RenderInline* inlineContinuation() const;
103 void setContinuation(RenderBox* c) { m_continuation = c; } 110 void setContinuation(RenderBoxModelObject* c) { m_continuation = c; }
104 111
105 virtual void updateDragState(bool dragOn); 112 virtual void updateDragState(bool dragOn);
106 113
107 virtual void childBecameNonInline(RenderObject* child); 114 virtual void childBecameNonInline(RenderObject* child);
108 115
109 virtual void updateHitTestResult(HitTestResult&, const IntPoint&); 116 virtual void updateHitTestResult(HitTestResult&, const IntPoint&);
110 117
111 IntSize relativePositionedInlineOffset(const RenderBox* child) const; 118 IntSize relativePositionedInlineOffset(const RenderBox* child) const;
112 119
113 virtual void addFocusRingRects(GraphicsContext*, int tx, int ty); 120 virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
114 void paintOutline(GraphicsContext*, int tx, int ty); 121 void paintOutline(GraphicsContext*, int tx, int ty);
115 122
116 void calcMargins(int containerWidth) 123 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
117 { 124
118 m_marginLeft = style()->marginLeft().calcMinValue(containerWidth);
119 m_marginRight = style()->marginRight().calcMinValue(containerWidth);
120 }
121
122 #if ENABLE(DASHBOARD_SUPPORT) 125 #if ENABLE(DASHBOARD_SUPPORT)
123 virtual void addDashboardRegions(Vector<DashboardRegionValue>&); 126 virtual void addDashboardRegions(Vector<DashboardRegionValue>&);
124 #endif 127 #endif
125 128
126 protected: 129 protected:
127 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); 130 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
128 virtual void updateBoxModelInfoFromStyle(); 131 virtual void updateBoxModelInfoFromStyle();
129 132
130 static RenderInline* cloneInline(RenderInline* src); 133 static RenderInline* cloneInline(RenderInline* src);
131 134
132 private: 135 private:
133 void paintOutlineForLine(GraphicsContext*, int tx, int ty, const IntRect& pr evLine, const IntRect& thisLine, const IntRect& nextLine); 136 void paintOutlineForLine(GraphicsContext*, int tx, int ty, const IntRect& pr evLine, const IntRect& thisLine, const IntRect& nextLine);
134 RenderBox* continuationBefore(RenderObject* beforeChild); 137 RenderBoxModelObject* continuationBefore(RenderObject* beforeChild);
135 138
136 protected: 139 protected:
137 RenderObjectChildList m_children; 140 RenderObjectChildList m_children;
138 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. 141 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.
139 142
140 private: 143 private:
141 RenderBox* m_continuation; // Can be either a block or an inline. <b><i><p>H ello</p></i></b>. In this example the <i> will have a block as its continuation but the 144 RenderBoxModelObject* m_continuation; // Can be either a block or an inline. <b><i><p>Hello</p></i></b>. In this example the <i> will have a block as its co ntinuation but the
142 // <b> will just have an inline as its cont inuation. 145 // <b> will just have an inline as its continuation.
143 mutable int m_lineHeight; 146 mutable int m_lineHeight;
144 }; 147 };
145 148
146 inline RenderInline* toRenderInline(RenderObject* o) 149 inline RenderInline* toRenderInline(RenderObject* o)
147 { 150 {
148 ASSERT(!o || o->isRenderInline()); 151 ASSERT(!o || o->isRenderInline());
149 return static_cast<RenderInline*>(o); 152 return static_cast<RenderInline*>(o);
150 } 153 }
151 154
152 inline const RenderInline* toRenderInline(const RenderObject* o) 155 inline const RenderInline* toRenderInline(const RenderObject* o)
153 { 156 {
154 ASSERT(!o || o->isRenderInline()); 157 ASSERT(!o || o->isRenderInline());
155 return static_cast<const RenderInline*>(o); 158 return static_cast<const RenderInline*>(o);
156 } 159 }
157 160
158 // This will catch anyone doing an unnecessary cast. 161 // This will catch anyone doing an unnecessary cast.
159 void toRenderInline(const RenderInline*); 162 void toRenderInline(const RenderInline*);
160 163
161 } // namespace WebCore 164 } // namespace WebCore
162 165
163 #endif // RenderInline_h 166 #endif // RenderInline_h
OLDNEW
« no previous file with comments | « third_party/WebKit/WebCore/rendering/RenderForeignObject.cpp ('k') | third_party/WebKit/WebCore/rendering/RenderInline.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698