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

Side by Side Diff: third_party/WebKit/Source/platform/scroll/Scrollbar.cpp

Issue 1486743002: Clean up some remaining obsolete coordinate-space naming. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Mac compile Created 5 years 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) 2004, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 || m_hoveredPart != NoPart) 329 || m_hoveredPart != NoPart)
330 setNeedsPaintInvalidation(); 330 setNeedsPaintInvalidation();
331 m_pressedPart = part; 331 m_pressedPart = part;
332 } 332 }
333 333
334 bool Scrollbar::gestureEvent(const PlatformGestureEvent& evt) 334 bool Scrollbar::gestureEvent(const PlatformGestureEvent& evt)
335 { 335 {
336 switch (evt.type()) { 336 switch (evt.type()) {
337 case PlatformEvent::GestureTapDown: 337 case PlatformEvent::GestureTapDown:
338 setPressedPart(theme()->hitTest(this, evt.position())); 338 setPressedPart(theme()->hitTest(this, evt.position()));
339 m_pressedPos = orientation() == HorizontalScrollbar ? convertFromContain ingWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y(); 339 m_pressedPos = orientation() == HorizontalScrollbar ? convertFromRootFra me(evt.position()).x() : convertFromRootFrame(evt.position()).y();
340 return true; 340 return true;
341 case PlatformEvent::GestureTapDownCancel: 341 case PlatformEvent::GestureTapDownCancel:
342 case PlatformEvent::GestureScrollBegin: 342 case PlatformEvent::GestureScrollBegin:
343 if (m_pressedPart != ThumbPart) 343 if (m_pressedPart != ThumbPart)
344 return false; 344 return false;
345 m_scrollPos = m_pressedPos; 345 m_scrollPos = m_pressedPos;
346 return true; 346 return true;
347 case PlatformEvent::GestureScrollUpdate: 347 case PlatformEvent::GestureScrollUpdate:
348 if (m_pressedPart != ThumbPart) 348 if (m_pressedPart != ThumbPart)
349 return false; 349 return false;
(...skipping 24 matching lines...) Expand all
374 } 374 }
375 375
376 void Scrollbar::mouseMoved(const PlatformMouseEvent& evt) 376 void Scrollbar::mouseMoved(const PlatformMouseEvent& evt)
377 { 377 {
378 if (m_pressedPart == ThumbPart) { 378 if (m_pressedPart == ThumbPart) {
379 if (theme()->shouldSnapBackToDragOrigin(this, evt)) { 379 if (theme()->shouldSnapBackToDragOrigin(this, evt)) {
380 if (m_scrollableArea) { 380 if (m_scrollableArea) {
381 m_scrollableArea->setScrollPositionSingleAxis(m_orientation, m_d ragOrigin + m_scrollableArea->minimumScrollPosition(m_orientation), UserScroll); 381 m_scrollableArea->setScrollPositionSingleAxis(m_orientation, m_d ragOrigin + m_scrollableArea->minimumScrollPosition(m_orientation), UserScroll);
382 } 382 }
383 } else { 383 } else {
384 moveThumb(m_orientation == HorizontalScrollbar ? 384 moveThumb(m_orientation == HorizontalScrollbar
385 convertFromContainingWindow(evt.position()).x() : 385 ? convertFromRootFrame(evt.position()).x()
386 convertFromContainingWindow(evt.position()).y(), theme()-> shouldDragDocumentInsteadOfThumb(this, evt)); 386 : convertFromRootFrame(evt.position()).y(), theme()->shouldDragD ocumentInsteadOfThumb(this, evt));
387 } 387 }
388 return; 388 return;
389 } 389 }
390 390
391 if (m_pressedPart != NoPart) 391 if (m_pressedPart != NoPart)
392 m_pressedPos = orientation() == HorizontalScrollbar ? convertFromContain ingWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y(); 392 m_pressedPos = orientation() == HorizontalScrollbar ? convertFromRootFra me(evt.position()).x() : convertFromRootFrame(evt.position()).y();
393 393
394 ScrollbarPart part = theme()->hitTest(this, evt.position()); 394 ScrollbarPart part = theme()->hitTest(this, evt.position());
395 if (part != m_hoveredPart) { 395 if (part != m_hoveredPart) {
396 if (m_pressedPart != NoPart) { 396 if (m_pressedPart != NoPart) {
397 if (part == m_pressedPart) { 397 if (part == m_pressedPart) {
398 // The mouse is moving back over the pressed part. We 398 // The mouse is moving back over the pressed part. We
399 // need to start up the timer action again. 399 // need to start up the timer action again.
400 startTimerIfNeeded(theme()->autoscrollTimerDelay()); 400 startTimerIfNeeded(theme()->autoscrollTimerDelay());
401 setNeedsPaintInvalidation(); 401 setNeedsPaintInvalidation();
402 } else if (m_hoveredPart == m_pressedPart) { 402 } else if (m_hoveredPart == m_pressedPart) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 } 442 }
443 } 443 }
444 444
445 void Scrollbar::mouseDown(const PlatformMouseEvent& evt) 445 void Scrollbar::mouseDown(const PlatformMouseEvent& evt)
446 { 446 {
447 // Early exit for right click 447 // Early exit for right click
448 if (evt.button() == RightButton) 448 if (evt.button() == RightButton)
449 return; 449 return;
450 450
451 setPressedPart(theme()->hitTest(this, evt.position())); 451 setPressedPart(theme()->hitTest(this, evt.position()));
452 int pressedPos = orientation() == HorizontalScrollbar ? convertFromContainin gWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y(); 452 int pressedPos = orientation() == HorizontalScrollbar ? convertFromRootFrame (evt.position()).x() : convertFromRootFrame(evt.position()).y();
453 453
454 if ((m_pressedPart == BackTrackPart || m_pressedPart == ForwardTrackPart) && theme()->shouldCenterOnThumb(this, evt)) { 454 if ((m_pressedPart == BackTrackPart || m_pressedPart == ForwardTrackPart) && theme()->shouldCenterOnThumb(this, evt)) {
455 setHoveredPart(ThumbPart); 455 setHoveredPart(ThumbPart);
456 setPressedPart(ThumbPart); 456 setPressedPart(ThumbPart);
457 m_dragOrigin = m_currentPos; 457 m_dragOrigin = m_currentPos;
458 int thumbLen = theme()->thumbLength(this); 458 int thumbLen = theme()->thumbLength(this);
459 int desiredPos = pressedPos; 459 int desiredPos = pressedPos;
460 // Set the pressed position to the middle of the thumb so that when we d o the move, the delta 460 // Set the pressed position to the middle of the thumb so that when we d o the move, the delta
461 // will be from the current pixel position of the thumb to the new desir ed position for the thumb. 461 // will be from the current pixel position of the thumb to the new desir ed position for the thumb.
462 m_pressedPos = theme()->trackPosition(this) + theme()->thumbPosition(thi s) + thumbLen / 2; 462 m_pressedPos = theme()->trackPosition(this) + theme()->thumbPosition(thi s) + thumbLen / 2;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 invalidate(); 511 invalidate();
512 } 512 }
513 #endif 513 #endif
514 } 514 }
515 515
516 bool Scrollbar::isWindowActive() const 516 bool Scrollbar::isWindowActive() const
517 { 517 {
518 return m_scrollableArea && m_scrollableArea->isActive(); 518 return m_scrollableArea && m_scrollableArea->isActive();
519 } 519 }
520 520
521 IntRect Scrollbar::convertToContainingView(const IntRect& localRect) const 521 IntRect Scrollbar::convertToContainingWidget(const IntRect& localRect) const
522 { 522 {
523 if (m_scrollableArea) 523 if (m_scrollableArea)
524 return m_scrollableArea->convertFromScrollbarToContainingView(this, loca lRect); 524 return m_scrollableArea->convertFromScrollbarToContainingWidget(this, lo calRect);
525 525
526 return Widget::convertToContainingView(localRect); 526 return Widget::convertToContainingWidget(localRect);
527 } 527 }
528 528
529 IntRect Scrollbar::convertFromContainingView(const IntRect& parentRect) const 529 IntRect Scrollbar::convertFromContainingWidget(const IntRect& parentRect) const
530 { 530 {
531 if (m_scrollableArea) 531 if (m_scrollableArea)
532 return m_scrollableArea->convertFromContainingViewToScrollbar(this, pare ntRect); 532 return m_scrollableArea->convertFromContainingWidgetToScrollbar(this, pa rentRect);
533 533
534 return Widget::convertFromContainingView(parentRect); 534 return Widget::convertFromContainingWidget(parentRect);
535 } 535 }
536 536
537 IntPoint Scrollbar::convertToContainingView(const IntPoint& localPoint) const 537 IntPoint Scrollbar::convertToContainingWidget(const IntPoint& localPoint) const
538 { 538 {
539 if (m_scrollableArea) 539 if (m_scrollableArea)
540 return m_scrollableArea->convertFromScrollbarToContainingView(this, loca lPoint); 540 return m_scrollableArea->convertFromScrollbarToContainingWidget(this, lo calPoint);
541 541
542 return Widget::convertToContainingView(localPoint); 542 return Widget::convertToContainingWidget(localPoint);
543 } 543 }
544 544
545 IntPoint Scrollbar::convertFromContainingView(const IntPoint& parentPoint) const 545 IntPoint Scrollbar::convertFromContainingWidget(const IntPoint& parentPoint) con st
546 { 546 {
547 if (m_scrollableArea) 547 if (m_scrollableArea)
548 return m_scrollableArea->convertFromContainingViewToScrollbar(this, pare ntPoint); 548 return m_scrollableArea->convertFromContainingWidgetToScrollbar(this, pa rentPoint);
549 549
550 return Widget::convertFromContainingView(parentPoint); 550 return Widget::convertFromContainingWidget(parentPoint);
551 } 551 }
552 552
553 float Scrollbar::scrollableAreaCurrentPos() const 553 float Scrollbar::scrollableAreaCurrentPos() const
554 { 554 {
555 if (!m_scrollableArea) 555 if (!m_scrollableArea)
556 return 0; 556 return 0;
557 557
558 if (m_orientation == HorizontalScrollbar) 558 if (m_orientation == HorizontalScrollbar)
559 return m_scrollableArea->scrollPosition().x() - m_scrollableArea->minimu mScrollPosition().x(); 559 return m_scrollableArea->scrollPosition().x() - m_scrollableArea->minimu mScrollPosition().x();
560 560
561 return m_scrollableArea->scrollPosition().y() - m_scrollableArea->minimumScr ollPosition().y(); 561 return m_scrollableArea->scrollPosition().y() - m_scrollableArea->minimumScr ollPosition().y();
562 } 562 }
563 563
564 void Scrollbar::setNeedsPaintInvalidation() 564 void Scrollbar::setNeedsPaintInvalidation()
565 { 565 {
566 if (m_theme->shouldRepaintAllPartsOnInvalidation()) { 566 if (m_theme->shouldRepaintAllPartsOnInvalidation()) {
567 m_trackNeedsRepaint = true; 567 m_trackNeedsRepaint = true;
568 m_thumbNeedsRepaint = true; 568 m_thumbNeedsRepaint = true;
569 } 569 }
570 if (m_scrollableArea) 570 if (m_scrollableArea)
571 m_scrollableArea->setScrollbarNeedsPaintInvalidation(this); 571 m_scrollableArea->setScrollbarNeedsPaintInvalidation(this);
572 } 572 }
573 573
574 } // namespace blink 574 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/scroll/Scrollbar.h ('k') | third_party/WebKit/Source/platform/scroll/ScrollbarTheme.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698