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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 // alone when sizing). | 103 // alone when sizing). |
104 int thickness = m_theme->scrollbarThickness(controlSize); | 104 int thickness = m_theme->scrollbarThickness(controlSize); |
105 Widget::setFrameRect(IntRect(0, 0, thickness, thickness)); | 105 Widget::setFrameRect(IntRect(0, 0, thickness, thickness)); |
106 | 106 |
107 if (m_scrollableArea) | 107 if (m_scrollableArea) |
108 m_currentPos = static_cast<float>(m_scrollableArea->scrollPosition(this)
); | 108 m_currentPos = static_cast<float>(m_scrollableArea->scrollPosition(this)
); |
109 } | 109 } |
110 | 110 |
111 Scrollbar::~Scrollbar() | 111 Scrollbar::~Scrollbar() |
112 { | 112 { |
113 if (AXObjectCache* cache = existingAXObjectCache()) | 113 if (AXObjectCache::accessibilityEnabled() && axObjectCache()) |
114 cache->remove(this); | 114 axObjectCache()->remove(this); |
115 | 115 |
116 stopTimerIfNeeded(); | 116 stopTimerIfNeeded(); |
117 | 117 |
118 m_theme->unregisterScrollbar(this); | 118 m_theme->unregisterScrollbar(this); |
119 } | 119 } |
120 | 120 |
121 ScrollbarOverlayStyle Scrollbar::scrollbarOverlayStyle() const | 121 ScrollbarOverlayStyle Scrollbar::scrollbarOverlayStyle() const |
122 { | 122 { |
123 return m_scrollableArea ? m_scrollableArea->scrollbarOverlayStyle() : Scroll
barOverlayStyleDefault; | 123 return m_scrollableArea ? m_scrollableArea->scrollbarOverlayStyle() : Scroll
barOverlayStyleDefault; |
124 } | 124 } |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 // Non-overlay scrollbars should always participate in hit testing. | 559 // Non-overlay scrollbars should always participate in hit testing. |
560 if (!isOverlayScrollbar()) | 560 if (!isOverlayScrollbar()) |
561 return true; | 561 return true; |
562 return m_scrollableArea->scrollAnimator()->shouldScrollbarParticipateInHitTe
sting(this); | 562 return m_scrollableArea->scrollAnimator()->shouldScrollbarParticipateInHitTe
sting(this); |
563 } | 563 } |
564 | 564 |
565 bool Scrollbar::isWindowActive() const | 565 bool Scrollbar::isWindowActive() const |
566 { | 566 { |
567 return m_scrollableArea && m_scrollableArea->isActive(); | 567 return m_scrollableArea && m_scrollableArea->isActive(); |
568 } | 568 } |
569 | 569 |
570 AXObjectCache* Scrollbar::existingAXObjectCache() const | 570 AXObjectCache* Scrollbar::axObjectCache() const |
571 { | 571 { |
572 if (!parent()) | 572 if (!parent() || !parent()->isFrameView()) |
573 return 0; | 573 return 0; |
574 | 574 |
575 return parent()->axObjectCache(); | 575 // FIXME: Accessing the FrameView and Document here is a layering violation |
| 576 // and should be removed. |
| 577 Document* document = toFrameView(parent())->frame()->document(); |
| 578 return document->axObjectCache(); |
576 } | 579 } |
577 | 580 |
578 void Scrollbar::invalidateRect(const IntRect& rect) | 581 void Scrollbar::invalidateRect(const IntRect& rect) |
579 { | 582 { |
580 if (suppressInvalidation()) | 583 if (suppressInvalidation()) |
581 return; | 584 return; |
582 | 585 |
583 if (m_scrollableArea) | 586 if (m_scrollableArea) |
584 m_scrollableArea->invalidateScrollbar(this, rect); | 587 m_scrollableArea->invalidateScrollbar(this, rect); |
585 } | 588 } |
(...skipping 24 matching lines...) Expand all Loading... |
610 | 613 |
611 IntPoint Scrollbar::convertFromContainingView(const IntPoint& parentPoint) const | 614 IntPoint Scrollbar::convertFromContainingView(const IntPoint& parentPoint) const |
612 { | 615 { |
613 if (m_scrollableArea) | 616 if (m_scrollableArea) |
614 return m_scrollableArea->convertFromContainingViewToScrollbar(this, pare
ntPoint); | 617 return m_scrollableArea->convertFromContainingViewToScrollbar(this, pare
ntPoint); |
615 | 618 |
616 return Widget::convertFromContainingView(parentPoint); | 619 return Widget::convertFromContainingView(parentPoint); |
617 } | 620 } |
618 | 621 |
619 } // namespace WebCore | 622 } // namespace WebCore |
OLD | NEW |