| OLD | NEW |
| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 , m_orientation(orientation) | 55 , m_orientation(orientation) |
| 56 , m_visibleSize(0) | 56 , m_visibleSize(0) |
| 57 , m_totalSize(0) | 57 , m_totalSize(0) |
| 58 , m_currentPos(0) | 58 , m_currentPos(0) |
| 59 , m_dragOrigin(0) | 59 , m_dragOrigin(0) |
| 60 , m_hoveredPart(NoPart) | 60 , m_hoveredPart(NoPart) |
| 61 , m_pressedPart(NoPart) | 61 , m_pressedPart(NoPart) |
| 62 , m_pressedPos(0) | 62 , m_pressedPos(0) |
| 63 , m_scrollPos(0) | 63 , m_scrollPos(0) |
| 64 , m_documentDragPos(0) | 64 , m_documentDragPos(0) |
| 65 , m_enabled(true) | |
| 66 , m_scrollTimer(this, &Scrollbar::autoscrollTimerFired) | 65 , m_scrollTimer(this, &Scrollbar::autoscrollTimerFired) |
| 67 , m_overlapsResizer(false) | 66 , m_overlapsResizer(false) |
| 68 { | 67 { |
| 69 // FIXME: This is ugly and would not be necessary if we fix cross-platform c
ode to actually query for | 68 // FIXME: This is ugly and would not be necessary if we fix cross-platform c
ode to actually query for |
| 70 // scrollbar thickness and use it when sizing scrollbars (rather than leavin
g one dimension of the scrollbar | 69 // scrollbar thickness and use it when sizing scrollbars (rather than leavin
g one dimension of the scrollbar |
| 71 // alone when sizing). | 70 // alone when sizing). |
| 72 int thickness = scrollbarThickness(); | 71 int thickness = scrollbarThickness(); |
| 73 Widget::setFrameRect(IntRect(0, 0, thickness, thickness)); | 72 Widget::setFrameRect(IntRect(0, 0, thickness, thickness)); |
| 74 | 73 |
| 75 m_currentPos = scrollableAreaCurrentPos(); | 74 m_currentPos = scrollableAreaCurrentPos(); |
| 76 } | 75 } |
| 77 | 76 |
| 78 Scrollbar::~Scrollbar() | 77 Scrollbar::~Scrollbar() |
| 79 { | 78 { |
| 80 stopTimerIfNeeded(); | 79 stopTimerIfNeeded(); |
| 81 } | 80 } |
| 82 | 81 |
| 83 ScrollbarOverlayStyle Scrollbar::scrollbarOverlayStyle() const | |
| 84 { | |
| 85 return m_scrollableArea ? m_scrollableArea->scrollbarOverlayStyle() : Scroll
barOverlayStyleDefault; | |
| 86 } | |
| 87 | |
| 88 bool Scrollbar::isScrollableAreaActive() const | 82 bool Scrollbar::isScrollableAreaActive() const |
| 89 { | 83 { |
| 90 return m_scrollableArea && m_scrollableArea->isActive(); | 84 return m_scrollableArea && m_scrollableArea->isActive(); |
| 91 } | 85 } |
| 92 | 86 |
| 93 bool Scrollbar::isLeftSideVerticalScrollbar() const | 87 bool Scrollbar::isLeftSideVerticalScrollbar() const |
| 94 { | 88 { |
| 95 if (m_orientation == VerticalScrollbar && m_scrollableArea) | 89 if (m_orientation == VerticalScrollbar && m_scrollableArea) |
| 96 return m_scrollableArea->shouldPlaceVerticalScrollbarOnLeft(); | 90 return m_scrollableArea->shouldPlaceVerticalScrollbarOnLeft(); |
| 97 return false; | 91 return false; |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 int pressedPos = orientation() == HorizontalScrollbar ? convertFromContainin
gView(evt.position()).x() : convertFromContainingView(evt.position()).y(); | 357 int pressedPos = orientation() == HorizontalScrollbar ? convertFromContainin
gView(evt.position()).x() : convertFromContainingView(evt.position()).y(); |
| 364 | 358 |
| 365 if (m_pressedPart == ThumbPart) | 359 if (m_pressedPart == ThumbPart) |
| 366 m_dragOrigin = m_currentPos; | 360 m_dragOrigin = m_currentPos; |
| 367 | 361 |
| 368 m_pressedPos = pressedPos; | 362 m_pressedPos = pressedPos; |
| 369 | 363 |
| 370 autoscrollPressedPart(initialAutoscrollTimerDelay()); | 364 autoscrollPressedPart(initialAutoscrollTimerDelay()); |
| 371 } | 365 } |
| 372 | 366 |
| 373 void Scrollbar::setEnabled(bool e) | |
| 374 { | |
| 375 if (m_enabled == e) | |
| 376 return; | |
| 377 m_enabled = e; | |
| 378 invalidate(); | |
| 379 } | |
| 380 | |
| 381 bool Scrollbar::isOverlayScrollbar() const | 367 bool Scrollbar::isOverlayScrollbar() const |
| 382 { | 368 { |
| 383 // FIXME(sky): Remove | 369 // FIXME(sky): Remove |
| 384 return true; | 370 return true; |
| 385 } | 371 } |
| 386 | 372 |
| 387 bool Scrollbar::shouldParticipateInHitTesting() | 373 bool Scrollbar::shouldParticipateInHitTesting() |
| 388 { | 374 { |
| 389 // Non-overlay scrollbars should always participate in hit testing. | 375 // Non-overlay scrollbars should always participate in hit testing. |
| 390 if (!isOverlayScrollbar()) | 376 if (!isOverlayScrollbar()) |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 thumbRect.setWidth(thumbRect.width() - kScrollbarMargin); | 518 thumbRect.setWidth(thumbRect.width() - kScrollbarMargin); |
| 533 if (isLeftSideVerticalScrollbar()) | 519 if (isLeftSideVerticalScrollbar()) |
| 534 thumbRect.setX(thumbRect.x() + kScrollbarMargin); | 520 thumbRect.setX(thumbRect.x() + kScrollbarMargin); |
| 535 } | 521 } |
| 536 | 522 |
| 537 DEFINE_STATIC_LOCAL(Color, color, (128, 128, 128, 128)); | 523 DEFINE_STATIC_LOCAL(Color, color, (128, 128, 128, 128)); |
| 538 context->fillRect(thumbRect, color); | 524 context->fillRect(thumbRect, color); |
| 539 } | 525 } |
| 540 | 526 |
| 541 } // namespace blink | 527 } // namespace blink |
| OLD | NEW |