Esempio n. 1
0
bool Scrollbar::mouseMoved(const PlatformMouseEvent& evt)
{
    if (m_pressedPart == ThumbPart) {
        moveThumb(m_orientation == HorizontalScrollbar ? 
                  convertFromContainingWindow(evt.pos()).x() :
                  convertFromContainingWindow(evt.pos()).y());
        return true;
    }

    if (m_pressedPart != NoPart)
        m_pressedPos = (orientation() == HorizontalScrollbar ? convertFromContainingWindow(evt.pos()).x() : convertFromContainingWindow(evt.pos()).y());

    ScrollbarPart part = theme()->hitTest(this, evt);    
    if (part != m_hoveredPart) {
        if (m_pressedPart != NoPart) {
            if (part == m_pressedPart) {
                // The mouse is moving back over the pressed part.  We
                // need to start up the timer action again.
                startTimerIfNeeded(theme()->autoscrollTimerDelay());
                theme()->invalidatePart(this, m_pressedPart);
            } else if (m_hoveredPart == m_pressedPart) {
                // The mouse is leaving the pressed part.  Kill our timer
                // if needed.
                stopTimerIfNeeded();
                theme()->invalidatePart(this, m_pressedPart);
            }
        } 
        
        setHoveredPart(part);
    } 

    return true;
}
Esempio n. 2
0
void Scrollbar::mouseMoved(const PlatformMouseEvent& evt)
{
    if (m_pressedPart == ThumbPart) {
        moveThumb(m_orientation == HorizontalScrollbar ?
                  convertFromContainingView(evt.position()).x() :
                  convertFromContainingView(evt.position()).y());
        return;
    }

    if (m_pressedPart != NoPart)
        m_pressedPos = orientation() == HorizontalScrollbar ? convertFromContainingView(evt.position()).x() : convertFromContainingView(evt.position()).y();

    // FIXME(sky): Cleanup this code now that part is always NoPart.
    ScrollbarPart part = NoPart;
    if (part != m_hoveredPart) {
        if (m_pressedPart != NoPart) {
            if (part == m_pressedPart) {
                // The mouse is moving back over the pressed part.  We
                // need to start up the timer action again.
                startTimerIfNeeded(autoscrollTimerDelay());
                invalidatePart(m_pressedPart);
            } else if (m_hoveredPart == m_pressedPart) {
                // The mouse is leaving the pressed part.  Kill our timer
                // if needed.
                stopTimerIfNeeded();
                invalidatePart(m_pressedPart);
            }
        }

        setHoveredPart(part);
    }

    return;
}
Esempio n. 3
0
Scrollbar::~Scrollbar()
{
    if (AXObjectCache::accessibilityEnabled() && axObjectCache())
        axObjectCache()->remove(this);
    
    stopTimerIfNeeded();
    
    m_theme->unregisterScrollbar(this);
}
Esempio n. 4
0
Scrollbar::~Scrollbar()
{
    if (AXObjectCache* cache = existingAXObjectCache())
        cache->remove(this);
    
    stopTimerIfNeeded();
    
    m_theme->unregisterScrollbar(this);
}
Esempio n. 5
0
bool Scrollbar::mouseUp()
{
    setPressedPart(NoPart);
    m_pressedPos = 0;
    stopTimerIfNeeded();

    if (parent() && parent()->isFrameView())
        static_cast<FrameView*>(parent())->frame()->eventHandler()->setMousePressed(false);

    return true;
}
Esempio n. 6
0
void Scrollbar::mouseUp(const PlatformMouseEvent& mouseEvent)
{
    setPressedPart(NoPart);
    m_pressedPos = 0;
    stopTimerIfNeeded();

    if (m_scrollableArea) {
        // m_hoveredPart won't be updated until the next mouseMoved or mouseDown, so we have to hit test
        // to really know if the mouse has exited the scrollbar on a mouseUp.
        m_scrollableArea->mouseExitedScrollbar(this);
    }
}
Esempio n. 7
0
void Scrollbar::mouseUp(const PlatformMouseEvent& mouseEvent)
{
    setPressedPart(NoPart);
    m_pressedPos = 0;
    m_draggingDocument = false;
    stopTimerIfNeeded();

    if (m_scrollableArea) {
        // m_hoveredPart won't be updated until the next mouseMoved or mouseDown, so we have to hit test
        // to really know if the mouse has exited the scrollbar on a mouseUp.
        ScrollbarPart part = theme()->hitTest(this, mouseEvent.position());
        if (part == NoPart)
            m_scrollableArea->mouseExitedScrollbar(this);
    }
}
Esempio n. 8
0
Scrollbar::~Scrollbar()
{
    stopTimerIfNeeded();

    m_theme->unregisterScrollbar(this);

#if ENABLE(OILPAN)
    if (!m_animator)
        return;

    ASSERT(m_scrollableArea);
    if (m_orientation == VerticalScrollbar)
        m_animator->willRemoveVerticalScrollbar(this);
    else
        m_animator->willRemoveHorizontalScrollbar(this);
#endif
}
Esempio n. 9
0
void Scrollbar::mouseUp(const PlatformMouseEvent& mouseEvent) {
  bool isCaptured = m_pressedPart == ThumbPart;
  setPressedPart(NoPart);
  m_pressedPos = 0;
  m_draggingDocument = false;
  stopTimerIfNeeded();

  if (m_scrollableArea) {
    if (isCaptured)
      m_scrollableArea->mouseReleasedScrollbar();

    // m_hoveredPart won't be updated until the next mouseMoved or mouseDown, so
    // we have to hit test to really know if the mouse has exited the scrollbar
    // on a mouseUp.
    ScrollbarPart part = theme().hitTest(*this, mouseEvent.position());
    if (part == NoPart)
      m_scrollableArea->mouseExitedScrollbar(*this);
  }
}
Esempio n. 10
0
bool PlatformScrollbar::handleMouseReleaseEvent(const PlatformMouseEvent& evt)
{
    const QPoint pos = convertFromContainingWindow(evt.pos());
    const QPoint topLeft = m_opt.rect.topLeft();
    m_opt.rect.moveTo(QPoint(0, 0));
    QStyle::SubControl scAtMousePoint = QApplication::style()->hitTestComplexControl(QStyle::CC_ScrollBar, &m_opt, pos, 0);
    m_opt.rect.moveTo(topLeft);

    m_hoveredPart = scAtMousePoint;
    if (m_hoveredPart == QStyle::SC_None)
        m_opt.state &= ~QStyle::State_MouseOver;

    m_opt.state &= ~QStyle::State_Sunken;
    m_pressedPart = QStyle::SC_None;
    m_pressedPos = 0;
    stopTimerIfNeeded();
    invalidate();
    return true;
}
Esempio n. 11
0
void Scrollbar::mouseMoved(const PlatformMouseEvent& evt) {
  if (m_pressedPart == ThumbPart) {
    if (theme().shouldSnapBackToDragOrigin(*this, evt)) {
      if (m_scrollableArea) {
        m_scrollableArea->setScrollOffsetSingleAxis(
            m_orientation,
            m_dragOrigin + m_scrollableArea->minimumScrollOffset(m_orientation),
            UserScroll);
      }
    } else {
      moveThumb(m_orientation == HorizontalScrollbar
                    ? convertFromRootFrame(evt.position()).x()
                    : convertFromRootFrame(evt.position()).y(),
                theme().shouldDragDocumentInsteadOfThumb(*this, evt));
    }
    return;
  }

  if (m_pressedPart != NoPart)
    m_pressedPos = orientation() == HorizontalScrollbar
                       ? convertFromRootFrame(evt.position()).x()
                       : convertFromRootFrame(evt.position()).y();

  ScrollbarPart part = theme().hitTest(*this, evt.position());
  if (part != m_hoveredPart) {
    if (m_pressedPart != NoPart) {
      if (part == m_pressedPart) {
        // The mouse is moving back over the pressed part.  We
        // need to start up the timer action again.
        startTimerIfNeeded(theme().autoscrollTimerDelay());
      } else if (m_hoveredPart == m_pressedPart) {
        // The mouse is leaving the pressed part.  Kill our timer
        // if needed.
        stopTimerIfNeeded();
      }
    }

    setHoveredPart(part);
  }

  return;
}
Esempio n. 12
0
bool Scrollbar::mouseUp(const PlatformMouseEvent& mouseEvent)
{
    setPressedPart(NoPart);
    m_pressedPos = 0;
    m_draggingDocument = false;
    stopTimerIfNeeded();

    if (m_scrollableArea) {
        // m_hoveredPart won't be updated until the next mouseMoved or mouseDown, so we have to hit test
        // to really know if the mouse has exited the scrollbar on a mouseUp.
        ScrollbarPart part = theme()->hitTest(this, mouseEvent.position());
        if (part == NoPart)
            m_scrollableArea->mouseExitedScrollbar(this);
    }

    if (parent() && parent()->isFrameView())
        static_cast<FrameView*>(parent())->frame()->eventHandler()->setMousePressed(false);

    return true;
}
Esempio n. 13
0
bool Scrollbar::mouseMoved(const PlatformMouseEvent& evt)
{
    if (m_pressedPart == ThumbPart) {
        if (theme()->shouldSnapBackToDragOrigin(this, evt)) {
            if (m_scrollableArea)
                m_scrollableArea->scrollToOffsetWithoutAnimation(m_orientation, m_dragOrigin);
        } else {
            moveThumb(m_orientation == HorizontalScrollbar ? 
                      convertFromContainingWindow(evt.pos()).x() :
                      convertFromContainingWindow(evt.pos()).y(), theme()->shouldDragDocumentInsteadOfThumb(this, evt));
        }
        return true;
    }

    if (m_pressedPart != NoPart)
        m_pressedPos = (orientation() == HorizontalScrollbar ? convertFromContainingWindow(evt.pos()).x() : convertFromContainingWindow(evt.pos()).y());

    ScrollbarPart part = theme()->hitTest(this, evt);    
    if (part != m_hoveredPart) {
        if (m_pressedPart != NoPart) {
            if (part == m_pressedPart) {
                // The mouse is moving back over the pressed part.  We
                // need to start up the timer action again.
                startTimerIfNeeded(theme()->autoscrollTimerDelay());
                theme()->invalidatePart(this, m_pressedPart);
            } else if (m_hoveredPart == m_pressedPart) {
                // The mouse is leaving the pressed part.  Kill our timer
                // if needed.
                stopTimerIfNeeded();
                theme()->invalidatePart(this, m_pressedPart);
            }
        } 
        
        setHoveredPart(part);
    } 

    return true;
}
Esempio n. 14
0
Scrollbar::~Scrollbar()
{
    stopTimerIfNeeded();
}
Esempio n. 15
0
Scrollbar::~Scrollbar()
{
    stopTimerIfNeeded();
    
    theme().unregisterScrollbar(*this);
}
Esempio n. 16
0
Scrollbar::~Scrollbar()
{
    stopTimerIfNeeded();
    
    m_theme->unregisterScrollbar(this);
}
Esempio n. 17
0
bool PlatformScrollbar::handleMouseMoveEvent(const PlatformMouseEvent& evt)
{
    const QPoint pos = convertFromContainingWindow(evt.pos());
    //qDebug() << "PlatformScrollbar::handleMouseMoveEvent" << m_opt.rect << pos << evt.pos();

    m_opt.state |= QStyle::State_MouseOver;
    const QPoint topLeft = m_opt.rect.topLeft();
    m_opt.rect.moveTo(QPoint(0, 0));
    QStyle::SubControl sc = QApplication::style()->hitTestComplexControl(QStyle::CC_ScrollBar, &m_opt, pos, 0);
    m_opt.rect.moveTo(topLeft);

    if (m_pressedPart == QStyle::SC_ScrollBarSlider) {
        // Drag the thumb.
        int thumbPos = thumbPosition();
        int thumbLen = thumbLength();
        int trackLen = trackLength();
        int maxPos = trackLen - thumbLen;
        int delta = 0;
        if (m_orientation == HorizontalScrollbar)
            delta = pos.x() - m_pressedPos;
        else
            delta = pos.y() - m_pressedPos;

        if (delta > 0)
            // The mouse moved down/right.
            delta = min(maxPos - thumbPos, delta);
        else if (delta < 0)
            // The mouse moved up/left.
            delta = max(-thumbPos, delta);

        if (delta != 0) {
            setValue((int)((float)(thumbPos + delta) * (m_totalSize - m_visibleSize) / (trackLen - thumbLen)));
            m_pressedPos += thumbPosition() - thumbPos;
        }

        return true;
    }

    if (m_pressedPart != QStyle::SC_None)
        m_pressedPos = m_orientation == HorizontalScrollbar ? pos.x() : pos.y();

    if (sc != m_hoveredPart) {
        if (m_pressedPart != QStyle::SC_None) {
            if (sc == m_pressedPart) {
                // The mouse is moving back over the pressed part.  We
                // need to start up the timer action again.
                startTimerIfNeeded(cNormalTimerDelay);
                invalidate();
            } else if (m_hoveredPart == m_pressedPart) {
                // The mouse is leaving the pressed part.  Kill our timer
                // if needed.
                stopTimerIfNeeded();
                invalidate();
            }
        } else {
            invalidate();
        }
        m_hoveredPart = sc;
    }

    return true;
}
Esempio n. 18
0
PlatformScrollbar::~PlatformScrollbar()
{
    stopTimerIfNeeded();
}