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

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

Issue 1787913002: Clear page-defined constraints when viewportEnabled setting becomes false. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address nit Created 4 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 | « third_party/WebKit/Source/web/WebViewImpl.h ('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 3292 matching lines...) Expand 10 before | Expand all | Expand 10 after
3303 3303
3304 void WebViewImpl::updatePageDefinedViewportConstraints(const ViewportDescription & description) 3304 void WebViewImpl::updatePageDefinedViewportConstraints(const ViewportDescription & description)
3305 { 3305 {
3306 // If we're not reading the viewport meta tag, allow GPU rasterization. 3306 // If we're not reading the viewport meta tag, allow GPU rasterization.
3307 if (!settingsImpl()->viewportMetaEnabled()) { 3307 if (!settingsImpl()->viewportMetaEnabled()) {
3308 m_matchesHeuristicsForGpuRasterization = true; 3308 m_matchesHeuristicsForGpuRasterization = true;
3309 if (m_layerTreeView) 3309 if (m_layerTreeView)
3310 m_layerTreeView->heuristicsForGpuRasterizationUpdated(m_matchesHeuri sticsForGpuRasterization); 3310 m_layerTreeView->heuristicsForGpuRasterizationUpdated(m_matchesHeuri sticsForGpuRasterization);
3311 } 3311 }
3312 3312
3313 if (!settings()->viewportEnabled() || !page() || (!m_size.width && !m_size.h eight) || !page()->mainFrame()->isLocalFrame()) 3313 if (!page() || (!m_size.width && !m_size.height) || !page()->mainFrame()->is LocalFrame())
3314 return; 3314 return;
3315 3315
3316 if (!settings()->viewportEnabled()) {
3317 pageScaleConstraintsSet().clearPageDefinedConstraints();
3318 updateMainFrameLayoutSize();
3319 return;
3320 }
3321
3316 Document* document = page()->deprecatedLocalMainFrame()->document(); 3322 Document* document = page()->deprecatedLocalMainFrame()->document();
3317 3323
3318 m_matchesHeuristicsForGpuRasterization = description.matchesHeuristicsForGpu Rasterization(); 3324 m_matchesHeuristicsForGpuRasterization = description.matchesHeuristicsForGpu Rasterization();
3319 if (m_layerTreeView) 3325 if (m_layerTreeView)
3320 m_layerTreeView->heuristicsForGpuRasterizationUpdated(m_matchesHeuristic sForGpuRasterization); 3326 m_layerTreeView->heuristicsForGpuRasterizationUpdated(m_matchesHeuristic sForGpuRasterization);
3321 3327
3322 Length defaultMinWidth = document->viewportDefaultMinWidth(); 3328 Length defaultMinWidth = document->viewportDefaultMinWidth();
3323 if (defaultMinWidth.isAuto()) 3329 if (defaultMinWidth.isAuto())
3324 defaultMinWidth = Length(ExtendToZoom); 3330 defaultMinWidth = Length(ExtendToZoom);
3325 3331
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
3406 3412
3407 Document* document = m_page->mainFrame()->isLocalFrame() ? m_page->deprecate dLocalMainFrame()->document() : nullptr; 3413 Document* document = m_page->mainFrame()->isLocalFrame() ? m_page->deprecate dLocalMainFrame()->document() : nullptr;
3408 if (!document || !document->layoutView() || !document->documentElement() || !document->documentElement()->layoutBox()) 3414 if (!document || !document->layoutView() || !document->documentElement() || !document->documentElement()->layoutBox())
3409 return WebSize(); 3415 return WebSize();
3410 3416
3411 int widthScaled = document->layoutView()->minPreferredLogicalWidth().round() ; // Already accounts for zoom. 3417 int widthScaled = document->layoutView()->minPreferredLogicalWidth().round() ; // Already accounts for zoom.
3412 int heightScaled = document->documentElement()->layoutBox()->scrollHeight(). round(); 3418 int heightScaled = document->documentElement()->layoutBox()->scrollHeight(). round();
3413 return IntSize(widthScaled, heightScaled); 3419 return IntSize(widthScaled, heightScaled);
3414 } 3420 }
3415 3421
3416 void WebViewImpl::enableViewport()
3417 {
3418 settings()->setViewportEnabled(true);
3419 }
3420
3421 void WebViewImpl::disableViewport()
3422 {
3423 settings()->setViewportEnabled(false);
3424 pageScaleConstraintsSet().clearPageDefinedConstraints();
3425 updateMainFrameLayoutSize();
3426 }
3427
3428 float WebViewImpl::defaultMinimumPageScaleFactor() const 3422 float WebViewImpl::defaultMinimumPageScaleFactor() const
3429 { 3423 {
3430 return pageScaleConstraintsSet().defaultConstraints().minimumScale; 3424 return pageScaleConstraintsSet().defaultConstraints().minimumScale;
3431 } 3425 }
3432 3426
3433 float WebViewImpl::defaultMaximumPageScaleFactor() const 3427 float WebViewImpl::defaultMaximumPageScaleFactor() const
3434 { 3428 {
3435 return pageScaleConstraintsSet().defaultConstraints().maximumScale; 3429 return pageScaleConstraintsSet().defaultConstraints().maximumScale;
3436 } 3430 }
3437 3431
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
4575 { 4569 {
4576 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than 4570 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than
4577 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. 4571 // page's scale factor, which can be 1 in use-zoom-for-dsf mode.
4578 if (!page()) 4572 if (!page())
4579 return 1; 4573 return 1;
4580 4574
4581 return page()->deviceScaleFactor(); 4575 return page()->deviceScaleFactor();
4582 } 4576 }
4583 4577
4584 } // namespace blink 4578 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698