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

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

Issue 882683003: Normalize top controls offset to (0, 1), Blink-side. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rename to shownratio Created 5 years, 10 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 | « Source/core/frame/FrameView.cpp ('k') | Source/web/WebViewImpl.cpp » ('j') | 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) 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 virtual void themeChanged() override; 113 virtual void themeChanged() override;
114 virtual bool handleInputEvent(const WebInputEvent&) override; 114 virtual bool handleInputEvent(const WebInputEvent&) override;
115 virtual void setCursorVisibilityState(bool isVisible) override; 115 virtual void setCursorVisibilityState(bool isVisible) override;
116 virtual bool hasTouchEventHandlersAt(const WebPoint&) override; 116 virtual bool hasTouchEventHandlersAt(const WebPoint&) override;
117 117
118 // FIXME(bokan): Old pinch path only - This should be removed once old pinch 118 // FIXME(bokan): Old pinch path only - This should be removed once old pinch
119 // is removed. 119 // is removed.
120 virtual void applyViewportDeltas( 120 virtual void applyViewportDeltas(
121 const WebSize& scrollDelta, 121 const WebSize& scrollDelta,
122 float pageScaleDelta, 122 float pageScaleDelta,
123 float topControlsDelta) override; 123 float topControlsShownRatioDelta) override;
124 virtual void applyViewportDeltas( 124 virtual void applyViewportDeltas(
125 const WebSize& pinchViewportDelta, 125 const WebSize& pinchViewportDelta,
126 const WebSize& mainFrameDelta, 126 const WebSize& mainFrameDelta,
127 const WebFloatSize& elasticOverscrollDelta, 127 const WebFloatSize& elasticOverscrollDelta,
128 float pageScaleDelta, 128 float pageScaleDelta,
129 float topControlsDelta) override; 129 float topControlsShownRatioDelta) override;
130 virtual void applyViewportDeltas( 130 virtual void applyViewportDeltas(
131 const WebFloatSize& pinchViewportDelta, 131 const WebFloatSize& pinchViewportDelta,
132 const WebFloatSize& mainFrameDelta, 132 const WebFloatSize& mainFrameDelta,
133 const WebFloatSize& elasticOverscrollDelta, 133 const WebFloatSize& elasticOverscrollDelta,
134 float pageScaleDelta, 134 float pageScaleDelta,
135 float topControlsDelta) override; 135 float topControlsShownRatioDelta) override;
136 virtual void mouseCaptureLost() override; 136 virtual void mouseCaptureLost() override;
137 virtual void setFocus(bool enable) override; 137 virtual void setFocus(bool enable) override;
138 virtual bool setComposition( 138 virtual bool setComposition(
139 const WebString& text, 139 const WebString& text,
140 const WebVector<WebCompositionUnderline>& underlines, 140 const WebVector<WebCompositionUnderline>& underlines,
141 int selectionStart, 141 int selectionStart,
142 int selectionEnd) override; 142 int selectionEnd) override;
143 virtual bool confirmComposition() override; 143 virtual bool confirmComposition() override;
144 virtual bool confirmComposition(ConfirmCompositionBehavior selectionBehavior ) override; 144 virtual bool confirmComposition(ConfirmCompositionBehavior selectionBehavior ) override;
145 virtual bool confirmComposition(const WebString& text) override; 145 virtual bool confirmComposition(const WebString& text) override;
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 // Exposed for tests. 508 // Exposed for tests.
509 WebVector<WebCompositionUnderline> compositionUnderlines() const; 509 WebVector<WebCompositionUnderline> compositionUnderlines() const;
510 510
511 WebLayerTreeView* layerTreeView() const { return m_layerTreeView; } 511 WebLayerTreeView* layerTreeView() const { return m_layerTreeView; }
512 512
513 bool pinchVirtualViewportEnabled() const; 513 bool pinchVirtualViewportEnabled() const;
514 514
515 bool matchesHeuristicsForGpuRasterizationForTesting() const { return m_match esHeuristicsForGpuRasterization; } 515 bool matchesHeuristicsForGpuRasterizationForTesting() const { return m_match esHeuristicsForGpuRasterization; }
516 516
517 virtual void setTopControlsLayoutHeight(float) override; 517 virtual void setTopControlsLayoutHeight(float) override;
518 virtual void setTopControlsHeight(float height, bool topControlsShrinkLayout Size) override;
518 519
519 virtual void forceNextWebGLContextCreationToFail() override; 520 virtual void forceNextWebGLContextCreationToFail() override;
520 521
521 IntSize mainFrameSize(); 522 IntSize mainFrameSize();
522 523
523 private: 524 private:
524 void didUpdateTopControls(); 525 void didUpdateTopControls();
525 void setTopControlsContentOffset(float); 526 void setTopControlsShownRatio(float);
526 527
527 // TODO(bokan): Remains for legacy pinch. Remove once it's gone. Made privat e to 528 // TODO(bokan): Remains for legacy pinch. Remove once it's gone. Made privat e to
528 // prevent external usage 529 // prevent external usage
529 virtual void setPageScaleFactor(float scaleFactor, const WebPoint& origin) o verride; 530 virtual void setPageScaleFactor(float scaleFactor, const WebPoint& origin) o verride;
530 void setPageScaleFactorAndLocation(float, const FloatPoint&); 531 void setPageScaleFactorAndLocation(float, const FloatPoint&);
531 532
532 void scrollAndRescaleViewports(float scaleFactor, const IntPoint& mainFrameO rigin, const FloatPoint& pinchViewportOrigin); 533 void scrollAndRescaleViewports(float scaleFactor, const IntPoint& mainFrameO rigin, const FloatPoint& pinchViewportOrigin);
533 534
534 IntRect visibleRectInDocument() const; 535 IntRect visibleRectInDocument() const;
535 536
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 bool m_showPaintRects; 750 bool m_showPaintRects;
750 bool m_showDebugBorders; 751 bool m_showDebugBorders;
751 bool m_continuousPaintingEnabled; 752 bool m_continuousPaintingEnabled;
752 bool m_showScrollBottleneckRects; 753 bool m_showScrollBottleneckRects;
753 WebColor m_baseBackgroundColor; 754 WebColor m_baseBackgroundColor;
754 WebColor m_backgroundColorOverride; 755 WebColor m_backgroundColorOverride;
755 float m_zoomFactorOverride; 756 float m_zoomFactorOverride;
756 757
757 bool m_userGestureObserved; 758 bool m_userGestureObserved;
758 759
759 // The top controls offset since the last compositor commit. 760 // The top controls shown amount (normalized from 0 to 1) since the last
760 float m_topControlsContentOffset; 761 // compositor commit.
762 float m_topControlsShownRatio;
761 763
762 // The top controls offset at the time of the last Resize event. This is the 764 float m_topControlsHeight;
763 // amount that the viewport was shrunk by to accomodate the top controls. 765 // If this is true, then the embedder shrunk the WebView size by the top
764 float m_topControlsLayoutHeight; 766 // controls height.
767 bool m_topControlsShrinkLayoutSize;
768
769 // If true, then top controls is normalized between 0 and 1; if false,
770 // then it's an absolute value.
771 // TODO(aelias): Delete this after Blink roll.
772 bool m_topControlsOffsetIsNormalized;
765 }; 773 };
766 774
767 DEFINE_TYPE_CASTS(WebViewImpl, WebWidget, widget, widget->isWebView(), widget.is WebView()); 775 DEFINE_TYPE_CASTS(WebViewImpl, WebWidget, widget, widget->isWebView(), widget.is WebView());
768 // We have no ways to check if the specified WebView is an instance of 776 // We have no ways to check if the specified WebView is an instance of
769 // WebViewImpl because WebViewImpl is the only implementation of WebView. 777 // WebViewImpl because WebViewImpl is the only implementation of WebView.
770 DEFINE_TYPE_CASTS(WebViewImpl, WebView, webView, true, true); 778 DEFINE_TYPE_CASTS(WebViewImpl, WebView, webView, true, true);
771 779
772 } // namespace blink 780 } // namespace blink
773 781
774 #endif 782 #endif
OLDNEW
« no previous file with comments | « Source/core/frame/FrameView.cpp ('k') | Source/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698