Commit 5ed526f8 authored by eae@chromium.org's avatar eae@chromium.org

Switch RenderBoxModelObject to to new layout types

https://bugs.webkit.org/show_bug.cgi?id=66534

Reviewed by Eric Seidel.

Convert RenderBoxModelObject to new layout abstraction.

No new tests as no new functionality.

* rendering/RenderBoxModelObject.cpp:
(WebCore::ImageQualityController::set):
(WebCore::ImageQualityController::shouldPaintAtLowQuality):
(WebCore::RenderBoxModelObject::shouldPaintAtLowQuality):
(WebCore::backgroundRectAdjustedForBleedAvoidance):
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
(WebCore::RenderBoxModelObject::calculateFillTileSize):
(WebCore::RenderBoxModelObject::BackgroundImageGeometry::useFixedAttachment):
(WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
(WebCore::RenderBoxModelObject::paintNinePieceImage):
(WebCore::borderWillArcInnerEdge):
(WebCore::RenderBoxModelObject::paintOneBorderSide):
(WebCore::RenderBoxModelObject::paintBorderSides):
(WebCore::RenderBoxModelObject::paintBorder):
(WebCore::RenderBoxModelObject::drawBoxSideFromPath):
(WebCore::RenderBoxModelObject::clipBorderSidePolygon):
(WebCore::areaCastingShadowInHole):
(WebCore::RenderBoxModelObject::paintBoxShadow):
(WebCore::RenderBoxModelObject::containingBlockLogicalWidthForContent):
* rendering/RenderBoxModelObject.h:


git-svn-id: svn://svn.chromium.org/blink/trunk@93435 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent a649f2e0
2011-08-19 Emil A Eklund <eae@chromium.org>
Switch RenderBoxModelObject to to new layout types
https://bugs.webkit.org/show_bug.cgi?id=66534
Reviewed by Eric Seidel.
Convert RenderBoxModelObject to new layout abstraction.
No new tests as no new functionality.
* rendering/RenderBoxModelObject.cpp:
(WebCore::ImageQualityController::set):
(WebCore::ImageQualityController::shouldPaintAtLowQuality):
(WebCore::RenderBoxModelObject::shouldPaintAtLowQuality):
(WebCore::backgroundRectAdjustedForBleedAvoidance):
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
(WebCore::RenderBoxModelObject::calculateFillTileSize):
(WebCore::RenderBoxModelObject::BackgroundImageGeometry::useFixedAttachment):
(WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
(WebCore::RenderBoxModelObject::paintNinePieceImage):
(WebCore::borderWillArcInnerEdge):
(WebCore::RenderBoxModelObject::paintOneBorderSide):
(WebCore::RenderBoxModelObject::paintBorderSides):
(WebCore::RenderBoxModelObject::paintBorder):
(WebCore::RenderBoxModelObject::drawBoxSideFromPath):
(WebCore::RenderBoxModelObject::clipBorderSidePolygon):
(WebCore::areaCastingShadowInHole):
(WebCore::RenderBoxModelObject::paintBoxShadow):
(WebCore::RenderBoxModelObject::containingBlockLogicalWidthForContent):
* rendering/RenderBoxModelObject.h:
2011-08-19 Mihnea Ovidenie <mihnea@adobe.com> 2011-08-19 Mihnea Ovidenie <mihnea@adobe.com>
[CSSRegions]Speed up RenderFlowThread repaint of regions [CSSRegions]Speed up RenderFlowThread repaint of regions
...@@ -51,7 +51,7 @@ bool RenderBoxModelObject::s_layerWasSelfPainting = false; ...@@ -51,7 +51,7 @@ bool RenderBoxModelObject::s_layerWasSelfPainting = false;
static const double cInterpolationCutoff = 800. * 800.; static const double cInterpolationCutoff = 800. * 800.;
static const double cLowQualityTimeThreshold = 0.500; // 500 ms static const double cLowQualityTimeThreshold = 0.500; // 500 ms
typedef HashMap<const void*, IntSize> LayerSizeMap; typedef HashMap<const void*, LayoutSize> LayerSizeMap;
typedef HashMap<RenderBoxModelObject*, LayerSizeMap> ObjectLayerSizeMap; typedef HashMap<RenderBoxModelObject*, LayerSizeMap> ObjectLayerSizeMap;
// The HashMap for storing continuation pointers. // The HashMap for storing continuation pointers.
...@@ -68,9 +68,9 @@ class ImageQualityController { ...@@ -68,9 +68,9 @@ class ImageQualityController {
WTF_MAKE_NONCOPYABLE(ImageQualityController); WTF_MAKE_FAST_ALLOCATED; WTF_MAKE_NONCOPYABLE(ImageQualityController); WTF_MAKE_FAST_ALLOCATED;
public: public:
ImageQualityController(); ImageQualityController();
bool shouldPaintAtLowQuality(GraphicsContext*, RenderBoxModelObject*, Image*, const void* layer, const IntSize&); bool shouldPaintAtLowQuality(GraphicsContext*, RenderBoxModelObject*, Image*, const void* layer, const LayoutSize&);
void removeLayer(RenderBoxModelObject*, LayerSizeMap* innerMap, const void* layer); void removeLayer(RenderBoxModelObject*, LayerSizeMap* innerMap, const void* layer);
void set(RenderBoxModelObject*, LayerSizeMap* innerMap, const void* layer, const IntSize&); void set(RenderBoxModelObject*, LayerSizeMap* innerMap, const void* layer, const LayoutSize&);
void objectDestroyed(RenderBoxModelObject*); void objectDestroyed(RenderBoxModelObject*);
bool isEmpty() { return m_objectLayerSizeMap.isEmpty(); } bool isEmpty() { return m_objectLayerSizeMap.isEmpty(); }
...@@ -98,7 +98,7 @@ void ImageQualityController::removeLayer(RenderBoxModelObject* object, LayerSize ...@@ -98,7 +98,7 @@ void ImageQualityController::removeLayer(RenderBoxModelObject* object, LayerSize
} }
} }
void ImageQualityController::set(RenderBoxModelObject* object, LayerSizeMap* innerMap, const void* layer, const IntSize& size) void ImageQualityController::set(RenderBoxModelObject* object, LayerSizeMap* innerMap, const void* layer, const LayoutSize& size)
{ {
if (innerMap) if (innerMap)
innerMap->set(layer, size); innerMap->set(layer, size);
...@@ -132,7 +132,7 @@ void ImageQualityController::restartTimer() ...@@ -132,7 +132,7 @@ void ImageQualityController::restartTimer()
m_timer.startOneShot(cLowQualityTimeThreshold); m_timer.startOneShot(cLowQualityTimeThreshold);
} }
bool ImageQualityController::shouldPaintAtLowQuality(GraphicsContext* context, RenderBoxModelObject* object, Image* image, const void *layer, const IntSize& size) bool ImageQualityController::shouldPaintAtLowQuality(GraphicsContext* context, RenderBoxModelObject* object, Image* image, const void *layer, const LayoutSize& size)
{ {
// If the image is not a bitmap image, then none of this is relevant and we just paint at high // If the image is not a bitmap image, then none of this is relevant and we just paint at high
// quality. // quality.
...@@ -149,7 +149,7 @@ bool ImageQualityController::shouldPaintAtLowQuality(GraphicsContext* context, R ...@@ -149,7 +149,7 @@ bool ImageQualityController::shouldPaintAtLowQuality(GraphicsContext* context, R
// Look ourselves up in the hashtables. // Look ourselves up in the hashtables.
ObjectLayerSizeMap::iterator i = m_objectLayerSizeMap.find(object); ObjectLayerSizeMap::iterator i = m_objectLayerSizeMap.find(object);
LayerSizeMap* innerMap = i != m_objectLayerSizeMap.end() ? &i->second : 0; LayerSizeMap* innerMap = i != m_objectLayerSizeMap.end() ? &i->second : 0;
IntSize oldSize; LayoutSize oldSize;
bool isFirstResize = true; bool isFirstResize = true;
if (innerMap) { if (innerMap) {
LayerSizeMap::iterator j = innerMap->find(layer); LayerSizeMap::iterator j = innerMap->find(layer);
...@@ -161,7 +161,9 @@ bool ImageQualityController::shouldPaintAtLowQuality(GraphicsContext* context, R ...@@ -161,7 +161,9 @@ bool ImageQualityController::shouldPaintAtLowQuality(GraphicsContext* context, R
const AffineTransform& currentTransform = context->getCTM(); const AffineTransform& currentTransform = context->getCTM();
bool contextIsScaled = !currentTransform.isIdentityOrTranslationOrFlipped(); bool contextIsScaled = !currentTransform.isIdentityOrTranslationOrFlipped();
if (!contextIsScaled && imageSize == size) { // FIXME: Change to use roughlyEquals when we move to float.
// See https://bugs.webkit.org/show_bug.cgi?id=66148
if (!contextIsScaled && size == imageSize) {
// There is no scale in effect. If we had a scale in effect before, we can just remove this object from the list. // There is no scale in effect. If we had a scale in effect before, we can just remove this object from the list.
removeLayer(object, innerMap, layer); removeLayer(object, innerMap, layer);
return false; return false;
...@@ -183,6 +185,8 @@ bool ImageQualityController::shouldPaintAtLowQuality(GraphicsContext* context, R ...@@ -183,6 +185,8 @@ bool ImageQualityController::shouldPaintAtLowQuality(GraphicsContext* context, R
// If this is the first time resizing this image, or its size is the // If this is the first time resizing this image, or its size is the
// same as the last resize, draw at high res, but record the paint // same as the last resize, draw at high res, but record the paint
// size and set the timer. // size and set the timer.
// FIXME: Change to use roughlyEquals when we move to float.
// See https://bugs.webkit.org/show_bug.cgi?id=66148
if (isFirstResize || oldSize == size) { if (isFirstResize || oldSize == size) {
restartTimer(); restartTimer();
set(object, innerMap, layer, size); set(object, innerMap, layer, size);
...@@ -235,7 +239,7 @@ void RenderBoxModelObject::setSelectionState(SelectionState s) ...@@ -235,7 +239,7 @@ void RenderBoxModelObject::setSelectionState(SelectionState s)
cb->setSelectionState(s); cb->setSelectionState(s);
} }
bool RenderBoxModelObject::shouldPaintAtLowQuality(GraphicsContext* context, Image* image, const void* layer, const IntSize& size) bool RenderBoxModelObject::shouldPaintAtLowQuality(GraphicsContext* context, Image* image, const void* layer, const LayoutSize& size)
{ {
return imageQualityController()->shouldPaintAtLowQuality(context, this, image, layer, size); return imageQualityController()->shouldPaintAtLowQuality(context, this, image, layer, size);
} }
...@@ -575,12 +579,12 @@ RoundedRect RenderBoxModelObject::getBackgroundRoundedRect(const LayoutRect& bor ...@@ -575,12 +579,12 @@ RoundedRect RenderBoxModelObject::getBackgroundRoundedRect(const LayoutRect& bor
return border; return border;
} }
static IntRect backgroundRectAdjustedForBleedAvoidance(GraphicsContext* context, const IntRect& borderRect, BackgroundBleedAvoidance bleedAvoidance) static LayoutRect backgroundRectAdjustedForBleedAvoidance(GraphicsContext* context, const LayoutRect& borderRect, BackgroundBleedAvoidance bleedAvoidance)
{ {
if (bleedAvoidance != BackgroundBleedShrinkBackground) if (bleedAvoidance != BackgroundBleedShrinkBackground)
return borderRect; return borderRect;
IntRect adjustedRect = borderRect; LayoutRect adjustedRect = borderRect;
// We need to shrink the border by one device pixel on each side. // We need to shrink the border by one device pixel on each side.
AffineTransform ctm = context->getCTM(); AffineTransform ctm = context->getCTM();
FloatSize contextScale(static_cast<float>(ctm.xScale()), static_cast<float>(ctm.yScale())); FloatSize contextScale(static_cast<float>(ctm.xScale()), static_cast<float>(ctm.yScale()));
...@@ -777,7 +781,7 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co ...@@ -777,7 +781,7 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co
} }
} }
IntSize RenderBoxModelObject::calculateFillTileSize(const FillLayer* fillLayer, IntSize positioningAreaSize) const LayoutSize RenderBoxModelObject::calculateFillTileSize(const FillLayer* fillLayer, LayoutSize positioningAreaSize) const
{ {
StyleImage* image = fillLayer->image(); StyleImage* image = fillLayer->image();
image->setImageContainerSize(positioningAreaSize); // Use the box established by background-origin. image->setImageContainerSize(positioningAreaSize); // Use the box established by background-origin.
...@@ -786,8 +790,8 @@ IntSize RenderBoxModelObject::calculateFillTileSize(const FillLayer* fillLayer, ...@@ -786,8 +790,8 @@ IntSize RenderBoxModelObject::calculateFillTileSize(const FillLayer* fillLayer,
switch (type) { switch (type) {
case SizeLength: { case SizeLength: {
int w = positioningAreaSize.width(); LayoutUnit w = positioningAreaSize.width();
int h = positioningAreaSize.height(); LayoutUnit h = positioningAreaSize.height();
Length layerWidth = fillLayer->size().size.width(); Length layerWidth = fillLayer->size().size.width();
Length layerHeight = fillLayer->size().size.height(); Length layerHeight = fillLayer->size().size.height();
...@@ -805,31 +809,31 @@ IntSize RenderBoxModelObject::calculateFillTileSize(const FillLayer* fillLayer, ...@@ -805,31 +809,31 @@ IntSize RenderBoxModelObject::calculateFillTileSize(const FillLayer* fillLayer,
// If one of the values is auto we have to use the appropriate // If one of the values is auto we have to use the appropriate
// scale to maintain our aspect ratio. // scale to maintain our aspect ratio.
if (layerWidth.isAuto() && !layerHeight.isAuto()) { if (layerWidth.isAuto() && !layerHeight.isAuto()) {
IntSize imageIntrinsicSize = image->imageSize(this, style()->effectiveZoom()); LayoutSize imageIntrinsicSize = image->imageSize(this, style()->effectiveZoom());
if (imageIntrinsicSize.height()) if (imageIntrinsicSize.height())
w = imageIntrinsicSize.width() * h / imageIntrinsicSize.height(); w = imageIntrinsicSize.width() * h / imageIntrinsicSize.height();
} else if (!layerWidth.isAuto() && layerHeight.isAuto()) { } else if (!layerWidth.isAuto() && layerHeight.isAuto()) {
IntSize imageIntrinsicSize = image->imageSize(this, style()->effectiveZoom()); LayoutSize imageIntrinsicSize = image->imageSize(this, style()->effectiveZoom());
if (imageIntrinsicSize.width()) if (imageIntrinsicSize.width())
h = imageIntrinsicSize.height() * w / imageIntrinsicSize.width(); h = imageIntrinsicSize.height() * w / imageIntrinsicSize.width();
} else if (layerWidth.isAuto() && layerHeight.isAuto()) { } else if (layerWidth.isAuto() && layerHeight.isAuto()) {
// If both width and height are auto, use the image's intrinsic size. // If both width and height are auto, use the image's intrinsic size.
IntSize imageIntrinsicSize = image->imageSize(this, style()->effectiveZoom()); LayoutSize imageIntrinsicSize = image->imageSize(this, style()->effectiveZoom());
w = imageIntrinsicSize.width(); w = imageIntrinsicSize.width();
h = imageIntrinsicSize.height(); h = imageIntrinsicSize.height();
} }
return IntSize(max(1, w), max(1, h)); return LayoutSize(max<LayoutUnit>(1, w), max<LayoutUnit>(1, h));
} }
case Contain: case Contain:
case Cover: { case Cover: {
IntSize imageIntrinsicSize = image->imageSize(this, 1); LayoutSize imageIntrinsicSize = image->imageSize(this, 1);
float horizontalScaleFactor = imageIntrinsicSize.width() float horizontalScaleFactor = imageIntrinsicSize.width()
? static_cast<float>(positioningAreaSize.width()) / imageIntrinsicSize.width() : 1; ? static_cast<float>(positioningAreaSize.width()) / imageIntrinsicSize.width() : 1;
float verticalScaleFactor = imageIntrinsicSize.height() float verticalScaleFactor = imageIntrinsicSize.height()
? static_cast<float>(positioningAreaSize.height()) / imageIntrinsicSize.height() : 1; ? static_cast<float>(positioningAreaSize.height()) / imageIntrinsicSize.height() : 1;
float scaleFactor = type == Contain ? min(horizontalScaleFactor, verticalScaleFactor) : max(horizontalScaleFactor, verticalScaleFactor); float scaleFactor = type == Contain ? min(horizontalScaleFactor, verticalScaleFactor) : max(horizontalScaleFactor, verticalScaleFactor);
return IntSize(max<int>(1, imageIntrinsicSize.width() * scaleFactor), max<int>(1, imageIntrinsicSize.height() * scaleFactor)); return LayoutSize(max<LayoutUnit>(1, imageIntrinsicSize.width() * scaleFactor), max<LayoutUnit>(1, imageIntrinsicSize.height() * scaleFactor));
} }
case SizeNone: case SizeNone:
break; break;
...@@ -853,7 +857,7 @@ void RenderBoxModelObject::BackgroundImageGeometry::setNoRepeatY(int yOffset) ...@@ -853,7 +857,7 @@ void RenderBoxModelObject::BackgroundImageGeometry::setNoRepeatY(int yOffset)
void RenderBoxModelObject::BackgroundImageGeometry::useFixedAttachment(const LayoutPoint& attachmentPoint) void RenderBoxModelObject::BackgroundImageGeometry::useFixedAttachment(const LayoutPoint& attachmentPoint)
{ {
m_phase.move(max(attachmentPoint.x() - m_destRect.x(), 0), max(attachmentPoint.y() - m_destRect.y(), 0)); m_phase.move(max<LayoutUnit>(attachmentPoint.x() - m_destRect.x(), 0), max<LayoutUnit>(attachmentPoint.y() - m_destRect.y(), 0));
} }
void RenderBoxModelObject::BackgroundImageGeometry::clip(const LayoutRect& clipRect) void RenderBoxModelObject::BackgroundImageGeometry::clip(const LayoutRect& clipRect)
...@@ -868,12 +872,12 @@ LayoutPoint RenderBoxModelObject::BackgroundImageGeometry::relativePhase() const ...@@ -868,12 +872,12 @@ LayoutPoint RenderBoxModelObject::BackgroundImageGeometry::relativePhase() const
return phase; return phase;
} }
void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fillLayer, const IntRect& paintRect, void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fillLayer, const LayoutRect& paintRect,
BackgroundImageGeometry& geometry) BackgroundImageGeometry& geometry)
{ {
int left = 0; LayoutUnit left = 0;
int top = 0; LayoutUnit top = 0;
IntSize positioningAreaSize; LayoutSize positioningAreaSize;
// Determine the background positioning area and set destRect to the background painting area. // Determine the background positioning area and set destRect to the background painting area.
// destRect will be adjusted later if the background is non-repeating. // destRect will be adjusted later if the background is non-repeating.
...@@ -892,8 +896,8 @@ void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fil ...@@ -892,8 +896,8 @@ void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fil
if (!fixedAttachment) { if (!fixedAttachment) {
geometry.setDestRect(paintRect); geometry.setDestRect(paintRect);
int right = 0; LayoutUnit right = 0;
int bottom = 0; LayoutUnit bottom = 0;
// Scroll and Local. // Scroll and Local.
if (fillLayer->origin() != BorderFillBox) { if (fillLayer->origin() != BorderFillBox) {
left = borderLeft(); left = borderLeft();
...@@ -912,11 +916,11 @@ void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fil ...@@ -912,11 +916,11 @@ void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fil
// its margins. Since those were added in already, we have to factor them out when computing // its margins. Since those were added in already, we have to factor them out when computing
// the background positioning area. // the background positioning area.
if (isRoot()) { if (isRoot()) {
positioningAreaSize = IntSize(toRenderBox(this)->width() - left - right, toRenderBox(this)->height() - top - bottom); positioningAreaSize = LayoutSize(toRenderBox(this)->width() - left - right, toRenderBox(this)->height() - top - bottom);
left += marginLeft(); left += marginLeft();
top += marginTop(); top += marginTop();
} else } else
positioningAreaSize = IntSize(paintRect.width() - left - right, paintRect.height() - top - bottom); positioningAreaSize = LayoutSize(paintRect.width() - left - right, paintRect.height() - top - bottom);
} else { } else {
geometry.setDestRect(viewRect()); geometry.setDestRect(viewRect());
positioningAreaSize = geometry.destRect().size(); positioningAreaSize = geometry.destRect().size();
...@@ -927,15 +931,15 @@ void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fil ...@@ -927,15 +931,15 @@ void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fil
EFillRepeat backgroundRepeatX = fillLayer->repeatX(); EFillRepeat backgroundRepeatX = fillLayer->repeatX();
EFillRepeat backgroundRepeatY = fillLayer->repeatY(); EFillRepeat backgroundRepeatY = fillLayer->repeatY();
int xPosition = fillLayer->xPosition().calcMinValue(positioningAreaSize.width() - geometry.tileSize().width(), true); LayoutUnit xPosition = fillLayer->xPosition().calcMinValue(positioningAreaSize.width() - geometry.tileSize().width(), true);
if (backgroundRepeatX == RepeatFill) if (backgroundRepeatX == RepeatFill)
geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().width() - (xPosition + left) % geometry.tileSize().width() : 0); geometry.setPhaseX(geometry.tileSize().width() ? layoutMod(geometry.tileSize().width() - (xPosition + left), geometry.tileSize().width()) : 0);
else else
geometry.setNoRepeatX(xPosition + left); geometry.setNoRepeatX(xPosition + left);
int yPosition = fillLayer->yPosition().calcMinValue(positioningAreaSize.height() - geometry.tileSize().height(), true); LayoutUnit yPosition = fillLayer->yPosition().calcMinValue(positioningAreaSize.height() - geometry.tileSize().height(), true);
if (backgroundRepeatY == RepeatFill) if (backgroundRepeatY == RepeatFill)
geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().height() - (yPosition + top) % geometry.tileSize().height() : 0); geometry.setPhaseY(geometry.tileSize().height() ? layoutMod(geometry.tileSize().height() - (yPosition + top), geometry.tileSize().height()) : 0);
else else
geometry.setNoRepeatY(yPosition + top); geometry.setNoRepeatY(yPosition + top);
...@@ -946,7 +950,7 @@ void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fil ...@@ -946,7 +950,7 @@ void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fil
geometry.setDestOrigin(geometry.destRect().location()); geometry.setDestOrigin(geometry.destRect().location());
} }
bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext, const IntRect& rect, const RenderStyle* style, bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext, const LayoutRect& rect, const RenderStyle* style,
const NinePieceImage& ninePieceImage, CompositeOperator op) const NinePieceImage& ninePieceImage, CompositeOperator op)
{ {
StyleImage* styleImage = ninePieceImage.image(); StyleImage* styleImage = ninePieceImage.image();
...@@ -962,24 +966,24 @@ bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext, ...@@ -962,24 +966,24 @@ bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext,
// FIXME: border-image is broken with full page zooming when tiling has to happen, since the tiling function // FIXME: border-image is broken with full page zooming when tiling has to happen, since the tiling function
// doesn't have any understanding of the zoom that is in effect on the tile. // doesn't have any understanding of the zoom that is in effect on the tile.
styleImage->setImageContainerSize(rect.size()); styleImage->setImageContainerSize(rect.size());
IntSize imageSize = styleImage->imageSize(this, 1.0f); LayoutSize imageSize = styleImage->imageSize(this, 1.0f);
int imageWidth = imageSize.width(); LayoutUnit imageWidth = imageSize.width();
int imageHeight = imageSize.height(); LayoutUnit imageHeight = imageSize.height();
int topSlice = min(imageHeight, ninePieceImage.slices().top().calcValue(imageHeight)); LayoutUnit topSlice = min<LayoutUnit>(imageHeight, ninePieceImage.slices().top().calcValue(imageHeight));
int bottomSlice = min(imageHeight, ninePieceImage.slices().bottom().calcValue(imageHeight)); LayoutUnit bottomSlice = min<LayoutUnit>(imageHeight, ninePieceImage.slices().bottom().calcValue(imageHeight));
int leftSlice = min(imageWidth, ninePieceImage.slices().left().calcValue(imageWidth)); LayoutUnit leftSlice = min<LayoutUnit>(imageWidth, ninePieceImage.slices().left().calcValue(imageWidth));
int rightSlice = min(imageWidth, ninePieceImage.slices().right().calcValue(imageWidth)); LayoutUnit rightSlice = min<LayoutUnit>(imageWidth, ninePieceImage.slices().right().calcValue(imageWidth));
ENinePieceImageRule hRule = ninePieceImage.horizontalRule(); ENinePieceImageRule hRule = ninePieceImage.horizontalRule();
ENinePieceImageRule vRule = ninePieceImage.verticalRule(); ENinePieceImageRule vRule = ninePieceImage.verticalRule();
bool fitToBorder = style->borderImage() == ninePieceImage; bool fitToBorder = style->borderImage() == ninePieceImage;
int leftWidth = fitToBorder ? style->borderLeftWidth() : leftSlice; LayoutUnit leftWidth = fitToBorder ? style->borderLeftWidth() : leftSlice;
int topWidth = fitToBorder ? style->borderTopWidth() : topSlice; LayoutUnit topWidth = fitToBorder ? style->borderTopWidth() : topSlice;
int rightWidth = fitToBorder ? style->borderRightWidth() : rightSlice; LayoutUnit rightWidth = fitToBorder ? style->borderRightWidth() : rightSlice;
int bottomWidth = fitToBorder ? style->borderBottomWidth() : bottomSlice; LayoutUnit bottomWidth = fitToBorder ? style->borderBottomWidth() : bottomSlice;
bool drawLeft = leftSlice > 0 && leftWidth > 0; bool drawLeft = leftSlice > 0 && leftWidth > 0;
bool drawTop = topSlice > 0 && topWidth > 0; bool drawTop = topSlice > 0 && topWidth > 0;
...@@ -997,20 +1001,20 @@ bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext, ...@@ -997,20 +1001,20 @@ bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext,
// The top left corner rect is (tx, ty, leftWidth, topWidth) // The top left corner rect is (tx, ty, leftWidth, topWidth)
// The rect to use from within the image is obtained from our slice, and is (0, 0, leftSlice, topSlice) // The rect to use from within the image is obtained from our slice, and is (0, 0, leftSlice, topSlice)
if (drawTop) if (drawTop)
graphicsContext->drawImage(image.get(), colorSpace, IntRect(rect.location(), IntSize(leftWidth, topWidth)), graphicsContext->drawImage(image.get(), colorSpace, LayoutRect(rect.location(), LayoutSize(leftWidth, topWidth)),
IntRect(0, 0, leftSlice, topSlice), op); LayoutRect(0, 0, leftSlice, topSlice), op);
// The bottom left corner rect is (tx, ty + h - bottomWidth, leftWidth, bottomWidth) // The bottom left corner rect is (tx, ty + h - bottomWidth, leftWidth, bottomWidth)
// The rect to use from within the image is (0, imageHeight - bottomSlice, leftSlice, botomSlice) // The rect to use from within the image is (0, imageHeight - bottomSlice, leftSlice, botomSlice)
if (drawBottom) if (drawBottom)
graphicsContext->drawImage(image.get(), colorSpace, IntRect(rect.x(), rect.y() + rect.height() - bottomWidth, leftWidth, bottomWidth), graphicsContext->drawImage(image.get(), colorSpace, LayoutRect(rect.x(), rect.y() + rect.height() - bottomWidth, leftWidth, bottomWidth),
IntRect(0, imageHeight - bottomSlice, leftSlice, bottomSlice), op); LayoutRect(0, imageHeight - bottomSlice, leftSlice, bottomSlice), op);
// Paint the left edge. // Paint the left edge.
// Have to scale and tile into the border rect. // Have to scale and tile into the border rect.
graphicsContext->drawTiledImage(image.get(), colorSpace, IntRect(rect.x(), rect.y() + topWidth, leftWidth, graphicsContext->drawTiledImage(image.get(), colorSpace, LayoutRect(rect.x(), rect.y() + topWidth, leftWidth,
rect.height() - topWidth - bottomWidth), rect.height() - topWidth - bottomWidth),
IntRect(0, topSlice, leftSlice, imageHeight - topSlice - bottomSlice), LayoutRect(0, topSlice, leftSlice, imageHeight - topSlice - bottomSlice),
Image::StretchTile, (Image::TileRule)vRule, op); Image::StretchTile, (Image::TileRule)vRule, op);
} }
...@@ -1019,40 +1023,40 @@ bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext, ...@@ -1019,40 +1023,40 @@ bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext,
// The top right corner rect is (tx + w - rightWidth, ty, rightWidth, topWidth) // The top right corner rect is (tx + w - rightWidth, ty, rightWidth, topWidth)
// The rect to use from within the image is obtained from our slice, and is (imageWidth - rightSlice, 0, rightSlice, topSlice) // The rect to use from within the image is obtained from our slice, and is (imageWidth - rightSlice, 0, rightSlice, topSlice)
if (drawTop) if (drawTop)
graphicsContext->drawImage(image.get(), colorSpace, IntRect(rect.x() + rect.width() - rightWidth, rect.y(), rightWidth, topWidth), graphicsContext->drawImage(image.get(), colorSpace, LayoutRect(rect.x() + rect.width() - rightWidth, rect.y(), rightWidth, topWidth),
IntRect(imageWidth - rightSlice, 0, rightSlice, topSlice), op); LayoutRect(imageWidth - rightSlice, 0, rightSlice, topSlice), op);
// The bottom right corner rect is (tx + w - rightWidth, ty + h - bottomWidth, rightWidth, bottomWidth) // The bottom right corner rect is (tx + w - rightWidth, ty + h - bottomWidth, rightWidth, bottomWidth)
// The rect to use from within the image is (imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, bottomSlice) // The rect to use from within the image is (imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, bottomSlice)
if (drawBottom) if (drawBottom)
graphicsContext->drawImage(image.get(), colorSpace, IntRect(rect.x() + rect.width() - rightWidth, rect.y() + rect.height() - bottomWidth, rightWidth, bottomWidth), graphicsContext->drawImage(image.get(), colorSpace, LayoutRect(rect.x() + rect.width() - rightWidth, rect.y() + rect.height() - bottomWidth, rightWidth, bottomWidth),
IntRect(imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, bottomSlice), op); LayoutRect(imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, bottomSlice), op);
// Paint the right edge. // Paint the right edge.
graphicsContext->drawTiledImage(image.get(), colorSpace, IntRect(rect.x() + rect.width() - rightWidth, rect.y() + topWidth, rightWidth, graphicsContext->drawTiledImage(image.get(), colorSpace, LayoutRect(rect.x() + rect.width() - rightWidth, rect.y() + topWidth, rightWidth,
rect.height() - topWidth - bottomWidth), rect.height() - topWidth - bottomWidth),
IntRect(imageWidth - rightSlice, topSlice, rightSlice, imageHeight - topSlice - bottomSlice), LayoutRect(imageWidth - rightSlice, topSlice, rightSlice, imageHeight - topSlice - bottomSlice),
Image::StretchTile, (Image::TileRule)vRule, op); Image::StretchTile, (Image::TileRule)vRule, op);
} }
// Paint the top edge. // Paint the top edge.
if (drawTop) if (drawTop)
graphicsContext->drawTiledImage(image.get(), colorSpace, IntRect(rect.x() + leftWidth, rect.y(), rect.width() - leftWidth - rightWidth, topWidth), graphicsContext->drawTiledImage(image.get(), colorSpace, LayoutRect(rect.x() + leftWidth, rect.y(), rect.width() - leftWidth - rightWidth, topWidth),
IntRect(leftSlice, 0, imageWidth - rightSlice - leftSlice, topSlice), LayoutRect(leftSlice, 0, imageWidth - rightSlice - leftSlice, topSlice),
(Image::TileRule)hRule, Image::StretchTile, op); (Image::TileRule)hRule, Image::StretchTile, op);
// Paint the bottom edge. // Paint the bottom edge.
if (drawBottom) if (drawBottom)
graphicsContext->drawTiledImage(image.get(), colorSpace, IntRect(rect.x() + leftWidth, rect.y() + rect.height() - bottomWidth, graphicsContext->drawTiledImage(image.get(), colorSpace, LayoutRect(rect.x() + leftWidth, rect.y() + rect.height() - bottomWidth,
rect.width() - leftWidth - rightWidth, bottomWidth), rect.width() - leftWidth - rightWidth, bottomWidth),
IntRect(leftSlice, imageHeight - bottomSlice, imageWidth - rightSlice - leftSlice, bottomSlice), LayoutRect(leftSlice, imageHeight - bottomSlice, imageWidth - rightSlice - leftSlice, bottomSlice),
(Image::TileRule)hRule, Image::StretchTile, op); (Image::TileRule)hRule, Image::StretchTile, op);
// Paint the middle. // Paint the middle.
if (drawMiddle) if (drawMiddle)
graphicsContext->drawTiledImage(image.get(), colorSpace, IntRect(rect.x() + leftWidth, rect.y() + topWidth, rect.width() - leftWidth - rightWidth, graphicsContext->drawTiledImage(image.get(), colorSpace, LayoutRect(rect.x() + leftWidth, rect.y() + topWidth, rect.width() - leftWidth - rightWidth,
rect.height() - topWidth - bottomWidth), rect.height() - topWidth - bottomWidth),
IntRect(leftSlice, topSlice, imageWidth - rightSlice - leftSlice, imageHeight - topSlice - bottomSlice), LayoutRect(leftSlice, topSlice, imageWidth - rightSlice - leftSlice, imageHeight - topSlice - bottomSlice),
(Image::TileRule)hRule, (Image::TileRule)vRule, op); (Image::TileRule)hRule, (Image::TileRule)vRule, op);
return true; return true;
...@@ -1161,7 +1165,7 @@ static bool allCornersClippedOut(const RoundedRect& border, const LayoutRect& cl ...@@ -1161,7 +1165,7 @@ static bool allCornersClippedOut(const RoundedRect& border, const LayoutRect& cl
} }
#if HAVE(PATH_BASED_BORDER_RADIUS_DRAWING) #if HAVE(PATH_BASED_BORDER_RADIUS_DRAWING)
static bool borderWillArcInnerEdge(const IntSize& firstRadius, const IntSize& secondRadius) static bool borderWillArcInnerEdge(const LayoutSize& firstRadius, const FloatSize& secondRadius)
{ {
return !firstRadius.isZero() || !secondRadius.isZero(); return !firstRadius.isZero() || !secondRadius.isZero();
} }
...@@ -1292,7 +1296,7 @@ static bool joinRequiresMitre(BoxSide side, BoxSide adjacentSide, const BorderEd ...@@ -1292,7 +1296,7 @@ static bool joinRequiresMitre(BoxSide side, BoxSide adjacentSide, const BorderEd
} }
void RenderBoxModelObject::paintOneBorderSide(GraphicsContext* graphicsContext, const RenderStyle* style, const RoundedRect& outerBorder, const RoundedRect& innerBorder, void RenderBoxModelObject::paintOneBorderSide(GraphicsContext* graphicsContext, const RenderStyle* style, const RoundedRect& outerBorder, const RoundedRect& innerBorder,
const IntRect& sideRect, BoxSide side, BoxSide adjacentSide1, BoxSide adjacentSide2, const BorderEdge edges[], const Path* path, const LayoutRect& sideRect, BoxSide side, BoxSide adjacentSide1, BoxSide adjacentSide2, const BorderEdge edges[], const Path* path,
BackgroundBleedAvoidance bleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias, const Color* overrideColor) BackgroundBleedAvoidance bleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias, const Color* overrideColor)
{ {
const BorderEdge& edgeToRender = edges[side]; const BorderEdge& edgeToRender = edges[side];
...@@ -1357,28 +1361,32 @@ void RenderBoxModelObject::paintBorderSides(GraphicsContext* graphicsContext, co ...@@ -1357,28 +1361,32 @@ void RenderBoxModelObject::paintBorderSides(GraphicsContext* graphicsContext, co
roundedPath.addRoundedRect(outerBorder); roundedPath.addRoundedRect(outerBorder);
if (edges[BSTop].shouldRender() && includesEdge(edgeSet, BSTop)) { if (edges[BSTop].shouldRender() && includesEdge(edgeSet, BSTop)) {
LayoutRect sideRect = calculateSideRect(outerBorder, edges, BSTop); LayoutRect sideRect = outerBorder.rect();
sideRect.setHeight(edges[BSTop].width);
bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSTop].style) || borderWillArcInnerEdge(innerBorder.radii().topLeft(), innerBorder.radii().topRight())); bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSTop].style) || borderWillArcInnerEdge(innerBorder.radii().topLeft(), innerBorder.radii().topRight()));
paintOneBorderSide(graphicsContext, style, outerBorder, innerBorder, sideRect, BSTop, BSLeft, BSRight, edges, usePath ? &roundedPath : 0, bleedAvoidance, includeLogicalLeftEdge, includeLogicalRightEdge, antialias, overrideColor); paintOneBorderSide(graphicsContext, style, outerBorder, innerBorder, sideRect, BSTop, BSLeft, BSRight, edges, usePath ? &roundedPath : 0, bleedAvoidance, includeLogicalLeftEdge, includeLogicalRightEdge, antialias, overrideColor);
} }
if (edges[BSBottom].shouldRender() && includesEdge(edgeSet, BSBottom)) { if (edges[BSBottom].shouldRender() && includesEdge(edgeSet, BSBottom)) {
LayoutRect sideRect = calculateSideRect(outerBorder, edges, BSBottom); LayoutRect sideRect = outerBorder.rect();
sideRect.shiftYEdgeTo(sideRect.maxY() - edges[BSBottom].width);
bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSBottom].style) || borderWillArcInnerEdge(innerBorder.radii().bottomLeft(), innerBorder.radii().bottomRight())); bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSBottom].style) || borderWillArcInnerEdge(innerBorder.radii().bottomLeft(), innerBorder.radii().bottomRight()));
paintOneBorderSide(graphicsContext, style, outerBorder, innerBorder, sideRect, BSBottom, BSLeft, BSRight, edges, usePath ? &roundedPath : 0, bleedAvoidance, includeLogicalLeftEdge, includeLogicalRightEdge, antialias, overrideColor); paintOneBorderSide(graphicsContext, style, outerBorder, innerBorder, sideRect, BSBottom, BSLeft, BSRight, edges, usePath ? &roundedPath : 0, bleedAvoidance, includeLogicalLeftEdge, includeLogicalRightEdge, antialias, overrideColor);
} }
if (edges[BSLeft].shouldRender() && includesEdge(edgeSet, BSLeft)) { if (edges[BSLeft].shouldRender() && includesEdge(edgeSet, BSLeft)) {
LayoutRect sideRect = calculateSideRect(outerBorder, edges, BSLeft); LayoutRect sideRect = outerBorder.rect();
sideRect.setWidth(edges[BSLeft].width);
bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSLeft].style) || borderWillArcInnerEdge(innerBorder.radii().bottomLeft(), innerBorder.radii().topLeft())); bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSLeft].style) || borderWillArcInnerEdge(innerBorder.radii().bottomLeft(), innerBorder.radii().topLeft()));
paintOneBorderSide(graphicsContext, style, outerBorder, innerBorder, sideRect, BSLeft, BSTop, BSBottom, edges, usePath ? &roundedPath : 0, bleedAvoidance, includeLogicalLeftEdge, includeLogicalRightEdge, antialias, overrideColor); paintOneBorderSide(graphicsContext, style, outerBorder, innerBorder, sideRect, BSLeft, BSTop, BSBottom, edges, usePath ? &roundedPath : 0, bleedAvoidance, includeLogicalLeftEdge, includeLogicalRightEdge, antialias, overrideColor);
} }
if (edges[BSRight].shouldRender() && includesEdge(edgeSet, BSRight)) { if (edges[BSRight].shouldRender() && includesEdge(edgeSet, BSRight)) {
LayoutRect sideRect = calculateSideRect(outerBorder, edges, BSRight); LayoutRect sideRect = outerBorder.rect();
sideRect.shiftXEdgeTo(sideRect.maxX() - edges[BSRight].width);
bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSRight].style) || borderWillArcInnerEdge(innerBorder.radii().bottomRight(), innerBorder.radii().topRight())); bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSRight].style) || borderWillArcInnerEdge(innerBorder.radii().bottomRight(), innerBorder.radii().topRight()));
paintOneBorderSide(graphicsContext, style, outerBorder, innerBorder, sideRect, BSRight, BSTop, BSBottom, edges, usePath ? &roundedPath : 0, bleedAvoidance, includeLogicalLeftEdge, includeLogicalRightEdge, antialias, overrideColor); paintOneBorderSide(graphicsContext, style, outerBorder, innerBorder, sideRect, BSRight, BSTop, BSBottom, edges, usePath ? &roundedPath : 0, bleedAvoidance, includeLogicalLeftEdge, includeLogicalRightEdge, antialias, overrideColor);
...@@ -1425,7 +1433,7 @@ void RenderBoxModelObject::paintTranslucentBorderSides(GraphicsContext* graphics ...@@ -1425,7 +1433,7 @@ void RenderBoxModelObject::paintTranslucentBorderSides(GraphicsContext* graphics
} }
} }
void RenderBoxModelObject::paintBorder(const PaintInfo& info, const IntRect& rect, const RenderStyle* style, void RenderBoxModelObject::paintBorder(const PaintInfo& info, const LayoutRect& rect, const RenderStyle* style,
BackgroundBleedAvoidance bleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) BackgroundBleedAvoidance bleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
{ {
GraphicsContext* graphicsContext = info.context; GraphicsContext* graphicsContext = info.context;
...@@ -1537,7 +1545,7 @@ void RenderBoxModelObject::paintBorder(const PaintInfo& info, const IntRect& rec ...@@ -1537,7 +1545,7 @@ void RenderBoxModelObject::paintBorder(const PaintInfo& info, const IntRect& rec
paintBorderSides(graphicsContext, style, outerBorder, innerBorder, edges, AllBorderEdges, bleedAvoidance, includeLogicalLeftEdge, includeLogicalRightEdge, antialias); paintBorderSides(graphicsContext, style, outerBorder, innerBorder, edges, AllBorderEdges, bleedAvoidance, includeLogicalLeftEdge, includeLogicalRightEdge, antialias);
} }
void RenderBoxModelObject::drawBoxSideFromPath(GraphicsContext* graphicsContext, const IntRect& borderRect, const Path& borderPath, const BorderEdge edges[], void RenderBoxModelObject::drawBoxSideFromPath(GraphicsContext* graphicsContext, const LayoutRect& borderRect, const Path& borderPath, const BorderEdge edges[],
float thickness, float drawThickness, BoxSide side, const RenderStyle* style, float thickness, float drawThickness, BoxSide side, const RenderStyle* style,
Color color, EBorderStyle borderStyle, BackgroundBleedAvoidance bleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) Color color, EBorderStyle borderStyle, BackgroundBleedAvoidance bleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
{ {
...@@ -1624,7 +1632,7 @@ void RenderBoxModelObject::drawBoxSideFromPath(GraphicsContext* graphicsContext, ...@@ -1624,7 +1632,7 @@ void RenderBoxModelObject::drawBoxSideFromPath(GraphicsContext* graphicsContext,
// Draw outer border line // Draw outer border line
{ {
GraphicsContextStateSaver stateSaver(*graphicsContext); GraphicsContextStateSaver stateSaver(*graphicsContext);
IntRect outerRect = borderRect; LayoutRect outerRect = borderRect;
if (bleedAvoidance == BackgroundBleedUseTransparencyLayer) { if (bleedAvoidance == BackgroundBleedUseTransparencyLayer) {
outerRect.inflate(1); outerRect.inflate(1);
++outerBorderTopWidth; ++outerBorderTopWidth;
...@@ -2029,8 +2037,8 @@ void RenderBoxModelObject::clipBorderSidePolygon(GraphicsContext* graphicsContex ...@@ -2029,8 +2037,8 @@ void RenderBoxModelObject::clipBorderSidePolygon(GraphicsContext* graphicsContex
{ {
FloatPoint quad[4]; FloatPoint quad[4];
const IntRect& outerRect = outerBorder.rect(); const LayoutRect& outerRect = outerBorder.rect();
const IntRect& innerRect = innerBorder.rect(); const LayoutRect& innerRect = innerBorder.rect();
FloatPoint centerPoint(innerRect.location().x() + static_cast<float>(innerRect.width()) / 2, innerRect.location().y() + static_cast<float>(innerRect.height()) / 2); FloatPoint centerPoint(innerRect.location().x() + static_cast<float>(innerRect.width()) / 2, innerRect.location().y() + static_cast<float>(innerRect.height()) / 2);
...@@ -2195,16 +2203,16 @@ bool RenderBoxModelObject::borderObscuresBackground() const ...@@ -2195,16 +2203,16 @@ bool RenderBoxModelObject::borderObscuresBackground() const
return true; return true;
} }
static inline IntRect areaCastingShadowInHole(const IntRect& holeRect, int shadowBlur, int shadowSpread, const IntSize& shadowOffset) static inline LayoutRect areaCastingShadowInHole(const LayoutRect& holeRect, int shadowBlur, int shadowSpread, const LayoutSize& shadowOffset)
{ {
IntRect bounds(holeRect); LayoutRect bounds(holeRect);
bounds.inflate(shadowBlur); bounds.inflate(shadowBlur);
if (shadowSpread < 0) if (shadowSpread < 0)
bounds.inflate(-shadowSpread); bounds.inflate(-shadowSpread);
IntRect offsetBounds = bounds; LayoutRect offsetBounds = bounds;
offsetBounds.move(-shadowOffset); offsetBounds.move(-shadowOffset);
return unionRect(bounds, offsetBounds); return unionRect(bounds, offsetBounds);
} }
...@@ -2242,7 +2250,7 @@ void RenderBoxModelObject::paintBoxShadow(const PaintInfo& info, const LayoutRec ...@@ -2242,7 +2250,7 @@ void RenderBoxModelObject::paintBoxShadow(const PaintInfo& info, const LayoutRec
if (fillRect.isEmpty()) if (fillRect.isEmpty())
continue; continue;
LayoutRect shadowRect = border.rect(); LayoutRect shadowRect(border.rect());
shadowRect.inflate(shadowBlur + shadowSpread); shadowRect.inflate(shadowBlur + shadowSpread);
shadowRect.move(shadowOffset); shadowRect.move(shadowOffset);
...@@ -2356,7 +2364,7 @@ void RenderBoxModelObject::paintBoxShadow(const PaintInfo& info, const LayoutRec ...@@ -2356,7 +2364,7 @@ void RenderBoxModelObject::paintBoxShadow(const PaintInfo& info, const LayoutRec
} }
} }
int RenderBoxModelObject::containingBlockLogicalWidthForContent() const LayoutUnit RenderBoxModelObject::containingBlockLogicalWidthForContent() const
{ {
return containingBlock()->availableLogicalWidth(); return containingBlock()->availableLogicalWidth();
} }
......
...@@ -112,18 +112,18 @@ public: ...@@ -112,18 +112,18 @@ public:
bool hasInlineDirectionBordersPaddingOrMargin() const { return hasInlineDirectionBordersOrPadding() || marginStart()|| marginEnd(); } bool hasInlineDirectionBordersPaddingOrMargin() const { return hasInlineDirectionBordersOrPadding() || marginStart()|| marginEnd(); }
bool hasInlineDirectionBordersOrPadding() const { return borderStart() || borderEnd() || paddingStart()|| paddingEnd(); } bool hasInlineDirectionBordersOrPadding() const { return borderStart() || borderEnd() || paddingStart()|| paddingEnd(); }
virtual int containingBlockLogicalWidthForContent() const; virtual LayoutUnit containingBlockLogicalWidthForContent() const;
virtual void childBecameNonInline(RenderObject* /*child*/) { } virtual void childBecameNonInline(RenderObject* /*child*/) { }
void paintBorder(const PaintInfo&, const IntRect&, const RenderStyle*, BackgroundBleedAvoidance = BackgroundBleedNone, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true); void paintBorder(const PaintInfo&, const LayoutRect&, const RenderStyle*, BackgroundBleedAvoidance = BackgroundBleedNone, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
bool paintNinePieceImage(GraphicsContext*, const IntRect&, const RenderStyle*, const NinePieceImage&, CompositeOperator = CompositeSourceOver); bool paintNinePieceImage(GraphicsContext*, const LayoutRect&, const RenderStyle*, const NinePieceImage&, CompositeOperator = CompositeSourceOver);
void paintBoxShadow(const PaintInfo&, const LayoutRect&, const RenderStyle*, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true); void paintBoxShadow(const PaintInfo&, const LayoutRect&, const RenderStyle*, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox* = 0, const LayoutSize& = LayoutSize(), CompositeOperator = CompositeSourceOver, RenderObject* backgroundObject = 0); void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox* = 0, const LayoutSize& = LayoutSize(), CompositeOperator = CompositeSourceOver, RenderObject* backgroundObject = 0);
// Overridden by subclasses to determine line height and baseline position. // Overridden by subclasses to determine line height and baseline position.
virtual int lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const = 0; virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const = 0;
virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const = 0; virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const = 0;
// Called by RenderObject::willBeDestroyed() and is the only way layers should ever be destroyed // Called by RenderObject::willBeDestroyed() and is the only way layers should ever be destroyed
void destroyLayer(); void destroyLayer();
...@@ -180,12 +180,12 @@ protected: ...@@ -180,12 +180,12 @@ protected:
LayoutSize m_tileSize; LayoutSize m_tileSize;
}; };
void calculateBackgroundImageGeometry(const FillLayer*, const IntRect& paintRect, BackgroundImageGeometry&); void calculateBackgroundImageGeometry(const FillLayer*, const LayoutRect& paintRect, BackgroundImageGeometry&);
void getBorderEdgeInfo(class BorderEdge[], bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const; void getBorderEdgeInfo(class BorderEdge[], bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
bool borderObscuresBackgroundEdge(const FloatSize& contextScale) const; bool borderObscuresBackgroundEdge(const FloatSize& contextScale) const;
bool borderObscuresBackground() const; bool borderObscuresBackground() const;
bool shouldPaintAtLowQuality(GraphicsContext*, Image*, const void*, const IntSize&); bool shouldPaintAtLowQuality(GraphicsContext*, Image*, const void*, const LayoutSize&);
RenderBoxModelObject* continuation() const; RenderBoxModelObject* continuation() const;
void setContinuation(RenderBoxModelObject*); void setContinuation(RenderBoxModelObject*);
...@@ -193,7 +193,7 @@ protected: ...@@ -193,7 +193,7 @@ protected:
private: private:
virtual bool isBoxModelObject() const { return true; } virtual bool isBoxModelObject() const { return true; }
IntSize calculateFillTileSize(const FillLayer*, IntSize scaledSize) const; LayoutSize calculateFillTileSize(const FillLayer*, LayoutSize scaledSize) const;
RoundedRect getBackgroundRoundedRect(const LayoutRect&, InlineFlowBox*, LayoutUnit inlineBoxWidth, LayoutUnit inlineBoxHeight, RoundedRect getBackgroundRoundedRect(const LayoutRect&, InlineFlowBox*, LayoutUnit inlineBoxWidth, LayoutUnit inlineBoxHeight,
bool includeLogicalLeftEdge, bool includeLogicalRightEdge); bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
...@@ -201,14 +201,14 @@ private: ...@@ -201,14 +201,14 @@ private:
void clipBorderSidePolygon(GraphicsContext*, const RoundedRect& outerBorder, const RoundedRect& innerBorder, void clipBorderSidePolygon(GraphicsContext*, const RoundedRect& outerBorder, const RoundedRect& innerBorder,
BoxSide, bool firstEdgeMatches, bool secondEdgeMatches); BoxSide, bool firstEdgeMatches, bool secondEdgeMatches);
void paintOneBorderSide(GraphicsContext*, const RenderStyle*, const RoundedRect& outerBorder, const RoundedRect& innerBorder, void paintOneBorderSide(GraphicsContext*, const RenderStyle*, const RoundedRect& outerBorder, const RoundedRect& innerBorder,
const IntRect& sideRect, BoxSide, BoxSide adjacentSide1, BoxSide adjacentSide2, const class BorderEdge[], const LayoutRect& sideRect, BoxSide, BoxSide adjacentSide1, BoxSide adjacentSide2, const class BorderEdge[],
const Path*, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias, const Color* overrideColor = 0); const Path*, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias, const Color* overrideColor = 0);
void paintTranslucentBorderSides(GraphicsContext*, const RenderStyle*, const RoundedRect& outerBorder, const RoundedRect& innerBorder, void paintTranslucentBorderSides(GraphicsContext*, const RenderStyle*, const RoundedRect& outerBorder, const RoundedRect& innerBorder,
const class BorderEdge[], BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias = false); const class BorderEdge[], BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias = false);
void paintBorderSides(GraphicsContext*, const RenderStyle*, const RoundedRect& outerBorder, const RoundedRect& innerBorder, void paintBorderSides(GraphicsContext*, const RenderStyle*, const RoundedRect& outerBorder, const RoundedRect& innerBorder,
const class BorderEdge[], BorderEdgeFlags, BackgroundBleedAvoidance, const class BorderEdge[], BorderEdgeFlags, BackgroundBleedAvoidance,
bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias = false, const Color* overrideColor = 0); bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias = false, const Color* overrideColor = 0);
void drawBoxSideFromPath(GraphicsContext*, const IntRect&, const Path&, const class BorderEdge[], void drawBoxSideFromPath(GraphicsContext*, const LayoutRect&, const Path&, const class BorderEdge[],
float thickness, float drawThickness, BoxSide, const RenderStyle*, float thickness, float drawThickness, BoxSide, const RenderStyle*,
Color, EBorderStyle, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge); Color, EBorderStyle, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment