Chromium Code Reviews| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 static OverrideSizeMap* gOverrideContainingBlockLogicalWidthMap = 0; | 82 static OverrideSizeMap* gOverrideContainingBlockLogicalWidthMap = 0; |
| 83 static OverrideSizeMap* gExtraInlineOffsetMap = 0; | 83 static OverrideSizeMap* gExtraInlineOffsetMap = 0; |
| 84 static OverrideSizeMap* gExtraBlockOffsetMap = 0; | 84 static OverrideSizeMap* gExtraBlockOffsetMap = 0; |
| 85 | 85 |
| 86 | 86 |
| 87 // Size of border belt for autoscroll. When mouse pointer in border belt, | 87 // Size of border belt for autoscroll. When mouse pointer in border belt, |
| 88 // autoscroll is started. | 88 // autoscroll is started. |
| 89 static const int autoscrollBeltSize = 20; | 89 static const int autoscrollBeltSize = 20; |
| 90 static const unsigned backgroundObscurationTestMaxDepth = 4; | 90 static const unsigned backgroundObscurationTestMaxDepth = 4; |
| 91 | 91 |
| 92 static bool skipBodyBackground(const LayoutBox* bodyElementLayoutObject) | |
| 93 { | |
| 94 ASSERT(bodyElementLayoutObject->isBody()); | |
| 95 // The <body> only paints its background if the root element has defined a b ackground independent of the body, | |
| 96 // or if the <body>'s parent is not the document element's layoutObject (e.g . inside SVG foreignObject). | |
| 97 LayoutObject* documentElementLayoutObject = bodyElementLayoutObject->documen t().documentElement()->layoutObject(); | |
| 98 return documentElementLayoutObject | |
| 99 && !documentElementLayoutObject->hasBackground() | |
| 100 && (documentElementLayoutObject == bodyElementLayoutObject->parent()); | |
| 101 } | |
| 102 | |
| 103 LayoutBox::LayoutBox(ContainerNode* node) | 92 LayoutBox::LayoutBox(ContainerNode* node) |
| 104 : LayoutBoxModelObject(node) | 93 : LayoutBoxModelObject(node) |
| 105 , m_intrinsicContentLogicalHeight(-1) | 94 , m_intrinsicContentLogicalHeight(-1) |
| 106 , m_minPreferredLogicalWidth(-1) | 95 , m_minPreferredLogicalWidth(-1) |
| 107 , m_maxPreferredLogicalWidth(-1) | 96 , m_maxPreferredLogicalWidth(-1) |
| 108 { | 97 { |
| 109 setIsBox(); | 98 setIsBox(); |
| 110 } | 99 } |
| 111 | 100 |
| 112 DeprecatedPaintLayerType LayoutBox::layerTypeRequired() const | 101 DeprecatedPaintLayerType LayoutBox::layerTypeRequired() const |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 } | 159 } |
| 171 | 160 |
| 172 if (isOutOfFlowPositioned()) | 161 if (isOutOfFlowPositioned()) |
| 173 LayoutBlock::removePositionedObject(this); | 162 LayoutBlock::removePositionedObject(this); |
| 174 } | 163 } |
| 175 | 164 |
| 176 void LayoutBox::styleWillChange(StyleDifference diff, const ComputedStyle& newSt yle) | 165 void LayoutBox::styleWillChange(StyleDifference diff, const ComputedStyle& newSt yle) |
| 177 { | 166 { |
| 178 const ComputedStyle* oldStyle = style(); | 167 const ComputedStyle* oldStyle = style(); |
| 179 if (oldStyle) { | 168 if (oldStyle) { |
| 180 // The background of the root element or the body element could propagat e up to | |
| 181 // the canvas. Just dirty the entire canvas when our style changes subst antially. | |
| 182 if ((diff.needsPaintInvalidation() || diff.needsLayout()) && node() | |
| 183 && (isHTMLHtmlElement(*node()) || isHTMLBodyElement(*node()))) { | |
| 184 view()->setShouldDoFullPaintInvalidation(); | |
| 185 | |
| 186 if (oldStyle->hasEntirelyFixedBackground() != newStyle.hasEntirelyFi xedBackground()) | |
| 187 view()->compositor()->setNeedsUpdateFixedBackground(); | |
| 188 } | |
| 189 | |
| 190 // When a layout hint happens and an object's position style changes, we have to do a layout | 169 // When a layout hint happens and an object's position style changes, we have to do a layout |
| 191 // to dirty the layout tree using the old position value now. | 170 // to dirty the layout tree using the old position value now. |
| 192 if (diff.needsFullLayout() && parent() && oldStyle->position() != newSty le.position()) { | 171 if (diff.needsFullLayout() && parent() && oldStyle->position() != newSty le.position()) { |
| 193 markContainerChainForLayout(); | 172 markContainerChainForLayout(); |
| 194 if (oldStyle->position() == StaticPosition) | 173 if (oldStyle->position() == StaticPosition) |
| 195 setShouldDoFullPaintInvalidation(); | 174 setShouldDoFullPaintInvalidation(); |
| 196 else if (newStyle.hasOutOfFlowPosition()) | 175 else if (newStyle.hasOutOfFlowPosition()) |
| 197 parent()->setChildNeedsLayout(); | 176 parent()->setChildNeedsLayout(); |
| 198 if (isFloating() && !isOutOfFlowPositioned() && newStyle.hasOutOfFlo wPosition()) | 177 if (isFloating() && !isOutOfFlowPositioned() && newStyle.hasOutOfFlo wPosition()) |
| 199 removeFloatingOrPositionedChildFromBlockLists(); | 178 removeFloatingOrPositionedChildFromBlockLists(); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 297 // It should be possible to not dirty the grid in some cases (like moving an explicitly placed grid item). | 276 // It should be possible to not dirty the grid in some cases (like moving an explicitly placed grid item). |
| 298 // For now, it's more simple to just always recompute the grid. | 277 // For now, it's more simple to just always recompute the grid. |
| 299 toLayoutGrid(parent())->dirtyGrid(); | 278 toLayoutGrid(parent())->dirtyGrid(); |
| 300 } | 279 } |
| 301 | 280 |
| 302 void LayoutBox::updateFromStyle() | 281 void LayoutBox::updateFromStyle() |
| 303 { | 282 { |
| 304 LayoutBoxModelObject::updateFromStyle(); | 283 LayoutBoxModelObject::updateFromStyle(); |
| 305 | 284 |
| 306 const ComputedStyle& styleToUse = styleRef(); | 285 const ComputedStyle& styleToUse = styleRef(); |
| 307 bool isRootObject = isDocumentElement(); | |
| 308 bool isViewObject = isLayoutView(); | 286 bool isViewObject = isLayoutView(); |
| 309 bool rootLayerScrolls = document().settings() && document().settings()->root LayerScrolls(); | 287 bool rootLayerScrolls = document().settings() && document().settings()->root LayerScrolls(); |
| 310 | 288 |
| 311 // The root and the LayoutView always paint their backgrounds/borders. | 289 // LayoutView of the main frame is resposible from painting base background. |
| 312 if (isRootObject || isViewObject) | 290 if (isViewObject && !document().ownerElement()) |
| 313 setHasBoxDecorationBackground(true); | 291 setHasBoxDecorationBackground(true); |
| 314 | 292 |
| 315 setFloating(!isOutOfFlowPositioned() && styleToUse.isFloating()); | 293 setFloating(!isOutOfFlowPositioned() && styleToUse.isFloating()); |
| 316 | 294 |
| 317 bool boxHasOverflowClip = false; | 295 bool boxHasOverflowClip = false; |
| 318 if (!styleToUse.isOverflowVisible() && isLayoutBlock() && (rootLayerScrolls || !isViewObject)) { | 296 if (!styleToUse.isOverflowVisible() && isLayoutBlock() && (rootLayerScrolls || !isViewObject)) { |
| 319 // If overflow has been propagated to the viewport, it has no effect her e. | 297 // If overflow has been propagated to the viewport, it has no effect her e. |
| 320 if (node() != document().viewportDefiningElement()) | 298 if (node() != document().viewportDefiningElement()) |
| 321 boxHasOverflowClip = true; | 299 boxHasOverflowClip = true; |
| 322 } | 300 } |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1173 BackgroundImageGeometry geometry; | 1151 BackgroundImageGeometry geometry; |
| 1174 BoxPainter::calculateBackgroundImageGeometry(*this, 0, style()->backgroundLa yers(), backgroundRect, geometry); | 1152 BoxPainter::calculateBackgroundImageGeometry(*this, 0, style()->backgroundLa yers(), backgroundRect, geometry); |
| 1175 if (geometry.hasNonLocalGeometry()) | 1153 if (geometry.hasNonLocalGeometry()) |
| 1176 return false; | 1154 return false; |
| 1177 paintedExtent = LayoutRect(geometry.destRect()); | 1155 paintedExtent = LayoutRect(geometry.destRect()); |
| 1178 return true; | 1156 return true; |
| 1179 } | 1157 } |
| 1180 | 1158 |
| 1181 bool LayoutBox::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) c onst | 1159 bool LayoutBox::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) c onst |
| 1182 { | 1160 { |
| 1183 if (isBody() && skipBodyBackground(this)) | 1161 if (isDocumentElement() || backgroundStolenForBeingBody()) |
| 1184 return false; | 1162 return false; |
| 1185 | 1163 |
| 1186 Color backgroundColor = resolveColor(CSSPropertyBackgroundColor); | 1164 Color backgroundColor = resolveColor(CSSPropertyBackgroundColor); |
| 1187 if (backgroundColor.hasAlpha()) | 1165 if (backgroundColor.hasAlpha()) |
| 1188 return false; | 1166 return false; |
| 1189 | 1167 |
| 1190 // If the element has appearance, it might be painted by theme. | 1168 // If the element has appearance, it might be painted by theme. |
| 1191 // We cannot be sure if theme paints the background opaque. | 1169 // We cannot be sure if theme paints the background opaque. |
| 1192 // In this case it is safe to not assume opaqueness. | 1170 // In this case it is safe to not assume opaqueness. |
| 1193 // FIXME: May be ask theme if it paints opaque. | 1171 // FIXME: May be ask theme if it paints opaque. |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1314 return false; | 1292 return false; |
| 1315 } | 1293 } |
| 1316 | 1294 |
| 1317 void LayoutBox::paintMask(const PaintInfo& paintInfo, const LayoutPoint& paintOf fset) | 1295 void LayoutBox::paintMask(const PaintInfo& paintInfo, const LayoutPoint& paintOf fset) |
| 1318 { | 1296 { |
| 1319 BoxPainter(*this).paintMask(paintInfo, paintOffset); | 1297 BoxPainter(*this).paintMask(paintInfo, paintOffset); |
| 1320 } | 1298 } |
| 1321 | 1299 |
| 1322 void LayoutBox::imageChanged(WrappedImagePtr image, const IntRect*) | 1300 void LayoutBox::imageChanged(WrappedImagePtr image, const IntRect*) |
| 1323 { | 1301 { |
| 1324 if (!parent()) | |
| 1325 return; | |
| 1326 | |
| 1327 // TODO(chrishtr): support PaintInvalidationDelayedFull for animated border images. | 1302 // TODO(chrishtr): support PaintInvalidationDelayedFull for animated border images. |
| 1328 if ((style()->borderImage().image() && style()->borderImage().image()->data( ) == image) | 1303 if ((style()->borderImage().image() && style()->borderImage().image()->data( ) == image) |
| 1329 || (style()->maskBoxImage().image() && style()->maskBoxImage().image()-> data() == image)) { | 1304 || (style()->maskBoxImage().image() && style()->maskBoxImage().image()-> data() == image)) { |
| 1330 setShouldDoFullPaintInvalidation(); | 1305 setShouldDoFullPaintInvalidation(); |
| 1331 return; | 1306 return; |
| 1332 } | 1307 } |
| 1333 | 1308 |
| 1334 ShapeValue* shapeOutsideValue = style()->shapeOutside(); | 1309 ShapeValue* shapeOutsideValue = style()->shapeOutside(); |
| 1335 if (!frameView()->isInPerformLayout() && isFloating() && shapeOutsideValue & & shapeOutsideValue->image() && shapeOutsideValue->image()->data() == image) { | 1310 if (!frameView()->isInPerformLayout() && isFloating() && shapeOutsideValue & & shapeOutsideValue->image() && shapeOutsideValue->image()->data() == image) { |
| 1336 ShapeOutsideInfo& info = ShapeOutsideInfo::ensureInfo(*this); | 1311 ShapeOutsideInfo& info = ShapeOutsideInfo::ensureInfo(*this); |
| 1337 if (!info.isComputingShape()) { | 1312 if (!info.isComputingShape()) { |
| 1338 info.markShapeAsDirty(); | 1313 info.markShapeAsDirty(); |
| 1339 markShapeOutsideDependentsForLayout(); | 1314 markShapeOutsideDependentsForLayout(); |
| 1340 } | 1315 } |
| 1341 } | 1316 } |
| 1342 | 1317 |
| 1343 if (!paintInvalidationLayerRectsForImage(image, style()->backgroundLayers(), true)) | 1318 if (!invalidatePaintOfLayerRectsForImage(image, style()->backgroundLayers(), true)) |
| 1344 paintInvalidationLayerRectsForImage(image, style()->maskLayers(), false) ; | 1319 invalidatePaintOfLayerRectsForImage(image, style()->maskLayers(), false) ; |
| 1345 } | 1320 } |
| 1346 | 1321 |
| 1347 bool LayoutBox::paintInvalidationLayerRectsForImage(WrappedImagePtr image, const FillLayer& layers, bool drawingBackground) | 1322 bool LayoutBox::invalidatePaintOfLayerRectsForImage(WrappedImagePtr image, const FillLayer& layers, bool drawingBackground) |
| 1348 { | 1323 { |
| 1349 Vector<LayoutObject*> layerLayoutObjects; | 1324 if (drawingBackground && (isDocumentElement() || backgroundStolenForBeingBod y())) |
| 1350 | 1325 return false; |
| 1351 // A background of the body or document must extend to the total visible siz e of the document. This means the union of the | |
| 1352 // view and document bounds, since it can be the case that the view is large r than the document and vice-versa. | |
| 1353 // http://dev.w3.org/csswg/css-backgrounds/#the-background | |
| 1354 if (drawingBackground && (isDocumentElement() || (isBody() && !document().do cumentElement()->layoutObject()->hasBackground()))) { | |
| 1355 layerLayoutObjects.append(document().documentElement()->layoutObject()); | |
| 1356 layerLayoutObjects.append(view()); | |
| 1357 if (view()->frameView()) | |
| 1358 view()->frameView()->setNeedsFullPaintInvalidation(); | |
| 1359 } else { | |
| 1360 layerLayoutObjects.append(this); | |
| 1361 } | |
| 1362 for (const FillLayer* curLayer = &layers; curLayer; curLayer = curLayer->nex t()) { | 1326 for (const FillLayer* curLayer = &layers; curLayer; curLayer = curLayer->nex t()) { |
| 1363 if (curLayer->image() && image == curLayer->image()->data() && curLayer- >image()->canRender(*this, style()->effectiveZoom())) { | 1327 if (curLayer->image() && image == curLayer->image()->data()) { |
| 1364 for (LayoutObject* layerLayoutObject : layerLayoutObjects) { | 1328 bool maybeAnimated = curLayer->image()->cachedImage() && curLayer->i mage()->cachedImage()->image() && curLayer->image()->cachedImage()->image()->may beAnimated(); |
| 1365 // For now, only support delayed paint invalidation for animated background images. | 1329 if (maybeAnimated && drawingBackground) |
| 1366 bool maybeAnimated = curLayer->image()->cachedImage() && curLaye r->image()->cachedImage()->image() && curLayer->image()->cachedImage()->image()- >maybeAnimated(); | 1330 setShouldDoFullPaintInvalidation(PaintInvalidationDelayedFull); |
| 1367 if (maybeAnimated && drawingBackground) | 1331 else |
| 1368 layerLayoutObject->setShouldDoFullPaintInvalidation(PaintInv alidationDelayedFull); | 1332 setShouldDoFullPaintInvalidation(); |
| 1369 else | |
| 1370 layerLayoutObject->setShouldDoFullPaintInvalidation(PaintInv alidationFull); | |
| 1371 } | |
| 1372 return true; | 1333 return true; |
| 1373 } | 1334 } |
| 1374 } | 1335 } |
| 1375 return false; | 1336 return false; |
| 1376 } | 1337 } |
| 1377 | 1338 |
| 1378 bool LayoutBox::intersectsVisibleViewport() | 1339 bool LayoutBox::intersectsVisibleViewport() |
| 1379 { | 1340 { |
| 1380 LayoutRect rect = visualOverflowRect(); | 1341 LayoutRect rect = visualOverflowRect(); |
| 1381 LayoutView* layoutView = view(); | 1342 LayoutView* layoutView = view(); |
| (...skipping 2565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3947 return invalidationReason; | 3908 return invalidationReason; |
| 3948 | 3909 |
| 3949 // If the transform is not identity or translation, incremental invalidation is not applicable | 3910 // If the transform is not identity or translation, incremental invalidation is not applicable |
| 3950 // because the difference between oldBounds and newBounds doesn't cover all area needing invalidation. | 3911 // because the difference between oldBounds and newBounds doesn't cover all area needing invalidation. |
| 3951 // FIXME: Should also consider ancestor transforms since paintInvalidationCo ntainer. crbug.com/426111. | 3912 // FIXME: Should also consider ancestor transforms since paintInvalidationCo ntainer. crbug.com/426111. |
| 3952 if (invalidationReason == PaintInvalidationIncremental | 3913 if (invalidationReason == PaintInvalidationIncremental |
| 3953 && paintInvalidationContainer != this | 3914 && paintInvalidationContainer != this |
| 3954 && hasLayer() && layer()->transform() && !layer()->transform()->isIdenti tyOrTranslation()) | 3915 && hasLayer() && layer()->transform() && !layer()->transform()->isIdenti tyOrTranslation()) |
| 3955 return PaintInvalidationBoundsChange; | 3916 return PaintInvalidationBoundsChange; |
| 3956 | 3917 |
| 3957 if (!style()->hasBackground() && !style()->hasBoxDecorations()) { | 3918 bool paintsBackground = style()->hasBackground() && !isDocumentElement() && !backgroundStolenForBeingBody(); |
| 3919 if (!paintsBackground && !style()->hasBoxDecorations()) { | |
| 3958 // We could let incremental invalidation cover non-composited scrollbars , but just | 3920 // We could let incremental invalidation cover non-composited scrollbars , but just |
| 3959 // do a full invalidation because incremental invalidation will go away with slimming paint. | 3921 // do a full invalidation because incremental invalidation will go away with slimming paint. |
| 3960 if (invalidationReason == PaintInvalidationIncremental && hasNonComposit edScrollbars()) | 3922 if (invalidationReason == PaintInvalidationIncremental && hasNonComposit edScrollbars()) |
| 3961 return PaintInvalidationBorderBoxChange; | 3923 return PaintInvalidationBorderBoxChange; |
| 3962 return invalidationReason; | 3924 return invalidationReason; |
| 3963 } | 3925 } |
| 3964 | 3926 |
| 3965 if (style()->backgroundLayers().thisOrNextLayersUseContentBox() || style()-> maskLayers().thisOrNextLayersUseContentBox()) { | 3927 if (paintsBackground && (style()->backgroundLayers().thisOrNextLayersUseCont entBox() || style()->maskLayers().thisOrNextLayersUseContentBox())) { |
| 3966 LayoutRect oldContentBoxRect = m_rareData ? m_rareData->m_previousConten tBoxRect : LayoutRect(); | 3928 LayoutRect oldContentBoxRect = m_rareData ? m_rareData->m_previousConten tBoxRect : LayoutRect(); |
| 3967 LayoutRect newContentBoxRect = contentBoxRect(); | 3929 LayoutRect newContentBoxRect = contentBoxRect(); |
| 3968 if (oldContentBoxRect != newContentBoxRect) | 3930 if (oldContentBoxRect != newContentBoxRect) |
| 3969 return PaintInvalidationContentBoxChange; | 3931 return PaintInvalidationContentBoxChange; |
| 3970 } | 3932 } |
| 3971 | 3933 |
| 3972 if (style()->backgroundLayers().thisOrNextLayersHaveLocalAttachment()) { | 3934 if (paintsBackground && style()->backgroundLayers().thisOrNextLayersHaveLoca lAttachment()) { |
| 3973 LayoutRect oldLayoutOverflowRect = m_rareData ? m_rareData->m_previousLa youtOverflowRect : LayoutRect(); | 3935 LayoutRect oldLayoutOverflowRect = m_rareData ? m_rareData->m_previousLa youtOverflowRect : LayoutRect(); |
| 3974 LayoutRect newLayoutOverflowRect = layoutOverflowRect(); | 3936 LayoutRect newLayoutOverflowRect = layoutOverflowRect(); |
| 3975 if (oldLayoutOverflowRect != newLayoutOverflowRect) | 3937 if (oldLayoutOverflowRect != newLayoutOverflowRect) { |
|
Xianzhu
2015/06/05 00:52:46
We could keep these lines as-is. The change increa
| |
| 3976 return PaintInvalidationLayoutOverflowBoxChange; | 3938 // Background positioning for the LayoutView are based on the box of the root element. |
| 3939 // Whether full invalidation is needed will be checked with special logic in | |
| 3940 // LayoutView::invalidatePaintIfNeeded. Here we only need to guarant ee incremental | |
| 3941 // painting is done for newly expanded area. | |
| 3942 if (!isLayoutView()) | |
| 3943 return PaintInvalidationLayoutOverflowBoxChange; | |
| 3944 if (invalidationReason < PaintInvalidationIncremental) | |
| 3945 invalidationReason = PaintInvalidationIncremental; | |
| 3946 } | |
| 3977 } | 3947 } |
| 3978 | 3948 |
| 3979 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size()) ; | 3949 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size()) ; |
| 3980 LayoutSize newBorderBoxSize = size(); | 3950 LayoutSize newBorderBoxSize = size(); |
| 3981 | 3951 |
| 3982 if (oldBorderBoxSize == newBorderBoxSize) | 3952 if (oldBorderBoxSize == newBorderBoxSize) |
| 3983 return invalidationReason; | 3953 return invalidationReason; |
| 3984 | 3954 |
| 3985 // See another hasNonCompositedScrollbars() callsite above. | 3955 // See another hasNonCompositedScrollbars() callsite above. |
| 3986 if (hasNonCompositedScrollbars()) | 3956 if (hasNonCompositedScrollbars()) |
| 3987 return PaintInvalidationBorderBoxChange; | 3957 return PaintInvalidationBorderBoxChange; |
| 3988 | 3958 |
| 3989 if (style()->hasVisualOverflowingEffect() || style()->hasAppearance() || sty le()->hasFilter() || style()->resize() != RESIZE_NONE) | 3959 if (style()->hasVisualOverflowingEffect() || style()->hasAppearance() || sty le()->hasFilter() || style()->resize() != RESIZE_NONE) |
| 3990 return PaintInvalidationBorderBoxChange; | 3960 return PaintInvalidationBorderBoxChange; |
| 3991 | 3961 |
| 3992 if (style()->hasBorderRadius()) { | 3962 if (style()->hasBorderRadius()) { |
| 3993 // If a border-radius exists and width/height is smaller than radius wid th/height, | 3963 // If a border-radius exists and width/height is smaller than radius wid th/height, |
| 3994 // we need to fully invalidate to cover the changed radius. | 3964 // we need to fully invalidate to cover the changed radius. |
| 3995 FloatRoundedRect oldRoundedRect = style()->getRoundedBorderFor(LayoutRec t(LayoutPoint(0, 0), oldBorderBoxSize)); | 3965 FloatRoundedRect oldRoundedRect = style()->getRoundedBorderFor(LayoutRec t(LayoutPoint(0, 0), oldBorderBoxSize)); |
| 3996 FloatRoundedRect newRoundedRect = style()->getRoundedBorderFor(LayoutRec t(LayoutPoint(0, 0), newBorderBoxSize)); | 3966 FloatRoundedRect newRoundedRect = style()->getRoundedBorderFor(LayoutRec t(LayoutPoint(0, 0), newBorderBoxSize)); |
| 3997 if (oldRoundedRect.radii() != newRoundedRect.radii()) | 3967 if (oldRoundedRect.radii() != newRoundedRect.radii()) |
| 3998 return PaintInvalidationBorderBoxChange; | 3968 return PaintInvalidationBorderBoxChange; |
| 3999 } | 3969 } |
| 4000 | 3970 |
| 3971 if (!paintsBackground) | |
| 3972 return invalidationReason; | |
| 3973 | |
| 4001 if (oldBorderBoxSize.width() != newBorderBoxSize.width() && mustInvalidateBa ckgroundOrBorderPaintOnWidthChange()) | 3974 if (oldBorderBoxSize.width() != newBorderBoxSize.width() && mustInvalidateBa ckgroundOrBorderPaintOnWidthChange()) |
| 4002 return PaintInvalidationBorderBoxChange; | 3975 return PaintInvalidationBorderBoxChange; |
| 4003 if (oldBorderBoxSize.height() != newBorderBoxSize.height() && mustInvalidate BackgroundOrBorderPaintOnHeightChange()) | 3976 if (oldBorderBoxSize.height() != newBorderBoxSize.height() && mustInvalidate BackgroundOrBorderPaintOnHeightChange()) |
| 4004 return PaintInvalidationBorderBoxChange; | 3977 return PaintInvalidationBorderBoxChange; |
| 4005 | |
| 4006 return PaintInvalidationIncremental; | 3978 return PaintInvalidationIncremental; |
| 4007 } | 3979 } |
| 4008 | 3980 |
| 4009 void LayoutBox::incrementallyInvalidatePaint(const LayoutBoxModelObject& paintIn validationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds, c onst LayoutPoint& positionFromPaintInvalidationBacking) | 3981 void LayoutBox::incrementallyInvalidatePaint(const LayoutBoxModelObject& paintIn validationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds, c onst LayoutPoint& positionFromPaintInvalidationBacking) |
| 4010 { | 3982 { |
| 4011 LayoutObject::incrementallyInvalidatePaint(paintInvalidationContainer, oldBo unds, newBounds, positionFromPaintInvalidationBacking); | 3983 LayoutObject::incrementallyInvalidatePaint(paintInvalidationContainer, oldBo unds, newBounds, positionFromPaintInvalidationBacking); |
| 4012 | 3984 |
| 4013 bool hasBoxDecorations = style()->hasBoxDecorations(); | 3985 bool hasBoxDecorations = style()->hasBoxDecorations(); |
| 4014 if (!style()->hasBackground() && !hasBoxDecorations) | 3986 if (!style()->hasBackground() && !hasBoxDecorations) |
| 4015 return; | 3987 return; |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4706 computedValues.m_margins.m_start = marginStart(); | 4678 computedValues.m_margins.m_start = marginStart(); |
| 4707 computedValues.m_margins.m_end = marginEnd(); | 4679 computedValues.m_margins.m_end = marginEnd(); |
| 4708 | 4680 |
| 4709 setLogicalTop(oldLogicalTop); | 4681 setLogicalTop(oldLogicalTop); |
| 4710 setLogicalWidth(oldLogicalWidth); | 4682 setLogicalWidth(oldLogicalWidth); |
| 4711 setLogicalLeft(oldLogicalLeft); | 4683 setLogicalLeft(oldLogicalLeft); |
| 4712 setMarginLeft(oldMarginLeft); | 4684 setMarginLeft(oldMarginLeft); |
| 4713 setMarginRight(oldMarginRight); | 4685 setMarginRight(oldMarginRight); |
| 4714 } | 4686 } |
| 4715 | 4687 |
| 4716 inline bool LayoutBox::mustInvalidateFillLayersPaintOnWidthChange(const FillLaye r& layer) const | 4688 bool LayoutBox::mustInvalidateFillLayersPaintOnWidthChange(const FillLayer& laye r) const |
| 4717 { | 4689 { |
| 4718 // Nobody will use multiple layers without wanting fancy positioning. | 4690 // Nobody will use multiple layers without wanting fancy positioning. |
| 4719 if (layer.next()) | 4691 if (layer.next()) |
| 4720 return true; | 4692 return true; |
| 4721 | 4693 |
| 4722 // Make sure we have a valid image. | 4694 // Make sure we have a valid image. |
| 4723 StyleImage* img = layer.image(); | 4695 StyleImage* img = layer.image(); |
| 4724 if (!img || !img->canRender(*this, style()->effectiveZoom())) | 4696 if (!img || !img->canRender(*this, style()->effectiveZoom())) |
| 4725 return false; | 4697 return false; |
| 4726 | 4698 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4793 bool LayoutBox::canRenderBorderImage() const | 4765 bool LayoutBox::canRenderBorderImage() const |
| 4794 { | 4766 { |
| 4795 if (!style()->hasBorderDecoration()) | 4767 if (!style()->hasBorderDecoration()) |
| 4796 return false; | 4768 return false; |
| 4797 | 4769 |
| 4798 StyleImage* borderImage = style()->borderImage().image(); | 4770 StyleImage* borderImage = style()->borderImage().image(); |
| 4799 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded(); | 4771 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded(); |
| 4800 } | 4772 } |
| 4801 | 4773 |
| 4802 } // namespace blink | 4774 } // namespace blink |
| OLD | NEW |