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 "config.h" | 5 #include "config.h" |
| 6 #include "core/paint/BoxPainter.h" | 6 #include "core/paint/BoxPainter.h" |
| 7 | 7 |
| 8 #include "core/HTMLNames.h" | 8 #include "core/HTMLNames.h" |
| 9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
| 10 #include "core/html/HTMLFrameOwnerElement.h" | 10 #include "core/html/HTMLFrameOwnerElement.h" |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 704 if (fillLayer.size().size.width().isAuto() && backgroundRepeatX != Round Fill) { | 704 if (fillLayer.size().size.width().isAuto() && backgroundRepeatX != Round Fill) { |
| 705 fillTileSize.setWidth(fillTileSize.width() * positioningAreaSize.hei ght() / (nrTiles * fillTileSize.height())); | 705 fillTileSize.setWidth(fillTileSize.width() * positioningAreaSize.hei ght() / (nrTiles * fillTileSize.height())); |
| 706 } | 706 } |
| 707 | 707 |
| 708 geometry.setTileSize(fillTileSize); | 708 geometry.setTileSize(fillTileSize); |
| 709 geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().he ight() - roundToInt(computedYPosition + top) % geometry.tileSize().height() : 0) ; | 709 geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().he ight() - roundToInt(computedYPosition + top) % geometry.tileSize().height() : 0) ; |
| 710 geometry.setSpaceSize(IntSize()); | 710 geometry.setSpaceSize(IntSize()); |
| 711 } | 711 } |
| 712 | 712 |
| 713 if (backgroundRepeatX == RepeatFill) { | 713 if (backgroundRepeatX == RepeatFill) { |
| 714 geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().wid th() - roundToInt(computedXPosition + left) % geometry.tileSize().width() : 0); | 714 int xOffset = fillLayer.backgroundXOrigin() == RightEdge ? availableWidt h - computedXPosition : computedXPosition; |
| 715 geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().wid th() - roundToInt(xOffset + left) % geometry.tileSize().width() : 0); | |
| 715 geometry.setSpaceSize(IntSize()); | 716 geometry.setSpaceSize(IntSize()); |
| 716 } else if (backgroundRepeatX == SpaceFill && fillTileSize.width() > 0) { | 717 } else if (backgroundRepeatX == SpaceFill && fillTileSize.width() > 0) { |
| 717 int space = getSpaceBetweenImageTiles(positioningAreaSize.width(), geome try.tileSize().width()); | 718 int space = getSpaceBetweenImageTiles(positioningAreaSize.width(), geome try.tileSize().width()); |
| 718 int actualWidth = geometry.tileSize().width() + space; | 719 int actualWidth = geometry.tileSize().width() + space; |
| 719 | 720 |
| 720 if (space >= 0) { | 721 if (space >= 0) { |
| 721 computedXPosition = roundedMinimumValueForLength(Length(), available Width); | 722 computedXPosition = roundedMinimumValueForLength(Length(), available Width); |
|
pdr.
2015/08/18 06:41:08
I think we need to account for the origin for Spac
davve
2015/08/18 06:52:15
Not sure I follow. Spec says for space: "The value
| |
| 722 geometry.setSpaceSize(IntSize(space, 0)); | 723 geometry.setSpaceSize(IntSize(space, 0)); |
| 723 geometry.setPhaseX(actualWidth ? actualWidth - roundToInt(computedXP osition + left) % actualWidth : 0); | 724 geometry.setPhaseX(actualWidth ? actualWidth - roundToInt(computedXP osition + left) % actualWidth : 0); |
| 724 } else { | 725 } else { |
| 725 backgroundRepeatX = NoRepeatFill; | 726 backgroundRepeatX = NoRepeatFill; |
| 726 } | 727 } |
| 727 } | 728 } |
| 728 if (backgroundRepeatX == NoRepeatFill) { | 729 if (backgroundRepeatX == NoRepeatFill) { |
| 729 int xOffset = fillLayer.backgroundXOrigin() == RightEdge ? availableWidt h - computedXPosition : computedXPosition; | 730 int xOffset = fillLayer.backgroundXOrigin() == RightEdge ? availableWidt h - computedXPosition : computedXPosition; |
| 730 geometry.setNoRepeatX(left + xOffset); | 731 geometry.setNoRepeatX(left + xOffset); |
| 731 geometry.setSpaceSize(IntSize(0, geometry.spaceSize().height())); | 732 geometry.setSpaceSize(IntSize(0, geometry.spaceSize().height())); |
| 732 } | 733 } |
| 733 | 734 |
| 734 if (backgroundRepeatY == RepeatFill) { | 735 if (backgroundRepeatY == RepeatFill) { |
| 735 geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().he ight() - roundToInt(computedYPosition + top) % geometry.tileSize().height() : 0) ; | 736 int yOffset = fillLayer.backgroundYOrigin() == BottomEdge ? availableHei ght - computedYPosition : computedYPosition; |
| 737 geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().he ight() - roundToInt(yOffset + top) % geometry.tileSize().height() : 0); | |
| 736 geometry.setSpaceSize(IntSize(geometry.spaceSize().width(), 0)); | 738 geometry.setSpaceSize(IntSize(geometry.spaceSize().width(), 0)); |
| 737 } else if (backgroundRepeatY == SpaceFill && fillTileSize.height() > 0) { | 739 } else if (backgroundRepeatY == SpaceFill && fillTileSize.height() > 0) { |
| 738 int space = getSpaceBetweenImageTiles(positioningAreaSize.height(), geom etry.tileSize().height()); | 740 int space = getSpaceBetweenImageTiles(positioningAreaSize.height(), geom etry.tileSize().height()); |
| 739 int actualHeight = geometry.tileSize().height() + space; | 741 int actualHeight = geometry.tileSize().height() + space; |
| 740 | 742 |
| 741 if (space >= 0) { | 743 if (space >= 0) { |
| 742 computedYPosition = roundedMinimumValueForLength(Length(), available Height); | 744 computedYPosition = roundedMinimumValueForLength(Length(), available Height); |
| 743 geometry.setSpaceSize(IntSize(geometry.spaceSize().width(), space)); | 745 geometry.setSpaceSize(IntSize(geometry.spaceSize().width(), space)); |
| 744 geometry.setPhaseY(actualHeight ? actualHeight - roundToInt(computed YPosition + top) % actualHeight : 0); | 746 geometry.setPhaseY(actualHeight ? actualHeight - roundToInt(computed YPosition + top) % actualHeight : 0); |
| 745 } else { | 747 } else { |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1044 } | 1046 } |
| 1045 } | 1047 } |
| 1046 | 1048 |
| 1047 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(const ComputedStyle& style, const Document& document) | 1049 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(const ComputedStyle& style, const Document& document) |
| 1048 { | 1050 { |
| 1049 return document.printing() && style.printColorAdjust() == PrintColorAdjustEc onomy | 1051 return document.printing() && style.printColorAdjust() == PrintColorAdjustEc onomy |
| 1050 && (!document.settings() || !document.settings()->shouldPrintBackgrounds ()); | 1052 && (!document.settings() || !document.settings()->shouldPrintBackgrounds ()); |
| 1051 } | 1053 } |
| 1052 | 1054 |
| 1053 } // namespace blink | 1055 } // namespace blink |
| OLD | NEW |