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

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

Issue 164773008: Reduce the number of virtual calls in the noOverflowRect() method by half (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | no next file » | 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 4453 matching lines...) Expand 10 before | Expand all | Expand 10 after
4464 if (style()->writingMode() == RightToLeftWritingMode || parentStyle->writing Mode() == RightToLeftWritingMode) 4464 if (style()->writingMode() == RightToLeftWritingMode || parentStyle->writing Mode() == RightToLeftWritingMode)
4465 rect.setX(width() - rect.maxX()); 4465 rect.setX(width() - rect.maxX());
4466 else if (style()->writingMode() == BottomToTopWritingMode || parentStyle->wr itingMode() == BottomToTopWritingMode) 4466 else if (style()->writingMode() == BottomToTopWritingMode || parentStyle->wr itingMode() == BottomToTopWritingMode)
4467 rect.setY(height() - rect.maxY()); 4467 rect.setY(height() - rect.maxY());
4468 4468
4469 return rect; 4469 return rect;
4470 } 4470 }
4471 4471
4472 LayoutRect RenderBox::noOverflowRect() const 4472 LayoutRect RenderBox::noOverflowRect() const
4473 { 4473 {
4474 // Because of the special coodinate system used for overflow rectangles and many other 4474 // Because of the special coordinate system used for overflow rectangles and many other
4475 // rectangles (not quite logical, not quite physical), we need to flip the b lock progression 4475 // rectangles (not quite logical, not quite physical), we need to flip the b lock progression
4476 // coordinate in vertical-rl and horizontal-bt writing modes. In other words , the rectangle 4476 // coordinate in vertical-rl and horizontal-bt writing modes. In other words , the rectangle
4477 // returned is physical, except for the block direction progression coordina te (y in horizontal 4477 // returned is physical, except for the block direction progression coordina te (y in horizontal
4478 // writing modes, x in vertical writing modes), which is always "logical top ". Apart from the 4478 // writing modes, x in vertical writing modes), which is always "logical top ". Apart from the
4479 // flipping, this method does the same as clientBoxRect(). 4479 // flipping, this method does the same as clientBoxRect().
4480 4480
4481 LayoutUnit left = borderLeft() + (style()->shouldPlaceBlockDirectionScrollba rOnLogicalLeft() ? verticalScrollbarWidth() : 0); 4481 const int scrollBarWidth = verticalScrollbarWidth();
4482 const int scrollBarHeight = horizontalScrollbarHeight();
4483 LayoutUnit left = borderLeft() + (style()->shouldPlaceBlockDirectionScrollba rOnLogicalLeft() ? scrollBarWidth : 0);
4482 LayoutUnit top = borderTop(); 4484 LayoutUnit top = borderTop();
4483 LayoutUnit right = borderRight(); 4485 LayoutUnit right = borderRight();
4484 LayoutUnit bottom = borderBottom(); 4486 LayoutUnit bottom = borderBottom();
4485 LayoutRect rect(left, top, width() - left - right, height() - top - bottom); 4487 LayoutRect rect(left, top, width() - left - right, height() - top - bottom);
4486 flipForWritingMode(rect); 4488 flipForWritingMode(rect);
4487 // Subtract space occupied by scrollbars. Order is important here: first fli p, then subtract 4489 // Subtract space occupied by scrollbars. Order is important here: first fli p, then subtract
4488 // scrollbars. This may seem backwards and weird, since one would think that a horizontal 4490 // scrollbars. This may seem backwards and weird, since one would think that a horizontal
4489 // scrollbar at the physical bottom in horizontal-bt ought to be at the logi cal top (physical 4491 // scrollbar at the physical bottom in horizontal-bt ought to be at the logi cal top (physical
4490 // bottom), between the logical top (physical bottom) border and the logical top (physical 4492 // bottom), between the logical top (physical bottom) border and the logical top (physical
4491 // bottom) padding. But this is how the rest of the code expects us to behav e. This is highly 4493 // bottom) padding. But this is how the rest of the code expects us to behav e. This is highly
4492 // related to https://bugs.webkit.org/show_bug.cgi?id=76129 4494 // related to https://bugs.webkit.org/show_bug.cgi?id=76129
4493 // FIXME: when the above mentioned bug is fixed, it should hopefully be poss ible to call 4495 // FIXME: when the above mentioned bug is fixed, it should hopefully be poss ible to call
4494 // clientBoxRect() or paddingBoxRect() in this method, rather than fiddling with the edges on 4496 // clientBoxRect() or paddingBoxRect() in this method, rather than fiddling with the edges on
4495 // our own. 4497 // our own.
4496 if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) 4498 if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
4497 rect.contract(0, horizontalScrollbarHeight()); 4499 rect.contract(0, scrollBarHeight);
4498 else 4500 else
4499 rect.contract(verticalScrollbarWidth(), horizontalScrollbarHeight()); 4501 rect.contract(scrollBarWidth, scrollBarHeight);
4500 return rect; 4502 return rect;
4501 } 4503 }
4502 4504
4503 LayoutRect RenderBox::overflowRectForPaintRejection() const 4505 LayoutRect RenderBox::overflowRectForPaintRejection() const
4504 { 4506 {
4505 LayoutRect overflowRect = visualOverflowRect(); 4507 LayoutRect overflowRect = visualOverflowRect();
4506 if (!m_overflow || !usesCompositedScrolling()) 4508 if (!m_overflow || !usesCompositedScrolling())
4507 return overflowRect; 4509 return overflowRect;
4508 4510
4509 overflowRect.unite(layoutOverflowRect()); 4511 overflowRect.unite(layoutOverflowRect());
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
4673 return 0; 4675 return 0;
4674 4676
4675 if (!layoutState && !flowThreadContainingBlock()) 4677 if (!layoutState && !flowThreadContainingBlock())
4676 return 0; 4678 return 0;
4677 4679
4678 RenderBlock* containerBlock = containingBlock(); 4680 RenderBlock* containerBlock = containingBlock();
4679 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); 4681 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop();
4680 } 4682 }
4681 4683
4682 } // namespace WebCore 4684 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698