Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/paint/BackgroundImageGeometry.h" | 5 #include "core/paint/BackgroundImageGeometry.h" |
| 6 | 6 |
| 7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
| 8 #include "core/layout/LayoutBox.h" | 8 #include "core/layout/LayoutBox.h" |
| 9 #include "core/layout/LayoutBoxModelObject.h" | 9 #include "core/layout/LayoutBoxModelObject.h" |
| 10 #include "core/layout/LayoutView.h" | 10 #include "core/layout/LayoutView.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 if (block == container) | 139 if (block == container) |
| 140 break; | 140 break; |
| 141 } | 141 } |
| 142 return result; | 142 return result; |
| 143 } | 143 } |
| 144 | 144 |
| 145 // When we match the sub-pixel fraction of the destination rect in a dimension, we | 145 // When we match the sub-pixel fraction of the destination rect in a dimension, we |
| 146 // snap the same way. This commonly occurs when the background is meant to fill the | 146 // snap the same way. This commonly occurs when the background is meant to fill the |
| 147 // padding box but there's a border (which in Blink is always stored as an integ er). | 147 // padding box but there's a border (which in Blink is always stored as an integ er). |
| 148 // Otherwise we floor to avoid growing our tile size. Often these tiles are from a | 148 // Otherwise we floor to avoid growing our tile size. Often these tiles are from a |
| 149 // sprite map, and bleeding adjactent sprites is visually worse than clipping th e | 149 // sprite map, and bleeding adjacent sprites is visually worse than clipping the |
| 150 // intenteded one. | 150 // intended one. |
| 151 LayoutSize applySubPixelHeuristicToImageSize(const LayoutSize& size, const Layou tRect& destination) | 151 LayoutSize applySubPixelHeuristicToImageSize(const LayoutSize& size, const Layou tRect& destination) |
| 152 { | 152 { |
| 153 LayoutSize snappedSize = LayoutSize( | 153 LayoutSize snappedSize = LayoutSize( |
| 154 size.width().fraction() == destination.width().fraction() ? snapSizeToPi xel(size.width(), destination.x()) : size.width().floor(), | 154 size.width().fraction() == destination.width().fraction() ? snapSizeToPi xel(size.width(), destination.x()) : size.width().floor(), |
| 155 size.height().fraction() == destination.height().fraction() ? snapSizeTo Pixel(size.height(), destination.y()) : size.height().floor()); | 155 size.height().fraction() == destination.height().fraction() ? snapSizeTo Pixel(size.height(), destination.y()) : size.height().floor()); |
| 156 return snappedSize; | 156 return snappedSize; |
| 157 } | 157 } |
| 158 | 158 |
| 159 } // anonymous namespace | 159 } // anonymous namespace |
| 160 | 160 |
| 161 void BackgroundImageGeometry::setNoRepeatX(LayoutUnit xOffset) | 161 void BackgroundImageGeometry::setNoRepeatX(LayoutUnit xOffset) |
| 162 { | 162 { |
| 163 m_destRect.move(std::max(xOffset, LayoutUnit()), LayoutUnit()); | 163 int roundedOffset = roundToInt(xOffset); |
| 164 m_phase.setX(-std::min(xOffset, LayoutUnit())); | 164 m_destRect.move(std::max(roundedOffset, 0), LayoutUnit()); |
|
Stephen Chennney
2016/06/29 20:26:23
If we round the dest rect differently to the phase
| |
| 165 m_destRect.setWidth(m_tileSize.width() + std::min(xOffset, LayoutUnit())); | 165 m_phase.setX(LayoutUnit(-std::min(roundedOffset, 0))); |
| 166 m_destRect.setWidth(m_tileSize.width() + std::min(roundedOffset, 0)); | |
| 166 setSpaceSize(LayoutSize(LayoutUnit(), spaceSize().height())); | 167 setSpaceSize(LayoutSize(LayoutUnit(), spaceSize().height())); |
| 167 } | 168 } |
| 168 | 169 |
| 169 void BackgroundImageGeometry::setNoRepeatY(LayoutUnit yOffset) | 170 void BackgroundImageGeometry::setNoRepeatY(LayoutUnit yOffset) |
| 170 { | 171 { |
| 171 m_destRect.move(LayoutUnit(), std::max(yOffset, LayoutUnit())); | 172 int roundedOffset = roundToInt(yOffset); |
| 172 m_phase.setY(-std::min(yOffset, LayoutUnit())); | 173 m_destRect.move(LayoutUnit(), std::max(roundedOffset, 0)); |
| 173 m_destRect.setHeight(m_tileSize.height() + std::min(yOffset, LayoutUnit())); | 174 m_phase.setY(LayoutUnit(-std::min(roundedOffset, 0))); |
| 175 m_destRect.setHeight(m_tileSize.height() + std::min(roundedOffset, 0)); | |
| 174 setSpaceSize(LayoutSize(spaceSize().width(), LayoutUnit())); | 176 setSpaceSize(LayoutSize(spaceSize().width(), LayoutUnit())); |
| 175 } | 177 } |
| 176 | 178 |
| 177 void BackgroundImageGeometry::setRepeatX( | 179 void BackgroundImageGeometry::setRepeatX( |
| 178 const FillLayer& fillLayer, | 180 const FillLayer& fillLayer, |
| 179 LayoutUnit unsnappedTileWidth, | 181 LayoutUnit unsnappedTileWidth, |
| 180 LayoutUnit snappedAvailableWidth, | 182 LayoutUnit snappedAvailableWidth, |
| 181 LayoutUnit unsnappedAvailableWidth, | 183 LayoutUnit unsnappedAvailableWidth, |
| 182 LayoutUnit extraOffset) | 184 LayoutUnit extraOffset) |
| 183 { | 185 { |
| 184 // We would like to identify the phase as a fraction of the image size in th e absence of snapping, | 186 // We would like to identify the phase as a fraction of the image size in th e absence of snapping, |
| 185 // then re-apply it to the snapped values. This is to handle large positions . | 187 // then re-apply it to the snapped values. This is to handle large positions . |
| 186 if (unsnappedTileWidth) { | 188 if (unsnappedTileWidth) { |
| 187 LayoutUnit computedXPosition = roundedMinimumValueForLength(fillLayer.xP osition(), unsnappedAvailableWidth); | 189 LayoutUnit computedXPosition = roundedMinimumValueForLength(fillLayer.xP osition(), unsnappedAvailableWidth); |
| 188 if (fillLayer.backgroundXOrigin() == RightEdge) { | 190 if (fillLayer.backgroundXOrigin() == RightEdge) { |
| 189 float numberOfTilesInPosition = (snappedAvailableWidth - computedXPo sition + extraOffset).toFloat() / unsnappedTileWidth.toFloat(); | 191 float numberOfTilesInPosition = (snappedAvailableWidth - computedXPo sition + extraOffset).toFloat() / unsnappedTileWidth.toFloat(); |
| 190 float fractionalPositionWithinTile = numberOfTilesInPosition - trunc f(numberOfTilesInPosition); | 192 float fractionalPositionWithinTile = numberOfTilesInPosition - trunc f(numberOfTilesInPosition); |
| 191 setPhaseX(LayoutUnit(fractionalPositionWithinTile * tileSize().width ())); | 193 setPhaseX(LayoutUnit(round(fractionalPositionWithinTile * tileSize() .width()))); |
| 192 } else { | 194 } else { |
| 193 float numberOfTilesInPosition = (computedXPosition + extraOffset).to Float() / unsnappedTileWidth.toFloat(); | 195 float numberOfTilesInPosition = (computedXPosition + extraOffset).to Float() / unsnappedTileWidth.toFloat(); |
| 194 float fractionalPositionWithinTile = 1.0f - (numberOfTilesInPosition - truncf(numberOfTilesInPosition)); | 196 float fractionalPositionWithinTile = 1.0f - (numberOfTilesInPosition - truncf(numberOfTilesInPosition)); |
| 195 setPhaseX(LayoutUnit(fractionalPositionWithinTile * tileSize().width ())); | 197 setPhaseX(LayoutUnit(round(fractionalPositionWithinTile * tileSize() .width()))); |
| 196 } | 198 } |
| 197 } else { | 199 } else { |
| 198 setPhaseX(LayoutUnit()); | 200 setPhaseX(LayoutUnit()); |
| 199 } | 201 } |
| 200 setSpaceSize(LayoutSize(LayoutUnit(), spaceSize().height())); | 202 setSpaceSize(LayoutSize(LayoutUnit(), spaceSize().height())); |
| 201 } | 203 } |
| 202 | 204 |
| 203 void BackgroundImageGeometry::setRepeatY( | 205 void BackgroundImageGeometry::setRepeatY( |
| 204 const FillLayer& fillLayer, | 206 const FillLayer& fillLayer, |
| 205 LayoutUnit unsnappedTileHeight, | 207 LayoutUnit unsnappedTileHeight, |
| 206 LayoutUnit snappedAvailableHeight, | 208 LayoutUnit snappedAvailableHeight, |
| 207 LayoutUnit unsnappedAvailableHeight, | 209 LayoutUnit unsnappedAvailableHeight, |
| 208 LayoutUnit extraOffset) | 210 LayoutUnit extraOffset) |
| 209 { | 211 { |
| 210 // We would like to identify the phase as a fraction of the image size in th e absence of snapping, | 212 // We would like to identify the phase as a fraction of the image size in th e absence of snapping, |
| 211 // then re-apply it to the snapped values. This is to handle large positions . | 213 // then re-apply it to the snapped values. This is to handle large positions . |
| 212 if (unsnappedTileHeight) { | 214 if (unsnappedTileHeight) { |
| 213 LayoutUnit computedYPosition = roundedMinimumValueForLength(fillLayer.yP osition(), unsnappedAvailableHeight); | 215 LayoutUnit computedYPosition = roundedMinimumValueForLength(fillLayer.yP osition(), unsnappedAvailableHeight); |
| 214 if (fillLayer.backgroundYOrigin() == BottomEdge) { | 216 if (fillLayer.backgroundYOrigin() == BottomEdge) { |
| 215 float numberOfTilesInPosition = (snappedAvailableHeight - computedYP osition + extraOffset).toFloat() / unsnappedTileHeight.toFloat(); | 217 float numberOfTilesInPosition = (snappedAvailableHeight - computedYP osition + extraOffset).toFloat() / unsnappedTileHeight.toFloat(); |
| 216 float fractionalPositionWithinTile = numberOfTilesInPosition - trunc f(numberOfTilesInPosition); | 218 float fractionalPositionWithinTile = numberOfTilesInPosition - trunc f(numberOfTilesInPosition); |
| 217 setPhaseY(LayoutUnit(fractionalPositionWithinTile * tileSize().heigh t())); | 219 setPhaseY(LayoutUnit(round(fractionalPositionWithinTile * tileSize() .height()))); |
| 218 } else { | 220 } else { |
| 219 float numberOfTilesInPosition = (computedYPosition + extraOffset).to Float() / unsnappedTileHeight.toFloat(); | 221 float numberOfTilesInPosition = (computedYPosition + extraOffset).to Float() / unsnappedTileHeight.toFloat(); |
| 220 float fractionalPositionWithinTile = 1.0f - (numberOfTilesInPosition - truncf(numberOfTilesInPosition)); | 222 float fractionalPositionWithinTile = 1.0f - (numberOfTilesInPosition - truncf(numberOfTilesInPosition)); |
| 221 setPhaseY(LayoutUnit(fractionalPositionWithinTile * tileSize().heigh t())); | 223 setPhaseY(LayoutUnit(round(fractionalPositionWithinTile * tileSize() .height()))); |
| 222 } | 224 } |
| 223 } else { | 225 } else { |
| 224 setPhaseY(LayoutUnit()); | 226 setPhaseY(LayoutUnit()); |
| 225 } | 227 } |
| 226 setSpaceSize(LayoutSize(spaceSize().width(), LayoutUnit())); | 228 setSpaceSize(LayoutSize(spaceSize().width(), LayoutUnit())); |
| 227 } | 229 } |
| 228 | 230 |
| 229 void BackgroundImageGeometry::setSpaceX(LayoutUnit space, LayoutUnit availableWi dth, LayoutUnit extraOffset) | 231 void BackgroundImageGeometry::setSpaceX(LayoutUnit space, LayoutUnit availableWi dth, LayoutUnit extraOffset) |
| 230 { | 232 { |
| 231 LayoutUnit computedXPosition = roundedMinimumValueForLength(Length(), availa bleWidth); | 233 LayoutUnit computedXPosition = roundedMinimumValueForLength(Length(), availa bleWidth); |
| 232 setSpaceSize(LayoutSize(space.round(), spaceSize().height())); | 234 setSpaceSize(LayoutSize(space.round(), spaceSize().height())); |
| 233 LayoutUnit actualWidth = tileSize().width() + space; | 235 LayoutUnit actualWidth = tileSize().width() + space; |
| 234 setPhaseX(actualWidth ? LayoutUnit(actualWidth - fmodf((computedXPosition + extraOffset), actualWidth)) : LayoutUnit()); | 236 setPhaseX(actualWidth ? LayoutUnit(round(actualWidth - fmodf((computedXPosit ion + extraOffset), actualWidth))) : LayoutUnit()); |
| 235 } | 237 } |
| 236 | 238 |
| 237 void BackgroundImageGeometry::setSpaceY(LayoutUnit space, LayoutUnit availableHe ight, LayoutUnit extraOffset) | 239 void BackgroundImageGeometry::setSpaceY(LayoutUnit space, LayoutUnit availableHe ight, LayoutUnit extraOffset) |
| 238 { | 240 { |
| 239 LayoutUnit computedYPosition = roundedMinimumValueForLength(Length(), availa bleHeight); | 241 LayoutUnit computedYPosition = roundedMinimumValueForLength(Length(), availa bleHeight); |
| 240 setSpaceSize(LayoutSize(spaceSize().width(), space.round())); | 242 setSpaceSize(LayoutSize(spaceSize().width(), space.round())); |
| 241 LayoutUnit actualHeight = tileSize().height() + space; | 243 LayoutUnit actualHeight = tileSize().height() + space; |
| 242 setPhaseY(actualHeight ? LayoutUnit(actualHeight - fmodf((computedYPosition + extraOffset), actualHeight)) : LayoutUnit()); | 244 setPhaseY(actualHeight ? LayoutUnit(round(actualHeight - fmodf((computedYPos ition + extraOffset), actualHeight))) : LayoutUnit()); |
| 243 } | 245 } |
| 244 | 246 |
| 245 void BackgroundImageGeometry::useFixedAttachment(const LayoutPoint& attachmentPo int) | 247 void BackgroundImageGeometry::useFixedAttachment(const LayoutPoint& attachmentPo int) |
| 246 { | 248 { |
| 247 LayoutPoint alignedPoint = attachmentPoint; | 249 LayoutPoint alignedPoint = attachmentPoint; |
| 248 m_phase.move(std::max(alignedPoint.x() - m_destRect.x(), LayoutUnit()), std: :max(alignedPoint.y() - m_destRect.y(), LayoutUnit())); | 250 m_phase.move(std::max(alignedPoint.x() - m_destRect.x(), LayoutUnit()), std: :max(alignedPoint.y() - m_destRect.y(), LayoutUnit())); |
| 251 m_phase = LayoutPoint(roundedIntPoint(m_phase)); | |
| 249 } | 252 } |
| 250 | 253 |
| 251 void BackgroundImageGeometry::calculate(const LayoutBoxModelObject& obj, const L ayoutBoxModelObject* paintContainer, | 254 void BackgroundImageGeometry::calculate(const LayoutBoxModelObject& obj, const L ayoutBoxModelObject* paintContainer, |
| 252 const GlobalPaintFlags globalPaintFlags, const FillLayer& fillLayer, const L ayoutRect& paintRect) | 255 const GlobalPaintFlags globalPaintFlags, const FillLayer& fillLayer, const L ayoutRect& paintRect) |
| 253 { | 256 { |
| 254 LayoutUnit left; | 257 LayoutUnit left; |
| 255 LayoutUnit top; | 258 LayoutUnit top; |
| 256 LayoutSize positioningAreaSize; | 259 LayoutSize positioningAreaSize; |
| 257 bool isLayoutView = obj.isLayoutView(); | 260 bool isLayoutView = obj.isLayoutView(); |
| 258 const LayoutBox* rootBox = nullptr; | 261 const LayoutBox* rootBox = nullptr; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 330 | 333 |
| 331 setDestRect(viewportRect); | 334 setDestRect(viewportRect); |
| 332 positioningAreaSize = destRect().size(); | 335 positioningAreaSize = destRect().size(); |
| 333 } | 336 } |
| 334 | 337 |
| 335 LayoutSize fillTileSize(calculateFillTileSize(positioningBox, fillLayer, pos itioningAreaSize)); | 338 LayoutSize fillTileSize(calculateFillTileSize(positioningBox, fillLayer, pos itioningAreaSize)); |
| 336 // It's necessary to apply the heuristic here prior to any further calculati ons to avoid | 339 // It's necessary to apply the heuristic here prior to any further calculati ons to avoid |
| 337 // incorrectly using sub-pixel values that won't be present in the painted t ile. | 340 // incorrectly using sub-pixel values that won't be present in the painted t ile. |
| 338 setTileSize(applySubPixelHeuristicToImageSize(fillTileSize, m_destRect)); | 341 setTileSize(applySubPixelHeuristicToImageSize(fillTileSize, m_destRect)); |
| 339 | 342 |
| 343 setDestRect(LayoutRect(pixelSnappedIntRect(m_destRect))); | |
| 344 | |
| 345 | |
| 340 EFillRepeat backgroundRepeatX = fillLayer.repeatX(); | 346 EFillRepeat backgroundRepeatX = fillLayer.repeatX(); |
| 341 EFillRepeat backgroundRepeatY = fillLayer.repeatY(); | 347 EFillRepeat backgroundRepeatY = fillLayer.repeatY(); |
| 342 LayoutUnit unsnappedAvailableWidth = positioningAreaSize.width() - fillTileS ize.width(); | 348 LayoutUnit unsnappedAvailableWidth = positioningAreaSize.width() - fillTileS ize.width(); |
| 343 LayoutUnit unsnappedAvailableHeight = positioningAreaSize.height() - fillTil eSize.height(); | 349 LayoutUnit unsnappedAvailableHeight = positioningAreaSize.height() - fillTil eSize.height(); |
| 344 positioningAreaSize = LayoutSize(snapSizeToPixel(positioningAreaSize.width() , m_destRect.x()), snapSizeToPixel(positioningAreaSize.height(), m_destRect.y()) ); | 350 positioningAreaSize = LayoutSize(snapSizeToPixel(positioningAreaSize.width() , m_destRect.x()), snapSizeToPixel(positioningAreaSize.height(), m_destRect.y()) ); |
| 345 LayoutUnit availableWidth = positioningAreaSize.width() - tileSize().width() ; | 351 LayoutUnit availableWidth = positioningAreaSize.width() - tileSize().width() ; |
| 346 LayoutUnit availableHeight = positioningAreaSize.height() - tileSize().heigh t(); | 352 LayoutUnit availableHeight = positioningAreaSize.height() - tileSize().heigh t(); |
| 347 | 353 |
| 348 LayoutUnit computedXPosition = roundedMinimumValueForLength(fillLayer.xPosit ion(), availableWidth); | 354 LayoutUnit computedXPosition = roundedMinimumValueForLength(fillLayer.xPosit ion(), availableWidth); |
| 349 if (backgroundRepeatX == RoundFill && positioningAreaSize.width() > LayoutUn it() && fillTileSize.width() > LayoutUnit()) { | 355 if (backgroundRepeatX == RoundFill && positioningAreaSize.width() > LayoutUn it() && fillTileSize.width() > LayoutUnit()) { |
| 350 int nrTiles = std::max(1, roundToInt(positioningAreaSize.width() / fillT ileSize.width())); | 356 int nrTiles = std::max(1, roundToInt(positioningAreaSize.width() / fillT ileSize.width())); |
| 351 | 357 |
| 352 fillTileSize.setWidth(positioningAreaSize.width() / nrTiles); | 358 fillTileSize.setWidth(positioningAreaSize.width() / nrTiles); |
| 353 | 359 |
| 354 // Maintain aspect ratio if background-size: auto is set | 360 // Maintain aspect ratio if background-size: auto is set |
| 355 if (fillLayer.size().size.height().isAuto() && backgroundRepeatY != Roun dFill) { | 361 if (fillLayer.size().size.height().isAuto() && backgroundRepeatY != Roun dFill) { |
| 356 fillTileSize.setHeight(fillTileSize.height() * positioningAreaSize.w idth() / (nrTiles * fillTileSize.width())); | 362 fillTileSize.setHeight(fillTileSize.height() * positioningAreaSize.w idth() / (nrTiles * fillTileSize.width())); |
| 357 } | 363 } |
| 358 setTileSize(applySubPixelHeuristicToImageSize(fillTileSize, m_destRect)) ; | 364 setTileSize(applySubPixelHeuristicToImageSize(fillTileSize, m_destRect)) ; |
| 359 setPhaseX(tileSize().width() ? LayoutUnit(tileSize().width() - fmodf((co mputedXPosition + left), tileSize().width())) | 365 setPhaseX(tileSize().width() |
| 366 ? LayoutUnit(round(tileSize().width() - fmodf((computedXPosition + l eft), tileSize().width()))) | |
| 360 : LayoutUnit()); | 367 : LayoutUnit()); |
| 361 setSpaceSize(LayoutSize()); | 368 setSpaceSize(LayoutSize()); |
| 362 } | 369 } |
| 363 | 370 |
| 364 LayoutUnit computedYPosition = roundedMinimumValueForLength(fillLayer.yPosit ion(), availableHeight); | 371 LayoutUnit computedYPosition = roundedMinimumValueForLength(fillLayer.yPosit ion(), availableHeight); |
| 365 if (backgroundRepeatY == RoundFill && positioningAreaSize.height() > LayoutU nit() && fillTileSize.height() > LayoutUnit()) { | 372 if (backgroundRepeatY == RoundFill && positioningAreaSize.height() > LayoutU nit() && fillTileSize.height() > LayoutUnit()) { |
| 366 int nrTiles = std::max(1, roundToInt(positioningAreaSize.height() / fill TileSize.height())); | 373 int nrTiles = std::max(1, roundToInt(positioningAreaSize.height() / fill TileSize.height())); |
| 367 | 374 |
| 368 fillTileSize.setHeight(positioningAreaSize.height() / nrTiles); | 375 fillTileSize.setHeight(positioningAreaSize.height() / nrTiles); |
| 369 | 376 |
| 370 // Maintain aspect ratio if background-size: auto is set | 377 // Maintain aspect ratio if background-size: auto is set |
| 371 if (fillLayer.size().size.width().isAuto() && backgroundRepeatX != Round Fill) { | 378 if (fillLayer.size().size.width().isAuto() && backgroundRepeatX != Round Fill) { |
| 372 fillTileSize.setWidth(fillTileSize.width() * positioningAreaSize.hei ght() / (nrTiles * fillTileSize.height())); | 379 fillTileSize.setWidth(fillTileSize.width() * positioningAreaSize.hei ght() / (nrTiles * fillTileSize.height())); |
| 373 } | 380 } |
| 374 setTileSize(applySubPixelHeuristicToImageSize(fillTileSize, m_destRect)) ; | 381 setTileSize(applySubPixelHeuristicToImageSize(fillTileSize, m_destRect)) ; |
| 375 setPhaseY(tileSize().height() ? LayoutUnit(tileSize().height() - fmodf(( computedYPosition + top), tileSize().height())) | 382 setPhaseY(tileSize().height() |
| 383 ? LayoutUnit(round(tileSize().height() - fmodf((computedYPosition + top), tileSize().height()))) | |
| 376 : LayoutUnit()); | 384 : LayoutUnit()); |
| 377 setSpaceSize(LayoutSize()); | 385 setSpaceSize(LayoutSize()); |
| 378 } | 386 } |
| 379 | 387 |
| 380 if (backgroundRepeatX == RepeatFill) { | 388 if (backgroundRepeatX == RepeatFill) { |
| 381 setRepeatX(fillLayer, fillTileSize.width(), availableWidth, unsnappedAva ilableWidth, left); | 389 setRepeatX(fillLayer, fillTileSize.width(), availableWidth, unsnappedAva ilableWidth, left); |
| 382 } else if (backgroundRepeatX == SpaceFill && tileSize().width() > LayoutUnit ()) { | 390 } else if (backgroundRepeatX == SpaceFill && tileSize().width() > LayoutUnit ()) { |
| 383 LayoutUnit space = getSpaceBetweenImageTiles(positioningAreaSize.width() , tileSize().width()); | 391 LayoutUnit space = getSpaceBetweenImageTiles(positioningAreaSize.width() , tileSize().width()); |
| 384 if (space >= LayoutUnit()) | 392 if (space >= LayoutUnit()) |
| 385 setSpaceX(space, availableWidth, left); | 393 setSpaceX(space, availableWidth, left); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 405 setNoRepeatY(top + yOffset); | 413 setNoRepeatY(top + yOffset); |
| 406 } | 414 } |
| 407 | 415 |
| 408 if (fixedAttachment) | 416 if (fixedAttachment) |
| 409 useFixedAttachment(paintRect.location()); | 417 useFixedAttachment(paintRect.location()); |
| 410 | 418 |
| 411 // Clip the final output rect to the paint rect | 419 // Clip the final output rect to the paint rect |
| 412 m_destRect.intersect(paintRect); | 420 m_destRect.intersect(paintRect); |
| 413 | 421 |
| 414 // Snap as-yet unsnapped values. | 422 // Snap as-yet unsnapped values. |
| 415 setPhase(LayoutPoint(roundedIntPoint(m_phase))); | 423 DCHECK(m_phase == LayoutPoint(roundedIntPoint(m_phase))); |
| 416 setDestRect(LayoutRect(pixelSnappedIntRect(m_destRect))); | 424 setDestRect(LayoutRect(pixelSnappedIntRect(m_destRect))); |
| 417 | 425 |
| 418 } | 426 } |
| 419 | 427 |
| 420 } // namespace blink | 428 } // namespace blink |
| OLD | NEW |