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

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

Issue 2478463003: Revert of Implement overlay scrollbar fade out for non-composited scrollers. (Closed)
Patch Set: Created 4 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
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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 m_scrollableArea->mouseEnteredScrollbar(*this); 455 m_scrollableArea->mouseEnteredScrollbar(*this);
456 } 456 }
457 457
458 void Scrollbar::mouseExited() { 458 void Scrollbar::mouseExited() {
459 if (m_scrollableArea) 459 if (m_scrollableArea)
460 m_scrollableArea->mouseExitedScrollbar(*this); 460 m_scrollableArea->mouseExitedScrollbar(*this);
461 setHoveredPart(NoPart); 461 setHoveredPart(NoPart);
462 } 462 }
463 463
464 void Scrollbar::mouseUp(const PlatformMouseEvent& mouseEvent) { 464 void Scrollbar::mouseUp(const PlatformMouseEvent& mouseEvent) {
465 bool isCaptured = m_pressedPart == ThumbPart;
466 setPressedPart(NoPart); 465 setPressedPart(NoPart);
467 m_pressedPos = 0; 466 m_pressedPos = 0;
468 m_draggingDocument = false; 467 m_draggingDocument = false;
469 stopTimerIfNeeded(); 468 stopTimerIfNeeded();
470 469
471 if (m_scrollableArea) { 470 if (m_scrollableArea) {
472 if (isCaptured)
473 m_scrollableArea->mouseReleasedScrollbar();
474
475 // m_hoveredPart won't be updated until the next mouseMoved or mouseDown, so 471 // m_hoveredPart won't be updated until the next mouseMoved or mouseDown, so
476 // we have to hit test to really know if the mouse has exited the scrollbar 472 // we have to hit test to really know if the mouse has exited the scrollbar
477 // on a mouseUp. 473 // on a mouseUp.
478 ScrollbarPart part = theme().hitTest(*this, mouseEvent.position()); 474 ScrollbarPart part = theme().hitTest(*this, mouseEvent.position());
479 if (part == NoPart) 475 if (part == NoPart)
480 m_scrollableArea->mouseExitedScrollbar(*this); 476 m_scrollableArea->mouseExitedScrollbar(*this);
481 } 477 }
482 } 478 }
483 479
484 void Scrollbar::mouseDown(const PlatformMouseEvent& evt) { 480 void Scrollbar::mouseDown(const PlatformMouseEvent& evt) {
(...skipping 14 matching lines...) Expand all
499 int thumbLen = theme().thumbLength(*this); 495 int thumbLen = theme().thumbLength(*this);
500 int desiredPos = pressedPos; 496 int desiredPos = pressedPos;
501 // Set the pressed position to the middle of the thumb so that when we do 497 // Set the pressed position to the middle of the thumb so that when we do
502 // the move, the delta will be from the current pixel position of the thumb 498 // the move, the delta will be from the current pixel position of the thumb
503 // to the new desired position for the thumb. 499 // to the new desired position for the thumb.
504 m_pressedPos = theme().trackPosition(*this) + theme().thumbPosition(*this) + 500 m_pressedPos = theme().trackPosition(*this) + theme().thumbPosition(*this) +
505 thumbLen / 2; 501 thumbLen / 2;
506 moveThumb(desiredPos); 502 moveThumb(desiredPos);
507 return; 503 return;
508 } 504 }
509 if (m_pressedPart == ThumbPart) { 505 if (m_pressedPart == ThumbPart)
510 m_dragOrigin = m_currentPos; 506 m_dragOrigin = m_currentPos;
511 if (m_scrollableArea)
512 m_scrollableArea->mouseCapturedScrollbar();
513 }
514 507
515 m_pressedPos = pressedPos; 508 m_pressedPos = pressedPos;
516 509
517 autoscrollPressedPart(theme().initialAutoscrollTimerDelay()); 510 autoscrollPressedPart(theme().initialAutoscrollTimerDelay());
518 } 511 }
519 512
520 void Scrollbar::setScrollbarsHidden(bool hidden) { 513 void Scrollbar::visibilityChanged() {
521 if (m_scrollableArea) 514 if (m_scrollableArea)
522 m_scrollableArea->setScrollbarsHidden(hidden); 515 m_scrollableArea->scrollbarVisibilityChanged();
523 } 516 }
524 517
525 void Scrollbar::setEnabled(bool e) { 518 void Scrollbar::setEnabled(bool e) {
526 if (m_enabled == e) 519 if (m_enabled == e)
527 return; 520 return;
528 m_enabled = e; 521 m_enabled = e;
529 theme().updateEnabledState(*this); 522 theme().updateEnabledState(*this);
530 setNeedsPaintInvalidation(AllParts); 523 setNeedsPaintInvalidation(AllParts);
531 } 524 }
532 525
533 int Scrollbar::scrollbarThickness() const { 526 int Scrollbar::scrollbarThickness() const {
534 int thickness = orientation() == HorizontalScrollbar ? height() : width(); 527 int thickness = orientation() == HorizontalScrollbar ? height() : width();
535 if (!thickness || !m_hostWindow) 528 if (!thickness || !m_hostWindow)
536 return thickness; 529 return thickness;
537 return m_hostWindow->windowToViewportScalar(m_themeScrollbarThickness); 530 return m_hostWindow->windowToViewportScalar(m_themeScrollbarThickness);
538 } 531 }
539 532
540 bool Scrollbar::isOverlayScrollbar() const { 533 bool Scrollbar::isOverlayScrollbar() const {
541 return m_theme.usesOverlayScrollbars(); 534 return m_theme.usesOverlayScrollbars();
542 } 535 }
543 536
544 bool Scrollbar::shouldParticipateInHitTesting() { 537 bool Scrollbar::shouldParticipateInHitTesting() {
545 // Non-overlay scrollbars should always participate in hit testing. 538 // Non-overlay scrollbars should always participate in hit testing.
546 if (!isOverlayScrollbar()) 539 if (!isOverlayScrollbar())
547 return true; 540 return true;
548 return !m_scrollableArea->scrollbarsHidden(); 541 return m_scrollableArea->scrollAnimator()
542 .shouldScrollbarParticipateInHitTesting(*this);
549 } 543 }
550 544
551 bool Scrollbar::isWindowActive() const { 545 bool Scrollbar::isWindowActive() const {
552 return m_scrollableArea && m_scrollableArea->isActive(); 546 return m_scrollableArea && m_scrollableArea->isActive();
553 } 547 }
554 548
555 IntRect Scrollbar::convertToContainingWidget(const IntRect& localRect) const { 549 IntRect Scrollbar::convertToContainingWidget(const IntRect& localRect) const {
556 if (m_scrollableArea) 550 if (m_scrollableArea)
557 return m_scrollableArea->convertFromScrollbarToContainingWidget(*this, 551 return m_scrollableArea->convertFromScrollbarToContainingWidget(*this,
558 localRect); 552 localRect);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 invalidParts = AllParts; 617 invalidParts = AllParts;
624 if (invalidParts & ~ThumbPart) 618 if (invalidParts & ~ThumbPart)
625 m_trackNeedsRepaint = true; 619 m_trackNeedsRepaint = true;
626 if (invalidParts & ThumbPart) 620 if (invalidParts & ThumbPart)
627 m_thumbNeedsRepaint = true; 621 m_thumbNeedsRepaint = true;
628 if (m_scrollableArea) 622 if (m_scrollableArea)
629 m_scrollableArea->setScrollbarNeedsPaintInvalidation(orientation()); 623 m_scrollableArea->setScrollbarNeedsPaintInvalidation(orientation());
630 } 624 }
631 625
632 } // namespace blink 626 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/scroll/Scrollbar.h ('k') | third_party/WebKit/Source/platform/scroll/ScrollbarTheme.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698