bool Scrollbar::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier) { #if HAVE(ACCESSIBILITY) if (AXObjectCache::accessibilityEnabled()) { if (parent() && parent()->isFrameView()) { Document* document = static_cast<FrameView*>(parent())->frame()->document(); AXObjectCache* cache = document->axObjectCache(); AccessibilityScrollbar* axObject = static_cast<AccessibilityScrollbar*>(cache->getOrCreate(ScrollBarRole)); axObject->setScrollbar(this); cache->postNotification(axObject, document, AXObjectCache::AXValueChanged, true); } } #endif // Ignore perpendicular scrolls. if ((m_orientation == HorizontalScrollbar) ? (direction == ScrollUp || direction == ScrollDown) : (direction == ScrollLeft || direction == ScrollRight)) return false; float step = 0; switch (granularity) { case ScrollByLine: step = m_lineStep; break; case ScrollByPage: step = m_pageStep; break; case ScrollByDocument: step = m_totalSize; break; case ScrollByPixel: step = m_pixelStep; break; } if (direction == ScrollUp || direction == ScrollLeft) multiplier = -multiplier; if (client()) return client()->scroll(m_orientation, granularity, step, multiplier); return setCurrentPos(max(min(m_currentPos + (step * multiplier), static_cast<float>(m_totalSize - m_visibleSize)), 0.0f), NotFromScrollAnimator); }
AccessibilityScrollbar* AccessibilityScrollView::addChildScrollbar(Scrollbar* scrollbar) { if (!scrollbar) return 0; AccessibilityScrollbar* scrollBarObject = static_cast<AccessibilityScrollbar*>(axObjectCache()->getOrCreate(scrollbar)); scrollBarObject->setParent(this); m_children.append(scrollBarObject); return scrollBarObject; }
AccessibilityScrollbar* AccessibilityScrollView::addChildScrollbar(Scrollbar* scrollbar) { if (!scrollbar) return nullptr; AXObjectCache* cache = axObjectCache(); if (!cache) return nullptr; AccessibilityScrollbar* scrollBarObject = toAccessibilityScrollbar(cache->getOrCreate(scrollbar)); scrollBarObject->setParent(this); m_children.append(scrollBarObject); return scrollBarObject; }