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

Side by Side Diff: Source/core/layout/line/InlineFlowBox.h

Issue 1183863003: Remove enclosingLayoutRect calls per FIXME. These are hot in profiles. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove some toFloat calls (and subsequent reverse conversions), per szager Created 5 years, 6 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
« no previous file with comments | « no previous file | Source/core/layout/line/InlineFlowBox.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 void setHasTextDescendants() { m_hasTextDescendants = true; } 208 void setHasTextDescendants() { m_hasTextDescendants = true; }
209 209
210 void checkConsistency() const; 210 void checkConsistency() const;
211 void setHasBadChildList(); 211 void setHasBadChildList();
212 212
213 // Line visual and layout overflow are in the coordinate space of the block. This means that they aren't purely physical directions. 213 // Line visual and layout overflow are in the coordinate space of the block. This means that they aren't purely physical directions.
214 // For horizontal-tb and vertical-lr they will match physical directions, bu t for horizontal-bt and vertical-rl, the top/bottom and left/right 214 // For horizontal-tb and vertical-lr they will match physical directions, bu t for horizontal-bt and vertical-rl, the top/bottom and left/right
215 // respectively are flipped when compared to their physical counterparts. F or example minX is on the left in vertical-lr, but it is on the right in vertica l-rl. 215 // respectively are flipped when compared to their physical counterparts. F or example minX is on the left in vertical-lr, but it is on the right in vertica l-rl.
216 LayoutRect layoutOverflowRect(LayoutUnit lineTop, LayoutUnit lineBottom) con st 216 LayoutRect layoutOverflowRect(LayoutUnit lineTop, LayoutUnit lineBottom) con st
217 { 217 {
218 // FIXME: the call to enclosingLayoutRect() below is temporary and shoul d be removed once 218 return m_overflow ? m_overflow->layoutOverflowRect() : frameRectIncludin gLineHeight(lineTop, lineBottom);
219 // the transition to LayoutUnit-based types is complete (crbug.com/32123 7)
220 return m_overflow ? m_overflow->layoutOverflowRect() : enclosingLayoutRe ct(frameRectIncludingLineHeight(lineTop, lineBottom));
221 } 219 }
222 LayoutUnit logicalTopLayoutOverflow(LayoutUnit lineTop) const 220 LayoutUnit logicalTopLayoutOverflow(LayoutUnit lineTop) const
223 { 221 {
224 if (m_overflow) 222 if (m_overflow)
225 return isHorizontal() ? m_overflow->layoutOverflowRect().y() : m_ove rflow->layoutOverflowRect().x(); 223 return isHorizontal() ? m_overflow->layoutOverflowRect().y() : m_ove rflow->layoutOverflowRect().x();
226 return lineTop; 224 return lineTop;
227 } 225 }
228 LayoutUnit logicalBottomLayoutOverflow(LayoutUnit lineBottom) const 226 LayoutUnit logicalBottomLayoutOverflow(LayoutUnit lineBottom) const
229 { 227 {
230 if (m_overflow) 228 if (m_overflow)
231 return isHorizontal() ? m_overflow->layoutOverflowRect().maxY() : m_ overflow->layoutOverflowRect().maxX(); 229 return isHorizontal() ? m_overflow->layoutOverflowRect().maxY() : m_ overflow->layoutOverflowRect().maxX();
232 return lineBottom; 230 return lineBottom;
233 } 231 }
234 LayoutRect logicalLayoutOverflowRect(LayoutUnit lineTop, LayoutUnit lineBott om) const 232 LayoutRect logicalLayoutOverflowRect(LayoutUnit lineTop, LayoutUnit lineBott om) const
235 { 233 {
236 LayoutRect result = layoutOverflowRect(lineTop, lineBottom); 234 LayoutRect result = layoutOverflowRect(lineTop, lineBottom);
237 if (!layoutObject().isHorizontalWritingMode()) 235 if (!layoutObject().isHorizontalWritingMode())
238 result = result.transposedRect(); 236 result = result.transposedRect();
239 return result; 237 return result;
240 } 238 }
241 239
242 LayoutRect visualOverflowRect(LayoutUnit lineTop, LayoutUnit lineBottom) con st 240 LayoutRect visualOverflowRect(LayoutUnit lineTop, LayoutUnit lineBottom) con st
243 { 241 {
244 // FIXME: the call to enclosingLayoutRect() below is temporary and shoul d be removed once 242 return m_overflow ? m_overflow->visualOverflowRect() : frameRectIncludin gLineHeight(lineTop, lineBottom);
245 // the transition to LayoutUnit-based types is complete (crbug.com/32123 7)
246 return m_overflow ? m_overflow->visualOverflowRect() : enclosingLayoutRe ct(frameRectIncludingLineHeight(lineTop, lineBottom));
247 } 243 }
248 LayoutUnit logicalLeftVisualOverflow() const { return m_overflow ? (isHorizo ntal() ? m_overflow->visualOverflowRect().x() : m_overflow->visualOverflowRect() .y()) : logicalLeft(); } 244 LayoutUnit logicalLeftVisualOverflow() const { return m_overflow ? (isHorizo ntal() ? m_overflow->visualOverflowRect().x() : m_overflow->visualOverflowRect() .y()) : logicalLeft(); }
249 LayoutUnit logicalRightVisualOverflow() const { return m_overflow ? (isHoriz ontal() ? m_overflow->visualOverflowRect().maxX() : m_overflow->visualOverflowRe ct().maxY()) : static_cast<LayoutUnit>(logicalRight().ceil()); } 245 LayoutUnit logicalRightVisualOverflow() const { return m_overflow ? (isHoriz ontal() ? m_overflow->visualOverflowRect().maxX() : m_overflow->visualOverflowRe ct().maxY()) : static_cast<LayoutUnit>(logicalRight().ceil()); }
250 LayoutUnit logicalTopVisualOverflow(LayoutUnit lineTop) const 246 LayoutUnit logicalTopVisualOverflow(LayoutUnit lineTop) const
251 { 247 {
252 if (m_overflow) 248 if (m_overflow)
253 return isHorizontal() ? m_overflow->visualOverflowRect().y() : m_ove rflow->visualOverflowRect().x(); 249 return isHorizontal() ? m_overflow->visualOverflowRect().y() : m_ove rflow->visualOverflowRect().x();
254 return lineTop; 250 return lineTop;
255 } 251 }
256 LayoutUnit logicalBottomVisualOverflow(LayoutUnit lineBottom) const 252 LayoutUnit logicalBottomVisualOverflow(LayoutUnit lineBottom) const
257 { 253 {
258 if (m_overflow) 254 if (m_overflow)
259 return isHorizontal() ? m_overflow->visualOverflowRect().maxY() : m_ overflow->visualOverflowRect().maxX(); 255 return isHorizontal() ? m_overflow->visualOverflowRect().maxY() : m_ overflow->visualOverflowRect().maxX();
260 return lineBottom; 256 return lineBottom;
261 } 257 }
262 LayoutRect logicalVisualOverflowRect(LayoutUnit lineTop, LayoutUnit lineBott om) const 258 LayoutRect logicalVisualOverflowRect(LayoutUnit lineTop, LayoutUnit lineBott om) const
263 { 259 {
264 LayoutRect result = visualOverflowRect(lineTop, lineBottom); 260 LayoutRect result = visualOverflowRect(lineTop, lineBottom);
265 if (!layoutObject().isHorizontalWritingMode()) 261 if (!layoutObject().isHorizontalWritingMode())
266 result = result.transposedRect(); 262 result = result.transposedRect();
267 return result; 263 return result;
268 } 264 }
269 265
270 void setOverflowFromLogicalRects(const LayoutRect& logicalLayoutOverflow, co nst LayoutRect& logicalVisualOverflow, LayoutUnit lineTop, LayoutUnit lineBottom ); 266 void setOverflowFromLogicalRects(const LayoutRect& logicalLayoutOverflow, co nst LayoutRect& logicalVisualOverflow, LayoutUnit lineTop, LayoutUnit lineBottom );
271 267
272 LayoutRect frameRectIncludingLineHeight(LayoutUnit lineTop, LayoutUnit lineB ottom) const 268 LayoutRect frameRectIncludingLineHeight(LayoutUnit lineTop, LayoutUnit lineB ottom) const
273 { 269 {
274 if (isHorizontal()) 270 if (isHorizontal())
275 return LayoutRect(m_topLeft.x(), lineTop.toFloat(), width(), (lineBo ttom - lineTop).toFloat()); 271 return LayoutRect(m_topLeft.x(), lineTop, width(), lineBottom - line Top);
276 return LayoutRect(lineTop.toFloat(), m_topLeft.y(), (lineBottom - lineTo p).toFloat(), height()); 272 return LayoutRect(lineTop, m_topLeft.y(), lineBottom - lineTop, height() );
277 } 273 }
278 274
279 LayoutRect logicalFrameRectIncludingLineHeight(LayoutUnit lineTop, LayoutUni t lineBottom) const 275 LayoutRect logicalFrameRectIncludingLineHeight(LayoutUnit lineTop, LayoutUni t lineBottom) const
280 { 276 {
281 return LayoutRect(logicalLeft(), lineTop.toFloat(), logicalWidth(), (lin eBottom - lineTop).toFloat()); 277 return LayoutRect(logicalLeft(), lineTop, logicalWidth(), lineBottom - l ineTop);
282 } 278 }
283 279
284 bool descendantsHaveSameLineHeightAndBaseline() const { return m_descendants HaveSameLineHeightAndBaseline; } 280 bool descendantsHaveSameLineHeightAndBaseline() const { return m_descendants HaveSameLineHeightAndBaseline; }
285 void clearDescendantsHaveSameLineHeightAndBaseline() 281 void clearDescendantsHaveSameLineHeightAndBaseline()
286 { 282 {
287 m_descendantsHaveSameLineHeightAndBaseline = false; 283 m_descendantsHaveSameLineHeightAndBaseline = false;
288 if (parent() && parent()->descendantsHaveSameLineHeightAndBaseline()) 284 if (parent() && parent()->descendantsHaveSameLineHeightAndBaseline())
289 parent()->clearDescendantsHaveSameLineHeightAndBaseline(); 285 parent()->clearDescendantsHaveSameLineHeightAndBaseline();
290 } 286 }
291 287
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 } 360 }
365 361
366 } // namespace blink 362 } // namespace blink
367 363
368 #ifndef NDEBUG 364 #ifndef NDEBUG
369 // Outside the WebCore namespace for ease of invocation from gdb. 365 // Outside the WebCore namespace for ease of invocation from gdb.
370 void showTree(const blink::InlineFlowBox*); 366 void showTree(const blink::InlineFlowBox*);
371 #endif 367 #endif
372 368
373 #endif // InlineFlowBox_h 369 #endif // InlineFlowBox_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/layout/line/InlineFlowBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698