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

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: Rebased, added comment 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
« no previous file with comments | « LayoutTests/inspector/device-emulation/device-emulation-mq-on-resize-expected.txt ('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 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document( )->viewportDescription()); 1614 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document( )->viewportDescription());
1615 updateMainFrameLayoutSize(); 1615 updateMainFrameLayoutSize();
1616 1616
1617 // If the virtual viewport pinch mode is enabled, the main frame will be resized 1617 // If the virtual viewport pinch mode is enabled, the main frame will be resized
1618 // after layout so it can be sized to the contentsSize. 1618 // after layout so it can be sized to the contentsSize.
1619 if (!pinchVirtualViewportEnabled() && mainFrameImpl()->frameView()) 1619 if (!pinchVirtualViewportEnabled() && mainFrameImpl()->frameView())
1620 mainFrameImpl()->frameView()->resize(m_size); 1620 mainFrameImpl()->frameView()->resize(m_size);
1621 1621
1622 if (pinchVirtualViewportEnabled()) 1622 if (pinchVirtualViewportEnabled())
1623 page()->frameHost().pinchViewport().setSize(m_size); 1623 page()->frameHost().pinchViewport().setSize(m_size);
1624
1625 // When device emulation is enabled, device size values may change - the y are
1626 // usually set equal to the view size. These values are not considered v iewport-dependent
1627 // (see MediaQueryExp::isViewportDependent), and will not be invalidated in |FrameView::performPreLayoutTasks|.
ojan 2014/06/10 17:22:37 I would add something like... These values are no
dgozman 2014/06/18 13:15:43 Done.
1628 // Therefore we should force explicit media queries invalidation here.
1629 if (page()->inspectorController().deviceEmulationEnabled()) {
1630 if (Document* document = mainFrameImpl()->frame()->document())
1631 document->mediaQueryAffectingValueChanged();
1632 }
1624 } 1633 }
1625 1634
1626 if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) { 1635 if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) {
1627 // Relayout immediately to recalculate the minimum scale limit. 1636 // Relayout immediately to recalculate the minimum scale limit.
1628 if (view->needsLayout()) 1637 if (view->needsLayout())
1629 view->layout(); 1638 view->layout();
1630 1639
1631 if (shouldAnchorAndRescaleViewport) { 1640 if (shouldAnchorAndRescaleViewport) {
1632 float viewportWidthRatio = static_cast<float>(newSize.width) / oldSi ze.width; 1641 float viewportWidthRatio = static_cast<float>(newSize.width) / oldSi ze.width;
1633 float contentsWidthRatio = static_cast<float>(contentsSize().width() ) / oldContentsWidth; 1642 float contentsWidthRatio = static_cast<float>(contentsSize().width() ) / oldContentsWidth;
(...skipping 2467 matching lines...) Expand 10 before | Expand all | Expand 10 after
4101 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4110 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4102 4111
4103 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4112 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4104 return false; 4113 return false;
4105 4114
4106 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4115 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4107 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4116 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4108 } 4117 }
4109 4118
4110 } // namespace blink 4119 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/inspector/device-emulation/device-emulation-mq-on-resize-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698