| 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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 return true; | 680 return true; |
| 681 } | 681 } |
| 682 | 682 |
| 683 // --------------------- painting stuff ------------------------------- | 683 // --------------------- painting stuff ------------------------------- |
| 684 | 684 |
| 685 static inline bool forwardCompareZIndex(RenderBox* first, RenderBox* second) | 685 static inline bool forwardCompareZIndex(RenderBox* first, RenderBox* second) |
| 686 { | 686 { |
| 687 return first->style()->zIndex() < second->style()->zIndex(); | 687 return first->style()->zIndex() < second->style()->zIndex(); |
| 688 } | 688 } |
| 689 | 689 |
| 690 void RenderBox::paintLayer(GraphicsContext* context, RenderLayer* rootLayer, con
st IntRect& rect) | 690 void RenderBox::paintLayer(GraphicsContext* context, const LayerPaintingInfo& pa
intingInfo) |
| 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()); | |
| 698 | |
| 699 TransformationMatrix* layerTransform = layer()->transform(); | 697 TransformationMatrix* layerTransform = layer()->transform(); |
| 700 | 698 |
| 701 if (!layerTransform) { | 699 if (!layerTransform) { |
| 702 paintLayerContents(context, paintingInfo, rect); | 700 paintLayerContents(context, paintingInfo); |
| 703 return; | 701 return; |
| 704 } | 702 } |
| 705 | 703 |
| 706 // The RenderView can't be transformed in Sky. | 704 // The RenderView can't be transformed in Sky. |
| 707 ASSERT(layer()->parent()); | 705 ASSERT(layer()->parent()); |
| 708 | 706 |
| 709 // If the transform can't be inverted, then don't paint anything. | 707 // If the transform can't be inverted, then don't paint anything. |
| 710 if (!layerTransform->isInvertible()) | 708 if (!layerTransform->isInvertible()) |
| 711 return; | 709 return; |
| 712 | 710 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 730 // Apply the transform. | 728 // Apply the transform. |
| 731 GraphicsContextStateSaver stateSaver(*context, false); | 729 GraphicsContextStateSaver stateSaver(*context, false); |
| 732 if (!transform.isIdentity()) { | 730 if (!transform.isIdentity()) { |
| 733 stateSaver.save(); | 731 stateSaver.save(); |
| 734 context->concatCTM(transform.toAffineTransform()); | 732 context->concatCTM(transform.toAffineTransform()); |
| 735 } | 733 } |
| 736 | 734 |
| 737 // Now do a paint with the root layer shifted to be us. | 735 // Now do a paint with the root layer shifted to be us. |
| 738 LayerPaintingInfo transformedPaintingInfo(layer(), enclosingIntRect(transfor
m.inverse().mapRect(paintingInfo.paintDirtyRect)), | 736 LayerPaintingInfo transformedPaintingInfo(layer(), enclosingIntRect(transfor
m.inverse().mapRect(paintingInfo.paintDirtyRect)), |
| 739 adjustedSubPixelAccumulation); | 737 adjustedSubPixelAccumulation); |
| 740 paintLayerContents(context, transformedPaintingInfo, rect); | 738 paintLayerContents(context, transformedPaintingInfo); |
| 741 | 739 |
| 742 // Restore the clip. | 740 // Restore the clip. |
| 743 layer()->parent()->restoreClip(context, paintingInfo.paintDirtyRect, clipRec
t); | 741 layer()->parent()->restoreClip(context, paintingInfo.paintDirtyRect, clipRec
t); |
| 744 } | 742 } |
| 745 | 743 |
| 746 void RenderBox::paintLayerContents(GraphicsContext* context, const LayerPainting
Info& paintingInfo, const IntRect& rect) | 744 void RenderBox::paintLayerContents(GraphicsContext* context, const LayerPainting
Info& paintingInfo) |
| 747 { | 745 { |
| 748 float deviceScaleFactor = blink::deviceScaleFactor(frame()); | 746 float deviceScaleFactor = blink::deviceScaleFactor(frame()); |
| 749 context->setDeviceScaleFactor(deviceScaleFactor); | 747 context->setDeviceScaleFactor(deviceScaleFactor); |
| 750 | 748 |
| 751 LayoutPoint offsetFromRoot; | 749 LayoutPoint offsetFromRoot; |
| 752 layer()->convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot); | 750 layer()->convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot); |
| 753 | 751 |
| 754 LayerPaintingInfo localPaintingInfo(paintingInfo); | 752 LayerPaintingInfo localPaintingInfo(paintingInfo); |
| 755 | 753 |
| 756 LayoutRect layerBounds; | 754 LayoutRect layerBounds; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 } | 806 } |
| 809 | 807 |
| 810 LayoutPoint layerLocation = toPoint(layerBounds.location() - location() + lo
calPaintingInfo.subPixelAccumulation); | 808 LayoutPoint layerLocation = toPoint(layerBounds.location() - location() + lo
calPaintingInfo.subPixelAccumulation); |
| 811 | 809 |
| 812 Vector<RenderBox*> layers; | 810 Vector<RenderBox*> layers; |
| 813 PaintInfo paintInfo(context, pixelSnappedIntRect(contentRect.rect()), localP
aintingInfo.rootLayer->renderer()); | 811 PaintInfo paintInfo(context, pixelSnappedIntRect(contentRect.rect()), localP
aintingInfo.rootLayer->renderer()); |
| 814 paint(paintInfo, layerLocation, layers); | 812 paint(paintInfo, layerLocation, layers); |
| 815 | 813 |
| 816 std::stable_sort(layers.begin(), layers.end(), forwardCompareZIndex); | 814 std::stable_sort(layers.begin(), layers.end(), forwardCompareZIndex); |
| 817 for (auto& box : layers) { | 815 for (auto& box : layers) { |
| 818 box->paintLayer(context, paintingInfo.rootLayer, rect); | 816 box->paintLayer(context, paintingInfo); |
| 819 } | 817 } |
| 820 | 818 |
| 821 if (filterPainter.hasStartedFilterEffect()) | 819 if (filterPainter.hasStartedFilterEffect()) |
| 822 context = filterPainter.applyFilterEffect(); | 820 context = filterPainter.applyFilterEffect(); |
| 823 | 821 |
| 824 layer()->restoreClip(context, localPaintingInfo.paintDirtyRect, contentRect)
; | 822 layer()->restoreClip(context, localPaintingInfo.paintDirtyRect, contentRect)
; |
| 825 | 823 |
| 826 if (layer()->isTransparent()) { | 824 if (layer()->isTransparent()) { |
| 827 context->endLayer(); | 825 context->endLayer(); |
| 828 context->restore(); | 826 context->restore(); |
| (...skipping 2135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2964 | 2962 |
| 2965 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) | 2963 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) |
| 2966 { | 2964 { |
| 2967 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); | 2965 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); |
| 2968 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); | 2966 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); |
| 2969 ASSERT(hasBackground == style.hasBackground()); | 2967 ASSERT(hasBackground == style.hasBackground()); |
| 2970 hasBorder = style.hasBorder(); | 2968 hasBorder = style.hasBorder(); |
| 2971 } | 2969 } |
| 2972 | 2970 |
| 2973 } // namespace blink | 2971 } // namespace blink |
| OLD | NEW |