void LayoutScrollbar::setPressedPart(ScrollbarPart part) { ScrollbarPart oldPart = m_pressedPart; Scrollbar::setPressedPart(part); updateScrollbarPart(oldPart); updateScrollbarPart(part); updateScrollbarPart(ScrollbarBGPart); updateScrollbarPart(TrackBGPart); }
void RenderScrollbar::updateScrollbarParts(bool destroy) { updateScrollbarPart(ScrollbarBGPart, destroy); updateScrollbarPart(BackButtonStartPart, destroy); updateScrollbarPart(ForwardButtonStartPart, destroy); updateScrollbarPart(BackTrackPart, destroy); updateScrollbarPart(ThumbPart, destroy); updateScrollbarPart(ForwardTrackPart, destroy); updateScrollbarPart(BackButtonEndPart, destroy); updateScrollbarPart(ForwardButtonEndPart, destroy); updateScrollbarPart(TrackBGPart, destroy); if (destroy) return; // See if the scrollbar's thickness changed. If so, we need to mark our owning object as needing a layout. bool isHorizontal = orientation() == HorizontalScrollbar; int oldThickness = isHorizontal ? height() : width(); int newThickness = 0; RenderScrollbarPart* part = m_parts.get(ScrollbarBGPart); if (part) { part->layout(); newThickness = isHorizontal ? part->height() : part->width(); } if (newThickness != oldThickness) { setFrameRect(IntRect(x(), y(), isHorizontal ? width() : newThickness, isHorizontal ? newThickness : height())); owningRenderer()->setChildNeedsLayout(true); } }
void LayoutScrollbar::setHoveredPart(ScrollbarPart part) { if (part == m_hoveredPart) return; ScrollbarPart oldPart = m_hoveredPart; m_hoveredPart = part; updateScrollbarPart(oldPart); updateScrollbarPart(m_hoveredPart); updateScrollbarPart(ScrollbarBGPart); updateScrollbarPart(TrackBGPart); }
RenderScrollbar::RenderScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, Node* ownerNode, LocalFrame* owningFrame) : Scrollbar(scrollableArea, orientation, RegularScrollbar, RenderScrollbarTheme::renderScrollbarTheme()) , m_owner(ownerNode) , m_owningFrame(owningFrame) { ASSERT(ownerNode || owningFrame); // FIXME: We need to do this because RenderScrollbar::styleChanged is called as soon as the scrollbar is created. // Update the scrollbar size. int width = 0; int height = 0; updateScrollbarPart(ScrollbarBGPart); if (RenderScrollbarPart* part = m_parts.get(ScrollbarBGPart)) { part->layout(); width = part->width(); height = part->height(); } else if (this->orientation() == HorizontalScrollbar) width = this->width(); else height = this->height(); setFrameRect(IntRect(0, 0, width, height)); #if ENABLE(OILPAN) ThreadState::current()->registerPreFinalizer(*this); #endif }
LayoutScrollbar::LayoutScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, Node* ownerNode, LocalFrame* owningFrame) : Scrollbar(scrollableArea, orientation, RegularScrollbar, nullptr, LayoutScrollbarTheme::layoutScrollbarTheme()), m_owner(ownerNode), m_owningFrame(owningFrame) { ASSERT(ownerNode || owningFrame); // FIXME: We need to do this because LayoutScrollbar::styleChanged is called // as soon as the scrollbar is created. // Update the scrollbar size. IntRect rect(0, 0, 0, 0); updateScrollbarPart(ScrollbarBGPart); if (LayoutScrollbarPart* part = m_parts.get(ScrollbarBGPart)) { part->layout(); rect.setSize(flooredIntSize(part->size())); } else if (this->orientation() == HorizontalScrollbar) { rect.setWidth(this->width()); } else { rect.setHeight(this->height()); } setFrameRect(rect); }
RenderScrollbar::RenderScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, RenderBox* renderer, Frame* owningFrame) : Scrollbar(client, orientation, RegularScrollbar, RenderScrollbarTheme::renderScrollbarTheme()) , m_owner(renderer) , m_owningFrame(owningFrame) { // FIXME: We need to do this because RenderScrollbar::styleChanged is called as soon as the scrollbar is created. // Update the scrollbar size. updateScrollbarPart(ScrollbarBGPart); RenderScrollbarPart* part = m_parts.get(ScrollbarBGPart); if (!part) return; part->layout(); setFrameRect(IntRect(0, 0, part->width(), part->height())); }
void LayoutScrollbar::updateScrollbarParts(bool destroy) { updateScrollbarPart(ScrollbarBGPart, destroy); updateScrollbarPart(BackButtonStartPart, destroy); updateScrollbarPart(ForwardButtonStartPart, destroy); updateScrollbarPart(BackTrackPart, destroy); updateScrollbarPart(ThumbPart, destroy); updateScrollbarPart(ForwardTrackPart, destroy); updateScrollbarPart(BackButtonEndPart, destroy); updateScrollbarPart(ForwardButtonEndPart, destroy); updateScrollbarPart(TrackBGPart, destroy); if (destroy) return; // See if the scrollbar's thickness changed. If so, we need to mark our // owning object as needing a layout. bool isHorizontal = orientation() == HorizontalScrollbar; int oldThickness = isHorizontal ? height() : width(); int newThickness = 0; LayoutScrollbarPart* part = m_parts.get(ScrollbarBGPart); if (part) { part->layout(); newThickness = (isHorizontal ? part->size().height() : part->size().width()).toInt(); } if (newThickness != oldThickness) { setFrameRect( IntRect(location(), IntSize(isHorizontal ? width() : newThickness, isHorizontal ? newThickness : height()))); if (LayoutBox* box = owningLayoutObjectWithinFrame()) { if (box->isLayoutBlock()) toLayoutBlock(box)->notifyScrollbarThicknessChanged(); box->setChildNeedsLayout(); if (m_scrollableArea) m_scrollableArea->setScrollCornerNeedsPaintInvalidation(); } } }
RenderScrollbar::RenderScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, RenderBox* renderer, Frame* owningFrame) : Scrollbar(scrollableArea, orientation, RegularScrollbar, RenderScrollbarTheme::renderScrollbarTheme()) , m_owner(renderer) , m_owningFrame(owningFrame) { // FIXME: We need to do this because RenderScrollbar::styleChanged is called as soon as the scrollbar is created. // Update the scrollbar size. int width = 0; int height = 0; updateScrollbarPart(ScrollbarBGPart); if (RenderScrollbarPart* part = m_parts.get(ScrollbarBGPart)) { part->layout(); width = part->width(); height = part->height(); } else if (this->orientation() == HorizontalScrollbar) width = this->width(); else height = this->height(); setFrameRect(IntRect(0, 0, width, height)); }