<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[180644] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/180644">180644</a></dd>
<dt>Author</dt> <dd>zalan@apple.com</dd>
<dt>Date</dt> <dd>2015-02-25 15:19:17 -0800 (Wed, 25 Feb 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Cleanup BackgroundImageGeometry class.
https://bugs.webkit.org/show_bug.cgi?id=141997
Reviewed by Simon Fraser.
This patch attempts to improve RenderBoxModelObject::calculateBackgroundImageGeometry() readability by
removing redundant code and making image geometry operations explicit. BackgroundImageGeometry
becomes a read only class (with the exception of the clip() method).
No change in functionality.
* rendering/RenderBoxModelObject.cpp:
(WebCore::BackgroundImageGeometry::BackgroundImageGeometry):
(WebCore::BackgroundImageGeometry::pixelSnapBackgroundImageGeometryForPainting):
(WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
(WebCore::BackgroundImageGeometry::setNoRepeatX): Deleted.
(WebCore::BackgroundImageGeometry::setNoRepeatY): Deleted.
(WebCore::BackgroundImageGeometry::useFixedAttachment): Deleted.
(WebCore::BackgroundImageGeometry::clip): Deleted.
(WebCore::RenderBoxModelObject::pixelSnapBackgroundImageGeometryForPainting): Deleted.
* rendering/RenderBoxModelObject.h:
(WebCore::BackgroundImageGeometry::clip):
(WebCore::BackgroundImageGeometry::BackgroundImageGeometry): Deleted.
(WebCore::BackgroundImageGeometry::setDestRect): Deleted.
(WebCore::BackgroundImageGeometry::setPhase): Deleted.
(WebCore::BackgroundImageGeometry::setPhaseX): Deleted.
(WebCore::BackgroundImageGeometry::setPhaseY): Deleted.
(WebCore::BackgroundImageGeometry::setTileSize): Deleted.
(WebCore::BackgroundImageGeometry::setSpaceSize): Deleted.
(WebCore::BackgroundImageGeometry::setHasNonLocalGeometry): Deleted.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxModelObjectcpp">trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxModelObjecth">trunk/Source/WebCore/rendering/RenderBoxModelObject.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (180643 => 180644)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-02-25 23:05:20 UTC (rev 180643)
+++ trunk/Source/WebCore/ChangeLog        2015-02-25 23:19:17 UTC (rev 180644)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2015-02-25 Zalan Bujtas <zalan@apple.com>
+
+ Cleanup BackgroundImageGeometry class.
+ https://bugs.webkit.org/show_bug.cgi?id=141997
+
+ Reviewed by Simon Fraser.
+
+ This patch attempts to improve RenderBoxModelObject::calculateBackgroundImageGeometry() readability by
+ removing redundant code and making image geometry operations explicit. BackgroundImageGeometry
+ becomes a read only class (with the exception of the clip() method).
+
+ No change in functionality.
+
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::BackgroundImageGeometry::BackgroundImageGeometry):
+ (WebCore::BackgroundImageGeometry::pixelSnapBackgroundImageGeometryForPainting):
+ (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
+ (WebCore::BackgroundImageGeometry::setNoRepeatX): Deleted.
+ (WebCore::BackgroundImageGeometry::setNoRepeatY): Deleted.
+ (WebCore::BackgroundImageGeometry::useFixedAttachment): Deleted.
+ (WebCore::BackgroundImageGeometry::clip): Deleted.
+ (WebCore::RenderBoxModelObject::pixelSnapBackgroundImageGeometryForPainting): Deleted.
+ * rendering/RenderBoxModelObject.h:
+ (WebCore::BackgroundImageGeometry::clip):
+ (WebCore::BackgroundImageGeometry::BackgroundImageGeometry): Deleted.
+ (WebCore::BackgroundImageGeometry::setDestRect): Deleted.
+ (WebCore::BackgroundImageGeometry::setPhase): Deleted.
+ (WebCore::BackgroundImageGeometry::setPhaseX): Deleted.
+ (WebCore::BackgroundImageGeometry::setPhaseY): Deleted.
+ (WebCore::BackgroundImageGeometry::setTileSize): Deleted.
+ (WebCore::BackgroundImageGeometry::setSpaceSize): Deleted.
+ (WebCore::BackgroundImageGeometry::setHasNonLocalGeometry): Deleted.
+
</ins><span class="cx"> 2015-02-25 Said Abou-Hallawa <sabouhallawa@apple.com>
</span><span class="cx">
</span><span class="cx"> Horizontal and vertical lines are clipped completely if clip-path is included in the tag but the referenced element is defined later.
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxModelObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (180643 => 180644)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp        2015-02-25 23:05:20 UTC (rev 180643)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp        2015-02-25 23:19:17 UTC (rev 180644)
</span><span class="lines">@@ -1032,30 +1032,14 @@
</span><span class="cx"> return LayoutSize();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void BackgroundImageGeometry::setNoRepeatX(LayoutUnit xOffset)
</del><ins>+static void pixelSnapBackgroundImageGeometryForPainting(LayoutRect& destinationRect, LayoutSize& tileSize, LayoutSize& phase, LayoutSize& space, float scaleFactor)
</ins><span class="cx"> {
</span><del>- m_destRect.move(std::max<LayoutUnit>(xOffset, 0), 0);
- m_phase.setWidth(-std::min<LayoutUnit>(xOffset, 0));
- m_destRect.setWidth(m_tileSize.width() + std::min<float>(xOffset, 0));
</del><ins>+ tileSize = LayoutSize(snapRectToDevicePixels(LayoutRect(destinationRect.location(), tileSize), scaleFactor).size());
+ space = LayoutSize(snapRectToDevicePixels(LayoutRect(LayoutPoint(), space), scaleFactor).size());
+ destinationRect = LayoutRect(snapRectToDevicePixels(destinationRect, scaleFactor));
+ phase = LayoutSize(toFloatSize(roundPointToDevicePixels(toLayoutPoint(phase), scaleFactor)));
</ins><span class="cx"> }
</span><del>-void BackgroundImageGeometry::setNoRepeatY(LayoutUnit yOffset)
-{
- m_destRect.move(0, std::max<LayoutUnit>(yOffset, 0));
- m_phase.setHeight(-std::min<LayoutUnit>(yOffset, 0));
- m_destRect.setHeight(m_tileSize.height() + std::min<float>(yOffset, 0));
-}
</del><span class="cx">
</span><del>-void BackgroundImageGeometry::useFixedAttachment(const LayoutPoint& attachmentPoint)
-{
- FloatPoint alignedPoint = attachmentPoint;
- m_phase.expand(std::max<LayoutUnit>(alignedPoint.x() - m_destRect.x(), 0), std::max<LayoutUnit>(alignedPoint.y() - m_destRect.y(), 0));
-}
-
-void BackgroundImageGeometry::clip(const LayoutRect& clipRect)
-{
- m_destRect.intersect(clipRect);
-}
-
</del><span class="cx"> bool RenderBoxModelObject::fixedBackgroundPaintsInLocalCoordinates() const
</span><span class="cx"> {
</span><span class="cx"> if (!isRoot())
</span><span class="lines">@@ -1082,31 +1066,18 @@
</span><span class="cx"> return space;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void RenderBoxModelObject::pixelSnapBackgroundImageGeometryForPainting(BackgroundImageGeometry& geometry) const
-{
- float deviceScaleFactor = document().deviceScaleFactor();
- // FIXME: We need a better rounding strategy to round/space out tiles.
- geometry.setTileSize(LayoutSize(snapRectToDevicePixels(LayoutRect(geometry.destRect().location(), geometry.tileSize()), deviceScaleFactor).size()));
- geometry.setSpaceSize(LayoutSize(snapRectToDevicePixels(LayoutRect(LayoutPoint(), geometry.spaceSize()), deviceScaleFactor).size()));
- geometry.setDestRect(LayoutRect(snapRectToDevicePixels(geometry.destRect(), deviceScaleFactor)));
- FloatSize pixelSnappedPhase = toFloatSize(roundPointToDevicePixels(toLayoutPoint(geometry.phase()), deviceScaleFactor));
- geometry.setPhase(LayoutSize(pixelSnappedPhase));
-}
-
</del><span class="cx"> BackgroundImageGeometry RenderBoxModelObject::calculateBackgroundImageGeometry(const RenderLayerModelObject* paintContainer, const FillLayer& fillLayer, const LayoutRect& paintRect,
</span><span class="cx"> RenderElement* backgroundObject) const
</span><span class="cx"> {
</span><del>- BackgroundImageGeometry geometry;
</del><span class="cx"> LayoutUnit left = 0;
</span><span class="cx"> LayoutUnit top = 0;
</span><span class="cx"> LayoutSize positioningAreaSize;
</span><del>- // Determine the background positioning area and set destRect to the background painting area.
- // destRect will be adjusted later if the background is non-repeating.
</del><ins>+ // Determine the background positioning area and set destination rect to the background painting area.
+ // Destination rect will be adjusted later if the background is non-repeating.
</ins><span class="cx"> // FIXME: transforms spec says that fixed backgrounds behave like scroll inside transforms. https://bugs.webkit.org/show_bug.cgi?id=15679
</span><ins>+ LayoutRect destinationRect(paintRect);
</ins><span class="cx"> bool fixedAttachment = fillLayer.attachment() == FixedBackgroundAttachment;
</span><span class="cx"> if (!fixedAttachment) {
</span><del>- geometry.setDestRect(paintRect);
-
</del><span class="cx"> LayoutUnit right = 0;
</span><span class="cx"> LayoutUnit bottom = 0;
</span><span class="cx"> // Scroll and Local.
</span><span class="lines">@@ -1136,8 +1107,6 @@
</span><span class="cx"> } else
</span><span class="cx"> positioningAreaSize = paintRect.size() - LayoutSize(left + right, top + bottom);
</span><span class="cx"> } else {
</span><del>- geometry.setHasNonLocalGeometry();
-
</del><span class="cx"> LayoutRect viewportRect;
</span><span class="cx"> if (frame().settings().fixedBackgroundsPaintRelativeToDocument())
</span><span class="cx"> viewportRect = view().unscaledDocumentRect();
</span><span class="lines">@@ -1154,92 +1123,97 @@
</span><span class="cx"> if (paintContainer)
</span><span class="cx"> viewportRect.moveBy(LayoutPoint(-paintContainer->localToAbsolute(FloatPoint())));
</span><span class="cx">
</span><del>- geometry.setDestRect(viewportRect);
- positioningAreaSize = geometry.destRect().size();
</del><ins>+ destinationRect = viewportRect;
+ positioningAreaSize = destinationRect.size();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> auto clientForBackgroundImage = backgroundObject ? backgroundObject : this;
</span><del>- LayoutSize fillTileSize = calculateFillTileSize(fillLayer, positioningAreaSize);
</del><ins>+ LayoutSize tileSize = calculateFillTileSize(fillLayer, positioningAreaSize);
</ins><span class="cx"> if (StyleImage* layerImage = fillLayer.image())
</span><del>- layerImage->setContainerSizeForRenderer(clientForBackgroundImage, fillTileSize, style().effectiveZoom());
</del><ins>+ layerImage->setContainerSizeForRenderer(clientForBackgroundImage, tileSize, style().effectiveZoom());
</ins><span class="cx">
</span><del>- geometry.setTileSize(fillTileSize);
-
</del><span class="cx"> EFillRepeat backgroundRepeatX = fillLayer.repeatX();
</span><span class="cx"> EFillRepeat backgroundRepeatY = fillLayer.repeatY();
</span><del>- LayoutUnit availableWidth = positioningAreaSize.width() - geometry.tileSize().width();
- LayoutUnit availableHeight = positioningAreaSize.height() - geometry.tileSize().height();
</del><ins>+ LayoutUnit availableWidth = positioningAreaSize.width() - tileSize.width();
+ LayoutUnit availableHeight = positioningAreaSize.height() - tileSize.height();
</ins><span class="cx">
</span><ins>+ LayoutSize spaceSize;
+ LayoutSize phase;
+ LayoutSize noRepeat;
</ins><span class="cx"> LayoutUnit computedXPosition = minimumValueForLength(fillLayer.xPosition(), availableWidth, false);
</span><del>- if (backgroundRepeatX == RoundFill && positioningAreaSize.width() > 0 && fillTileSize.width() > 0) {
- int numTiles = std::max(1, roundToInt(positioningAreaSize.width() / fillTileSize.width()));
</del><ins>+ if (backgroundRepeatX == RoundFill && positioningAreaSize.width() > 0 && tileSize.width() > 0) {
+ int numTiles = std::max(1, roundToInt(positioningAreaSize.width() / tileSize.width()));
</ins><span class="cx"> if (fillLayer.size().size.height().isAuto() && backgroundRepeatY != RoundFill)
</span><del>- fillTileSize.setHeight(fillTileSize.height() * positioningAreaSize.width() / (numTiles * fillTileSize.width()));
</del><ins>+ tileSize.setHeight(tileSize.height() * positioningAreaSize.width() / (numTiles * tileSize.width()));
</ins><span class="cx">
</span><del>- fillTileSize.setWidth(positioningAreaSize.width() / numTiles);
- geometry.setTileSize(fillTileSize);
- geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().width() - fmodf((computedXPosition + left), geometry.tileSize().width()) : 0);
- geometry.setSpaceSize(LayoutSize());
</del><ins>+ tileSize.setWidth(positioningAreaSize.width() / numTiles);
+ phase.setWidth(tileSize.width() ? tileSize.width() - fmodf((computedXPosition + left), tileSize.width()) : 0);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> LayoutUnit computedYPosition = minimumValueForLength(fillLayer.yPosition(), availableHeight, false);
</span><del>- if (backgroundRepeatY == RoundFill && positioningAreaSize.height() > 0 && fillTileSize.height() > 0) {
- int numTiles = std::max(1, roundToInt(positioningAreaSize.height() / fillTileSize.height()));
</del><ins>+ if (backgroundRepeatY == RoundFill && positioningAreaSize.height() > 0 && tileSize.height() > 0) {
+ int numTiles = std::max(1, roundToInt(positioningAreaSize.height() / tileSize.height()));
</ins><span class="cx"> if (fillLayer.size().size.width().isAuto() && backgroundRepeatX != RoundFill)
</span><del>- fillTileSize.setWidth(fillTileSize.width() * positioningAreaSize.height() / (numTiles * fillTileSize.height()));
</del><ins>+ tileSize.setWidth(tileSize.width() * positioningAreaSize.height() / (numTiles * tileSize.height()));
</ins><span class="cx">
</span><del>- fillTileSize.setHeight(positioningAreaSize.height() / numTiles);
- geometry.setTileSize(fillTileSize);
- geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().height() - fmodf((computedYPosition + top), geometry.tileSize().height()) : 0);
- geometry.setSpaceSize(LayoutSize());
</del><ins>+ tileSize.setHeight(positioningAreaSize.height() / numTiles);
+ phase.setHeight(tileSize.height() ? tileSize.height() - fmodf((computedYPosition + top), tileSize.height()) : 0);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (backgroundRepeatX == RepeatFill) {
</span><del>- geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().width() - fmodf(computedXPosition + left, geometry.tileSize().width()): 0);
- geometry.setSpaceSize(LayoutSize(0, geometry.spaceSize().height()));
- } else if (backgroundRepeatX == SpaceFill && fillTileSize.width() > 0) {
- LayoutUnit space = getSpace(positioningAreaSize.width(), geometry.tileSize().width());
- LayoutUnit actualWidth = geometry.tileSize().width() + space;
-
</del><ins>+ phase.setWidth(tileSize.width() ? tileSize.width() - fmodf(computedXPosition + left, tileSize.width()): 0);
+ spaceSize.setWidth(0);
+ } else if (backgroundRepeatX == SpaceFill && tileSize.width() > 0) {
+ LayoutUnit space = getSpace(positioningAreaSize.width(), tileSize.width());
</ins><span class="cx"> if (space >= 0) {
</span><ins>+ LayoutUnit actualWidth = tileSize.width() + space;
</ins><span class="cx"> computedXPosition = minimumValueForLength(Length(), availableWidth, false);
</span><del>- geometry.setSpaceSize(LayoutSize(space, 0));
- geometry.setPhaseX(actualWidth ? actualWidth - fmodf((computedXPosition + left), actualWidth) : 0);
</del><ins>+ spaceSize.setWidth(space);
+ spaceSize.setHeight(0);
+ phase.setWidth(actualWidth ? actualWidth - fmodf((computedXPosition + left), actualWidth) : 0);
</ins><span class="cx"> } else
</span><span class="cx"> backgroundRepeatX = NoRepeatFill;
</span><span class="cx"> }
</span><span class="cx"> if (backgroundRepeatX == NoRepeatFill) {
</span><del>- LayoutUnit xOffset = fillLayer.backgroundXOrigin() == RightEdge ? availableWidth - computedXPosition : computedXPosition;
- geometry.setNoRepeatX(left + xOffset);
- geometry.setSpaceSize(LayoutSize(0, geometry.spaceSize().height()));
</del><ins>+ LayoutUnit xOffset = left + (fillLayer.backgroundXOrigin() == RightEdge ? availableWidth - computedXPosition : computedXPosition);
+ if (xOffset > 0)
+ destinationRect.move(xOffset, 0);
+ xOffset = std::min<LayoutUnit>(xOffset, 0);
+ phase.setWidth(-xOffset);
+ destinationRect.setWidth(tileSize.width() + xOffset);
+ spaceSize.setWidth(0);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (backgroundRepeatY == RepeatFill) {
</span><del>- geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().height() - fmodf(computedYPosition + top, geometry.tileSize().height()) : 0);
- geometry.setSpaceSize(LayoutSize(geometry.spaceSize().width(), 0));
- } else if (backgroundRepeatY == SpaceFill && fillTileSize.height() > 0) {
- LayoutUnit space = getSpace(positioningAreaSize.height(), geometry.tileSize().height());
- LayoutUnit actualHeight = geometry.tileSize().height() + space;
</del><ins>+ phase.setHeight(tileSize.height() ? tileSize.height() - fmodf(computedYPosition + top, tileSize.height()) : 0);
+ spaceSize.setHeight(0);
+ } else if (backgroundRepeatY == SpaceFill && tileSize.height() > 0) {
+ LayoutUnit space = getSpace(positioningAreaSize.height(), tileSize.height());
</ins><span class="cx">
</span><span class="cx"> if (space >= 0) {
</span><ins>+ LayoutUnit actualHeight = tileSize.height() + space;
</ins><span class="cx"> computedYPosition = minimumValueForLength(Length(), availableHeight, false);
</span><del>- geometry.setSpaceSize(LayoutSize(geometry.spaceSize().width(), space));
- geometry.setPhaseY(actualHeight ? actualHeight - fmodf((computedYPosition + top), actualHeight) : 0);
</del><ins>+ spaceSize.setHeight(space);
+ phase.setHeight(actualHeight ? actualHeight - fmodf((computedYPosition + top), actualHeight) : 0);
</ins><span class="cx"> } else
</span><span class="cx"> backgroundRepeatY = NoRepeatFill;
</span><span class="cx"> }
</span><span class="cx"> if (backgroundRepeatY == NoRepeatFill) {
</span><del>- LayoutUnit yOffset = fillLayer.backgroundYOrigin() == BottomEdge ? availableHeight - computedYPosition : computedYPosition;
- geometry.setNoRepeatY(top + yOffset);
- geometry.setSpaceSize(LayoutSize(geometry.spaceSize().width(), 0));
</del><ins>+ LayoutUnit yOffset = top + (fillLayer.backgroundYOrigin() == BottomEdge ? availableHeight - computedYPosition : computedYPosition);
+ if (yOffset > 0)
+ destinationRect.move(0, yOffset);
+ yOffset = std::min<LayoutUnit>(yOffset, 0);
+ phase.setHeight(-yOffset);
+ destinationRect.setHeight(tileSize.height() + yOffset);
+ spaceSize.setHeight(0);
</ins><span class="cx"> }
</span><del>-
- if (fixedAttachment)
- geometry.useFixedAttachment(paintRect.location());
-
- geometry.clip(paintRect);
- pixelSnapBackgroundImageGeometryForPainting(geometry);
- return geometry;
</del><ins>+ if (fixedAttachment) {
+ LayoutPoint attachmentPoint = paintRect.location();
+ phase.expand(std::max<LayoutUnit>(attachmentPoint.x() - destinationRect.x(), 0), std::max<LayoutUnit>(attachmentPoint.y() - destinationRect.y(), 0));
+ }
+ destinationRect.intersect(paintRect);
+ pixelSnapBackgroundImageGeometryForPainting(destinationRect, tileSize, phase, spaceSize, document().deviceScaleFactor());
+ return BackgroundImageGeometry(destinationRect, tileSize, phase, spaceSize, fixedAttachment);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RenderBoxModelObject::getGeometryForBackgroundImage(const RenderLayerModelObject* paintContainer, FloatRect& destRect, FloatSize& phase, FloatSize& tileSize) const
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxModelObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.h (180643 => 180644)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBoxModelObject.h        2015-02-25 23:05:20 UTC (rev 180643)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.h        2015-02-25 23:19:17 UTC (rev 180644)
</span><span class="lines">@@ -67,38 +67,27 @@
</span><span class="cx">
</span><span class="cx"> class BackgroundImageGeometry {
</span><span class="cx"> public:
</span><del>- BackgroundImageGeometry()
- : m_hasNonLocalGeometry(false)
- { }
</del><ins>+ BackgroundImageGeometry(const LayoutRect& destinationRect, const LayoutSize& tile, const LayoutSize& phase, const LayoutSize& space, bool fixedAttachment)
+ : m_destRect(destinationRect)
+ , m_tileSize(tile)
+ , m_phase(phase)
+ , m_space(space)
+ , m_hasNonLocalGeometry(fixedAttachment)
+ {
+ }
</ins><span class="cx">
</span><span class="cx"> LayoutRect destRect() const { return m_destRect; }
</span><del>- void setDestRect(const LayoutRect& destRect) { m_destRect = destRect; }
-
</del><span class="cx"> LayoutSize phase() const { return m_phase; }
</span><del>- void setPhase(const LayoutSize& phase) { m_phase = phase; }
- void setPhaseX(LayoutUnit deltaX) { m_phase.setWidth(deltaX); }
- void setPhaseY(LayoutUnit deltaY) { m_phase.setHeight(deltaY); }
-
</del><span class="cx"> LayoutSize tileSize() const { return m_tileSize; }
</span><del>- void setTileSize(const LayoutSize& tileSize) { m_tileSize = tileSize; }
-
</del><span class="cx"> LayoutSize spaceSize() const { return m_space; }
</span><del>- void setSpaceSize(const LayoutSize& space) { m_space = space; }
-
- void setNoRepeatX(LayoutUnit xOffset);
- void setNoRepeatY(LayoutUnit yOffset);
-
- void useFixedAttachment(const LayoutPoint& attachmentPoint);
-
- void clip(const LayoutRect&);
-
- void setHasNonLocalGeometry(bool hasNonLocalGeometry = true) { m_hasNonLocalGeometry = hasNonLocalGeometry; }
</del><span class="cx"> bool hasNonLocalGeometry() const { return m_hasNonLocalGeometry; }
</span><del>-
</del><ins>+
+ void clip(const LayoutRect& clipRect) { m_destRect.intersect(clipRect); }
+
</ins><span class="cx"> private:
</span><span class="cx"> LayoutRect m_destRect;
</span><del>- LayoutSize m_phase;
</del><span class="cx"> LayoutSize m_tileSize;
</span><ins>+ LayoutSize m_phase;
</ins><span class="cx"> LayoutSize m_space;
</span><span class="cx"> bool m_hasNonLocalGeometry; // Has background-attachment: fixed. Implies that we can't always cheaply compute destRect.
</span><span class="cx"> };
</span><span class="lines">@@ -328,8 +317,6 @@
</span><span class="cx"> float thickness, float drawThickness, BoxSide, const RenderStyle&,
</span><span class="cx"> Color, EBorderStyle, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
</span><span class="cx"> void paintMaskForTextFillBox(ImageBuffer*, const IntRect&, InlineFlowBox*, const LayoutRect&);
</span><del>-
- void pixelSnapBackgroundImageGeometryForPainting(BackgroundImageGeometry&) const;
</del><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre>
</div>
</div>
</body>
</html>