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

Side by Side Diff: Source/core/rendering/InlineBox.cpp

Issue 669803002: Optimize for horizontal writing mode (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: w compile fix Created 6 years, 2 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 { 196 {
197 BlockPainter::paintInlineBox(*this, paintInfo, paintOffset); 197 BlockPainter::paintInlineBox(*this, paintInfo, paintOffset);
198 } 198 }
199 199
200 bool InlineBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result , const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffs et, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/) 200 bool InlineBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result , const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffs et, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/)
201 { 201 {
202 // Hit test all phases of replaced elements atomically, as though the replac ed element established its 202 // Hit test all phases of replaced elements atomically, as though the replac ed element established its
203 // own stacking context. (See Appendix E.2, section 6.4 on inline block/tab le elements in the CSS2.1 203 // own stacking context. (See Appendix E.2, section 6.4 on inline block/tab le elements in the CSS2.1
204 // specification.) 204 // specification.)
205 LayoutPoint childPoint = accumulatedOffset; 205 LayoutPoint childPoint = accumulatedOffset;
206 if (parent()->renderer().style()->isFlippedBlocksWritingMode()) // Faster th an calling containingBlock(). 206 if (parent()->renderer().hasFlippedBlocksWritingMode()) // Faster than calli ng containingBlock().
207 childPoint = renderer().containingBlock()->flipForWritingModeForChild(&t oRenderBox(renderer()), childPoint); 207 childPoint = renderer().containingBlock()->flipForWritingModeForChild(&t oRenderBox(renderer()), childPoint);
208 208
209 return renderer().hitTest(request, result, locationInContainer, childPoint); 209 return renderer().hitTest(request, result, locationInContainer, childPoint);
210 } 210 }
211 211
212 const RootInlineBox& InlineBox::root() const 212 const RootInlineBox& InlineBox::root() const
213 { 213 {
214 if (m_parent) 214 if (m_parent)
215 return m_parent->root(); 215 return m_parent->root();
216 ASSERT(isRootInlineBox()); 216 ASSERT(isRootInlineBox());
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 301
302 void InlineBox::clearKnownToHaveNoOverflow() 302 void InlineBox::clearKnownToHaveNoOverflow()
303 { 303 {
304 m_bitfields.setKnownToHaveNoOverflow(false); 304 m_bitfields.setKnownToHaveNoOverflow(false);
305 if (parent() && parent()->knownToHaveNoOverflow()) 305 if (parent() && parent()->knownToHaveNoOverflow())
306 parent()->clearKnownToHaveNoOverflow(); 306 parent()->clearKnownToHaveNoOverflow();
307 } 307 }
308 308
309 FloatPoint InlineBox::locationIncludingFlipping() 309 FloatPoint InlineBox::locationIncludingFlipping()
310 { 310 {
311 if (!renderer().style()->isFlippedBlocksWritingMode()) 311 if (!UNLIKELY(renderer().hasFlippedBlocksWritingMode()))
312 return FloatPoint(x(), y()); 312 return FloatPoint(x(), y());
313
313 RenderBlockFlow& block = root().block(); 314 RenderBlockFlow& block = root().block();
314 if (block.style()->isHorizontalWritingMode()) 315 if (block.style()->isHorizontalWritingMode())
315 return FloatPoint(x(), block.height() - height() - y()); 316 return FloatPoint(x(), block.height() - height() - y());
316 317
317 return FloatPoint(block.width() - width() - x(), y()); 318 return FloatPoint(block.width() - width() - x(), y());
318 } 319 }
319 320
320 void InlineBox::flipForWritingMode(FloatRect& rect) 321 void InlineBox::flipForWritingMode(FloatRect& rect)
321 { 322 {
322 if (!renderer().style()->isFlippedBlocksWritingMode()) 323 if (!UNLIKELY(renderer().hasFlippedBlocksWritingMode()))
323 return; 324 return;
324 root().block().flipForWritingMode(rect); 325 root().block().flipForWritingMode(rect);
325 } 326 }
326 327
327 FloatPoint InlineBox::flipForWritingMode(const FloatPoint& point) 328 FloatPoint InlineBox::flipForWritingMode(const FloatPoint& point)
328 { 329 {
329 if (!renderer().style()->isFlippedBlocksWritingMode()) 330 if (!UNLIKELY(renderer().hasFlippedBlocksWritingMode()))
330 return point; 331 return point;
331 return root().block().flipForWritingMode(point); 332 return root().block().flipForWritingMode(point);
332 } 333 }
333 334
334 void InlineBox::flipForWritingMode(LayoutRect& rect) 335 void InlineBox::flipForWritingMode(LayoutRect& rect)
335 { 336 {
336 if (!renderer().style()->isFlippedBlocksWritingMode()) 337 if (!UNLIKELY(renderer().hasFlippedBlocksWritingMode()))
337 return; 338 return;
338 root().block().flipForWritingMode(rect); 339 root().block().flipForWritingMode(rect);
339 } 340 }
340 341
341 LayoutPoint InlineBox::flipForWritingMode(const LayoutPoint& point) 342 LayoutPoint InlineBox::flipForWritingMode(const LayoutPoint& point)
342 { 343 {
343 if (!renderer().style()->isFlippedBlocksWritingMode()) 344 if (!UNLIKELY(renderer().hasFlippedBlocksWritingMode()))
344 return point; 345 return point;
345 return root().block().flipForWritingMode(point); 346 return root().block().flipForWritingMode(point);
346 } 347 }
347 348
348 } // namespace blink 349 } // namespace blink
349 350
350 #ifndef NDEBUG 351 #ifndef NDEBUG
351 352
352 void showTree(const blink::InlineBox* b) 353 void showTree(const blink::InlineBox* b)
353 { 354 {
354 if (b) 355 if (b)
355 b->showTreeForThis(); 356 b->showTreeForThis();
356 } 357 }
357 358
358 void showLineTree(const blink::InlineBox* b) 359 void showLineTree(const blink::InlineBox* b)
359 { 360 {
360 if (b) 361 if (b)
361 b->showLineTreeForThis(); 362 b->showLineTreeForThis();
362 } 363 }
363 364
364 #endif 365 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698