void ScrollableAreaPainter::paintScrollCorner( GraphicsContext& context, const IntPoint& paintOffset, const CullRect& adjustedCullRect) { IntRect absRect = getScrollableArea().scrollCornerRect(); if (absRect.isEmpty()) return; absRect.moveBy(paintOffset); if (getScrollableArea().scrollCorner()) { if (!adjustedCullRect.intersectsCullRect(absRect)) return; ScrollbarPainter::paintIntoRect(*getScrollableArea().scrollCorner(), context, paintOffset, LayoutRect(absRect)); return; } // We don't want to paint white if we have overlay scrollbars, since we need // to see what is behind it. if (getScrollableArea().hasOverlayScrollbars()) return; if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( context, getScrollableArea().box(), DisplayItem::kScrollbarCorner)) return; LayoutObjectDrawingRecorder recorder(context, getScrollableArea().box(), DisplayItem::kScrollbarCorner, absRect); context.fillRect(absRect, Color::white); }
void Scrollbar::paint(GraphicsContext* context, const CullRect& cullRect) const { if (!cullRect.intersectsCullRect(frameRect())) return; if (!theme()->paint(this, context, cullRect)) Widget::paint(context, cullRect); }
bool LineBoxList::rangeIntersectsRect(LineLayoutBoxModel layoutObject, LayoutUnit logicalTop, LayoutUnit logicalBottom, const CullRect& cullRect, const LayoutPoint& offset) const { LineLayoutBox block; if (layoutObject.isBox()) block = LineLayoutBox(layoutObject); else block = layoutObject.containingBlock(); LayoutUnit physicalStart = block.flipForWritingMode(logicalTop); LayoutUnit physicalEnd = block.flipForWritingMode(logicalBottom); LayoutUnit physicalExtent = absoluteValue(physicalEnd - physicalStart); physicalStart = std::min(physicalStart, physicalEnd); if (layoutObject.style()->isHorizontalWritingMode()) { physicalStart += offset.y(); return cullRect.intersectsVerticalRange(physicalStart, physicalStart + physicalExtent); } else { physicalStart += offset.x(); return cullRect.intersectsHorizontalRange(physicalStart, physicalStart + physicalExtent); } }
bool ScrollableAreaPainter::overflowControlsIntersectRect( const CullRect& cullRect) const { const IntRect borderBox = getScrollableArea().box().pixelSnappedBorderBoxRect(); if (cullRect.intersectsCullRect( getScrollableArea().rectForHorizontalScrollbar(borderBox))) return true; if (cullRect.intersectsCullRect( getScrollableArea().rectForVerticalScrollbar(borderBox))) return true; if (cullRect.intersectsCullRect(getScrollableArea().scrollCornerRect())) return true; if (cullRect.intersectsCullRect( getScrollableArea().resizerCornerRect(borderBox, ResizerForPointer))) return true; return false; }
void ScrollableAreaPainter::paintResizer(GraphicsContext& context, const IntPoint& paintOffset, const CullRect& cullRect) { if (getScrollableArea().box().style()->resize() == RESIZE_NONE) return; IntRect absRect = getScrollableArea().resizerCornerRect( getScrollableArea().box().pixelSnappedBorderBoxRect(), ResizerForPointer); if (absRect.isEmpty()) return; absRect.moveBy(paintOffset); if (getScrollableArea().resizer()) { if (!cullRect.intersectsCullRect(absRect)) return; ScrollbarPainter::paintIntoRect(*getScrollableArea().resizer(), context, paintOffset, LayoutRect(absRect)); return; } if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( context, getScrollableArea().box(), DisplayItem::kResizer)) return; LayoutObjectDrawingRecorder recorder(context, getScrollableArea().box(), DisplayItem::kResizer, absRect); drawPlatformResizerImage(context, absRect); // Draw a frame around the resizer (1px grey line) if there are any scrollbars // present. Clipping will exclude the right and bottom edges of this frame. if (!getScrollableArea().hasOverlayScrollbars() && getScrollableArea().hasScrollbar()) { GraphicsContextStateSaver stateSaver(context); context.clip(absRect); IntRect largerCorner = absRect; largerCorner.setSize( IntSize(largerCorner.width() + 1, largerCorner.height() + 1)); context.setStrokeColor(Color(217, 217, 217)); context.setStrokeThickness(1.0f); context.setFillColor(Color::transparent); context.drawRect(largerCorner); } }