Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(677)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 1378743002: Refactor the API for setting dynamic resource load priorities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 if (!info.isComputingShape()) { 1344 if (!info.isComputingShape()) {
1345 info.markShapeAsDirty(); 1345 info.markShapeAsDirty();
1346 markShapeOutsideDependentsForLayout(); 1346 markShapeOutsideDependentsForLayout();
1347 } 1347 }
1348 } 1348 }
1349 1349
1350 if (!invalidatePaintOfLayerRectsForImage(image, style()->backgroundLayers(), true)) 1350 if (!invalidatePaintOfLayerRectsForImage(image, style()->backgroundLayers(), true))
1351 invalidatePaintOfLayerRectsForImage(image, style()->maskLayers(), false) ; 1351 invalidatePaintOfLayerRectsForImage(image, style()->maskLayers(), false) ;
1352 } 1352 }
1353 1353
1354 ResourcePriority LayoutBox::updatePriority(Resource*)
Nate Chapin 2015/10/07 19:40:40 Merge the basically identical logic in LayoutImage
esprehn 2015/10/08 05:39:11 You ignore the argument, why pass it at all? This
Nate Chapin 2015/10/08 21:26:37 I was thinking that the return value might depend
1355 {
1356 LayoutRect viewBounds = viewRect();
1357 LayoutRect objectBounds = LayoutRect(absoluteContentBox());
1358
1359 // The object bounds might be empty right now, so intersects will fail since it doesn't deal
1360 // with empty rects. Use LayoutRect::contains in that case.
1361 bool isVisible;
1362 if (!objectBounds.isEmpty())
1363 isVisible = viewBounds.intersects(objectBounds);
1364 else
1365 isVisible = viewBounds.contains(objectBounds);
1366
1367 LayoutRect screenRect;
1368 if (!objectBounds.isEmpty()) {
1369 screenRect = viewBounds;
1370 screenRect.intersect(objectBounds);
1371 }
1372
1373 int screenArea = 0;
1374 if (!screenRect.isEmpty() && isVisible)
1375 screenArea = static_cast<uint32_t>(screenRect.width() * screenRect.heigh t());
1376 return ResourcePriority(isVisible ? ResourcePriority::Visible : ResourcePrio rity::NotVisible, screenArea);
1377 }
1378
1354 bool LayoutBox::invalidatePaintOfLayerRectsForImage(WrappedImagePtr image, const FillLayer& layers, bool drawingBackground) 1379 bool LayoutBox::invalidatePaintOfLayerRectsForImage(WrappedImagePtr image, const FillLayer& layers, bool drawingBackground)
1355 { 1380 {
1356 if (drawingBackground && (isDocumentElement() || backgroundStolenForBeingBod y())) 1381 if (drawingBackground && (isDocumentElement() || backgroundStolenForBeingBod y()))
1357 return false; 1382 return false;
1358 for (const FillLayer* curLayer = &layers; curLayer; curLayer = curLayer->nex t()) { 1383 for (const FillLayer* curLayer = &layers; curLayer; curLayer = curLayer->nex t()) {
1359 if (curLayer->image() && image == curLayer->image()->data()) { 1384 if (curLayer->image() && image == curLayer->image()->data()) {
1360 bool maybeAnimated = curLayer->image()->cachedImage() && curLayer->i mage()->cachedImage()->image() && curLayer->image()->cachedImage()->image()->may beAnimated(); 1385 bool maybeAnimated = curLayer->image()->cachedImage() && curLayer->i mage()->cachedImage()->image() && curLayer->image()->cachedImage()->image()->may beAnimated();
1361 if (maybeAnimated && drawingBackground) 1386 if (maybeAnimated && drawingBackground)
1362 setShouldDoFullPaintInvalidation(PaintInvalidationDelayedFull); 1387 setShouldDoFullPaintInvalidation(PaintInvalidationDelayedFull);
1363 else 1388 else
(...skipping 3390 matching lines...) Expand 10 before | Expand all | Expand 10 after
4754 StyleImage* borderImage = style()->borderImage().image(); 4779 StyleImage* borderImage = style()->borderImage().image();
4755 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded(); 4780 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded();
4756 } 4781 }
4757 4782
4758 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const 4783 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const
4759 { 4784 {
4760 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr; 4785 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr;
4761 } 4786 }
4762 4787
4763 } // namespace blink 4788 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698