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

Side by Side Diff: Source/core/html/HTMLBodyElement.cpp

Issue 134443003: Implement CSSOM Smooth Scroll API (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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/html/HTMLBodyElement.h ('k') | Source/core/page/PageAnimator.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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Simon Hausmann (hausmann@kde.org) 4 * (C) 2000 Simon Hausmann (hausmann@kde.org)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 if (render->hasOverflowClip()) 232 if (render->hasOverflowClip())
233 return adjustForAbsoluteZoom(render->scrollLeft(), render); 233 return adjustForAbsoluteZoom(render->scrollLeft(), render);
234 if (!document.inQuirksMode()) 234 if (!document.inQuirksMode())
235 return 0; 235 return 0;
236 } 236 }
237 237
238 FrameView* view = document.view(); 238 FrameView* view = document.view();
239 return view ? adjustForZoom(view->scrollX(), &document) : 0; 239 return view ? adjustForZoom(view->scrollX(), &document) : 0;
240 } 240 }
241 241
242 void HTMLBodyElement::setScrollLeft(int scrollLeft) 242 void HTMLBodyElement::setScrollLeftInternal(int scrollLeft, ScrollBehavior scrol lBehavior)
243 { 243 {
244 Document& document = this->document(); 244 Document& document = this->document();
245 document.updateLayoutIgnorePendingStylesheets(); 245 document.updateLayoutIgnorePendingStylesheets();
246 246
247 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { 247 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) {
248 RenderBox* render = renderBox(); 248 RenderBox* render = renderBox();
249 if (!render) 249 if (!render)
250 return; 250 return;
251 if (render->hasOverflowClip()) { 251 if (render->hasOverflowClip()) {
252 // FIXME: Investigate how are other browsers casting to int (roundin g, ceiling, ...). 252 // FIXME: Investigate how are other browsers casting to int (roundin g, ceiling, ...).
253 render->setScrollLeft(static_cast<int>(scrollLeft * render->style()- >effectiveZoom())); 253 render->setScrollLeft(static_cast<int>(scrollLeft * render->style()- >effectiveZoom()), scrollBehavior);
254 return; 254 return;
255 } 255 }
256 if (!document.inQuirksMode()) 256 if (!document.inQuirksMode())
257 return; 257 return;
258 } 258 }
259 259
260 LocalFrame* frame = document.frame(); 260 LocalFrame* frame = document.frame();
261 if (!frame) 261 if (!frame)
262 return; 262 return;
263 FrameView* view = frame->view(); 263 FrameView* view = frame->view();
264 if (!view) 264 if (!view)
265 return; 265 return;
266 view->setScrollPosition(IntPoint(static_cast<int>(scrollLeft * frame->pageZo omFactor()), view->scrollY())); 266 view->setScrollPosition(IntPoint(static_cast<int>(scrollLeft * frame->pageZo omFactor()), view->scrollY()), scrollBehavior);
267 } 267 }
268 268
269 int HTMLBodyElement::scrollTop() 269 int HTMLBodyElement::scrollTop()
270 { 270 {
271 Document& document = this->document(); 271 Document& document = this->document();
272 document.updateLayoutIgnorePendingStylesheets(); 272 document.updateLayoutIgnorePendingStylesheets();
273 273
274 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { 274 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) {
275 RenderBox* render = renderBox(); 275 RenderBox* render = renderBox();
276 if (!render) 276 if (!render)
277 return 0; 277 return 0;
278 if (render->hasOverflowClip()) 278 if (render->hasOverflowClip())
279 return adjustForAbsoluteZoom(render->scrollTop(), render); 279 return adjustForAbsoluteZoom(render->scrollTop(), render);
280 if (!document.inQuirksMode()) 280 if (!document.inQuirksMode())
281 return 0; 281 return 0;
282 } 282 }
283 283
284 FrameView* view = document.view(); 284 FrameView* view = document.view();
285 return view ? adjustForZoom(view->scrollY(), &document) : 0; 285 return view ? adjustForZoom(view->scrollY(), &document) : 0;
286 } 286 }
287 287
288 void HTMLBodyElement::setScrollTop(int scrollTop) 288 void HTMLBodyElement::setScrollTopInternal(int scrollTop, ScrollBehavior scrollB ehavior)
289 { 289 {
290 Document& document = this->document(); 290 Document& document = this->document();
291 document.updateLayoutIgnorePendingStylesheets(); 291 document.updateLayoutIgnorePendingStylesheets();
292 292
293 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { 293 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) {
294 RenderBox* render = renderBox(); 294 RenderBox* render = renderBox();
295 if (!render) 295 if (!render)
296 return; 296 return;
297 if (render->hasOverflowClip()) { 297 if (render->hasOverflowClip()) {
298 // FIXME: Investigate how are other browsers casting to int (roundin g, ceiling, ...). 298 // FIXME: Investigate how are other browsers casting to int (roundin g, ceiling, ...).
299 render->setScrollTop(static_cast<int>(scrollTop * render->style()->e ffectiveZoom())); 299 render->setScrollTop(static_cast<int>(scrollTop * render->style()->e ffectiveZoom()), scrollBehavior);
300 return; 300 return;
301 } 301 }
302 if (!document.inQuirksMode()) 302 if (!document.inQuirksMode())
303 return; 303 return;
304 } 304 }
305 305
306 LocalFrame* frame = document.frame(); 306 LocalFrame* frame = document.frame();
307 if (!frame) 307 if (!frame)
308 return; 308 return;
309 FrameView* view = frame->view(); 309 FrameView* view = frame->view();
310 if (!view) 310 if (!view)
311 return; 311 return;
312 view->setScrollPosition(IntPoint(view->scrollX(), static_cast<int>(scrollTop * frame->pageZoomFactor()))); 312 view->setScrollPosition(IntPoint(view->scrollX(), static_cast<int>(scrollTop * frame->pageZoomFactor())), scrollBehavior);
313 } 313 }
314 314
315 int HTMLBodyElement::scrollHeight() 315 int HTMLBodyElement::scrollHeight()
316 { 316 {
317 // Update the document's layout. 317 // Update the document's layout.
318 Document& document = this->document(); 318 Document& document = this->document();
319 document.updateLayoutIgnorePendingStylesheets(); 319 document.updateLayoutIgnorePendingStylesheets();
320 FrameView* view = document.view(); 320 FrameView* view = document.view();
321 return view ? adjustForZoom(view->contentsHeight(), &document) : 0; 321 return view ? adjustForZoom(view->contentsHeight(), &document) : 0;
322 } 322 }
323 323
324 int HTMLBodyElement::scrollWidth() 324 int HTMLBodyElement::scrollWidth()
325 { 325 {
326 // Update the document's layout. 326 // Update the document's layout.
327 Document& document = this->document(); 327 Document& document = this->document();
328 document.updateLayoutIgnorePendingStylesheets(); 328 document.updateLayoutIgnorePendingStylesheets();
329 FrameView* view = document.view(); 329 FrameView* view = document.view();
330 return view ? adjustForZoom(view->contentsWidth(), &document) : 0; 330 return view ? adjustForZoom(view->contentsWidth(), &document) : 0;
331 } 331 }
332 332
333 } // namespace WebCore 333 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/HTMLBodyElement.h ('k') | Source/core/page/PageAnimator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698