| 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" |
| 11 #include "core/layout/Layer.h" |
| 11 #include "core/layout/LayoutTable.h" | 12 #include "core/layout/LayoutTable.h" |
| 12 #include "core/layout/LayoutTheme.h" | 13 #include "core/layout/LayoutTheme.h" |
| 13 #include "core/layout/compositing/CompositedLayerMapping.h" | 14 #include "core/layout/compositing/CompositedLayerMapping.h" |
| 14 #include "core/paint/BackgroundImageGeometry.h" | 15 #include "core/paint/BackgroundImageGeometry.h" |
| 15 #include "core/paint/BoxDecorationData.h" | 16 #include "core/paint/BoxDecorationData.h" |
| 16 #include "core/paint/RenderDrawingRecorder.h" | 17 #include "core/paint/RenderDrawingRecorder.h" |
| 17 #include "core/paint/RoundedInnerRectClipper.h" | 18 #include "core/paint/RoundedInnerRectClipper.h" |
| 18 #include "core/rendering/ImageQualityController.h" | 19 #include "core/rendering/ImageQualityController.h" |
| 19 #include "core/rendering/PaintInfo.h" | 20 #include "core/rendering/PaintInfo.h" |
| 20 #include "core/rendering/RenderBox.h" | 21 #include "core/rendering/RenderBox.h" |
| 21 #include "core/rendering/RenderBoxModelObject.h" | 22 #include "core/rendering/RenderBoxModelObject.h" |
| 22 #include "core/rendering/RenderLayer.h" | |
| 23 #include "core/rendering/RenderObject.h" | 23 #include "core/rendering/RenderObject.h" |
| 24 #include "core/rendering/RenderView.h" | 24 #include "core/rendering/RenderView.h" |
| 25 #include "core/rendering/style/BorderEdge.h" | 25 #include "core/rendering/style/BorderEdge.h" |
| 26 #include "core/rendering/style/ShadowList.h" | 26 #include "core/rendering/style/ShadowList.h" |
| 27 #include "platform/LengthFunctions.h" | 27 #include "platform/LengthFunctions.h" |
| 28 #include "platform/geometry/LayoutPoint.h" | 28 #include "platform/geometry/LayoutPoint.h" |
| 29 #include "platform/graphics/GraphicsContextStateSaver.h" | 29 #include "platform/graphics/GraphicsContextStateSaver.h" |
| 30 #include "platform/graphics/paint/CompositingDisplayItem.h" | 30 #include "platform/graphics/paint/CompositingDisplayItem.h" |
| 31 | 31 |
| 32 namespace blink { | 32 namespace blink { |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 int space = -1; | 615 int space = -1; |
| 616 | 616 |
| 617 if (numberOfTiles > 1) { | 617 if (numberOfTiles > 1) { |
| 618 // Spec doesn't specify rounding, so use the same method as for backgrou
nd-repeat: round. | 618 // Spec doesn't specify rounding, so use the same method as for backgrou
nd-repeat: round. |
| 619 space = lroundf((areaSize - numberOfTiles * tileSize) / (float)(numberOf
Tiles - 1)); | 619 space = lroundf((areaSize - numberOfTiles * tileSize) / (float)(numberOf
Tiles - 1)); |
| 620 } | 620 } |
| 621 | 621 |
| 622 return space; | 622 return space; |
| 623 } | 623 } |
| 624 | 624 |
| 625 void BoxPainter::calculateBackgroundImageGeometry(RenderBoxModelObject& obj, con
st RenderLayerModelObject* paintContainer, const FillLayer& fillLayer, const Lay
outRect& paintRect, | 625 void BoxPainter::calculateBackgroundImageGeometry(RenderBoxModelObject& obj, con
st LayoutLayerModelObject* paintContainer, const FillLayer& fillLayer, const Lay
outRect& paintRect, |
| 626 BackgroundImageGeometry& geometry, RenderObject* backgroundObject) | 626 BackgroundImageGeometry& geometry, RenderObject* backgroundObject) |
| 627 { | 627 { |
| 628 LayoutUnit left = 0; | 628 LayoutUnit left = 0; |
| 629 LayoutUnit top = 0; | 629 LayoutUnit top = 0; |
| 630 IntSize positioningAreaSize; | 630 IntSize positioningAreaSize; |
| 631 IntRect snappedPaintRect = pixelSnappedIntRect(paintRect); | 631 IntRect snappedPaintRect = pixelSnappedIntRect(paintRect); |
| 632 | 632 |
| 633 // Determine the background positioning area and set destRect to the backgro
und painting area. | 633 // Determine the background positioning area and set destRect to the backgro
und painting area. |
| 634 // destRect will be adjusted later if the background is non-repeating. | 634 // destRect will be adjusted later if the background is non-repeating. |
| 635 // FIXME: transforms spec says that fixed backgrounds behave like scroll ins
ide transforms. | 635 // FIXME: transforms spec says that fixed backgrounds behave like scroll ins
ide transforms. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 } | 788 } |
| 789 | 789 |
| 790 bool BoxPainter::fixedBackgroundPaintsInLocalCoordinates(const RenderObject& obj
) | 790 bool BoxPainter::fixedBackgroundPaintsInLocalCoordinates(const RenderObject& obj
) |
| 791 { | 791 { |
| 792 if (!obj.isDocumentElement()) | 792 if (!obj.isDocumentElement()) |
| 793 return false; | 793 return false; |
| 794 | 794 |
| 795 if (obj.view()->frameView() && obj.view()->frameView()->paintBehavior() & Pa
intBehaviorFlattenCompositingLayers) | 795 if (obj.view()->frameView() && obj.view()->frameView()->paintBehavior() & Pa
intBehaviorFlattenCompositingLayers) |
| 796 return false; | 796 return false; |
| 797 | 797 |
| 798 RenderLayer* rootLayer = obj.view()->layer(); | 798 Layer* rootLayer = obj.view()->layer(); |
| 799 if (!rootLayer || rootLayer->compositingState() == NotComposited) | 799 if (!rootLayer || rootLayer->compositingState() == NotComposited) |
| 800 return false; | 800 return false; |
| 801 | 801 |
| 802 return rootLayer->compositedLayerMapping()->backgroundLayerPaintsFixedRootBa
ckground(); | 802 return rootLayer->compositedLayerMapping()->backgroundLayerPaintsFixedRootBa
ckground(); |
| 803 } | 803 } |
| 804 | 804 |
| 805 static inline void applySubPixelHeuristicForTileSize(LayoutSize& tileSize, const
IntSize& positioningAreaSize) | 805 static inline void applySubPixelHeuristicForTileSize(LayoutSize& tileSize, const
IntSize& positioningAreaSize) |
| 806 { | 806 { |
| 807 tileSize.setWidth(positioningAreaSize.width() - tileSize.width() <= 1 ? tile
Size.width().ceil() : tileSize.width().floor()); | 807 tileSize.setWidth(positioningAreaSize.width() - tileSize.width() <= 1 ? tile
Size.width().ceil() : tileSize.width().floor()); |
| 808 tileSize.setHeight(positioningAreaSize.height() - tileSize.height() <= 1 ? t
ileSize.height().ceil() : tileSize.height().floor()); | 808 tileSize.setHeight(positioningAreaSize.height() - tileSize.height() <= 1 ? t
ileSize.height().ceil() : tileSize.height().floor()); |
| (...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2191 | 2191 |
| 2192 FloatPoint secondQuad[4]; | 2192 FloatPoint secondQuad[4]; |
| 2193 secondQuad[0] = quad[0]; | 2193 secondQuad[0] = quad[0]; |
| 2194 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy); | 2194 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy); |
| 2195 secondQuad[2] = quad[2]; | 2195 secondQuad[2] = quad[2]; |
| 2196 secondQuad[3] = quad[3]; | 2196 secondQuad[3] = quad[3]; |
| 2197 graphicsContext->clipPolygon(4, secondQuad, !secondEdgeMatches); | 2197 graphicsContext->clipPolygon(4, secondQuad, !secondEdgeMatches); |
| 2198 } | 2198 } |
| 2199 | 2199 |
| 2200 } // namespace blink | 2200 } // namespace blink |
| OLD | NEW |