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

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: Fix segfault in unit test. 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
« 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 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 2730 matching lines...) Expand 10 before | Expand all | Expand 10 after
2856 } 2857 }
2857 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()); 2858 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());
2858 float newInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().i nitialScale; 2859 float newInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().i nitialScale;
2859 if (oldInitialScale != newInitialScale && newInitialScale != -1) { 2860 if (oldInitialScale != newInitialScale && newInitialScale != -1) {
2860 m_pageScaleConstraintsSet.setNeedsReset(true); 2861 m_pageScaleConstraintsSet.setNeedsReset(true);
2861 if (mainFrameImpl() && mainFrameImpl()->frameView()) 2862 if (mainFrameImpl() && mainFrameImpl()->frameView())
2862 mainFrameImpl()->frameView()->setNeedsLayout(); 2863 mainFrameImpl()->frameView()->setNeedsLayout();
2863 } 2864 }
2864 2865
2865 updateMainFrameLayoutSize(); 2866 updateMainFrameLayoutSize();
2867
2868 if (LocalFrame* frame = page()->mainFrame()) {
2869 if (FastTextAutosizer* textAutosizer = frame->document()->fastTextAutosi zer())
2870 textAutosizer->updatePageInfoInAllFrames();
2871 }
2866 } 2872 }
2867 2873
2868 void WebViewImpl::updateMainFrameLayoutSize() 2874 void WebViewImpl::updateMainFrameLayoutSize()
2869 { 2875 {
2870 if (m_fixedLayoutSizeLock || !mainFrameImpl()) 2876 if (m_fixedLayoutSizeLock || !mainFrameImpl())
2871 return; 2877 return;
2872 2878
2873 RefPtr<FrameView> view = mainFrameImpl()->frameView(); 2879 RefPtr<FrameView> view = mainFrameImpl()->frameView();
2874 if (!view) 2880 if (!view)
2875 return; 2881 return;
2876 2882
2877 WebSize layoutSize = m_size; 2883 WebSize layoutSize = m_size;
2878 2884
2879 if (settings()->viewportEnabled()) { 2885 if (settings()->viewportEnabled()) {
2880 layoutSize = flooredIntSize(m_pageScaleConstraintsSet.pageDefinedConstra ints().layoutSize); 2886 layoutSize = flooredIntSize(m_pageScaleConstraintsSet.pageDefinedConstra ints().layoutSize);
2881 2887
2882 bool textAutosizingEnabled = page()->settings().textAutosizingEnabled(); 2888 bool textAutosizingEnabled = page()->settings().textAutosizingEnabled();
2883 if (textAutosizingEnabled && layoutSize.width != view->layoutSize().widt h()) { 2889 if (textAutosizingEnabled && layoutSize.width != view->layoutSize().widt h()) {
2884 TextAutosizer* textAutosizer = page()->mainFrame()->document()->text Autosizer(); 2890 if (TextAutosizer* textAutosizer = page()->mainFrame()->document()-> textAutosizer())
2885 if (textAutosizer)
2886 textAutosizer->recalculateMultipliers(); 2891 textAutosizer->recalculateMultipliers();
2887 } 2892 }
2888 } 2893 }
2889 2894
2890 view->setLayoutSize(layoutSize); 2895 view->setLayoutSize(layoutSize);
2891 } 2896 }
2892 2897
2893 IntSize WebViewImpl::contentsSize() const 2898 IntSize WebViewImpl::contentsSize() const
2894 { 2899 {
2895 RenderView* root = page()->mainFrame()->contentRenderer(); 2900 RenderView* root = page()->mainFrame()->contentRenderer();
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after
3990 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 3995 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
3991 3996
3992 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 3997 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
3993 return false; 3998 return false;
3994 3999
3995 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4000 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
3996 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4001 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
3997 } 4002 }
3998 4003
3999 } // namespace blink 4004 } // 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