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

Side by Side Diff: third_party/WebKit/Source/core/frame/VisualViewport.cpp

Issue 2901203002: Rename VisualViewport properties to match updated spec (Closed)
Patch Set: Make methods const Created 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 VisualViewport::~VisualViewport() { 72 VisualViewport::~VisualViewport() {
73 SendUMAMetrics(); 73 SendUMAMetrics();
74 } 74 }
75 75
76 DEFINE_TRACE(VisualViewport) { 76 DEFINE_TRACE(VisualViewport) {
77 visitor->Trace(page_); 77 visitor->Trace(page_);
78 ScrollableArea::Trace(visitor); 78 ScrollableArea::Trace(visitor);
79 } 79 }
80 80
81 void VisualViewport::UpdateStyleAndLayoutIgnorePendingStylesheets() { 81 void VisualViewport::UpdateStyleAndLayoutIgnorePendingStylesheets() const {
82 if (!MainFrame()) 82 if (!MainFrame())
83 return; 83 return;
84 84
85 if (Document* document = MainFrame()->GetDocument()) 85 if (Document* document = MainFrame()->GetDocument())
86 document->UpdateStyleAndLayoutIgnorePendingStylesheets(); 86 document->UpdateStyleAndLayoutIgnorePendingStylesheets();
87 } 87 }
88 88
89 void VisualViewport::EnqueueScrollEvent() { 89 void VisualViewport::EnqueueScrollEvent() {
90 if (!RuntimeEnabledFeatures::visualViewportAPIEnabled()) 90 if (!RuntimeEnabledFeatures::visualViewportAPIEnabled())
91 return; 91 return;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 183 }
184 184
185 void VisualViewport::Move(const ScrollOffset& delta) { 185 void VisualViewport::Move(const ScrollOffset& delta) {
186 SetLocation(FloatPoint(offset_ + delta)); 186 SetLocation(FloatPoint(offset_ + delta));
187 } 187 }
188 188
189 void VisualViewport::SetScale(float scale) { 189 void VisualViewport::SetScale(float scale) {
190 SetScaleAndLocation(scale, FloatPoint(offset_)); 190 SetScaleAndLocation(scale, FloatPoint(offset_));
191 } 191 }
192 192
193 double VisualViewport::ScrollLeft() { 193 double VisualViewport::OffsetLeft() const {
194 if (!MainFrame()) 194 if (!MainFrame())
195 return 0; 195 return 0;
196 196
197 UpdateStyleAndLayoutIgnorePendingStylesheets(); 197 UpdateStyleAndLayoutIgnorePendingStylesheets();
198 198
199 return AdjustScrollForAbsoluteZoom(VisibleRect().X(), 199 return AdjustScrollForAbsoluteZoom(VisibleRect().X(),
200 MainFrame()->PageZoomFactor()); 200 MainFrame()->PageZoomFactor());
201 } 201 }
202 202
203 double VisualViewport::ScrollTop() { 203 double VisualViewport::OffsetTop() const {
204 if (!MainFrame()) 204 if (!MainFrame())
205 return 0; 205 return 0;
206 206
207 UpdateStyleAndLayoutIgnorePendingStylesheets(); 207 UpdateStyleAndLayoutIgnorePendingStylesheets();
208 208
209 return AdjustScrollForAbsoluteZoom(VisibleRect().Y(), 209 return AdjustScrollForAbsoluteZoom(VisibleRect().Y(),
210 MainFrame()->PageZoomFactor()); 210 MainFrame()->PageZoomFactor());
211 } 211 }
212 212
213 double VisualViewport::ClientWidth() { 213 double VisualViewport::Width() const {
214 if (!MainFrame()) 214 if (!MainFrame())
215 return 0; 215 return 0;
216 216
217 UpdateStyleAndLayoutIgnorePendingStylesheets(); 217 UpdateStyleAndLayoutIgnorePendingStylesheets();
218 218
219 float width = AdjustScrollForAbsoluteZoom(VisibleSize().Width(), 219 float width = AdjustScrollForAbsoluteZoom(VisibleSize().Width(),
220 MainFrame()->PageZoomFactor()); 220 MainFrame()->PageZoomFactor());
221 return width - MainFrame()->View()->VerticalScrollbarWidth() / scale_; 221 return width - MainFrame()->View()->VerticalScrollbarWidth() / scale_;
222 } 222 }
223 223
224 double VisualViewport::ClientHeight() { 224 double VisualViewport::Height() const {
225 if (!MainFrame()) 225 if (!MainFrame())
226 return 0; 226 return 0;
227 227
228 UpdateStyleAndLayoutIgnorePendingStylesheets(); 228 UpdateStyleAndLayoutIgnorePendingStylesheets();
229 229
230 float height = AdjustScrollForAbsoluteZoom(VisibleSize().Height(), 230 float height = AdjustScrollForAbsoluteZoom(VisibleSize().Height(),
231 MainFrame()->PageZoomFactor()); 231 MainFrame()->PageZoomFactor());
232 return height - MainFrame()->View()->HorizontalScrollbarHeight() / scale_; 232 return height - MainFrame()->View()->HorizontalScrollbarHeight() / scale_;
233 } 233 }
234 234
235 double VisualViewport::PageScale() { 235 double VisualViewport::ScaleForVisualViewport() const {
236 UpdateStyleAndLayoutIgnorePendingStylesheets(); 236 return Scale();
237
238 return scale_;
239 } 237 }
240 238
241 void VisualViewport::SetScaleAndLocation(float scale, 239 void VisualViewport::SetScaleAndLocation(float scale,
242 const FloatPoint& location) { 240 const FloatPoint& location) {
243 if (DidSetScaleOrLocation(scale, location)) 241 if (DidSetScaleOrLocation(scale, location))
244 NotifyRootFrameViewport(); 242 NotifyRootFrameViewport();
245 } 243 }
246 244
247 bool VisualViewport::DidSetScaleOrLocation(float scale, 245 bool VisualViewport::DidSetScaleOrLocation(float scale,
248 const FloatPoint& location) { 246 const FloatPoint& location) {
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 } else if (graphics_layer == root_transform_layer_.get()) { 856 } else if (graphics_layer == root_transform_layer_.get()) {
859 name = "Root Transform Layer"; 857 name = "Root Transform Layer";
860 } else { 858 } else {
861 NOTREACHED(); 859 NOTREACHED();
862 } 860 }
863 861
864 return name; 862 return name;
865 } 863 }
866 864
867 } // namespace blink 865 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/VisualViewport.h ('k') | third_party/WebKit/Source/core/frame/VisualViewport.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698