Esempio n. 1
0
void ScrollbarTheme::splitTrack(const ScrollbarThemeClient& scrollbar,
                                const IntRect& unconstrainedTrackRect,
                                IntRect& beforeThumbRect,
                                IntRect& thumbRect,
                                IntRect& afterThumbRect) {
  // This function won't even get called unless we're big enough to have some
  // combination of these three rects where at least one of them is non-empty.
  IntRect trackRect =
      constrainTrackRectToTrackPieces(scrollbar, unconstrainedTrackRect);
  int thumbPos = thumbPosition(scrollbar);
  if (scrollbar.orientation() == HorizontalScrollbar) {
    thumbRect = IntRect(trackRect.x() + thumbPos, trackRect.y(),
                        thumbLength(scrollbar), scrollbar.height());
    beforeThumbRect =
        IntRect(trackRect.x(), trackRect.y(), thumbPos + thumbRect.width() / 2,
                trackRect.height());
    afterThumbRect =
        IntRect(trackRect.x() + beforeThumbRect.width(), trackRect.y(),
                trackRect.maxX() - beforeThumbRect.maxX(), trackRect.height());
  } else {
    thumbRect = IntRect(trackRect.x(), trackRect.y() + thumbPos,
                        scrollbar.width(), thumbLength(scrollbar));
    beforeThumbRect = IntRect(trackRect.x(), trackRect.y(), trackRect.width(),
                              thumbPos + thumbRect.height() / 2);
    afterThumbRect =
        IntRect(trackRect.x(), trackRect.y() + beforeThumbRect.height(),
                trackRect.width(), trackRect.maxY() - beforeThumbRect.maxY());
  }
}
Esempio n. 2
0
int ScrollbarTheme::trackLength(const ScrollbarThemeClient& scrollbar) {
  IntRect constrainedTrackRect =
      constrainTrackRectToTrackPieces(scrollbar, trackRect(scrollbar));
  return (scrollbar.orientation() == HorizontalScrollbar)
             ? constrainedTrackRect.width()
             : constrainedTrackRect.height();
}
Esempio n. 3
0
int ScrollbarTheme::trackPosition(const ScrollbarThemeClient& scrollbar) {
  IntRect constrainedTrackRect =
      constrainTrackRectToTrackPieces(scrollbar, trackRect(scrollbar));
  return (scrollbar.orientation() == HorizontalScrollbar)
             ? constrainedTrackRect.x() - scrollbar.x()
             : constrainedTrackRect.y() - scrollbar.y();
}
IntRect ScrollbarThemeGtk::thumbRect(ScrollbarThemeClient* scrollbar, const IntRect& unconstrainedTrackRect)
{
    IntRect trackRect = constrainTrackRectToTrackPieces(scrollbar, unconstrainedTrackRect);
    int thumbPos = thumbPosition(scrollbar);
    if (scrollbar->orientation() == HorizontalScrollbar)
        return IntRect(trackRect.x() + thumbPos, trackRect.y() + (trackRect.height() - m_thumbFatness) / 2, thumbLength(scrollbar), m_thumbFatness); 

    // VerticalScrollbar
    return IntRect(trackRect.x() + (trackRect.width() - m_thumbFatness) / 2, trackRect.y() + thumbPos, m_thumbFatness, thumbLength(scrollbar));
}
void ScrollbarThemeComposite::splitTrack(Scrollbar* scrollbar, const IntRect& unconstrainedTrackRect, IntRect& beforeThumbRect, IntRect& thumbRect, IntRect& afterThumbRect)
{
    // This function won't even get called unless we're big enough to have some combination of these three rects where at least
    // one of them is non-empty.
    IntRect trackRect = constrainTrackRectToTrackPieces(scrollbar, unconstrainedTrackRect);
    int thickness = scrollbar->orientation() == HorizontalScrollbar ? scrollbar->height() : scrollbar->width();
    int thumbPos = thumbPosition(scrollbar);
    if (scrollbar->orientation() == HorizontalScrollbar) {
        thumbRect = IntRect(trackRect.x() + thumbPos, trackRect.y() + (trackRect.height() - thickness) / 2, thumbLength(scrollbar), thickness); 
        beforeThumbRect = IntRect(trackRect.x(), trackRect.y(), thumbPos + thumbRect.width() / 2, trackRect.height()); 
        afterThumbRect = IntRect(trackRect.x() + beforeThumbRect.width(), trackRect.y(), trackRect.right() - beforeThumbRect.right(), trackRect.height());
    } else {
        thumbRect = IntRect(trackRect.x() + (trackRect.width() - thickness) / 2, trackRect.y() + thumbPos, thickness, thumbLength(scrollbar));
        beforeThumbRect = IntRect(trackRect.x(), trackRect.y(), trackRect.width(), thumbPos + thumbRect.height() / 2); 
        afterThumbRect = IntRect(trackRect.x(), trackRect.y() + beforeThumbRect.height(), trackRect.width(), trackRect.bottom() - beforeThumbRect.bottom());
    }
}
int ScrollbarThemeComposite::trackPosition(Scrollbar* scrollbar)
{
    IntRect constrainedTrackRect = constrainTrackRectToTrackPieces(scrollbar, trackRect(scrollbar));
    return (scrollbar->orientation() == HorizontalScrollbar) ? constrainedTrackRect.x() - scrollbar->x() : constrainedTrackRect.y() - scrollbar->y();
}