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

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: Address review comment. Created 6 years, 8 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 | « Source/core/rendering/FastTextAutosizer.cpp ('k') | 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) 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 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 1559
1560 bool shouldAnchorAndRescaleViewport = settings()->mainFrameResizesAreOrienta tionChanges() 1560 bool shouldAnchorAndRescaleViewport = settings()->mainFrameResizesAreOrienta tionChanges()
1561 && oldSize.width && oldContentsWidth && newSize.width != oldSize.width; 1561 && oldSize.width && oldContentsWidth && newSize.width != oldSize.width;
1562 1562
1563 ViewportAnchor viewportAnchor(&mainFrameImpl()->frame()->eventHandler()); 1563 ViewportAnchor viewportAnchor(&mainFrameImpl()->frame()->eventHandler());
1564 if (shouldAnchorAndRescaleViewport) { 1564 if (shouldAnchorAndRescaleViewport) {
1565 viewportAnchor.setAnchor(view->visibleContentRect(), 1565 viewportAnchor.setAnchor(view->visibleContentRect(),
1566 FloatSize(viewportAnchorXCoord, viewportAnchorY Coord)); 1566 FloatSize(viewportAnchorXCoord, viewportAnchorY Coord));
1567 } 1567 }
1568 1568
1569 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document()->v iewportDescription()); 1569 {
1570 updateMainFrameLayoutSize(); 1570 // Avoids unnecessary invalidations while various bits of state in FastT extAutosizer are updated.
1571 FastTextAutosizer::DeferUpdatePageInfo deferUpdatePageInfo(page());
1571 1572
1572 WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate(); 1573 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document( )->viewportDescription());
1573 if (agentPrivate) 1574 updateMainFrameLayoutSize();
1574 agentPrivate->webViewResized(newSize); 1575
1575 WebFrameImpl* webFrame = mainFrameImpl(); 1576 WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate();
1576 if (webFrame->frameView()) { 1577 if (agentPrivate)
1577 webFrame->frameView()->resize(m_size); 1578 agentPrivate->webViewResized(newSize);
1578 if (page()->settings().pinchVirtualViewportEnabled()) 1579 WebFrameImpl* webFrame = mainFrameImpl();
1579 page()->frameHost().pinchViewport().setSize(m_size); 1580 if (webFrame->frameView()) {
1581 webFrame->frameView()->resize(m_size);
1582 if (page()->settings().pinchVirtualViewportEnabled())
1583 page()->frameHost().pinchViewport().setSize(m_size);
1584 }
1580 } 1585 }
1581 1586
1582 if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) { 1587 if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) {
1583 // Relayout immediately to recalculate the minimum scale limit. 1588 // Relayout immediately to recalculate the minimum scale limit.
1584 if (view->needsLayout()) 1589 if (view->needsLayout())
1585 view->layout(); 1590 view->layout();
1586 1591
1587 if (shouldAnchorAndRescaleViewport) { 1592 if (shouldAnchorAndRescaleViewport) {
1588 float viewportWidthRatio = static_cast<float>(newSize.width) / oldSi ze.width; 1593 float viewportWidthRatio = static_cast<float>(newSize.width) / oldSi ze.width;
1589 float contentsWidthRatio = static_cast<float>(contentsSize().width() ) / oldContentsWidth; 1594 float contentsWidthRatio = static_cast<float>(contentsSize().width() ) / oldContentsWidth;
(...skipping 2385 matching lines...) Expand 10 before | Expand all | Expand 10 after
3975 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 3980 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
3976 3981
3977 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 3982 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
3978 return false; 3983 return false;
3979 3984
3980 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 3985 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
3981 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 3986 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
3982 } 3987 }
3983 3988
3984 } // namespace blink 3989 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/FastTextAutosizer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698