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

Side by Side Diff: Source/core/rendering/InlineFlowBox.h

Issue 184023003: Make InlineBox::renderer() and related subclass methods return reference. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 22 matching lines...) Expand all
33 class RenderLineBoxList; 33 class RenderLineBoxList;
34 class SimpleFontData; 34 class SimpleFontData;
35 class VerticalPositionCache; 35 class VerticalPositionCache;
36 36
37 struct GlyphOverflow; 37 struct GlyphOverflow;
38 38
39 typedef HashMap<const InlineTextBox*, pair<Vector<const SimpleFontData*>, GlyphO verflow> > GlyphOverflowAndFallbackFontsMap; 39 typedef HashMap<const InlineTextBox*, pair<Vector<const SimpleFontData*>, GlyphO verflow> > GlyphOverflowAndFallbackFontsMap;
40 40
41 class InlineFlowBox : public InlineBox { 41 class InlineFlowBox : public InlineBox {
42 public: 42 public:
43 InlineFlowBox(RenderObject* obj) 43 InlineFlowBox(RenderObject& obj)
44 : InlineBox(obj) 44 : InlineBox(obj)
45 , m_firstChild(0) 45 , m_firstChild(0)
46 , m_lastChild(0) 46 , m_lastChild(0)
47 , m_prevLineBox(0) 47 , m_prevLineBox(0)
48 , m_nextLineBox(0) 48 , m_nextLineBox(0)
49 , m_includeLogicalLeftEdge(false) 49 , m_includeLogicalLeftEdge(false)
50 , m_includeLogicalRightEdge(false) 50 , m_includeLogicalRightEdge(false)
51 , m_descendantsHaveSameLineHeightAndBaseline(true) 51 , m_descendantsHaveSameLineHeightAndBaseline(true)
52 , m_baselineType(AlphabeticBaseline) 52 , m_baselineType(AlphabeticBaseline)
53 , m_hasAnnotationsBefore(false) 53 , m_hasAnnotationsBefore(false)
54 , m_hasAnnotationsAfter(false) 54 , m_hasAnnotationsAfter(false)
55 #ifndef NDEBUG 55 #ifndef NDEBUG
56 , m_hasBadChildList(false) 56 , m_hasBadChildList(false)
57 #endif 57 #endif
58 { 58 {
59 // Internet Explorer and Firefox always create a marker for list items, even when the list-style-type is none. We do not make a marker 59 // Internet Explorer and Firefox always create a marker for list items, even when the list-style-type is none. We do not make a marker
60 // in the list-style-type: none case, since it is wasteful to do so. Ho wever, in order to match other browsers we have to pretend like 60 // in the list-style-type: none case, since it is wasteful to do so. Ho wever, in order to match other browsers we have to pretend like
61 // an invisible marker exists. The side effect of having an invisible m arker is that the quirks mode behavior of shrinking lines with no 61 // an invisible marker exists. The side effect of having an invisible m arker is that the quirks mode behavior of shrinking lines with no
62 // text children must not apply. This change also means that gaps will exist between image bullet list items. Even when the list bullet 62 // text children must not apply. This change also means that gaps will exist between image bullet list items. Even when the list bullet
63 // is an image, the line is still considered to be immune from the quirk . 63 // is an image, the line is still considered to be immune from the quirk .
64 m_hasTextChildren = obj->style()->display() == LIST_ITEM; 64 m_hasTextChildren = obj.style()->display() == LIST_ITEM;
65 m_hasTextDescendants = m_hasTextChildren; 65 m_hasTextDescendants = m_hasTextChildren;
66 } 66 }
67 67
68 #ifndef NDEBUG 68 #ifndef NDEBUG
69 virtual ~InlineFlowBox(); 69 virtual ~InlineFlowBox();
70 70
71 virtual void showLineTreeAndMark(const InlineBox* = 0, const char* = 0, cons t InlineBox* = 0, const char* = 0, const RenderObject* = 0, int = 0) const OVERR IDE; 71 virtual void showLineTreeAndMark(const InlineBox* = 0, const char* = 0, cons t InlineBox* = 0, const char* = 0, const RenderObject* = 0, int = 0) const OVERR IDE;
72 virtual const char* boxName() const OVERRIDE; 72 virtual const char* boxName() const OVERRIDE;
73 #endif 73 #endif
74 74
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 LayoutUnit marginLogicalRight() const 133 LayoutUnit marginLogicalRight() const
134 { 134 {
135 if (!includeLogicalRightEdge()) 135 if (!includeLogicalRightEdge())
136 return 0; 136 return 0;
137 return isHorizontal() ? boxModelObject()->marginRight() : boxModelObject ()->marginBottom(); 137 return isHorizontal() ? boxModelObject()->marginRight() : boxModelObject ()->marginBottom();
138 } 138 }
139 int borderLogicalLeft() const 139 int borderLogicalLeft() const
140 { 140 {
141 if (!includeLogicalLeftEdge()) 141 if (!includeLogicalLeftEdge())
142 return 0; 142 return 0;
143 return isHorizontal() ? renderer()->style(isFirstLineStyle())->borderLef tWidth() : renderer()->style(isFirstLineStyle())->borderTopWidth(); 143 return isHorizontal() ? renderer().style(isFirstLineStyle())->borderLeft Width() : renderer().style(isFirstLineStyle())->borderTopWidth();
144 } 144 }
145 int borderLogicalRight() const 145 int borderLogicalRight() const
146 { 146 {
147 if (!includeLogicalRightEdge()) 147 if (!includeLogicalRightEdge())
148 return 0; 148 return 0;
149 return isHorizontal() ? renderer()->style(isFirstLineStyle())->borderRig htWidth() : renderer()->style(isFirstLineStyle())->borderBottomWidth(); 149 return isHorizontal() ? renderer().style(isFirstLineStyle())->borderRigh tWidth() : renderer().style(isFirstLineStyle())->borderBottomWidth();
150 } 150 }
151 int paddingLogicalLeft() const 151 int paddingLogicalLeft() const
152 { 152 {
153 if (!includeLogicalLeftEdge()) 153 if (!includeLogicalLeftEdge())
154 return 0; 154 return 0;
155 return isHorizontal() ? boxModelObject()->paddingLeft() : boxModelObject ()->paddingTop(); 155 return isHorizontal() ? boxModelObject()->paddingLeft() : boxModelObject ()->paddingTop();
156 } 156 }
157 int paddingLogicalRight() const 157 int paddingLogicalRight() const
158 { 158 {
159 if (!includeLogicalRightEdge()) 159 if (!includeLogicalRightEdge())
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 } 237 }
238 LayoutUnit logicalBottomLayoutOverflow(LayoutUnit lineBottom) const 238 LayoutUnit logicalBottomLayoutOverflow(LayoutUnit lineBottom) const
239 { 239 {
240 if (m_overflow) 240 if (m_overflow)
241 return isHorizontal() ? m_overflow->layoutOverflowRect().maxY() : m_ overflow->layoutOverflowRect().maxX(); 241 return isHorizontal() ? m_overflow->layoutOverflowRect().maxY() : m_ overflow->layoutOverflowRect().maxX();
242 return lineBottom; 242 return lineBottom;
243 } 243 }
244 LayoutRect logicalLayoutOverflowRect(LayoutUnit lineTop, LayoutUnit lineBott om) const 244 LayoutRect logicalLayoutOverflowRect(LayoutUnit lineTop, LayoutUnit lineBott om) const
245 { 245 {
246 LayoutRect result = layoutOverflowRect(lineTop, lineBottom); 246 LayoutRect result = layoutOverflowRect(lineTop, lineBottom);
247 if (!renderer()->isHorizontalWritingMode()) 247 if (!renderer().isHorizontalWritingMode())
248 result = result.transposedRect(); 248 result = result.transposedRect();
249 return result; 249 return result;
250 } 250 }
251 251
252 LayoutRect visualOverflowRect(LayoutUnit lineTop, LayoutUnit lineBottom) con st 252 LayoutRect visualOverflowRect(LayoutUnit lineTop, LayoutUnit lineBottom) con st
253 { 253 {
254 return m_overflow ? m_overflow->visualOverflowRect() : enclosingLayoutRe ct(frameRectIncludingLineHeight(lineTop, lineBottom)); 254 return m_overflow ? m_overflow->visualOverflowRect() : enclosingLayoutRe ct(frameRectIncludingLineHeight(lineTop, lineBottom));
255 } 255 }
256 LayoutUnit logicalLeftVisualOverflow() const { return m_overflow ? (isHorizo ntal() ? m_overflow->visualOverflowRect().x() : m_overflow->visualOverflowRect() .y()) : static_cast<LayoutUnit>(logicalLeft()); } 256 LayoutUnit logicalLeftVisualOverflow() const { return m_overflow ? (isHorizo ntal() ? m_overflow->visualOverflowRect().x() : m_overflow->visualOverflowRect() .y()) : static_cast<LayoutUnit>(logicalLeft()); }
257 LayoutUnit logicalRightVisualOverflow() const { return m_overflow ? (isHoriz ontal() ? m_overflow->visualOverflowRect().maxX() : m_overflow->visualOverflowRe ct().maxY()) : static_cast<LayoutUnit>(ceilf(logicalRight())); } 257 LayoutUnit logicalRightVisualOverflow() const { return m_overflow ? (isHoriz ontal() ? m_overflow->visualOverflowRect().maxX() : m_overflow->visualOverflowRe ct().maxY()) : static_cast<LayoutUnit>(ceilf(logicalRight())); }
258 LayoutUnit logicalTopVisualOverflow(LayoutUnit lineTop) const 258 LayoutUnit logicalTopVisualOverflow(LayoutUnit lineTop) const
259 { 259 {
260 if (m_overflow) 260 if (m_overflow)
261 return isHorizontal() ? m_overflow->visualOverflowRect().y() : m_ove rflow->visualOverflowRect().x(); 261 return isHorizontal() ? m_overflow->visualOverflowRect().y() : m_ove rflow->visualOverflowRect().x();
262 return lineTop; 262 return lineTop;
263 } 263 }
264 LayoutUnit logicalBottomVisualOverflow(LayoutUnit lineBottom) const 264 LayoutUnit logicalBottomVisualOverflow(LayoutUnit lineBottom) const
265 { 265 {
266 if (m_overflow) 266 if (m_overflow)
267 return isHorizontal() ? m_overflow->visualOverflowRect().maxY() : m_ overflow->visualOverflowRect().maxX(); 267 return isHorizontal() ? m_overflow->visualOverflowRect().maxY() : m_ overflow->visualOverflowRect().maxX();
268 return lineBottom; 268 return lineBottom;
269 } 269 }
270 LayoutRect logicalVisualOverflowRect(LayoutUnit lineTop, LayoutUnit lineBott om) const 270 LayoutRect logicalVisualOverflowRect(LayoutUnit lineTop, LayoutUnit lineBott om) const
271 { 271 {
272 LayoutRect result = visualOverflowRect(lineTop, lineBottom); 272 LayoutRect result = visualOverflowRect(lineTop, lineBottom);
273 if (!renderer()->isHorizontalWritingMode()) 273 if (!renderer().isHorizontalWritingMode())
274 result = result.transposedRect(); 274 result = result.transposedRect();
275 return result; 275 return result;
276 } 276 }
277 277
278 void setOverflowFromLogicalRects(const LayoutRect& logicalLayoutOverflow, co nst LayoutRect& logicalVisualOverflow, LayoutUnit lineTop, LayoutUnit lineBottom ); 278 void setOverflowFromLogicalRects(const LayoutRect& logicalLayoutOverflow, co nst LayoutRect& logicalVisualOverflow, LayoutUnit lineTop, LayoutUnit lineBottom );
279 void setLayoutOverflow(const LayoutRect&, LayoutUnit lineTop, LayoutUnit lin eBottom); 279 void setLayoutOverflow(const LayoutRect&, LayoutUnit lineTop, LayoutUnit lin eBottom);
280 void setVisualOverflow(const LayoutRect&, LayoutUnit lineTop, LayoutUnit lin eBottom); 280 void setVisualOverflow(const LayoutRect&, LayoutUnit lineTop, LayoutUnit lin eBottom);
281 281
282 FloatRect frameRectIncludingLineHeight(LayoutUnit lineTop, LayoutUnit lineBo ttom) const 282 FloatRect frameRectIncludingLineHeight(LayoutUnit lineTop, LayoutUnit lineBo ttom) const
283 { 283 {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 } 366 }
367 367
368 } // namespace WebCore 368 } // namespace WebCore
369 369
370 #ifndef NDEBUG 370 #ifndef NDEBUG
371 // Outside the WebCore namespace for ease of invocation from gdb. 371 // Outside the WebCore namespace for ease of invocation from gdb.
372 void showTree(const WebCore::InlineFlowBox*); 372 void showTree(const WebCore::InlineFlowBox*);
373 #endif 373 #endif
374 374
375 #endif // InlineFlowBox_h 375 #endif // InlineFlowBox_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698