| 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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 } | 667 } |
| 668 | 668 |
| 669 void RenderBox::paintRootBoxFillLayers(const PaintInfo& paintInfo) | 669 void RenderBox::paintRootBoxFillLayers(const PaintInfo& paintInfo) |
| 670 { | 670 { |
| 671 if (paintInfo.skipRootBackground()) | 671 if (paintInfo.skipRootBackground()) |
| 672 return; | 672 return; |
| 673 | 673 |
| 674 const FillLayer& bgLayer = style()->backgroundLayers(); | 674 const FillLayer& bgLayer = style()->backgroundLayers(); |
| 675 Color bgColor = resolveColor(CSSPropertyBackgroundColor); | 675 Color bgColor = resolveColor(CSSPropertyBackgroundColor); |
| 676 | 676 |
| 677 paintFillLayers(paintInfo, bgColor, bgLayer, view()->backgroundRect(this), B
ackgroundBleedNone, CompositeSourceOver, this); | 677 paintFillLayers(paintInfo, bgColor, bgLayer, view()->backgroundRect(this), B
ackgroundBleedNone, this); |
| 678 } | 678 } |
| 679 | 679 |
| 680 BackgroundBleedAvoidance RenderBox::determineBackgroundBleedAvoidance(GraphicsCo
ntext* context, const BoxDecorationData& boxDecorationData) const | 680 BackgroundBleedAvoidance RenderBox::determineBackgroundBleedAvoidance(GraphicsCo
ntext* context, const BoxDecorationData& boxDecorationData) const |
| 681 { | 681 { |
| 682 if (!boxDecorationData.hasBackground || !boxDecorationData.hasBorder || !sty
le()->hasBorderRadius() || canRenderBorderImage()) | 682 if (!boxDecorationData.hasBackground || !boxDecorationData.hasBorder || !sty
le()->hasBorderRadius() || canRenderBorderImage()) |
| 683 return BackgroundBleedNone; | 683 return BackgroundBleedNone; |
| 684 | 684 |
| 685 // FIXME: See crbug.com/382491. getCTM does not accurately reflect the scale
at the time content is | 685 // FIXME: See crbug.com/382491. getCTM does not accurately reflect the scale
at the time content is |
| 686 // rasterized, and should not be relied on to make decisions about bleeding. | 686 // rasterized, and should not be relied on to make decisions about bleeding. |
| 687 AffineTransform ctm = context->getCTM(); | 687 AffineTransform ctm = context->getCTM(); |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 paintMaskImages(paintInfo, paintRect); | 914 paintMaskImages(paintInfo, paintRect); |
| 915 } | 915 } |
| 916 | 916 |
| 917 void RenderBox::paintClippingMask(PaintInfo& paintInfo, const LayoutPoint& paint
Offset) | 917 void RenderBox::paintClippingMask(PaintInfo& paintInfo, const LayoutPoint& paint
Offset) |
| 918 { | 918 { |
| 919 // FIXME(sky): Remove | 919 // FIXME(sky): Remove |
| 920 } | 920 } |
| 921 | 921 |
| 922 void RenderBox::paintMaskImages(const PaintInfo& paintInfo, const LayoutRect& pa
intRect) | 922 void RenderBox::paintMaskImages(const PaintInfo& paintInfo, const LayoutRect& pa
intRect) |
| 923 { | 923 { |
| 924 // Figure out if we need to push a transparency layer to render our mask. | 924 paintFillLayers(paintInfo, Color::transparent, style()->maskLayers(), paintR
ect, BackgroundBleedNone); |
| 925 bool pushTransparencyLayer = false; | 925 paintNinePieceImage(paintInfo.context, paintRect, style(), style()->maskBoxI
mage()); |
| 926 bool flattenCompositingLayers = view()->frameView() && view()->frameView()->
paintBehavior() & PaintBehaviorFlattenCompositingLayers; | |
| 927 CompositeOperator compositeOp = CompositeSourceOver; | |
| 928 | |
| 929 bool allMaskImagesLoaded = true; | |
| 930 | |
| 931 if (flattenCompositingLayers) { | |
| 932 pushTransparencyLayer = true; | |
| 933 StyleImage* maskBoxImage = style()->maskBoxImage().image(); | |
| 934 const FillLayer& maskLayers = style()->maskLayers(); | |
| 935 | |
| 936 // Don't render a masked element until all the mask images have loaded,
to prevent a flash of unmasked content. | |
| 937 if (maskBoxImage) | |
| 938 allMaskImagesLoaded &= maskBoxImage->isLoaded(); | |
| 939 | |
| 940 allMaskImagesLoaded &= maskLayers.imagesAreLoaded(); | |
| 941 | |
| 942 paintInfo.context->setCompositeOperation(CompositeDestinationIn); | |
| 943 paintInfo.context->beginTransparencyLayer(1); | |
| 944 compositeOp = CompositeSourceOver; | |
| 945 } | |
| 946 | |
| 947 if (allMaskImagesLoaded) { | |
| 948 paintFillLayers(paintInfo, Color::transparent, style()->maskLayers(), pa
intRect, BackgroundBleedNone, compositeOp); | |
| 949 paintNinePieceImage(paintInfo.context, paintRect, style(), style()->mask
BoxImage(), compositeOp); | |
| 950 } | |
| 951 | |
| 952 if (pushTransparencyLayer) | |
| 953 paintInfo.context->endLayer(); | |
| 954 } | 926 } |
| 955 | 927 |
| 956 void RenderBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, cons
t FillLayer& fillLayer, const LayoutRect& rect, | 928 void RenderBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, cons
t FillLayer& fillLayer, const LayoutRect& rect, |
| 957 BackgroundBleedAvoidance bleedAvoidance, CompositeOperator op, RenderObject*
backgroundObject) | 929 BackgroundBleedAvoidance bleedAvoidance, RenderObject* backgroundObject) |
| 958 { | 930 { |
| 959 Vector<const FillLayer*, 8> layers; | 931 Vector<const FillLayer*, 8> layers; |
| 960 const FillLayer* curLayer = &fillLayer; | 932 const FillLayer* curLayer = &fillLayer; |
| 961 bool shouldDrawBackgroundInSeparateBuffer = false; | 933 bool shouldDrawBackgroundInSeparateBuffer = false; |
| 962 bool isBottomLayerOccluded = false; | 934 bool isBottomLayerOccluded = false; |
| 963 while (curLayer) { | 935 while (curLayer) { |
| 964 layers.append(curLayer); | 936 layers.append(curLayer); |
| 965 // Stop traversal when an opaque layer is encountered. | 937 // Stop traversal when an opaque layer is encountered. |
| 966 // FIXME : It would be possible for the following occlusion culling test
to be more aggressive | 938 // FIXME : It would be possible for the following occlusion culling test
to be more aggressive |
| 967 // on layers with no repeat by testing whether the image covers the layo
ut rect. | 939 // on layers with no repeat by testing whether the image covers the layo
ut rect. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 994 // so that the background images don't blend with this color: http://crb
ug.com/389039. | 966 // so that the background images don't blend with this color: http://crb
ug.com/389039. |
| 995 if (isBaseColorVisible && isDocumentElementWithOpaqueBackground()) { | 967 if (isBaseColorVisible && isDocumentElementWithOpaqueBackground()) { |
| 996 paintRootBackgroundColor(paintInfo, rect, Color()); | 968 paintRootBackgroundColor(paintInfo, rect, Color()); |
| 997 skipBaseColor = true; | 969 skipBaseColor = true; |
| 998 } | 970 } |
| 999 context->beginTransparencyLayer(1); | 971 context->beginTransparencyLayer(1); |
| 1000 } | 972 } |
| 1001 | 973 |
| 1002 Vector<const FillLayer*>::const_reverse_iterator topLayer = layers.rend(); | 974 Vector<const FillLayer*>::const_reverse_iterator topLayer = layers.rend(); |
| 1003 for (Vector<const FillLayer*>::const_reverse_iterator it = layers.rbegin();
it != topLayer; ++it) | 975 for (Vector<const FillLayer*>::const_reverse_iterator it = layers.rbegin();
it != topLayer; ++it) |
| 1004 paintFillLayer(paintInfo, c, **it, rect, bleedAvoidance, op, backgroundO
bject, skipBaseColor); | 976 paintFillLayer(paintInfo, c, **it, rect, bleedAvoidance, backgroundObjec
t, skipBaseColor); |
| 1005 | 977 |
| 1006 if (shouldDrawBackgroundInSeparateBuffer) | 978 if (shouldDrawBackgroundInSeparateBuffer) |
| 1007 context->endLayer(); | 979 context->endLayer(); |
| 1008 } | 980 } |
| 1009 | 981 |
| 1010 void RenderBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const
FillLayer& fillLayer, const LayoutRect& rect, | 982 void RenderBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const
FillLayer& fillLayer, const LayoutRect& rect, |
| 1011 BackgroundBleedAvoidance bleedAvoidance, CompositeOperator op, RenderObject*
backgroundObject, bool skipBaseColor) | 983 BackgroundBleedAvoidance bleedAvoidance, RenderObject* backgroundObject, boo
l skipBaseColor) |
| 1012 { | 984 { |
| 1013 paintFillLayerExtended(paintInfo, c, fillLayer, rect, bleedAvoidance, 0, Lay
outSize(), op, backgroundObject, skipBaseColor); | 985 paintFillLayerExtended(paintInfo, c, fillLayer, rect, bleedAvoidance, 0, Lay
outSize(), backgroundObject, skipBaseColor); |
| 1014 } | 986 } |
| 1015 | 987 |
| 1016 void RenderBox::imageChanged(WrappedImagePtr image, const IntRect*) | 988 void RenderBox::imageChanged(WrappedImagePtr image, const IntRect*) |
| 1017 { | 989 { |
| 1018 if (!parent()) | 990 if (!parent()) |
| 1019 return; | 991 return; |
| 1020 | 992 |
| 1021 AllowPaintInvalidationScope scoper(frameView()); | 993 AllowPaintInvalidationScope scoper(frameView()); |
| 1022 | 994 |
| 1023 if ((style()->borderImage().image() && style()->borderImage().image()->data(
) == image) || | 995 if ((style()->borderImage().image() && style()->borderImage().image()->data(
) == image) || |
| (...skipping 2464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3488 | 3460 |
| 3489 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) | 3461 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) |
| 3490 { | 3462 { |
| 3491 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); | 3463 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); |
| 3492 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); | 3464 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); |
| 3493 ASSERT(hasBackground == style.hasBackground()); | 3465 ASSERT(hasBackground == style.hasBackground()); |
| 3494 hasBorder = style.hasBorder(); | 3466 hasBorder = style.hasBorder(); |
| 3495 } | 3467 } |
| 3496 | 3468 |
| 3497 } // namespace blink | 3469 } // namespace blink |
| OLD | NEW |