OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 | 689 |
690 void RenderBox::paintLayer(GraphicsContext* context, RenderLayer* rootLayer, con
st IntRect& rect) | 690 void RenderBox::paintLayer(GraphicsContext* context, RenderLayer* rootLayer, con
st IntRect& rect) |
691 { | 691 { |
692 // If this layer is totally invisible then there is nothing to paint. | 692 // If this layer is totally invisible then there is nothing to paint. |
693 // TODO(ojan): Return false from isSelfPainting and then ASSERT(!opacity())
here. | 693 // TODO(ojan): Return false from isSelfPainting and then ASSERT(!opacity())
here. |
694 if (!opacity()) | 694 if (!opacity()) |
695 return; | 695 return; |
696 | 696 |
697 LayerPaintingInfo paintingInfo(rootLayer, rect, LayoutSize()); | 697 LayerPaintingInfo paintingInfo(rootLayer, rect, LayoutSize()); |
698 | 698 |
699 if (!layer()->paintsWithTransform()) { | 699 TransformationMatrix* layerTransform = layer()->transform(); |
| 700 |
| 701 if (!layerTransform) { |
700 paintLayerContents(context, paintingInfo, rect); | 702 paintLayerContents(context, paintingInfo, rect); |
701 return; | 703 return; |
702 } | 704 } |
703 | 705 |
704 // The RenderView can't be transformed in Sky. | 706 // The RenderView can't be transformed in Sky. |
705 ASSERT(layer()->parent()); | 707 ASSERT(layer()->parent()); |
706 | 708 |
707 TransformationMatrix layerTransform = layer()->renderableTransform(); | |
708 // If the transform can't be inverted, then don't paint anything. | 709 // If the transform can't be inverted, then don't paint anything. |
709 if (!layerTransform.isInvertible()) | 710 if (!layerTransform->isInvertible()) |
710 return; | 711 return; |
711 | 712 |
712 // If we have a transparency layer enclosing us and we are the root of a tra
nsform, then we need to establish the transparency | 713 // If we have a transparency layer enclosing us and we are the root of a tra
nsform, then we need to establish the transparency |
713 // layer from the parent now, assuming there is a parent | 714 // layer from the parent now, assuming there is a parent |
714 if (layer()->isTransparent()) { | 715 if (layer()->isTransparent()) { |
715 // TODO(ojan): This should ASSERT(layer()->parent()) instead of branchin
g since the | 716 layer()->parent()->beginTransparencyLayers(context, paintingInfo.rootLay
er, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation); |
716 // RenderView can't be transformed in sky. | |
717 if (layer()->parent()) | |
718 layer()->parent()->beginTransparencyLayers(context, paintingInfo.roo
tLayer, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation); | |
719 else | |
720 layer()->beginTransparencyLayers(context, paintingInfo.rootLayer, pa
intingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation); | |
721 } | 717 } |
722 | 718 |
723 // Make sure the parent's clip rects have been calculated. | 719 // Make sure the parent's clip rects have been calculated. |
724 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, PaintingClipRects)
; | 720 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, PaintingClipRects)
; |
725 ClipRect clipRect = layer()->clipper().backgroundClipRect(clipRectsContext); | 721 ClipRect clipRect = layer()->clipper().backgroundClipRect(clipRectsContext); |
726 clipRect.intersect(paintingInfo.paintDirtyRect); | 722 clipRect.intersect(paintingInfo.paintDirtyRect); |
727 | 723 |
728 // Push the parent coordinate space's clip. | 724 // Push the parent coordinate space's clip. |
729 layer()->parent()->clipToRect(paintingInfo, context, clipRect); | 725 layer()->parent()->clipToRect(paintingInfo, context, clipRect); |
730 | 726 |
731 // This involves subtracting out the position of the layer in our current co
ordinate space, but preserving | 727 // This involves subtracting out the position of the layer in our current co
ordinate space, but preserving |
732 // the accumulated error for sub-pixel layout. | 728 // the accumulated error for sub-pixel layout. |
733 LayoutPoint delta; | 729 LayoutPoint delta; |
734 layer()->convertToLayerCoords(paintingInfo.rootLayer, delta); | 730 layer()->convertToLayerCoords(paintingInfo.rootLayer, delta); |
735 TransformationMatrix transform(layer()->renderableTransform()); | 731 TransformationMatrix transform(*layerTransform); |
736 IntPoint roundedDelta = roundedIntPoint(delta); | 732 IntPoint roundedDelta = roundedIntPoint(delta); |
737 transform.translateRight(roundedDelta.x(), roundedDelta.y()); | 733 transform.translateRight(roundedDelta.x(), roundedDelta.y()); |
738 LayoutSize adjustedSubPixelAccumulation = paintingInfo.subPixelAccumulation
+ (delta - roundedDelta); | 734 LayoutSize adjustedSubPixelAccumulation = paintingInfo.subPixelAccumulation
+ (delta - roundedDelta); |
739 | 735 |
740 // Apply the transform. | 736 // Apply the transform. |
741 GraphicsContextStateSaver stateSaver(*context, false); | 737 GraphicsContextStateSaver stateSaver(*context, false); |
742 if (!transform.isIdentity()) { | 738 if (!transform.isIdentity()) { |
743 stateSaver.save(); | 739 stateSaver.save(); |
744 context->concatCTM(transform.toAffineTransform()); | 740 context->concatCTM(transform.toAffineTransform()); |
745 } | 741 } |
(...skipping 2231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2977 LayoutRect RenderBox::layoutOverflowRectForPropagation() const | 2973 LayoutRect RenderBox::layoutOverflowRectForPropagation() const |
2978 { | 2974 { |
2979 // Only propagate interior layout overflow if we don't clip it. | 2975 // Only propagate interior layout overflow if we don't clip it. |
2980 LayoutRect rect = borderBoxRect(); | 2976 LayoutRect rect = borderBoxRect(); |
2981 rect.expand(LayoutSize(LayoutUnit(), marginAfter())); | 2977 rect.expand(LayoutSize(LayoutUnit(), marginAfter())); |
2982 | 2978 |
2983 if (!hasOverflowClip()) | 2979 if (!hasOverflowClip()) |
2984 rect.unite(layoutOverflowRect()); | 2980 rect.unite(layoutOverflowRect()); |
2985 | 2981 |
2986 if (hasLayer() && layer()->transform()) | 2982 if (hasLayer() && layer()->transform()) |
2987 rect = layer()->currentTransform().mapRect(rect); | 2983 rect = layer()->transform()->mapRect(rect); |
2988 | 2984 |
2989 return rect; | 2985 return rect; |
2990 } | 2986 } |
2991 | 2987 |
2992 LayoutUnit RenderBox::offsetLeft() const | 2988 LayoutUnit RenderBox::offsetLeft() const |
2993 { | 2989 { |
2994 return adjustedPositionRelativeToOffsetParent(location()).x(); | 2990 return adjustedPositionRelativeToOffsetParent(location()).x(); |
2995 } | 2991 } |
2996 | 2992 |
2997 LayoutUnit RenderBox::offsetTop() const | 2993 LayoutUnit RenderBox::offsetTop() const |
(...skipping 10 matching lines...) Expand all Loading... |
3008 | 3004 |
3009 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) | 3005 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) |
3010 { | 3006 { |
3011 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); | 3007 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); |
3012 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); | 3008 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); |
3013 ASSERT(hasBackground == style.hasBackground()); | 3009 ASSERT(hasBackground == style.hasBackground()); |
3014 hasBorder = style.hasBorder(); | 3010 hasBorder = style.hasBorder(); |
3015 } | 3011 } |
3016 | 3012 |
3017 } // namespace blink | 3013 } // namespace blink |
OLD | NEW |