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

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: 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 290 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().document().hasVerticalWritingMode())
312 || !renderer().style()->isFlippedBlocksWritingMode()) {
312 return FloatPoint(x(), y()); 313 return FloatPoint(x(), y());
314 }
313 RenderBlockFlow& block = root().block(); 315 RenderBlockFlow& block = root().block();
314 if (block.style()->isHorizontalWritingMode()) 316 if (block.style()->isHorizontalWritingMode())
315 return FloatPoint(x(), block.height() - height() - y()); 317 return FloatPoint(x(), block.height() - height() - y());
316 318
317 return FloatPoint(block.width() - width() - x(), y()); 319 return FloatPoint(block.width() - width() - x(), y());
318 } 320 }
319 321
320 void InlineBox::flipForWritingMode(FloatRect& rect) 322 void InlineBox::flipForWritingMode(FloatRect& rect)
321 { 323 {
322 if (!renderer().style()->isFlippedBlocksWritingMode()) 324 if (!UNLIKELY(renderer().document().hasVerticalWritingMode())
pdr. 2014/10/21 22:11:26 I'm not a huge fan of sprinkling unlikely's around
eae 2014/10/21 22:21:46 The entire point of this change is to short-circui
pdr. 2014/10/21 22:38:14 What do you think about the first part involving m
325 || !renderer().style()->isFlippedBlocksWritingMode()) {
323 return; 326 return;
327 }
324 root().block().flipForWritingMode(rect); 328 root().block().flipForWritingMode(rect);
325 } 329 }
326 330
327 FloatPoint InlineBox::flipForWritingMode(const FloatPoint& point) 331 FloatPoint InlineBox::flipForWritingMode(const FloatPoint& point)
328 { 332 {
329 if (!renderer().style()->isFlippedBlocksWritingMode()) 333 if (!UNLIKELY(renderer().document().hasVerticalWritingMode())
334 || !renderer().style()->isFlippedBlocksWritingMode()) {
330 return point; 335 return point;
336 }
331 return root().block().flipForWritingMode(point); 337 return root().block().flipForWritingMode(point);
332 } 338 }
333 339
334 void InlineBox::flipForWritingMode(LayoutRect& rect) 340 void InlineBox::flipForWritingMode(LayoutRect& rect)
335 { 341 {
336 if (!renderer().style()->isFlippedBlocksWritingMode()) 342 if (!UNLIKELY(renderer().document().hasVerticalWritingMode())
343 || !renderer().style()->isFlippedBlocksWritingMode()) {
337 return; 344 return;
345 }
338 root().block().flipForWritingMode(rect); 346 root().block().flipForWritingMode(rect);
339 } 347 }
340 348
341 LayoutPoint InlineBox::flipForWritingMode(const LayoutPoint& point) 349 LayoutPoint InlineBox::flipForWritingMode(const LayoutPoint& point)
342 { 350 {
343 if (!renderer().style()->isFlippedBlocksWritingMode()) 351 if (!UNLIKELY(renderer().document().hasVerticalWritingMode())
352 || !renderer().style()->isFlippedBlocksWritingMode()) {
344 return point; 353 return point;
354 }
345 return root().block().flipForWritingMode(point); 355 return root().block().flipForWritingMode(point);
346 } 356 }
347 357
348 } // namespace blink 358 } // namespace blink
349 359
350 #ifndef NDEBUG 360 #ifndef NDEBUG
351 361
352 void showTree(const blink::InlineBox* b) 362 void showTree(const blink::InlineBox* b)
353 { 363 {
354 if (b) 364 if (b)
355 b->showTreeForThis(); 365 b->showTreeForThis();
356 } 366 }
357 367
358 void showLineTree(const blink::InlineBox* b) 368 void showLineTree(const blink::InlineBox* b)
359 { 369 {
360 if (b) 370 if (b)
361 b->showLineTreeForThis(); 371 b->showLineTreeForThis();
362 } 372 }
363 373
364 #endif 374 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698