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

Side by Side Diff: Source/core/frame/TopControls.cpp

Issue 945233002: Oilpan: fix build after r190610 (214ee03e). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: adjust const position 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/frame/TopControls.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 // Copyright 2015 The Chromium Authors. All rights reserved.
2 * Copyright (C) 2015 Google Inc. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be
3 * 3 // found in the LICENSE file.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25 4
26 #include "config.h" 5 #include "config.h"
27 #include "TopControls.h" 6 #include "TopControls.h"
28 7
29 #include "core/frame/FrameHost.h" 8 #include "core/frame/FrameHost.h"
30 #include "core/page/Chrome.h" 9 #include "core/page/Chrome.h"
31 #include "core/page/ChromeClient.h" 10 #include "core/page/ChromeClient.h"
32 #include "platform/geometry/FloatSize.h" 11 #include "platform/geometry/FloatSize.h"
33 #include <algorithm> // for std::min and std::max 12 #include <algorithm> // for std::min and std::max
34 13
35 namespace blink { 14 namespace blink {
36 15
37 TopControls::TopControls(const FrameHost& frameHost) 16 TopControls::TopControls(const FrameHost& frameHost)
38 : m_frameHost(frameHost) 17 : m_frameHost(&frameHost)
39 , m_height(0) 18 , m_height(0)
40 , m_shownRatio(0) 19 , m_shownRatio(0)
41 , m_baselineContentOffset(0) 20 , m_baselineContentOffset(0)
42 , m_accumulatedScrollDelta(0) 21 , m_accumulatedScrollDelta(0)
43 , m_shrinkViewport(false) 22 , m_shrinkViewport(false)
44 , m_permittedState(WebTopControlsBoth) 23 , m_permittedState(WebTopControlsBoth)
45 { 24 {
46 } 25 }
47 26
27 TopControls::~TopControls()
28 {
29 }
30
31 void TopControls::trace(Visitor* visitor)
32 {
33 visitor->trace(m_frameHost);
34 }
35
48 void TopControls::scrollBegin() 36 void TopControls::scrollBegin()
49 { 37 {
50 resetBaseline(); 38 resetBaseline();
51 } 39 }
52 40
53 FloatSize TopControls::scrollBy(FloatSize pendingDelta) 41 FloatSize TopControls::scrollBy(FloatSize pendingDelta)
54 { 42 {
55 if ((m_permittedState == WebTopControlsShown && pendingDelta.height() < 0) | | (m_permittedState == WebTopControlsHidden && pendingDelta.height() > 0)) 43 if ((m_permittedState == WebTopControlsShown && pendingDelta.height() < 0) | | (m_permittedState == WebTopControlsHidden && pendingDelta.height() > 0))
56 return pendingDelta; 44 return pendingDelta;
57 45
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 78
91 void TopControls::setShownRatio(float shownRatio) 79 void TopControls::setShownRatio(float shownRatio)
92 { 80 {
93 shownRatio = std::min(shownRatio, 1.f); 81 shownRatio = std::min(shownRatio, 1.f);
94 shownRatio = std::max(shownRatio, 0.f); 82 shownRatio = std::max(shownRatio, 0.f);
95 83
96 if (m_shownRatio == shownRatio) 84 if (m_shownRatio == shownRatio)
97 return; 85 return;
98 86
99 m_shownRatio = shownRatio; 87 m_shownRatio = shownRatio;
100 m_frameHost.chrome().client().didUpdateTopControls(); 88 m_frameHost->chrome().client().didUpdateTopControls();
101 } 89 }
102 90
103 void TopControls::updateConstraints(WebTopControlsState constraints) 91 void TopControls::updateConstraints(WebTopControlsState constraints)
104 { 92 {
105 m_permittedState = constraints; 93 m_permittedState = constraints;
106 } 94 }
107 95
108 void TopControls::setHeight(float height, bool shrinkViewport) 96 void TopControls::setHeight(float height, bool shrinkViewport)
109 { 97 {
110 if (m_height == height && m_shrinkViewport == shrinkViewport) 98 if (m_height == height && m_shrinkViewport == shrinkViewport)
111 return; 99 return;
112 100
113 m_height = height; 101 m_height = height;
114 m_shrinkViewport = shrinkViewport; 102 m_shrinkViewport = shrinkViewport;
115 m_frameHost.chrome().client().didUpdateTopControls(); 103 m_frameHost->chrome().client().didUpdateTopControls();
116 } 104 }
117 105
118 } // namespace blink 106 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/TopControls.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698