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

Side by Side Diff: Source/web/WebViewImpl.cpp

Issue 209413002: Avoid unnecessary invalidations on resize. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@crap
Patch Set: Assert !m_updatePageInfoDeferred in beginLayout. Created 6 years, 9 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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 1545
1546 bool shouldAnchorAndRescaleViewport = settings()->mainFrameResizesAreOrienta tionChanges() 1546 bool shouldAnchorAndRescaleViewport = settings()->mainFrameResizesAreOrienta tionChanges()
1547 && oldSize.width && oldContentsWidth && newSize.width != oldSize.width; 1547 && oldSize.width && oldContentsWidth && newSize.width != oldSize.width;
1548 1548
1549 ViewportAnchor viewportAnchor(&mainFrameImpl()->frame()->eventHandler()); 1549 ViewportAnchor viewportAnchor(&mainFrameImpl()->frame()->eventHandler());
1550 if (shouldAnchorAndRescaleViewport) { 1550 if (shouldAnchorAndRescaleViewport) {
1551 viewportAnchor.setAnchor(view->visibleContentRect(), 1551 viewportAnchor.setAnchor(view->visibleContentRect(),
1552 FloatSize(viewportAnchorXCoord, viewportAnchorY Coord)); 1552 FloatSize(viewportAnchorXCoord, viewportAnchorY Coord));
1553 } 1553 }
1554 1554
1555 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document()->v iewportDescription()); 1555 {
1556 updateMainFrameLayoutSize(); 1556 // Avoids unnecessary invalidations while various bits of state in the F TA are updated.
1557 FastTextAutosizer::DeferUpdatePageInfo deferUpdatePageInfo(page());
1557 1558
1558 WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate(); 1559 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document( )->viewportDescription());
1559 if (agentPrivate) 1560 updateMainFrameLayoutSize();
1560 agentPrivate->webViewResized(newSize); 1561
1561 WebFrameImpl* webFrame = mainFrameImpl(); 1562 WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate();
1562 if (webFrame->frameView()) { 1563 if (agentPrivate)
1563 webFrame->frameView()->resize(m_size); 1564 agentPrivate->webViewResized(newSize);
1564 if (page()->settings().pinchVirtualViewportEnabled()) 1565 WebFrameImpl* webFrame = mainFrameImpl();
1565 page()->frameHost().pinchViewport().setViewportSize(m_size); 1566 if (webFrame->frameView()) {
1567 webFrame->frameView()->resize(m_size);
1568 if (page()->settings().pinchVirtualViewportEnabled())
1569 page()->frameHost().pinchViewport().setViewportSize(m_size);
1570 }
1566 } 1571 }
1567 1572
1568 if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) { 1573 if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) {
1569 // Relayout immediately to recalculate the minimum scale limit. 1574 // Relayout immediately to recalculate the minimum scale limit.
1570 if (view->needsLayout()) 1575 if (view->needsLayout())
1571 view->layout(); 1576 view->layout();
1572 1577
1573 if (shouldAnchorAndRescaleViewport) { 1578 if (shouldAnchorAndRescaleViewport) {
1574 float viewportWidthRatio = static_cast<float>(newSize.width) / oldSi ze.width; 1579 float viewportWidthRatio = static_cast<float>(newSize.width) / oldSi ze.width;
1575 float contentsWidthRatio = static_cast<float>(contentsSize().width() ) / oldContentsWidth; 1580 float contentsWidthRatio = static_cast<float>(contentsSize().width() ) / oldContentsWidth;
(...skipping 2419 matching lines...) Expand 10 before | Expand all | Expand 10 after
3995 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4000 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
3996 4001
3997 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4002 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
3998 return false; 4003 return false;
3999 4004
4000 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4005 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4001 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4006 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4002 } 4007 }
4003 4008
4004 } // namespace blink 4009 } // namespace blink
OLDNEW
« Source/core/rendering/FastTextAutosizer.cpp ('K') | « Source/core/rendering/FastTextAutosizer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698