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

Side by Side Diff: Source/WebKit/chromium/src/WebViewImpl.h

Issue 14813025: Refactor viewport initialization logic out of WebViewImpl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address code review comments Created 7 years, 7 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 23 matching lines...) Expand all
34 #include "BackForwardClientImpl.h" 34 #include "BackForwardClientImpl.h"
35 #include "ChromeClientImpl.h" 35 #include "ChromeClientImpl.h"
36 #include "ContextMenuClientImpl.h" 36 #include "ContextMenuClientImpl.h"
37 #include "DragClientImpl.h" 37 #include "DragClientImpl.h"
38 #include "EditorClientImpl.h" 38 #include "EditorClientImpl.h"
39 #include "InspectorClientImpl.h" 39 #include "InspectorClientImpl.h"
40 #include "NotificationPresenterImpl.h" 40 #include "NotificationPresenterImpl.h"
41 #include "PageOverlayList.h" 41 #include "PageOverlayList.h"
42 #include "PageWidgetDelegate.h" 42 #include "PageWidgetDelegate.h"
43 #include "UserMediaClientImpl.h" 43 #include "UserMediaClientImpl.h"
44 #include "ViewportAttributesManager.h"
44 #include "WebInputEvent.h" 45 #include "WebInputEvent.h"
45 #include "WebNavigationPolicy.h" 46 #include "WebNavigationPolicy.h"
46 #include "WebView.h" 47 #include "WebView.h"
47 #include "WebViewBenchmarkSupportImpl.h" 48 #include "WebViewBenchmarkSupportImpl.h"
48 #include "core/page/PagePopupDriver.h" 49 #include "core/page/PagePopupDriver.h"
49 #include "core/platform/graphics/FloatSize.h" 50 #include "core/platform/graphics/FloatSize.h"
50 #include "core/platform/graphics/GraphicsContext3D.h" 51 #include "core/platform/graphics/GraphicsContext3D.h"
51 #include "core/platform/graphics/GraphicsLayer.h" 52 #include "core/platform/graphics/GraphicsLayer.h"
52 #include "core/platform/graphics/IntPoint.h" 53 #include "core/platform/graphics/IntPoint.h"
53 #include "core/platform/graphics/IntRect.h" 54 #include "core/platform/graphics/IntRect.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 virtual void scrollFocusedNodeIntoView(); 220 virtual void scrollFocusedNodeIntoView();
220 virtual void scrollFocusedNodeIntoRect(const WebRect&); 221 virtual void scrollFocusedNodeIntoRect(const WebRect&);
221 virtual void zoomToFindInPageRect(const WebRect&); 222 virtual void zoomToFindInPageRect(const WebRect&);
222 virtual void advanceFocus(bool reverse); 223 virtual void advanceFocus(bool reverse);
223 virtual double zoomLevel(); 224 virtual double zoomLevel();
224 virtual double setZoomLevel(bool textOnly, double zoomLevel); 225 virtual double setZoomLevel(bool textOnly, double zoomLevel);
225 virtual void zoomLimitsChanged(double minimumZoomLevel, 226 virtual void zoomLimitsChanged(double minimumZoomLevel,
226 double maximumZoomLevel); 227 double maximumZoomLevel);
227 virtual void setInitialPageScaleOverride(float); 228 virtual void setInitialPageScaleOverride(float);
228 virtual float pageScaleFactor() const; 229 virtual float pageScaleFactor() const;
229 virtual bool isPageScaleFactorSet() const;
230 virtual void setPageScaleFactorPreservingScrollOffset(float); 230 virtual void setPageScaleFactorPreservingScrollOffset(float);
231 virtual void setPageScaleFactor(float scaleFactor, const WebPoint& origin); 231 virtual void setPageScaleFactor(float scaleFactor, const WebPoint& origin);
232 virtual void setPageScaleFactorLimits(float minPageScale, float maxPageScale ); 232 virtual void setPageScaleFactorLimits(float minPageScale, float maxPageScale );
233 virtual float minimumPageScaleFactor() const; 233 virtual float minimumPageScaleFactor() const;
234 virtual float maximumPageScaleFactor() const; 234 virtual float maximumPageScaleFactor() const;
235 virtual void saveScrollAndScaleState(); 235 virtual void saveScrollAndScaleState();
236 virtual void restoreScrollAndScaleState(); 236 virtual void restoreScrollAndScaleState();
237 virtual void resetScrollAndScaleState(); 237 virtual void resetScrollAndScaleState();
238 virtual void setIgnoreViewportTagMaximumScale(bool); 238 virtual void setIgnoreViewportTagScaleLimits(bool);
239 239
240 virtual float deviceScaleFactor() const; 240 virtual float deviceScaleFactor() const;
241 virtual void setDeviceScaleFactor(float); 241 virtual void setDeviceScaleFactor(float);
242 virtual bool isFixedLayoutModeEnabled() const; 242 virtual bool isFixedLayoutModeEnabled() const;
243 virtual void enableFixedLayoutMode(bool enable); 243 virtual void enableFixedLayoutMode(bool enable);
244 virtual WebSize fixedLayoutSize() const; 244 virtual WebSize fixedLayoutSize() const;
245 virtual void setFixedLayoutSize(const WebSize&); 245 virtual void setFixedLayoutSize(const WebSize&);
246 virtual void enableAutoResizeMode( 246 virtual void enableAutoResizeMode(
247 const WebSize& minSize, 247 const WebSize& minSize,
248 const WebSize& maxSize); 248 const WebSize& maxSize);
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 // (may not be 1 in the device metrics emulation mode). 459 // (may not be 1 in the device metrics emulation mode).
460 void setEmulatedTextZoomFactor(float); 460 void setEmulatedTextZoomFactor(float);
461 461
462 // Returns the emulated text zoom factor 462 // Returns the emulated text zoom factor
463 // (which may not be 1 in the device metrics emulation mode). 463 // (which may not be 1 in the device metrics emulation mode).
464 float emulatedTextZoomFactor() const 464 float emulatedTextZoomFactor() const
465 { 465 {
466 return m_emulatedTextZoomFactor; 466 return m_emulatedTextZoomFactor;
467 } 467 }
468 468
469 void setInitialPageScaleFactor(float initialPageScaleFactor) { m_initialPage ScaleFactor = initialPageScaleFactor; } 469 void updatePageDefinedViewportConstraints(const WebCore::ViewportArguments&) ;
470 bool ignoreViewportTagMaximumScale() const { return m_ignoreViewportTagMaxim umScale; }
471 470
472 // Determines whether a page should e.g. be opened in a background tab. 471 // Determines whether a page should e.g. be opened in a background tab.
473 // Returns false if it has no opinion, in which case it doesn't set *policy. 472 // Returns false if it has no opinion, in which case it doesn't set *policy.
474 static bool navigationPolicyFromMouseEvent( 473 static bool navigationPolicyFromMouseEvent(
475 unsigned short button, 474 unsigned short button,
476 bool ctrl, 475 bool ctrl,
477 bool shift, 476 bool shift,
478 bool alt, 477 bool alt,
479 bool meta, 478 bool meta,
480 WebNavigationPolicy*); 479 WebNavigationPolicy*);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 // Heuristic-based function for determining if we should disable workarounds 586 // Heuristic-based function for determining if we should disable workarounds
588 // for viewing websites that are not optimized for mobile devices. 587 // for viewing websites that are not optimized for mobile devices.
589 bool shouldDisableDesktopWorkarounds(); 588 bool shouldDisableDesktopWorkarounds();
590 589
591 // Exposed for tests. 590 // Exposed for tests.
592 LinkHighlight* linkHighlight() { return m_linkHighlight.get(); } 591 LinkHighlight* linkHighlight() { return m_linkHighlight.get(); }
593 592
594 WebSettingsImpl* settingsImpl(); 593 WebSettingsImpl* settingsImpl();
595 594
596 private: 595 private:
597 void computePageScaleFactorLimits(); 596 void refreshPageScaleFactorAfterLayout();
598 float clampPageScaleFactorToLimits(float scale); 597 void setUserAgentViewportConstraints(WebCore::ViewportAttributes newConstrai nts);
599 WebCore::IntPoint clampOffsetAtScale(const WebCore::IntPoint& offset, float scale) const; 598 float clampPageScaleFactorToLimits(float) const;
599 WebCore::IntPoint clampOffsetAtScale(const WebCore::IntPoint& offset, float scale);
600 WebCore::IntSize contentsSize() const; 600 WebCore::IntSize contentsSize() const;
601 601
602 void resetSavedScrollAndScaleState(); 602 void resetSavedScrollAndScaleState();
603 603
604 void updateMainFrameScrollPosition(const WebCore::IntPoint& scrollPosition, bool programmaticScroll); 604 void updateMainFrameScrollPosition(const WebCore::IntPoint& scrollPosition, bool programmaticScroll);
605 605
606 friend class WebView; // So WebView::Create can call our constructor 606 friend class WebView; // So WebView::Create can call our constructor
607 friend class WTF::RefCounted<WebViewImpl>; 607 friend class WTF::RefCounted<WebViewImpl>;
608 friend void setCurrentInputEventForTest(const WebInputEvent*); 608 friend void setCurrentInputEventForTest(const WebInputEvent*);
609 609
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 WebPoint m_lastMouseDownPoint; 719 WebPoint m_lastMouseDownPoint;
720 720
721 // Keeps track of the current zoom level. 0 means no zoom, positive numbers 721 // Keeps track of the current zoom level. 0 means no zoom, positive numbers
722 // mean zoom in, negative numbers mean zoom out. 722 // mean zoom in, negative numbers mean zoom out.
723 double m_zoomLevel; 723 double m_zoomLevel;
724 724
725 double m_minimumZoomLevel; 725 double m_minimumZoomLevel;
726 726
727 double m_maximumZoomLevel; 727 double m_maximumZoomLevel;
728 728
729 // State related to the page scale 729 ViewportAttributesManager m_viewportAttributesManager;
730 float m_pageDefinedMinimumPageScaleFactor;
731 float m_pageDefinedMaximumPageScaleFactor;
732 float m_minimumPageScaleFactor;
733 float m_maximumPageScaleFactor;
734 float m_initialPageScaleFactorOverride;
735 float m_initialPageScaleFactor;
736 bool m_ignoreViewportTagMaximumScale;
737 bool m_pageScaleFactorIsSet;
abarth-chromium 2013/05/13 18:22:24 Thank you!!
738 730
739 // Saved page scale state. 731 // Saved page scale state.
740 float m_savedPageScaleFactor; // 0 means that no page scale factor is saved. 732 float m_savedPageScaleFactor; // 0 means that no page scale factor is saved.
741 WebCore::IntSize m_savedScrollOffset; 733 WebCore::IntSize m_savedScrollOffset;
742 734
743 // The scale moved to by the latest double tap zoom, if any. 735 // The scale moved to by the latest double tap zoom, if any.
744 float m_doubleTapZoomPageScaleFactor; 736 float m_doubleTapZoomPageScaleFactor;
745 // Have we sent a double-tap zoom and not yet heard back the scale? 737 // Have we sent a double-tap zoom and not yet heard back the scale?
746 bool m_doubleTapZoomPending; 738 bool m_doubleTapZoomPending;
747 739
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 862
871 bool m_showFPSCounter; 863 bool m_showFPSCounter;
872 bool m_showPaintRects; 864 bool m_showPaintRects;
873 bool m_showDebugBorders; 865 bool m_showDebugBorders;
874 bool m_continuousPaintingEnabled; 866 bool m_continuousPaintingEnabled;
875 }; 867 };
876 868
877 } // namespace WebKit 869 } // namespace WebKit
878 870
879 #endif 871 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698