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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 | 333 |
334 setDestRect(viewportRect); | 334 setDestRect(viewportRect); |
335 positioningAreaSize = destRect().size(); | 335 positioningAreaSize = destRect().size(); |
336 } | 336 } |
337 | 337 |
338 LayoutSize fillTileSize(calculateFillTileSize(positioningBox, fillLayer, pos
itioningAreaSize)); | 338 LayoutSize fillTileSize(calculateFillTileSize(positioningBox, fillLayer, pos
itioningAreaSize)); |
339 // 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 |
340 // 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. |
341 setTileSize(applySubPixelHeuristicToImageSize(fillTileSize, m_destRect)); | 341 setTileSize(applySubPixelHeuristicToImageSize(fillTileSize, m_destRect)); |
342 | 342 |
343 setDestRect(LayoutRect(pixelSnappedIntRect(m_destRect))); | |
344 | |
345 | |
346 EFillRepeat backgroundRepeatX = fillLayer.repeatX(); | 343 EFillRepeat backgroundRepeatX = fillLayer.repeatX(); |
347 EFillRepeat backgroundRepeatY = fillLayer.repeatY(); | 344 EFillRepeat backgroundRepeatY = fillLayer.repeatY(); |
348 LayoutUnit unsnappedAvailableWidth = positioningAreaSize.width() - fillTileS
ize.width(); | 345 LayoutUnit unsnappedAvailableWidth = positioningAreaSize.width() - fillTileS
ize.width(); |
349 LayoutUnit unsnappedAvailableHeight = positioningAreaSize.height() - fillTil
eSize.height(); | 346 LayoutUnit unsnappedAvailableHeight = positioningAreaSize.height() - fillTil
eSize.height(); |
350 positioningAreaSize = LayoutSize(snapSizeToPixel(positioningAreaSize.width()
, m_destRect.x()), snapSizeToPixel(positioningAreaSize.height(), m_destRect.y())
); | 347 positioningAreaSize = LayoutSize(snapSizeToPixel(positioningAreaSize.width()
, m_destRect.x()), snapSizeToPixel(positioningAreaSize.height(), m_destRect.y())
); |
351 LayoutUnit availableWidth = positioningAreaSize.width() - tileSize().width()
; | 348 LayoutUnit availableWidth = positioningAreaSize.width() - tileSize().width()
; |
352 LayoutUnit availableHeight = positioningAreaSize.height() - tileSize().heigh
t(); | 349 LayoutUnit availableHeight = positioningAreaSize.height() - tileSize().heigh
t(); |
353 | 350 |
354 LayoutUnit computedXPosition = roundedMinimumValueForLength(fillLayer.xPosit
ion(), availableWidth); | 351 LayoutUnit computedXPosition = roundedMinimumValueForLength(fillLayer.xPosit
ion(), availableWidth); |
355 if (backgroundRepeatX == RoundFill && positioningAreaSize.width() > LayoutUn
it() && fillTileSize.width() > LayoutUnit()) { | 352 if (backgroundRepeatX == RoundFill && positioningAreaSize.width() > LayoutUn
it() && fillTileSize.width() > LayoutUnit()) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 | 413 |
417 if (fixedAttachment) | 414 if (fixedAttachment) |
418 useFixedAttachment(paintRect.location()); | 415 useFixedAttachment(paintRect.location()); |
419 | 416 |
420 // Clip the final output rect to the paint rect | 417 // Clip the final output rect to the paint rect |
421 m_destRect.intersect(paintRect); | 418 m_destRect.intersect(paintRect); |
422 | 419 |
423 // Snap as-yet unsnapped values. | 420 // Snap as-yet unsnapped values. |
424 DCHECK(m_phase == LayoutPoint(roundedIntPoint(m_phase))); | 421 DCHECK(m_phase == LayoutPoint(roundedIntPoint(m_phase))); |
425 setDestRect(LayoutRect(pixelSnappedIntRect(m_destRect))); | 422 setDestRect(LayoutRect(pixelSnappedIntRect(m_destRect))); |
426 | |
427 } | 423 } |
428 | 424 |
429 } // namespace blink | 425 } // namespace blink |
OLD | NEW |