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

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

Issue 23441020: Make it possibe to lock the fixedLayoutSize (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 , m_autofillClient(0) 372 , m_autofillClient(0)
373 , m_permissionClient(0) 373 , m_permissionClient(0)
374 , m_spellCheckClient(0) 374 , m_spellCheckClient(0)
375 , m_passwordGeneratorClient(0) 375 , m_passwordGeneratorClient(0)
376 , m_chromeClientImpl(this) 376 , m_chromeClientImpl(this)
377 , m_contextMenuClientImpl(this) 377 , m_contextMenuClientImpl(this)
378 , m_dragClientImpl(this) 378 , m_dragClientImpl(this)
379 , m_editorClientImpl(this) 379 , m_editorClientImpl(this)
380 , m_inspectorClientImpl(this) 380 , m_inspectorClientImpl(this)
381 , m_backForwardClientImpl(this) 381 , m_backForwardClientImpl(this)
382 , m_forceFixedLayoutSizeToEqualSize(false)
382 , m_shouldAutoResize(false) 383 , m_shouldAutoResize(false)
383 , m_observedNewNavigation(false) 384 , m_observedNewNavigation(false)
384 #ifndef NDEBUG 385 #ifndef NDEBUG
385 , m_newNavigationLoader(0) 386 , m_newNavigationLoader(0)
386 #endif 387 #endif
387 , m_zoomLevel(0) 388 , m_zoomLevel(0)
388 , m_minimumZoomLevel(zoomFactorToZoomLevel(minTextSizeMultiplier)) 389 , m_minimumZoomLevel(zoomFactorToZoomLevel(minTextSizeMultiplier))
389 , m_maximumZoomLevel(zoomFactorToZoomLevel(maxTextSizeMultiplier)) 390 , m_maximumZoomLevel(zoomFactorToZoomLevel(maxTextSizeMultiplier))
390 , m_savedPageScaleFactor(0) 391 , m_savedPageScaleFactor(0)
391 , m_doubleTapZoomPageScaleFactor(0) 392 , m_doubleTapZoomPageScaleFactor(0)
(...skipping 2610 matching lines...) Expand 10 before | Expand all | Expand 10 after
3002 m_pageScaleConstraintsSet.updatePageDefinedConstraints(arguments, m_size, pa ge()->settings().layoutFallbackWidth()); 3003 m_pageScaleConstraintsSet.updatePageDefinedConstraints(arguments, m_size, pa ge()->settings().layoutFallbackWidth());
3003 3004
3004 if (settingsImpl()->supportDeprecatedTargetDensityDPI()) 3005 if (settingsImpl()->supportDeprecatedTargetDensityDPI())
3005 m_pageScaleConstraintsSet.adjustPageDefinedConstraintsForAndroidWebView( arguments, m_size, page()->settings().layoutFallbackWidth(), deviceScaleFactor() , page()->settings().useWideViewport(), page()->settings().loadWithOverviewMode( )); 3006 m_pageScaleConstraintsSet.adjustPageDefinedConstraintsForAndroidWebView( arguments, m_size, page()->settings().layoutFallbackWidth(), deviceScaleFactor() , page()->settings().useWideViewport(), page()->settings().loadWithOverviewMode( ));
3006 3007
3007 WebSize layoutSize = flooredIntSize(m_pageScaleConstraintsSet.pageDefinedCon straints().layoutSize); 3008 WebSize layoutSize = flooredIntSize(m_pageScaleConstraintsSet.pageDefinedCon straints().layoutSize);
3008 3009
3009 if (page()->settings().textAutosizingEnabled() && page()->mainFrame() && lay outSize.width != fixedLayoutSize().width) 3010 if (page()->settings().textAutosizingEnabled() && page()->mainFrame() && lay outSize.width != fixedLayoutSize().width)
3010 page()->mainFrame()->document()->textAutosizer()->recalculateMultipliers (); 3011 page()->mainFrame()->document()->textAutosizer()->recalculateMultipliers ();
3011 3012
3012 setFixedLayoutSize(layoutSize); 3013 if (!m_shouldAutoResize)
3014 setFixedLayoutSize(layoutSize);
3013 } 3015 }
3014 3016
3015 IntSize WebViewImpl::contentsSize() const 3017 IntSize WebViewImpl::contentsSize() const
3016 { 3018 {
3017 RenderView* root = page()->mainFrame()->contentRenderer(); 3019 RenderView* root = page()->mainFrame()->contentRenderer();
3018 if (!root) 3020 if (!root)
3019 return IntSize(); 3021 return IntSize();
3020 return root->documentRect().size(); 3022 return root->documentRect().size();
3021 } 3023 }
3022 3024
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
3094 3096
3095 void WebViewImpl::setFixedLayoutSize(const WebSize& layoutSize) 3097 void WebViewImpl::setFixedLayoutSize(const WebSize& layoutSize)
3096 { 3098 {
3097 if (!page()) 3099 if (!page())
3098 return; 3100 return;
3099 3101
3100 Frame* frame = page()->mainFrame(); 3102 Frame* frame = page()->mainFrame();
3101 if (!frame || !frame->view()) 3103 if (!frame || !frame->view())
3102 return; 3104 return;
3103 3105
3104 frame->view()->setFixedLayoutSize(layoutSize); 3106 if (m_forceFixedLayoutSizeToEqualSize)
3107 frame->view()->setFixedLayoutSize(m_size);
3108 else
3109 frame->view()->setFixedLayoutSize(layoutSize);
3110
3111 }
3112
3113 void WebViewImpl::setForceFixedLayoutSizeToEqualSize(bool value)
3114 {
3115 m_forceFixedLayoutSizeToEqualSize = value;
3105 } 3116 }
3106 3117
3107 void WebViewImpl::performMediaPlayerAction(const WebMediaPlayerAction& action, 3118 void WebViewImpl::performMediaPlayerAction(const WebMediaPlayerAction& action,
3108 const WebPoint& location) 3119 const WebPoint& location)
3109 { 3120 {
3110 HitTestResult result = hitTestResultForWindowPos(location); 3121 HitTestResult result = hitTestResultForWindowPos(location);
3111 RefPtr<Node> node = result.innerNonSharedNode(); 3122 RefPtr<Node> node = result.innerNonSharedNode();
3112 if (!isHTMLVideoElement(node.get()) && !node->hasTagName(HTMLNames::audioTag )) 3123 if (!isHTMLVideoElement(node.get()) && !node->hasTagName(HTMLNames::audioTag ))
3113 return; 3124 return;
3114 3125
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
3644 // that means it's time to start producing frames again so un-defer. 3655 // that means it's time to start producing frames again so un-defer.
3645 if (m_layerTreeView) 3656 if (m_layerTreeView)
3646 m_layerTreeView->setDeferCommits(false); 3657 m_layerTreeView->setDeferCommits(false);
3647 m_layerTreeViewCommitsDeferred = false; 3658 m_layerTreeViewCommitsDeferred = false;
3648 } 3659 }
3649 3660
3650 if (m_shouldAutoResize && mainFrameImpl()->frame() && mainFrameImpl()->frame ()->view()) { 3661 if (m_shouldAutoResize && mainFrameImpl()->frame() && mainFrameImpl()->frame ()->view()) {
3651 WebSize frameSize = mainFrameImpl()->frame()->view()->frameRect().size() ; 3662 WebSize frameSize = mainFrameImpl()->frame()->view()->frameRect().size() ;
3652 if (frameSize != m_size) { 3663 if (frameSize != m_size) {
3653 m_size = frameSize; 3664 m_size = frameSize;
3654 m_client->didAutoResize(m_size); 3665 if (!m_forceFixedLayoutSizeToEqualSize)
mkosiba (inactive) 2013/08/30 18:25:09 the reason for this is that it causes RenderWidget
aelias_OOO_until_Jul13 2013/08/31 03:45:04 Could you explain why that's wrong? Is it because
mkosiba (inactive) 2013/09/02 11:28:58 Page scale mostly. My concern is that this ends up
3666 m_client->didAutoResize(m_size);
3655 sendResizeEventAndRepaint(); 3667 sendResizeEventAndRepaint();
3656 } 3668 }
3657 } 3669 }
3658 3670
3659 if (m_pageScaleConstraintsSet.constraintsDirty()) 3671 if (m_pageScaleConstraintsSet.constraintsDirty())
3660 refreshPageScaleFactorAfterLayout(); 3672 refreshPageScaleFactorAfterLayout();
3661 3673
3662 m_client->didUpdateLayout(); 3674 m_client->didUpdateLayout();
3663 } 3675 }
3664 3676
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
4117 } 4129 }
4118 4130
4119 bool WebViewImpl::shouldDisableDesktopWorkarounds() 4131 bool WebViewImpl::shouldDisableDesktopWorkarounds()
4120 { 4132 {
4121 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments(); 4133 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments();
4122 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom 4134 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom
4123 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto); 4135 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto);
4124 } 4136 }
4125 4137
4126 } // namespace WebKit 4138 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698