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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
655 isOpaque = !obj.document().hasSVGRootNode(); | 655 isOpaque = !obj.document().hasSVGRootNode(); |
656 } | 656 } |
657 } | 657 } |
658 } else if (obj.view()->frameView()) { | 658 } else if (obj.view()->frameView()) { |
659 isOpaque = !obj.view()->frameView()->isTransparent(); | 659 isOpaque = !obj.view()->frameView()->isTransparent(); |
660 } | 660 } |
661 | 661 |
662 return isOpaque; | 662 return isOpaque; |
663 } | 663 } |
664 | 664 |
665 // Return the amount of space to leave between image tiles for the background-re peat: space property. | 665 // Return the amount of characterSpace to leave between image tiles for the back ground-repeat: characterSpace property. |
jsbell
2015/05/05 17:29:53
This comment change is bogus
| |
666 static inline int getSpaceBetweenImageTiles(int areaSize, int tileSize) | 666 static inline int getSpaceBetweenImageTiles(int areaSize, int tileSize) |
667 { | 667 { |
668 int numberOfTiles = areaSize / tileSize; | 668 int numberOfTiles = areaSize / tileSize; |
669 int space = -1; | 669 int characterSpace = -1; |
jsbell
2015/05/05 17:29:53
This change is incorrect - it's a local variable,
| |
670 | 670 |
671 if (numberOfTiles > 1) { | 671 if (numberOfTiles > 1) { |
672 // Spec doesn't specify rounding, so use the same method as for backgrou nd-repeat: round. | 672 // Spec doesn't specify rounding, so use the same method as for backgrou nd-repeat: round. |
673 space = lroundf((areaSize - numberOfTiles * tileSize) / (float)(numberOf Tiles - 1)); | 673 characterSpace = lroundf((areaSize - numberOfTiles * tileSize) / (float) (numberOfTiles - 1)); |
674 } | 674 } |
675 | 675 |
676 return space; | 676 return characterSpace; |
677 } | 677 } |
678 | 678 |
679 void BoxPainter::calculateBackgroundImageGeometry(LayoutBoxModelObject& obj, con st LayoutBoxModelObject* paintContainer, const FillLayer& fillLayer, const Layou tRect& paintRect, | 679 void BoxPainter::calculateBackgroundImageGeometry(LayoutBoxModelObject& obj, con st LayoutBoxModelObject* paintContainer, const FillLayer& fillLayer, const Layou tRect& paintRect, |
680 BackgroundImageGeometry& geometry, LayoutObject* backgroundObject) | 680 BackgroundImageGeometry& geometry, LayoutObject* backgroundObject) |
681 { | 681 { |
682 LayoutUnit left = 0; | 682 LayoutUnit left = 0; |
683 LayoutUnit top = 0; | 683 LayoutUnit top = 0; |
684 IntSize positioningAreaSize; | 684 IntSize positioningAreaSize; |
685 IntRect snappedPaintRect = pixelSnappedIntRect(paintRect); | 685 IntRect snappedPaintRect = pixelSnappedIntRect(paintRect); |
686 | 686 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
789 | 789 |
790 geometry.setTileSize(fillTileSize); | 790 geometry.setTileSize(fillTileSize); |
791 geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().he ight() - roundToInt(computedYPosition + top) % geometry.tileSize().height() : 0) ; | 791 geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().he ight() - roundToInt(computedYPosition + top) % geometry.tileSize().height() : 0) ; |
792 geometry.setSpaceSize(IntSize()); | 792 geometry.setSpaceSize(IntSize()); |
793 } | 793 } |
794 | 794 |
795 if (backgroundRepeatX == RepeatFill) { | 795 if (backgroundRepeatX == RepeatFill) { |
796 geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().wid th() - roundToInt(computedXPosition + left) % geometry.tileSize().width() : 0); | 796 geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().wid th() - roundToInt(computedXPosition + left) % geometry.tileSize().width() : 0); |
797 geometry.setSpaceSize(IntSize()); | 797 geometry.setSpaceSize(IntSize()); |
798 } else if (backgroundRepeatX == SpaceFill && fillTileSize.width() > 0) { | 798 } else if (backgroundRepeatX == SpaceFill && fillTileSize.width() > 0) { |
799 int space = getSpaceBetweenImageTiles(positioningAreaSize.width(), geome try.tileSize().width()); | 799 int characterSpace = getSpaceBetweenImageTiles(positioningAreaSize.width (), geometry.tileSize().width()); |
jsbell
2015/05/05 17:29:53
Ditto.
| |
800 int actualWidth = geometry.tileSize().width() + space; | 800 int actualWidth = geometry.tileSize().width() + characterSpace; |
801 | 801 |
802 if (space >= 0) { | 802 if (characterSpace >= 0) { |
803 computedXPosition = roundedMinimumValueForLength(Length(), available Width); | 803 computedXPosition = roundedMinimumValueForLength(Length(), available Width); |
804 geometry.setSpaceSize(IntSize(space, 0)); | 804 geometry.setSpaceSize(IntSize(characterSpace, 0)); |
805 geometry.setPhaseX(actualWidth ? actualWidth - roundToInt(computedXP osition + left) % actualWidth : 0); | 805 geometry.setPhaseX(actualWidth ? actualWidth - roundToInt(computedXP osition + left) % actualWidth : 0); |
806 } else { | 806 } else { |
807 backgroundRepeatX = NoRepeatFill; | 807 backgroundRepeatX = NoRepeatFill; |
808 } | 808 } |
809 } | 809 } |
810 if (backgroundRepeatX == NoRepeatFill) { | 810 if (backgroundRepeatX == NoRepeatFill) { |
811 int xOffset = fillLayer.backgroundXOrigin() == RightEdge ? availableWidt h - computedXPosition : computedXPosition; | 811 int xOffset = fillLayer.backgroundXOrigin() == RightEdge ? availableWidt h - computedXPosition : computedXPosition; |
812 geometry.setNoRepeatX(left + xOffset); | 812 geometry.setNoRepeatX(left + xOffset); |
813 geometry.setSpaceSize(IntSize(0, geometry.spaceSize().height())); | 813 geometry.setSpaceSize(IntSize(0, geometry.spaceSize().height())); |
814 } | 814 } |
815 | 815 |
816 if (backgroundRepeatY == RepeatFill) { | 816 if (backgroundRepeatY == RepeatFill) { |
817 geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().he ight() - roundToInt(computedYPosition + top) % geometry.tileSize().height() : 0) ; | 817 geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().he ight() - roundToInt(computedYPosition + top) % geometry.tileSize().height() : 0) ; |
818 geometry.setSpaceSize(IntSize(geometry.spaceSize().width(), 0)); | 818 geometry.setSpaceSize(IntSize(geometry.spaceSize().width(), 0)); |
819 } else if (backgroundRepeatY == SpaceFill && fillTileSize.height() > 0) { | 819 } else if (backgroundRepeatY == SpaceFill && fillTileSize.height() > 0) { |
820 int space = getSpaceBetweenImageTiles(positioningAreaSize.height(), geom etry.tileSize().height()); | 820 int characterSpace = getSpaceBetweenImageTiles(positioningAreaSize.heigh t(), geometry.tileSize().height()); |
jsbell
2015/05/05 17:29:53
Ditto.
| |
821 int actualHeight = geometry.tileSize().height() + space; | 821 int actualHeight = geometry.tileSize().height() + characterSpace; |
822 | 822 |
823 if (space >= 0) { | 823 if (characterSpace >= 0) { |
824 computedYPosition = roundedMinimumValueForLength(Length(), available Height); | 824 computedYPosition = roundedMinimumValueForLength(Length(), available Height); |
825 geometry.setSpaceSize(IntSize(geometry.spaceSize().width(), space)); | 825 geometry.setSpaceSize(IntSize(geometry.spaceSize().width(), characte rSpace)); |
826 geometry.setPhaseY(actualHeight ? actualHeight - roundToInt(computed YPosition + top) % actualHeight : 0); | 826 geometry.setPhaseY(actualHeight ? actualHeight - roundToInt(computed YPosition + top) % actualHeight : 0); |
827 } else { | 827 } else { |
828 backgroundRepeatY = NoRepeatFill; | 828 backgroundRepeatY = NoRepeatFill; |
829 } | 829 } |
830 } | 830 } |
831 if (backgroundRepeatY == NoRepeatFill) { | 831 if (backgroundRepeatY == NoRepeatFill) { |
832 int yOffset = fillLayer.backgroundYOrigin() == BottomEdge ? availableHei ght - computedYPosition : computedYPosition; | 832 int yOffset = fillLayer.backgroundYOrigin() == BottomEdge ? availableHei ght - computedYPosition : computedYPosition; |
833 geometry.setNoRepeatY(top + yOffset); | 833 geometry.setNoRepeatY(top + yOffset); |
834 geometry.setSpaceSize(IntSize(geometry.spaceSize().width(), 0)); | 834 geometry.setSpaceSize(IntSize(geometry.spaceSize().width(), 0)); |
835 } | 835 } |
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2294 | 2294 |
2295 FloatPoint secondQuad[4]; | 2295 FloatPoint secondQuad[4]; |
2296 secondQuad[0] = quad[0]; | 2296 secondQuad[0] = quad[0]; |
2297 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy); | 2297 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy); |
2298 secondQuad[2] = quad[2]; | 2298 secondQuad[2] = quad[2]; |
2299 secondQuad[3] = quad[3]; | 2299 secondQuad[3] = quad[3]; |
2300 graphicsContext->clipPolygon(4, secondQuad, !secondEdgeMatches); | 2300 graphicsContext->clipPolygon(4, secondQuad, !secondEdgeMatches); |
2301 } | 2301 } |
2302 | 2302 |
2303 } // namespace blink | 2303 } // namespace blink |
OLD | NEW |