summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderScrollbarPart.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/rendering/RenderScrollbarPart.cpp
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/rendering/RenderScrollbarPart.cpp')
-rw-r--r--Source/WebCore/rendering/RenderScrollbarPart.cpp56
1 files changed, 27 insertions, 29 deletions
diff --git a/Source/WebCore/rendering/RenderScrollbarPart.cpp b/Source/WebCore/rendering/RenderScrollbarPart.cpp
index d05b8ec82..73618ffe7 100644
--- a/Source/WebCore/rendering/RenderScrollbarPart.cpp
+++ b/Source/WebCore/rendering/RenderScrollbarPart.cpp
@@ -34,8 +34,8 @@
namespace WebCore {
-RenderScrollbarPart::RenderScrollbarPart(Document& document, PassRef<RenderStyle> style, RenderScrollbar* scrollbar, ScrollbarPart part)
- : RenderBlock(document, std::move(style), 0)
+RenderScrollbarPart::RenderScrollbarPart(Document& document, RenderStyle&& style, RenderScrollbar* scrollbar, ScrollbarPart part)
+ : RenderBlock(document, WTFMove(style), 0)
, m_scrollbar(scrollbar)
, m_part(part)
{
@@ -79,47 +79,45 @@ void RenderScrollbarPart::layoutVerticalPart()
}
}
-static int calcScrollbarThicknessUsing(SizeType sizeType, const Length& length, int containingLength, RenderView* renderView)
+static int calcScrollbarThicknessUsing(SizeType sizeType, const Length& length, int containingLength)
{
if (!length.isIntrinsicOrAuto() || (sizeType == MinSize && length.isAuto()))
- return minimumValueForLength(length, containingLength, renderView);
- return ScrollbarTheme::theme()->scrollbarThickness();
+ return minimumValueForLength(length, containingLength);
+ return ScrollbarTheme::theme().scrollbarThickness();
}
void RenderScrollbarPart::computeScrollbarWidth()
{
if (!m_scrollbar->owningRenderer())
return;
- RenderView* renderView = &view();
// FIXME: We are querying layout information but nothing guarantees that it's up-to-date, especially since we are called at style change.
// FIXME: Querying the style's border information doesn't work on table cells with collapsing borders.
int visibleSize = m_scrollbar->owningRenderer()->width() - m_scrollbar->owningRenderer()->style().borderLeftWidth() - m_scrollbar->owningRenderer()->style().borderRightWidth();
- int w = calcScrollbarThicknessUsing(MainOrPreferredSize, style().width(), visibleSize, renderView);
- int minWidth = calcScrollbarThicknessUsing(MinSize, style().minWidth(), visibleSize, renderView);
- int maxWidth = style().maxWidth().isUndefined() ? w : calcScrollbarThicknessUsing(MaxSize, style().maxWidth(), visibleSize, renderView);
+ int w = calcScrollbarThicknessUsing(MainOrPreferredSize, style().width(), visibleSize);
+ int minWidth = calcScrollbarThicknessUsing(MinSize, style().minWidth(), visibleSize);
+ int maxWidth = style().maxWidth().isUndefined() ? w : calcScrollbarThicknessUsing(MaxSize, style().maxWidth(), visibleSize);
setWidth(std::max(minWidth, std::min(maxWidth, w)));
// Buttons and track pieces can all have margins along the axis of the scrollbar.
- m_marginBox.setLeft(minimumValueForLength(style().marginLeft(), visibleSize, renderView));
- m_marginBox.setRight(minimumValueForLength(style().marginRight(), visibleSize, renderView));
+ m_marginBox.setLeft(minimumValueForLength(style().marginLeft(), visibleSize));
+ m_marginBox.setRight(minimumValueForLength(style().marginRight(), visibleSize));
}
void RenderScrollbarPart::computeScrollbarHeight()
{
if (!m_scrollbar->owningRenderer())
return;
- RenderView* renderView = &view();
// FIXME: We are querying layout information but nothing guarantees that it's up-to-date, especially since we are called at style change.
// FIXME: Querying the style's border information doesn't work on table cells with collapsing borders.
int visibleSize = m_scrollbar->owningRenderer()->height() - m_scrollbar->owningRenderer()->style().borderTopWidth() - m_scrollbar->owningRenderer()->style().borderBottomWidth();
- int h = calcScrollbarThicknessUsing(MainOrPreferredSize, style().height(), visibleSize, renderView);
- int minHeight = calcScrollbarThicknessUsing(MinSize, style().minHeight(), visibleSize, renderView);
- int maxHeight = style().maxHeight().isUndefined() ? h : calcScrollbarThicknessUsing(MaxSize, style().maxHeight(), visibleSize, renderView);
+ int h = calcScrollbarThicknessUsing(MainOrPreferredSize, style().height(), visibleSize);
+ int minHeight = calcScrollbarThicknessUsing(MinSize, style().minHeight(), visibleSize);
+ int maxHeight = style().maxHeight().isUndefined() ? h : calcScrollbarThicknessUsing(MaxSize, style().maxHeight(), visibleSize);
setHeight(std::max(minHeight, std::min(maxHeight, h)));
// Buttons and track pieces can all have margins along the axis of the scrollbar.
- m_marginBox.setTop(minimumValueForLength(style().marginTop(), visibleSize, renderView));
- m_marginBox.setBottom(minimumValueForLength(style().marginBottom(), visibleSize, renderView));
+ m_marginBox.setTop(minimumValueForLength(style().marginTop(), visibleSize));
+ m_marginBox.setBottom(minimumValueForLength(style().marginBottom(), visibleSize));
}
void RenderScrollbarPart::computePreferredLogicalWidths()
@@ -140,15 +138,15 @@ void RenderScrollbarPart::styleDidChange(StyleDifference diff, const RenderStyle
setFloating(false);
setHasOverflowClip(false);
if (oldStyle && m_scrollbar && m_part != NoPart && diff >= StyleDifferenceRepaint)
- m_scrollbar->theme()->invalidatePart(m_scrollbar, m_part);
+ m_scrollbar->theme().invalidatePart(*m_scrollbar, m_part);
}
void RenderScrollbarPart::imageChanged(WrappedImagePtr image, const IntRect* rect)
{
if (m_scrollbar && m_part != NoPart)
- m_scrollbar->theme()->invalidatePart(m_scrollbar, m_part);
+ m_scrollbar->theme().invalidatePart(*m_scrollbar, m_part);
else {
- if (view().frameView().isFrameViewScrollCorner(this)) {
+ if (view().frameView().isFrameViewScrollCorner(*this)) {
view().frameView().invalidateScrollCorner(view().frameView().scrollCornerRect());
return;
}
@@ -157,27 +155,27 @@ void RenderScrollbarPart::imageChanged(WrappedImagePtr image, const IntRect* rec
}
}
-void RenderScrollbarPart::paintIntoRect(GraphicsContext* graphicsContext, const LayoutPoint& paintOffset, const LayoutRect& rect)
+void RenderScrollbarPart::paintIntoRect(GraphicsContext& graphicsContext, const LayoutPoint& paintOffset, const LayoutRect& rect)
{
// Make sure our dimensions match the rect.
- setLocation(rect.location() - toSize(paintOffset));
+ setLocation(rect.location() - toLayoutSize(paintOffset));
setWidth(rect.width());
setHeight(rect.height());
- if (graphicsContext->paintingDisabled() || !style().opacity())
+ if (graphicsContext.paintingDisabled() || !style().opacity())
return;
// We don't use RenderLayers for scrollbar parts, so we need to handle opacity here.
// Opacity for ScrollbarBGPart is handled by RenderScrollbarTheme::willPaintScrollbar().
bool needsTransparencyLayer = m_part != ScrollbarBGPart && style().opacity() < 1;
if (needsTransparencyLayer) {
- graphicsContext->save();
- graphicsContext->clip(rect);
- graphicsContext->beginTransparencyLayer(style().opacity());
+ graphicsContext.save();
+ graphicsContext.clip(rect);
+ graphicsContext.beginTransparencyLayer(style().opacity());
}
// Now do the paint.
- PaintInfo paintInfo(graphicsContext, pixelSnappedIntRect(rect), PaintPhaseBlockBackground, PaintBehaviorNormal);
+ PaintInfo paintInfo(graphicsContext, snappedIntRect(rect), PaintPhaseBlockBackground, PaintBehaviorNormal);
paint(paintInfo, paintOffset);
paintInfo.phase = PaintPhaseChildBlockBackgrounds;
paint(paintInfo, paintOffset);
@@ -189,8 +187,8 @@ void RenderScrollbarPart::paintIntoRect(GraphicsContext* graphicsContext, const
paint(paintInfo, paintOffset);
if (needsTransparencyLayer) {
- graphicsContext->endTransparencyLayer();
- graphicsContext->restore();
+ graphicsContext.endTransparencyLayer();
+ graphicsContext.restore();
}
}