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

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

Issue 209353003: Clean up handling of autosizing state changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@crap_base
Patch Set: Address review comments. 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 #include "core/page/DragSession.h" 106 #include "core/page/DragSession.h"
107 #include "core/page/EventHandler.h" 107 #include "core/page/EventHandler.h"
108 #include "core/page/FocusController.h" 108 #include "core/page/FocusController.h"
109 #include "core/page/FrameTree.h" 109 #include "core/page/FrameTree.h"
110 #include "core/page/InjectedStyleSheets.h" 110 #include "core/page/InjectedStyleSheets.h"
111 #include "core/page/Page.h" 111 #include "core/page/Page.h"
112 #include "core/page/PagePopupClient.h" 112 #include "core/page/PagePopupClient.h"
113 #include "core/page/PointerLockController.h" 113 #include "core/page/PointerLockController.h"
114 #include "core/page/ScopedPageLoadDeferrer.h" 114 #include "core/page/ScopedPageLoadDeferrer.h"
115 #include "core/page/TouchDisambiguation.h" 115 #include "core/page/TouchDisambiguation.h"
116 #include "core/rendering/FastTextAutosizer.h"
116 #include "core/rendering/RenderView.h" 117 #include "core/rendering/RenderView.h"
117 #include "core/rendering/RenderWidget.h" 118 #include "core/rendering/RenderWidget.h"
118 #include "core/rendering/TextAutosizer.h" 119 #include "core/rendering/TextAutosizer.h"
119 #include "core/rendering/compositing/RenderLayerCompositor.h" 120 #include "core/rendering/compositing/RenderLayerCompositor.h"
120 #include "modules/device_orientation/DeviceOrientationInspectorAgent.h" 121 #include "modules/device_orientation/DeviceOrientationInspectorAgent.h"
121 #include "modules/encryptedmedia/MediaKeysController.h" 122 #include "modules/encryptedmedia/MediaKeysController.h"
122 #include "modules/geolocation/GeolocationController.h" 123 #include "modules/geolocation/GeolocationController.h"
123 #include "modules/indexeddb/InspectorIndexedDBAgent.h" 124 #include "modules/indexeddb/InspectorIndexedDBAgent.h"
124 #include "modules/notifications/NotificationController.h" 125 #include "modules/notifications/NotificationController.h"
125 #include "painting/ContinuousPainter.h" 126 #include "painting/ContinuousPainter.h"
(...skipping 2737 matching lines...) Expand 10 before | Expand all | Expand 10 after
2863 } 2864 }
2864 m_pageScaleConstraintsSet.adjustForAndroidWebViewQuirks(adjustedDescription, m_size, page()->settings().layoutFallbackWidth(), deviceScaleFactor(), settings Impl()->supportDeprecatedTargetDensityDPI(), page()->settings().wideViewportQuir kEnabled(), page()->settings().useWideViewport(), page()->settings().loadWithOve rviewMode(), settingsImpl()->viewportMetaNonUserScalableQuirk()); 2865 m_pageScaleConstraintsSet.adjustForAndroidWebViewQuirks(adjustedDescription, m_size, page()->settings().layoutFallbackWidth(), deviceScaleFactor(), settings Impl()->supportDeprecatedTargetDensityDPI(), page()->settings().wideViewportQuir kEnabled(), page()->settings().useWideViewport(), page()->settings().loadWithOve rviewMode(), settingsImpl()->viewportMetaNonUserScalableQuirk());
2865 float newInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().i nitialScale; 2866 float newInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().i nitialScale;
2866 if (oldInitialScale != newInitialScale && newInitialScale != -1) { 2867 if (oldInitialScale != newInitialScale && newInitialScale != -1) {
2867 m_pageScaleConstraintsSet.setNeedsReset(true); 2868 m_pageScaleConstraintsSet.setNeedsReset(true);
2868 if (mainFrameImpl() && mainFrameImpl()->frameView()) 2869 if (mainFrameImpl() && mainFrameImpl()->frameView())
2869 mainFrameImpl()->frameView()->setNeedsLayout(); 2870 mainFrameImpl()->frameView()->setNeedsLayout();
2870 } 2871 }
2871 2872
2872 updateMainFrameLayoutSize(); 2873 updateMainFrameLayoutSize();
2874
2875 if (LocalFrame* frame = page()->mainFrame()) {
2876 if (FastTextAutosizer* textAutosizer = frame->document()->fastTextAutosi zer())
2877 textAutosizer->updatePageInfoInAllFrames();
2878 }
2873 } 2879 }
2874 2880
2875 void WebViewImpl::updateMainFrameLayoutSize() 2881 void WebViewImpl::updateMainFrameLayoutSize()
2876 { 2882 {
2877 if (m_fixedLayoutSizeLock || !mainFrameImpl()) 2883 if (m_fixedLayoutSizeLock || !mainFrameImpl())
2878 return; 2884 return;
2879 2885
2880 RefPtr<FrameView> view = mainFrameImpl()->frameView(); 2886 RefPtr<FrameView> view = mainFrameImpl()->frameView();
2881 if (!view) 2887 if (!view)
2882 return; 2888 return;
2883 2889
2884 WebSize layoutSize = m_size; 2890 WebSize layoutSize = m_size;
2885 2891
2886 if (settings()->viewportEnabled()) { 2892 if (settings()->viewportEnabled()) {
2887 layoutSize = flooredIntSize(m_pageScaleConstraintsSet.pageDefinedConstra ints().layoutSize); 2893 layoutSize = flooredIntSize(m_pageScaleConstraintsSet.pageDefinedConstra ints().layoutSize);
2888 2894
2889 bool textAutosizingEnabled = page()->settings().textAutosizingEnabled(); 2895 bool textAutosizingEnabled = page()->settings().textAutosizingEnabled();
2890 if (textAutosizingEnabled && layoutSize.width != view->layoutSize().widt h()) { 2896 if (textAutosizingEnabled && layoutSize.width != view->layoutSize().widt h()) {
2891 TextAutosizer* textAutosizer = page()->mainFrame()->document()->text Autosizer(); 2897 if (TextAutosizer* textAutosizer = page()->mainFrame()->document()-> textAutosizer())
2892 if (textAutosizer)
2893 textAutosizer->recalculateMultipliers(); 2898 textAutosizer->recalculateMultipliers();
2894 } 2899 }
2895 } 2900 }
2896 2901
2897 view->setLayoutSize(layoutSize); 2902 view->setLayoutSize(layoutSize);
2898 } 2903 }
2899 2904
2900 IntSize WebViewImpl::contentsSize() const 2905 IntSize WebViewImpl::contentsSize() const
2901 { 2906 {
2902 RenderView* root = page()->mainFrame()->contentRenderer(); 2907 RenderView* root = page()->mainFrame()->contentRenderer();
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after
3997 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4002 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
3998 4003
3999 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4004 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4000 return false; 4005 return false;
4001 4006
4002 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4007 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4003 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4008 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4004 } 4009 }
4005 4010
4006 } // namespace blink 4011 } // 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