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 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 } | 1045 } |
1046 | 1046 |
1047 void RenderBox::paintRootBoxFillLayers(const PaintInfo& paintInfo) | 1047 void RenderBox::paintRootBoxFillLayers(const PaintInfo& paintInfo) |
1048 { | 1048 { |
1049 if (paintInfo.skipRootBackground()) | 1049 if (paintInfo.skipRootBackground()) |
1050 return; | 1050 return; |
1051 | 1051 |
1052 RenderObject* rootBackgroundRenderer = rendererForRootBackground(); | 1052 RenderObject* rootBackgroundRenderer = rendererForRootBackground(); |
1053 | 1053 |
1054 const FillLayer* bgLayer = rootBackgroundRenderer->style()->backgroundLayers
(); | 1054 const FillLayer* bgLayer = rootBackgroundRenderer->style()->backgroundLayers
(); |
1055 Color bgColor = rootBackgroundRenderer->style()->visitedDependentColor(CSSPr
opertyBackgroundColor); | 1055 Color bgColor = rootBackgroundRenderer->resolveColor(CSSPropertyBackgroundCo
lor); |
1056 | 1056 |
1057 paintFillLayers(paintInfo, bgColor, bgLayer, view()->backgroundRect(this), B
ackgroundBleedNone, CompositeSourceOver, rootBackgroundRenderer); | 1057 paintFillLayers(paintInfo, bgColor, bgLayer, view()->backgroundRect(this), B
ackgroundBleedNone, CompositeSourceOver, rootBackgroundRenderer); |
1058 } | 1058 } |
1059 | 1059 |
1060 BackgroundBleedAvoidance RenderBox::determineBackgroundBleedAvoidance(GraphicsCo
ntext* context) const | 1060 BackgroundBleedAvoidance RenderBox::determineBackgroundBleedAvoidance(GraphicsCo
ntext* context) const |
1061 { | 1061 { |
1062 if (context->paintingDisabled()) | 1062 if (context->paintingDisabled()) |
1063 return BackgroundBleedNone; | 1063 return BackgroundBleedNone; |
1064 | 1064 |
1065 const RenderStyle* style = this->style(); | 1065 const RenderStyle* style = this->style(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 void RenderBox::paintBackground(const PaintInfo& paintInfo, const LayoutRect& pa
intRect, BackgroundBleedAvoidance bleedAvoidance) | 1144 void RenderBox::paintBackground(const PaintInfo& paintInfo, const LayoutRect& pa
intRect, BackgroundBleedAvoidance bleedAvoidance) |
1145 { | 1145 { |
1146 if (isRoot()) { | 1146 if (isRoot()) { |
1147 paintRootBoxFillLayers(paintInfo); | 1147 paintRootBoxFillLayers(paintInfo); |
1148 return; | 1148 return; |
1149 } | 1149 } |
1150 if (isBody() && skipBodyBackground(this)) | 1150 if (isBody() && skipBodyBackground(this)) |
1151 return; | 1151 return; |
1152 if (backgroundIsKnownToBeObscured()) | 1152 if (backgroundIsKnownToBeObscured()) |
1153 return; | 1153 return; |
1154 paintFillLayers(paintInfo, style()->visitedDependentColor(CSSPropertyBackgro
undColor), style()->backgroundLayers(), paintRect, bleedAvoidance); | 1154 paintFillLayers(paintInfo, resolveColor(CSSPropertyBackgroundColor), style()
->backgroundLayers(), paintRect, bleedAvoidance); |
1155 } | 1155 } |
1156 | 1156 |
1157 LayoutRect RenderBox::backgroundPaintedExtent() const | 1157 LayoutRect RenderBox::backgroundPaintedExtent() const |
1158 { | 1158 { |
1159 ASSERT(hasBackground()); | 1159 ASSERT(hasBackground()); |
1160 LayoutRect backgroundRect = pixelSnappedIntRect(borderBoxRect()); | 1160 LayoutRect backgroundRect = pixelSnappedIntRect(borderBoxRect()); |
1161 | 1161 |
1162 Color backgroundColor = style()->visitedDependentColor(CSSPropertyBackground
Color); | 1162 Color backgroundColor = resolveColor(CSSPropertyBackgroundColor); |
1163 if (backgroundColor.isValid() && backgroundColor.alpha()) | 1163 if (backgroundColor.isValid() && backgroundColor.alpha()) |
1164 return backgroundRect; | 1164 return backgroundRect; |
1165 if (!style()->backgroundLayers()->image() || style()->backgroundLayers()->ne
xt()) | 1165 if (!style()->backgroundLayers()->image() || style()->backgroundLayers()->ne
xt()) |
1166 return backgroundRect; | 1166 return backgroundRect; |
1167 BackgroundImageGeometry geometry; | 1167 BackgroundImageGeometry geometry; |
1168 const_cast<RenderBox*>(this)->calculateBackgroundImageGeometry(style()->back
groundLayers(), backgroundRect, geometry); | 1168 const_cast<RenderBox*>(this)->calculateBackgroundImageGeometry(style()->back
groundLayers(), backgroundRect, geometry); |
1169 return geometry.destRect(); | 1169 return geometry.destRect(); |
1170 } | 1170 } |
1171 | 1171 |
1172 bool RenderBox::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) c
onst | 1172 bool RenderBox::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) c
onst |
1173 { | 1173 { |
1174 if (isBody() && skipBodyBackground(this)) | 1174 if (isBody() && skipBodyBackground(this)) |
1175 return false; | 1175 return false; |
1176 | 1176 |
1177 Color backgroundColor = style()->visitedDependentColor(CSSPropertyBackground
Color); | 1177 Color backgroundColor = resolveColor(CSSPropertyBackgroundColor); |
1178 if (!backgroundColor.isValid() || backgroundColor.hasAlpha()) | 1178 if (!backgroundColor.isValid() || backgroundColor.hasAlpha()) |
1179 return false; | 1179 return false; |
1180 | 1180 |
1181 // If the element has appearance, it might be painted by theme. | 1181 // If the element has appearance, it might be painted by theme. |
1182 // We cannot be sure if theme paints the background opaque. | 1182 // We cannot be sure if theme paints the background opaque. |
1183 // In this case it is safe to not assume opaqueness. | 1183 // In this case it is safe to not assume opaqueness. |
1184 // FIXME: May be ask theme if it paints opaque. | 1184 // FIXME: May be ask theme if it paints opaque. |
1185 if (style()->hasAppearance()) | 1185 if (style()->hasAppearance()) |
1186 return false; | 1186 return false; |
1187 // FIXME: Check the opaqueness of background images. | 1187 // FIXME: Check the opaqueness of background images. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1285 | 1285 |
1286 // Clipped with local scrolling | 1286 // Clipped with local scrolling |
1287 if (hasOverflowClip() && fillLayer->attachment() == LocalBackgroundAttachmen
t) | 1287 if (hasOverflowClip() && fillLayer->attachment() == LocalBackgroundAttachmen
t) |
1288 return false; | 1288 return false; |
1289 | 1289 |
1290 if (fillLayer->hasOpaqueImage(this) && fillLayer->hasRepeatXY() && fillLayer
->image()->canRender(this, style()->effectiveZoom())) | 1290 if (fillLayer->hasOpaqueImage(this) && fillLayer->hasRepeatXY() && fillLayer
->image()->canRender(this, style()->effectiveZoom())) |
1291 return true; | 1291 return true; |
1292 | 1292 |
1293 // If there is only one layer and no image, check whether the background col
or is opaque | 1293 // If there is only one layer and no image, check whether the background col
or is opaque |
1294 if (!fillLayer->next() && !fillLayer->hasImage()) { | 1294 if (!fillLayer->next() && !fillLayer->hasImage()) { |
1295 Color bgColor = style()->visitedDependentColor(CSSPropertyBackgroundColo
r); | 1295 Color bgColor = resolveColor(CSSPropertyBackgroundColor); |
1296 if (bgColor.isValid() && bgColor.alpha() == 255) | 1296 if (bgColor.isValid() && bgColor.alpha() == 255) |
1297 return true; | 1297 return true; |
1298 } | 1298 } |
1299 | 1299 |
1300 return false; | 1300 return false; |
1301 } | 1301 } |
1302 | 1302 |
1303 void RenderBox::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffset) | 1303 void RenderBox::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
1304 { | 1304 { |
1305 if (!paintInfo.shouldPaintWithinRoot(this) || style()->visibility() != VISIB
LE || paintInfo.phase != PaintPhaseMask || paintInfo.context->paintingDisabled()
) | 1305 if (!paintInfo.shouldPaintWithinRoot(this) || style()->visibility() != VISIB
LE || paintInfo.phase != PaintPhaseMask || paintInfo.context->paintingDisabled()
) |
(...skipping 3323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4629 } | 4629 } |
4630 | 4630 |
4631 if (didSplitParentAnonymousBoxes) | 4631 if (didSplitParentAnonymousBoxes) |
4632 markBoxForRelayoutAfterSplit(this); | 4632 markBoxForRelayoutAfterSplit(this); |
4633 | 4633 |
4634 ASSERT(beforeChild->parent() == this); | 4634 ASSERT(beforeChild->parent() == this); |
4635 return beforeChild; | 4635 return beforeChild; |
4636 } | 4636 } |
4637 | 4637 |
4638 } // namespace WebCore | 4638 } // namespace WebCore |
OLD | NEW |