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

Side by Side Diff: sky/engine/core/dom/Element.cpp

Issue 677223002: Remove some more frame-level scrolling machinery. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « no previous file | sky/engine/core/dom/TreeScope.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) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 return 0; 454 return 0;
455 } 455 }
456 456
457 int Element::scrollLeft() 457 int Element::scrollLeft()
458 { 458 {
459 document().updateLayoutIgnorePendingStylesheets(); 459 document().updateLayoutIgnorePendingStylesheets();
460 460
461 if (document().documentElement() != this) { 461 if (document().documentElement() != this) {
462 if (RenderBox* rend = renderBox()) 462 if (RenderBox* rend = renderBox())
463 return adjustDoubleForAbsoluteZoom(rend->scrollLeft(), *rend); 463 return adjustDoubleForAbsoluteZoom(rend->scrollLeft(), *rend);
464 return 0;
465 }
466
467 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) {
468 if (FrameView* view = document().view()) {
469 if (RenderView* renderView = document().renderView())
470 return adjustDoubleForAbsoluteZoom(view->scrollX(), *renderView) ;
471 }
472 } 464 }
473 465
474 return 0; 466 return 0;
475 } 467 }
476 468
477 int Element::scrollTop() 469 int Element::scrollTop()
478 { 470 {
479 document().updateLayoutIgnorePendingStylesheets(); 471 document().updateLayoutIgnorePendingStylesheets();
480 472
481 if (document().documentElement() != this) { 473 if (document().documentElement() != this) {
482 if (RenderBox* rend = renderBox()) 474 if (RenderBox* rend = renderBox())
483 return adjustLayoutUnitForAbsoluteZoom(rend->scrollTop(), *rend); 475 return adjustLayoutUnitForAbsoluteZoom(rend->scrollTop(), *rend);
484 return 0;
485 }
486
487 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) {
488 if (FrameView* view = document().view()) {
489 if (RenderView* renderView = document().renderView())
490 return adjustDoubleForAbsoluteZoom(view->scrollY(), *renderView) ;
491 }
492 } 476 }
493 477
494 return 0; 478 return 0;
495 } 479 }
496 480
497 void Element::setScrollLeft(int newLeft) 481 void Element::setScrollLeft(int newLeft)
498 { 482 {
499 document().updateLayoutIgnorePendingStylesheets(); 483 document().updateLayoutIgnorePendingStylesheets();
500 484
501 if (document().documentElement() != this) { 485 if (document().documentElement() != this) {
502 if (RenderBox* rend = renderBox()) 486 if (RenderBox* rend = renderBox())
503 rend->setScrollLeft(LayoutUnit::fromFloatRound(newLeft * rend->style ()->effectiveZoom())); 487 rend->setScrollLeft(LayoutUnit::fromFloatRound(newLeft * rend->style ()->effectiveZoom()));
504 return;
505 }
506
507 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) {
508 LocalFrame* frame = document().frame();
509 if (!frame)
510 return;
511 FrameView* view = frame->view();
512 if (!view)
513 return;
514
515 view->setScrollPosition(IntPoint(roundf(newLeft * frame->pageZoomFactor( )), view->scrollY()));
516 } 488 }
517 } 489 }
518 490
519 void Element::setScrollLeft(const Dictionary& scrollOptionsHorizontal, Exception State& exceptionState) 491 void Element::setScrollLeft(const Dictionary& scrollOptionsHorizontal, Exception State& exceptionState)
520 { 492 {
521 String scrollBehaviorString; 493 String scrollBehaviorString;
522 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; 494 ScrollBehavior scrollBehavior = ScrollBehaviorAuto;
523 if (DictionaryHelper::get(scrollOptionsHorizontal, "behavior", scrollBehavio rString)) { 495 if (DictionaryHelper::get(scrollOptionsHorizontal, "behavior", scrollBehavio rString)) {
524 if (!ScrollableArea::scrollBehaviorFromString(scrollBehaviorString, scro llBehavior)) { 496 if (!ScrollableArea::scrollBehaviorFromString(scrollBehaviorString, scro llBehavior)) {
525 exceptionState.throwTypeError("The ScrollBehavior provided is invali d."); 497 exceptionState.throwTypeError("The ScrollBehavior provided is invali d.");
(...skipping 11 matching lines...) Expand all
537 setScrollLeft(position); 509 setScrollLeft(position);
538 } 510 }
539 511
540 void Element::setScrollTop(int newTop) 512 void Element::setScrollTop(int newTop)
541 { 513 {
542 document().updateLayoutIgnorePendingStylesheets(); 514 document().updateLayoutIgnorePendingStylesheets();
543 515
544 if (document().documentElement() != this) { 516 if (document().documentElement() != this) {
545 if (RenderBox* rend = renderBox()) 517 if (RenderBox* rend = renderBox())
546 rend->setScrollTop(LayoutUnit::fromFloatRound(newTop * rend->style() ->effectiveZoom())); 518 rend->setScrollTop(LayoutUnit::fromFloatRound(newTop * rend->style() ->effectiveZoom()));
547 return;
548 }
549
550 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) {
551 LocalFrame* frame = document().frame();
552 if (!frame)
553 return;
554 FrameView* view = frame->view();
555 if (!view)
556 return;
557
558 view->setScrollPosition(IntPoint(view->scrollX(), roundf(newTop * frame- >pageZoomFactor())));
559 } 519 }
560 } 520 }
561 521
562 void Element::setScrollTop(const Dictionary& scrollOptionsVertical, ExceptionSta te& exceptionState) 522 void Element::setScrollTop(const Dictionary& scrollOptionsVertical, ExceptionSta te& exceptionState)
563 { 523 {
564 String scrollBehaviorString; 524 String scrollBehaviorString;
565 ScrollBehavior scrollBehavior = ScrollBehaviorAuto; 525 ScrollBehavior scrollBehavior = ScrollBehaviorAuto;
566 if (DictionaryHelper::get(scrollOptionsVertical, "behavior", scrollBehaviorS tring)) { 526 if (DictionaryHelper::get(scrollOptionsVertical, "behavior", scrollBehaviorS tring)) {
567 if (!ScrollableArea::scrollBehaviorFromString(scrollBehaviorString, scro llBehavior)) { 527 if (!ScrollableArea::scrollBehaviorFromString(scrollBehaviorString, scro llBehavior)) {
568 exceptionState.throwTypeError("The ScrollBehavior provided is invali d."); 528 exceptionState.throwTypeError("The ScrollBehavior provided is invali d.");
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after
2164 { 2124 {
2165 #if ENABLE(OILPAN) 2125 #if ENABLE(OILPAN)
2166 if (hasRareData()) 2126 if (hasRareData())
2167 visitor->trace(elementRareData()); 2127 visitor->trace(elementRareData());
2168 visitor->trace(m_elementData); 2128 visitor->trace(m_elementData);
2169 #endif 2129 #endif
2170 ContainerNode::trace(visitor); 2130 ContainerNode::trace(visitor);
2171 } 2131 }
2172 2132
2173 } // namespace blink 2133 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/dom/TreeScope.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698