| 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 setPhaseY(tileSize().height() ? LayoutUnit(tileSize().height() - fmodf((
computedYPosition + top), tileSize().height())) | 294 setPhaseY(tileSize().height() ? LayoutUnit(tileSize().height() - fmodf((
computedYPosition + top), tileSize().height())) |
| 295 : LayoutUnit()); | 295 : LayoutUnit()); |
| 296 setSpaceSize(LayoutSize()); | 296 setSpaceSize(LayoutSize()); |
| 297 } | 297 } |
| 298 | 298 |
| 299 if (backgroundRepeatX == RepeatFill) { | 299 if (backgroundRepeatX == RepeatFill) { |
| 300 LayoutUnit xOffset = fillLayer.backgroundXOrigin() == RightEdge ? availa
bleWidth - computedXPosition : computedXPosition; | 300 LayoutUnit xOffset = fillLayer.backgroundXOrigin() == RightEdge ? availa
bleWidth - computedXPosition : computedXPosition; |
| 301 setPhaseX(tileSize().width() ? LayoutUnit(tileSize().width() - fmodf((xO
ffset + left), tileSize().width())) | 301 setPhaseX(tileSize().width() ? LayoutUnit(tileSize().width() - fmodf((xO
ffset + left), tileSize().width())) |
| 302 : LayoutUnit()); | 302 : LayoutUnit()); |
| 303 setSpaceSize(LayoutSize()); | 303 setSpaceSize(LayoutSize()); |
| 304 } else if (backgroundRepeatX == SpaceFill && fillTileSize.width() > LayoutUn
it()) { | 304 } else if (backgroundRepeatX == SpaceFill && tileSize().width() > LayoutUnit
()) { |
| 305 LayoutUnit space = getSpaceBetweenImageTiles(positioningAreaSize.width()
, tileSize().width()); | 305 LayoutUnit space = getSpaceBetweenImageTiles(positioningAreaSize.width()
, tileSize().width()); |
| 306 LayoutUnit actualWidth = tileSize().width() + space; | 306 LayoutUnit actualWidth = tileSize().width() + space; |
| 307 | 307 |
| 308 if (space >= LayoutUnit()) { | 308 if (space >= LayoutUnit()) { |
| 309 computedXPosition = roundedMinimumValueForLength(Length(), available
Width); | 309 computedXPosition = roundedMinimumValueForLength(Length(), available
Width); |
| 310 setSpaceSize(LayoutSize(space.round(), LayoutUnit())); | 310 setSpaceSize(LayoutSize(space.round(), LayoutUnit())); |
| 311 setPhaseX(actualWidth ? LayoutUnit(actualWidth - fmodf((computedXPos
ition + left), actualWidth)) : LayoutUnit()); | 311 setPhaseX(actualWidth ? LayoutUnit(actualWidth - fmodf((computedXPos
ition + left), actualWidth)) : LayoutUnit()); |
| 312 } else { | 312 } else { |
| 313 backgroundRepeatX = NoRepeatFill; | 313 backgroundRepeatX = NoRepeatFill; |
| 314 } | 314 } |
| 315 } | 315 } |
| 316 if (backgroundRepeatX == NoRepeatFill) { | 316 if (backgroundRepeatX == NoRepeatFill) { |
| 317 LayoutUnit xOffset = fillLayer.backgroundXOrigin() == RightEdge ? availa
bleWidth - computedXPosition : computedXPosition; | 317 LayoutUnit xOffset = fillLayer.backgroundXOrigin() == RightEdge ? availa
bleWidth - computedXPosition : computedXPosition; |
| 318 setNoRepeatX(left + xOffset); | 318 setNoRepeatX(left + xOffset); |
| 319 setSpaceSize(LayoutSize(LayoutUnit(), spaceSize().height())); | 319 setSpaceSize(LayoutSize(LayoutUnit(), spaceSize().height())); |
| 320 } | 320 } |
| 321 | 321 |
| 322 if (backgroundRepeatY == RepeatFill) { | 322 if (backgroundRepeatY == RepeatFill) { |
| 323 LayoutUnit yOffset = fillLayer.backgroundYOrigin() == BottomEdge ? avail
ableHeight - computedYPosition : computedYPosition; | 323 LayoutUnit yOffset = fillLayer.backgroundYOrigin() == BottomEdge ? avail
ableHeight - computedYPosition : computedYPosition; |
| 324 setPhaseY(tileSize().height() ? LayoutUnit(tileSize().height() - fmodf((
yOffset + top), tileSize().height())) | 324 setPhaseY(tileSize().height() ? LayoutUnit(tileSize().height() - fmodf((
yOffset + top), tileSize().height())) |
| 325 : LayoutUnit()); | 325 : LayoutUnit()); |
| 326 setSpaceSize(LayoutSize(spaceSize().width(), LayoutUnit())); | 326 setSpaceSize(LayoutSize(spaceSize().width(), LayoutUnit())); |
| 327 } else if (backgroundRepeatY == SpaceFill && fillTileSize.height() > LayoutU
nit()) { | 327 } else if (backgroundRepeatY == SpaceFill && tileSize().height() > LayoutUni
t()) { |
| 328 LayoutUnit space = getSpaceBetweenImageTiles(positioningAreaSize.height(
), tileSize().height()); | 328 LayoutUnit space = getSpaceBetweenImageTiles(positioningAreaSize.height(
), tileSize().height()); |
| 329 LayoutUnit actualHeight = tileSize().height() + space; | 329 LayoutUnit actualHeight = tileSize().height() + space; |
| 330 | 330 |
| 331 if (space >= LayoutUnit()) { | 331 if (space >= LayoutUnit()) { |
| 332 computedYPosition = roundedMinimumValueForLength(Length(), available
Height); | 332 computedYPosition = roundedMinimumValueForLength(Length(), available
Height); |
| 333 setSpaceSize(LayoutSize(spaceSize().width(), space.round())); | 333 setSpaceSize(LayoutSize(spaceSize().width(), space.round())); |
| 334 setPhaseY(actualHeight ? LayoutUnit(actualHeight - fmodf((computedYP
osition + top), actualHeight)) : LayoutUnit()); | 334 setPhaseY(actualHeight ? LayoutUnit(actualHeight - fmodf((computedYP
osition + top), actualHeight)) : LayoutUnit()); |
| 335 } else { | 335 } else { |
| 336 backgroundRepeatY = NoRepeatFill; | 336 backgroundRepeatY = NoRepeatFill; |
| 337 } | 337 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 348 // Clip the final output rect to the paint rect | 348 // Clip the final output rect to the paint rect |
| 349 m_destRect.intersect(paintRect); | 349 m_destRect.intersect(paintRect); |
| 350 | 350 |
| 351 // Snap as-yet unsnapped values. | 351 // Snap as-yet unsnapped values. |
| 352 setPhase(LayoutPoint(roundedIntPoint(m_phase))); | 352 setPhase(LayoutPoint(roundedIntPoint(m_phase))); |
| 353 setDestRect(LayoutRect(pixelSnappedIntRect(m_destRect))); | 353 setDestRect(LayoutRect(pixelSnappedIntRect(m_destRect))); |
| 354 | 354 |
| 355 } | 355 } |
| 356 | 356 |
| 357 } // namespace blink | 357 } // namespace blink |
| OLD | NEW |