Chromium Code Reviews| Index: Source/core/frame/FrameView.cpp |
| diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp |
| index 95f79cbc724c033eeb430f97c5e0db39788b65c4..a6b01aa945e7e18a5e2e51bb2fd288670eae5e5f 100644 |
| --- a/Source/core/frame/FrameView.cpp |
| +++ b/Source/core/frame/FrameView.cpp |
| @@ -883,7 +883,6 @@ void FrameView::layout(bool allowSubtree) |
| return; |
| } |
| - bool shouldDoFullLayout = false; |
| FontCachePurgePreventer fontCachePurgePreventer; |
| RenderLayer* layer; |
| { |
| @@ -909,7 +908,7 @@ void FrameView::layout(bool allowSubtree) |
| ScrollbarMode vMode; |
| calculateScrollbarModesForLayoutAndSetViewportRenderer(hMode, vMode); |
| - shouldDoFullLayout = !inSubtreeLayout && (m_firstLayout || toRenderView(rootForThisLayout)->document().printing()); |
| + bool shouldDoFullRepaint = !inSubtreeLayout && (m_firstLayout || toRenderView(rootForThisLayout)->document().printing()); |
| if (!inSubtreeLayout) { |
| // Now set our scrollbar state for the layout. |
| @@ -942,7 +941,15 @@ void FrameView::layout(bool allowSubtree) |
| m_size = LayoutSize(layoutSize().width(), layoutSize().height()); |
| if (oldSize != m_size) { |
| - shouldDoFullLayout = true; |
| + // It's hard to predict here which of full repaint or per-descendant repaint costs less. |
| + // For vertical writing mode or width change, it's more likely that per-descendant repaint |
| + // eventually turns out to be full repaint but with the cost to handle layout states and |
| + // discrete repaint rects, so marking full repaint here is more likely to cost less. |
| + // For height only changes, per-descendant repaint is more likely to avoid unnecessary |
| + // full repaints. |
| + if (!renderView()->style()->isHorizontalWritingMode() || oldSize.width() != m_size.width()) |
|
Julien - ping for review
2014/03/29 01:01:26
I don't think the isHorizontalWritingMode() check
ojan
2014/03/29 01:15:45
The html and body writing modes get propagated up
|
| + shouldDoFullRepaint = true; |
| + |
| if (!m_firstLayout) { |
| RenderBox* rootRenderer = document->documentElement() ? document->documentElement()->renderBox() : 0; |
| RenderBox* bodyRenderer = rootRenderer && document->body() ? document->body()->renderBox() : 0; |
| @@ -958,7 +965,7 @@ void FrameView::layout(bool allowSubtree) |
| // We need to set m_doFullRepaint before triggering layout as RenderObject::checkForRepaint |
| // checks the boolean to disable local repaints. |
| - m_doFullRepaint |= shouldDoFullLayout; |
| + m_doFullRepaint |= shouldDoFullRepaint; |
| performLayout(rootForThisLayout, inSubtreeLayout); |
| @@ -1746,7 +1753,10 @@ void FrameView::repaintContentRectangle(const IntRect& r) |
| void FrameView::contentsResized() |
| { |
| ScrollView::contentsResized(); |
| - setNeedsLayout(); |
| + if (RenderView* renderView = this->renderView()) { |
| + // Don't directly repaint layer in setNeedsLayout. We'll handle repaint in layout(). |
| + renderView->setNeedsLayout(MarkContainingBlockChain, 0, DontRepaintLayer); |
| + } |
| } |
| void FrameView::scrollbarExistenceDidChange() |