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 660133005: Widen GPU trigger condition (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git/+/master
Patch Set: Created 6 years, 2 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 | « no previous file | 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 3233 matching lines...) Expand 10 before | Expand all | Expand 10 after
3244 view->layout(); 3244 view->layout();
3245 } 3245 }
3246 3246
3247 void WebViewImpl::updatePageDefinedViewportConstraints(const ViewportDescription & description) 3247 void WebViewImpl::updatePageDefinedViewportConstraints(const ViewportDescription & description)
3248 { 3248 {
3249 if (!settings()->viewportEnabled() || !page() || (!m_size.width && !m_size.h eight) || !page()->mainFrame()->isLocalFrame()) 3249 if (!settings()->viewportEnabled() || !page() || (!m_size.width && !m_size.h eight) || !page()->mainFrame()->isLocalFrame())
3250 return; 3250 return;
3251 3251
3252 Document* document = page()->deprecatedLocalMainFrame()->document(); 3252 Document* document = page()->deprecatedLocalMainFrame()->document();
3253 3253
3254 m_matchesHeuristicsForGpuRasterization = description.maxWidth == Length(Devi ceWidth)
3255 && description.minZoom == 1.0
3256 && description.minZoomIsExplicit;
3257 if (m_layerTreeView)
3258 m_layerTreeView->heuristicsForGpuRasterizationUpdated(m_matchesHeuristic sForGpuRasterization);
3259
3260 Length defaultMinWidth = document->viewportDefaultMinWidth(); 3254 Length defaultMinWidth = document->viewportDefaultMinWidth();
3261 if (defaultMinWidth.isAuto()) 3255 if (defaultMinWidth.isAuto())
3262 defaultMinWidth = Length(ExtendToZoom); 3256 defaultMinWidth = Length(ExtendToZoom);
3263 3257
3264 ViewportDescription adjustedDescription = description; 3258 ViewportDescription adjustedDescription = description;
3265 if (settingsImpl()->viewportMetaLayoutSizeQuirk() && adjustedDescription.typ e == ViewportDescription::ViewportMeta) { 3259 if (settingsImpl()->viewportMetaLayoutSizeQuirk() && adjustedDescription.typ e == ViewportDescription::ViewportMeta) {
3266 const int legacyWidthSnappingMagicNumber = 320; 3260 const int legacyWidthSnappingMagicNumber = 320;
3267 if (adjustedDescription.maxWidth.isFixed() && adjustedDescription.maxWid th.value() <= legacyWidthSnappingMagicNumber) 3261 if (adjustedDescription.maxWidth.isFixed() && adjustedDescription.maxWid th.value() <= legacyWidthSnappingMagicNumber)
3268 adjustedDescription.maxWidth = Length(DeviceWidth); 3262 adjustedDescription.maxWidth = Length(DeviceWidth);
3269 if (adjustedDescription.maxHeight.isFixed() && adjustedDescription.maxHe ight.value() <= m_size.height) 3263 if (adjustedDescription.maxHeight.isFixed() && adjustedDescription.maxHe ight.value() <= m_size.height)
3270 adjustedDescription.maxHeight = Length(DeviceHeight); 3264 adjustedDescription.maxHeight = Length(DeviceHeight);
3271 adjustedDescription.minWidth = adjustedDescription.maxWidth; 3265 adjustedDescription.minWidth = adjustedDescription.maxWidth;
3272 adjustedDescription.minHeight = adjustedDescription.maxHeight; 3266 adjustedDescription.minHeight = adjustedDescription.maxHeight;
3273 } 3267 }
3274 3268
3275 float oldInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().i nitialScale; 3269 float oldInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().i nitialScale;
3276 m_pageScaleConstraintsSet.updatePageDefinedConstraints(adjustedDescription, defaultMinWidth); 3270 m_pageScaleConstraintsSet.updatePageDefinedConstraints(adjustedDescription, defaultMinWidth);
3277 3271
3278 if (settingsImpl()->clobberUserAgentInitialScaleQuirk() 3272 if (settingsImpl()->clobberUserAgentInitialScaleQuirk()
3279 && m_pageScaleConstraintsSet.userAgentConstraints().initialScale != -1 3273 && m_pageScaleConstraintsSet.userAgentConstraints().initialScale != -1
3280 && m_pageScaleConstraintsSet.userAgentConstraints().initialScale * devic eScaleFactor() <= 1) { 3274 && m_pageScaleConstraintsSet.userAgentConstraints().initialScale * devic eScaleFactor() <= 1) {
3281 if (description.maxWidth == Length(DeviceWidth) 3275 if (description.maxWidth == Length(DeviceWidth)
3282 || (description.maxWidth.type() == Auto && m_pageScaleConstraintsSet .pageDefinedConstraints().initialScale == 1.0f)) 3276 || (description.maxWidth.type() == Auto && m_pageScaleConstraintsSet .pageDefinedConstraints().initialScale == 1.0f))
3283 setInitialPageScaleOverride(-1); 3277 setInitialPageScaleOverride(-1);
3284 } 3278 }
3285 3279
3280 m_matchesHeuristicsForGpuRasterization = description.maxWidth == Length(Devi ceWidth)
3281 && (m_pageScaleConstraintsSet.pageDefinedConstraints().minimumScale >= 1 .0
3282 || (!description.userZoom && m_pageScaleConstraintsSet.pageDefinedCo nstraints().initialScale >= 1.0));
3283 if (m_layerTreeView)
3284 m_layerTreeView->heuristicsForGpuRasterizationUpdated(m_matchesHeuristic sForGpuRasterization);
3285
ajuma 2014/10/21 17:40:03 I understand the motivation of using the resolved
3286 m_pageScaleConstraintsSet.adjustForAndroidWebViewQuirks(adjustedDescription, defaultMinWidth.intValue(), deviceScaleFactor(), settingsImpl()->supportDepreca tedTargetDensityDPI(), page()->settings().wideViewportQuirkEnabled(), page()->se ttings().useWideViewport(), page()->settings().loadWithOverviewMode(), settingsI mpl()->viewportMetaNonUserScalableQuirk()); 3286 m_pageScaleConstraintsSet.adjustForAndroidWebViewQuirks(adjustedDescription, defaultMinWidth.intValue(), deviceScaleFactor(), settingsImpl()->supportDepreca tedTargetDensityDPI(), page()->settings().wideViewportQuirkEnabled(), page()->se ttings().useWideViewport(), page()->settings().loadWithOverviewMode(), settingsI mpl()->viewportMetaNonUserScalableQuirk());
3287 float newInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().i nitialScale; 3287 float newInitialScale = m_pageScaleConstraintsSet.pageDefinedConstraints().i nitialScale;
3288 if (oldInitialScale != newInitialScale && newInitialScale != -1) { 3288 if (oldInitialScale != newInitialScale && newInitialScale != -1) {
3289 m_pageScaleConstraintsSet.setNeedsReset(true); 3289 m_pageScaleConstraintsSet.setNeedsReset(true);
3290 if (mainFrameImpl() && mainFrameImpl()->frameView()) 3290 if (mainFrameImpl() && mainFrameImpl()->frameView())
3291 mainFrameImpl()->frameView()->setNeedsLayout(); 3291 mainFrameImpl()->frameView()->setNeedsLayout();
3292 } 3292 }
3293 3293
3294 updateMainFrameLayoutSize(); 3294 updateMainFrameLayoutSize();
3295 3295
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after
4466 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4466 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4467 4467
4468 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4468 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4469 return false; 4469 return false;
4470 4470
4471 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4471 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4472 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4472 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4473 } 4473 }
4474 4474
4475 } // namespace blink 4475 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698