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 215503003: Reland text autosizing changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 2731 matching lines...) Expand 10 before | Expand all | Expand 10 after
2857 } 2858 }
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()); 2859 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());
2859 float newInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().i nitialScale; 2860 float newInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().i nitialScale;
2860 if (oldInitialScale != newInitialScale && newInitialScale != -1) { 2861 if (oldInitialScale != newInitialScale && newInitialScale != -1) {
2861 m_pageScaleConstraintsSet.setNeedsReset(true); 2862 m_pageScaleConstraintsSet.setNeedsReset(true);
2862 if (mainFrameImpl() && mainFrameImpl()->frameView()) 2863 if (mainFrameImpl() && mainFrameImpl()->frameView())
2863 mainFrameImpl()->frameView()->setNeedsLayout(); 2864 mainFrameImpl()->frameView()->setNeedsLayout();
2864 } 2865 }
2865 2866
2866 updateMainFrameLayoutSize(); 2867 updateMainFrameLayoutSize();
2868
2869 if (LocalFrame* frame = page()->mainFrame()) {
2870 if (FastTextAutosizer* textAutosizer = frame->document()->fastTextAutosi zer())
2871 textAutosizer->updatePageInfoInAllFrames();
2872 }
2867 } 2873 }
2868 2874
2869 void WebViewImpl::updateMainFrameLayoutSize() 2875 void WebViewImpl::updateMainFrameLayoutSize()
2870 { 2876 {
2871 if (m_fixedLayoutSizeLock || !mainFrameImpl()) 2877 if (m_fixedLayoutSizeLock || !mainFrameImpl())
2872 return; 2878 return;
2873 2879
2874 RefPtr<FrameView> view = mainFrameImpl()->frameView(); 2880 RefPtr<FrameView> view = mainFrameImpl()->frameView();
2875 if (!view) 2881 if (!view)
2876 return; 2882 return;
2877 2883
2878 WebSize layoutSize = m_size; 2884 WebSize layoutSize = m_size;
2879 2885
2880 if (settings()->viewportEnabled()) { 2886 if (settings()->viewportEnabled()) {
2881 layoutSize = flooredIntSize(m_pageScaleConstraintsSet.pageDefinedConstra ints().layoutSize); 2887 layoutSize = flooredIntSize(m_pageScaleConstraintsSet.pageDefinedConstra ints().layoutSize);
2882 2888
2883 bool textAutosizingEnabled = page()->settings().textAutosizingEnabled(); 2889 bool textAutosizingEnabled = page()->settings().textAutosizingEnabled();
2884 if (textAutosizingEnabled && layoutSize.width != view->layoutSize().widt h()) { 2890 if (textAutosizingEnabled && layoutSize.width != view->layoutSize().widt h()) {
2885 TextAutosizer* textAutosizer = page()->mainFrame()->document()->text Autosizer(); 2891 if (TextAutosizer* textAutosizer = page()->mainFrame()->document()-> textAutosizer())
2886 if (textAutosizer)
2887 textAutosizer->recalculateMultipliers(); 2892 textAutosizer->recalculateMultipliers();
2888 } 2893 }
2889 } 2894 }
2890 2895
2891 view->setLayoutSize(layoutSize); 2896 view->setLayoutSize(layoutSize);
2892 } 2897 }
2893 2898
2894 IntSize WebViewImpl::contentsSize() const 2899 IntSize WebViewImpl::contentsSize() const
2895 { 2900 {
2896 RenderView* root = page()->mainFrame()->contentRenderer(); 2901 RenderView* root = page()->mainFrame()->contentRenderer();
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after
4003 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4008 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4004 4009
4005 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4010 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4006 return false; 4011 return false;
4007 4012
4008 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4013 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4009 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4014 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4010 } 4015 }
4011 4016
4012 } // namespace blink 4017 } // namespace blink
OLDNEW
« Source/core/dom/Document.cpp ('K') | « Source/core/rendering/RenderBlock.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698