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

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

Issue 308003007: [DevTools] Update media queries when resizing with emulation on. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: With test Created 6 years, 6 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 | Annotate | Revision Log
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 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document( )->viewportDescription()); 1616 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document( )->viewportDescription());
1617 updateMainFrameLayoutSize(); 1617 updateMainFrameLayoutSize();
1618 1618
1619 // If the virtual viewport pinch mode is enabled, the main frame will be resized 1619 // If the virtual viewport pinch mode is enabled, the main frame will be resized
1620 // after layout so it can be sized to the contentsSize. 1620 // after layout so it can be sized to the contentsSize.
1621 if (!pinchVirtualViewportEnabled() && mainFrameImpl()->frameView()) 1621 if (!pinchVirtualViewportEnabled() && mainFrameImpl()->frameView())
1622 mainFrameImpl()->frameView()->resize(m_size); 1622 mainFrameImpl()->frameView()->resize(m_size);
1623 1623
1624 if (pinchVirtualViewportEnabled()) 1624 if (pinchVirtualViewportEnabled())
1625 page()->frameHost().pinchViewport().setSize(m_size); 1625 page()->frameHost().pinchViewport().setSize(m_size);
1626
1627 if (page()->inspectorController().deviceEmulationEnabled()) {
1628 if (Document* document = mainFrameImpl()->frame()->document())
1629 document->mediaQueryAffectingValueChanged();
ojan 2014/06/10 02:38:05 I can't think of a better solution, so lgtm, but t
dgozman 2014/06/10 10:26:02 Done.
1630 }
1626 } 1631 }
1627 1632
1628 if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) { 1633 if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) {
1629 // Relayout immediately to recalculate the minimum scale limit. 1634 // Relayout immediately to recalculate the minimum scale limit.
1630 if (view->needsLayout()) 1635 if (view->needsLayout())
1631 view->layout(); 1636 view->layout();
1632 1637
1633 if (shouldAnchorAndRescaleViewport) { 1638 if (shouldAnchorAndRescaleViewport) {
1634 float viewportWidthRatio = static_cast<float>(newSize.width) / oldSi ze.width; 1639 float viewportWidthRatio = static_cast<float>(newSize.width) / oldSi ze.width;
1635 float contentsWidthRatio = static_cast<float>(contentsSize().width() ) / oldContentsWidth; 1640 float contentsWidthRatio = static_cast<float>(contentsSize().width() ) / oldContentsWidth;
(...skipping 2415 matching lines...) Expand 10 before | Expand all | Expand 10 after
4051 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4056 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4052 4057
4053 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4058 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4054 return false; 4059 return false;
4055 4060
4056 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4061 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4057 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4062 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4058 } 4063 }
4059 4064
4060 } // namespace blink 4065 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698