| 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 | 269 |
| 270 LayoutSize fillTileSize(calculateFillTileSize(positioningBox, fillLayer, pos
itioningAreaSize)); | 270 LayoutSize fillTileSize(calculateFillTileSize(positioningBox, fillLayer, pos
itioningAreaSize)); |
| 271 // It's necessary to apply the heuristic here prior to any further calculati
ons to avoid | 271 // It's necessary to apply the heuristic here prior to any further calculati
ons to avoid |
| 272 // incorrectly using sub-pixel values that won't be present in the painted t
ile. | 272 // incorrectly using sub-pixel values that won't be present in the painted t
ile. |
| 273 fillTileSize = applySubPixelHeuristicToImageSize(fillTileSize, m_destRect); | 273 fillTileSize = applySubPixelHeuristicToImageSize(fillTileSize, m_destRect); |
| 274 setTileSize(fillTileSize); | 274 setTileSize(fillTileSize); |
| 275 setImageContainerSize(fillTileSize); | 275 setImageContainerSize(fillTileSize); |
| 276 | 276 |
| 277 EFillRepeat backgroundRepeatX = fillLayer.repeatX(); | 277 EFillRepeat backgroundRepeatX = fillLayer.repeatX(); |
| 278 EFillRepeat backgroundRepeatY = fillLayer.repeatY(); | 278 EFillRepeat backgroundRepeatY = fillLayer.repeatY(); |
| 279 positioningAreaSize = LayoutSize(snapSizeToPixel(positioningAreaSize.width()
, m_destRect.x()), snapSizeToPixel(positioningAreaSize.height(), m_destRect.y())
); |
| 279 LayoutUnit availableWidth = positioningAreaSize.width() - tileSize().width()
; | 280 LayoutUnit availableWidth = positioningAreaSize.width() - tileSize().width()
; |
| 280 LayoutUnit availableHeight = positioningAreaSize.height() - tileSize().heigh
t(); | 281 LayoutUnit availableHeight = positioningAreaSize.height() - tileSize().heigh
t(); |
| 281 | 282 |
| 282 LayoutUnit computedXPosition = roundedMinimumValueForLength(fillLayer.xPosit
ion(), availableWidth); | 283 LayoutUnit computedXPosition = roundedMinimumValueForLength(fillLayer.xPosit
ion(), availableWidth); |
| 283 if (backgroundRepeatX == RoundFill && positioningAreaSize.width() > LayoutUn
it() && fillTileSize.width() > LayoutUnit()) { | 284 if (backgroundRepeatX == RoundFill && positioningAreaSize.width() > LayoutUn
it() && fillTileSize.width() > LayoutUnit()) { |
| 284 int nrTiles = std::max(1, roundToInt(positioningAreaSize.width() / fillT
ileSize.width())); | 285 int nrTiles = std::max(1, roundToInt(positioningAreaSize.width() / fillT
ileSize.width())); |
| 285 | 286 |
| 286 fillTileSize.setWidth(positioningAreaSize.width() / nrTiles); | 287 fillTileSize.setWidth(positioningAreaSize.width() / nrTiles); |
| 287 | 288 |
| 288 // Maintain aspect ratio if background-size: auto is set | 289 // Maintain aspect ratio if background-size: auto is set |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 } | 359 } |
| 359 | 360 |
| 360 if (fixedAttachment) | 361 if (fixedAttachment) |
| 361 useFixedAttachment(paintRect.location()); | 362 useFixedAttachment(paintRect.location()); |
| 362 | 363 |
| 363 clip(paintRect); | 364 clip(paintRect); |
| 364 pixelSnapGeometry(); | 365 pixelSnapGeometry(); |
| 365 } | 366 } |
| 366 | 367 |
| 367 } // namespace blink | 368 } // namespace blink |
| OLD | NEW |