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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.h

Issue 1416053003: Let synchronized painting generate correct paint invalidation rects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup Created 5 years, 1 month 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) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. 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 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 // Returns the rect bounds needed to invalidate the paint of this object, in the coordinate space of the layoutObject backing of |paintInvalidationContainer | 1013 // Returns the rect bounds needed to invalidate the paint of this object, in the coordinate space of the layoutObject backing of |paintInvalidationContainer |
1014 LayoutRect boundsRectForPaintInvalidation(const LayoutBoxModelObject* paintI nvalidationContainer, const PaintInvalidationState* = nullptr) const; 1014 LayoutRect boundsRectForPaintInvalidation(const LayoutBoxModelObject* paintI nvalidationContainer, const PaintInvalidationState* = nullptr) const;
1015 1015
1016 // Actually do the paint invalidate of rect r for this object which has been computed in the coordinate space 1016 // Actually do the paint invalidate of rect r for this object which has been computed in the coordinate space
1017 // of the GraphicsLayer backing of |paintInvalidationContainer|. Note that t his coordinaten space is not the same 1017 // of the GraphicsLayer backing of |paintInvalidationContainer|. Note that t his coordinaten space is not the same
1018 // as the local coordinate space of |paintInvalidationContainer| in the pres ence of layer squashing. 1018 // as the local coordinate space of |paintInvalidationContainer| in the pres ence of layer squashing.
1019 void invalidatePaintUsingContainer(const LayoutBoxModelObject& paintInvalida tionContainer, const LayoutRect&, PaintInvalidationReason) const; 1019 void invalidatePaintUsingContainer(const LayoutBoxModelObject& paintInvalida tionContainer, const LayoutRect&, PaintInvalidationReason) const;
1020 1020
1021 // Invalidate the paint of a specific subrectangle within a given object. Th e rect |r| is in the object's coordinate space. 1021 // Invalidate the paint of a specific subrectangle within a given object. Th e rect |r| is in the object's coordinate space.
1022 void invalidatePaintRectangle(const LayoutRect&) const; 1022 void invalidatePaintRectangle(const LayoutRect&) const;
1023 void invalidatePaintRectangleNotInvalidatingDisplayItemClients(const LayoutR ect&) const; 1023 void invalidatePaintRectangleNotInvalidatingDisplayItemClients(const LayoutR ect& r) const { invalidatePaintRectangleInternal(r); }
chrishtr 2015/10/23 17:15:07 Don't inline this.
Xianzhu 2015/10/23 18:43:27 Done.
1024 1024
1025 // Walk the tree after layout issuing paint invalidations for layoutObjects that have changed or moved, updating bounds that have changed, and clearing pain t invalidation state. 1025 // Walk the tree after layout issuing paint invalidations for layoutObjects that have changed or moved, updating bounds that have changed, and clearing pain t invalidation state.
1026 virtual void invalidateTreeIfNeeded(PaintInvalidationState&); 1026 virtual void invalidateTreeIfNeeded(PaintInvalidationState&);
1027 1027
1028 virtual void invalidatePaintForOverflow(); 1028 virtual void invalidatePaintForOverflow();
1029 void invalidatePaintForOverflowIfNeeded(); 1029 void invalidatePaintForOverflowIfNeeded();
1030 1030
1031 void invalidatePaintIncludingNonCompositingDescendants(); 1031 void invalidatePaintIncludingNonCompositingDescendants();
1032 void invalidatePaintIncludingNonSelfPaintingLayerDescendants(const LayoutBox ModelObject& paintInvalidationContainer); 1032 void invalidatePaintIncludingNonSelfPaintingLayerDescendants(const LayoutBox ModelObject& paintInvalidationContainer);
1033 void setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); 1033 void setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants();
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 // FIXME: should we hook up scrollbar parts in the layout tree? crbug.com/48 4263. 1265 // FIXME: should we hook up scrollbar parts in the layout tree? crbug.com/48 4263.
1266 void invalidateDisplayItemClientForNonCompositingDescendantsOf(const LayoutO bject&) const; 1266 void invalidateDisplayItemClientForNonCompositingDescendantsOf(const LayoutO bject&) const;
1267 1267
1268 // Called before anonymousChild.setStyle(). Override to set custom styles fo r the child. 1268 // Called before anonymousChild.setStyle(). Override to set custom styles fo r the child.
1269 virtual void updateAnonymousChildStyle(const LayoutObject& anonymousChild, C omputedStyle& style) const { } 1269 virtual void updateAnonymousChildStyle(const LayoutObject& anonymousChild, C omputedStyle& style) const { }
1270 1270
1271 // Painters can use const methods only, except for these explicitly declared methods. 1271 // Painters can use const methods only, except for these explicitly declared methods.
1272 class MutableForPainting { 1272 class MutableForPainting {
1273 public: 1273 public:
1274 void setPreviousPaintOffset(const LayoutPoint& paintOffset) { m_layoutOb ject.setPreviousPaintOffset(paintOffset); } 1274 void setPreviousPaintOffset(const LayoutPoint& paintOffset) { m_layoutOb ject.setPreviousPaintOffset(paintOffset); }
1275 void invalidatePaintIfNeeded(const PaintInfo& paintInfo) { m_layoutObjec t.invalidatePaintIfNeededForSynchronizedPainting(paintInfo); }
1276 1275
1277 private: 1276 private:
1278 friend class LayoutObject; 1277 friend class LayoutObject;
1279 MutableForPainting(const LayoutObject& layoutObject) : m_layoutObject(co nst_cast<LayoutObject&>(layoutObject)) { } 1278 MutableForPainting(const LayoutObject& layoutObject) : m_layoutObject(co nst_cast<LayoutObject&>(layoutObject)) { }
1280 1279
1281 LayoutObject& m_layoutObject; 1280 LayoutObject& m_layoutObject;
1282 }; 1281 };
1283 MutableForPainting mutableForPainting() const { return MutableForPainting(*t his); } 1282 MutableForPainting mutableForPainting() const { return MutableForPainting(*t his); }
1284 1283
1285 protected: 1284 protected:
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 1403
1405 #if ENABLE(ASSERT) 1404 #if ENABLE(ASSERT)
1406 virtual bool paintInvalidationStateIsDirty() const 1405 virtual bool paintInvalidationStateIsDirty() const
1407 { 1406 {
1408 return m_bitfields.neededLayoutBecauseOfChildren() || shouldCheckForPain tInvalidationRegardlessOfPaintInvalidationState(); 1407 return m_bitfields.neededLayoutBecauseOfChildren() || shouldCheckForPain tInvalidationRegardlessOfPaintInvalidationState();
1409 } 1408 }
1410 #endif 1409 #endif
1411 1410
1412 virtual void invalidatePaintOfSubtreesIfNeeded(PaintInvalidationState& child PaintInvalidationState); 1411 virtual void invalidatePaintOfSubtreesIfNeeded(PaintInvalidationState& child PaintInvalidationState);
1413 virtual PaintInvalidationReason invalidatePaintIfNeeded(PaintInvalidationSta te&, const LayoutBoxModelObject& paintInvalidationContainer); 1412 virtual PaintInvalidationReason invalidatePaintIfNeeded(PaintInvalidationSta te&, const LayoutBoxModelObject& paintInvalidationContainer);
1414 void invalidatePaintIfNeededForSynchronizedPainting(const PaintInfo&);
1415 1413
1416 // When this object is invalidated for paint, this method is called to inval idate any DisplayItemClients 1414 // When this object is invalidated for paint, this method is called to inval idate any DisplayItemClients
1417 // owned by this object, including the object itself, LayoutText/LayoutInlin e line boxes, etc., 1415 // owned by this object, including the object itself, LayoutText/LayoutInlin e line boxes, etc.,
1418 // not including children which will be invalidated normally during invalida teTreeIfNeeded() and 1416 // not including children which will be invalidated normally during invalida teTreeIfNeeded() and
1419 // parts which are invalidated separately (e.g. scrollbars). 1417 // parts which are invalidated separately (e.g. scrollbars).
1420 virtual void invalidateDisplayItemClients(const LayoutBoxModelObject& paintI nvalidationContainer, PaintInvalidationReason, const LayoutRect& previousPaintIn validationRect, const LayoutRect& newPaintInvalidationRect) const; 1418 // |paintInvalidationRect| can be nullptr if we know it's unchanged and Pain tController has cached the
1419 // previous value; otherwise we must pass a correct value.
1420 virtual void invalidateDisplayItemClients(const LayoutBoxModelObject& paintI nvalidationContainer, PaintInvalidationReason, const LayoutRect* paintInvalidati onRect) const;
chrishtr 2015/10/23 17:15:07 rename to visibleContentRect? Can skip for this CL
Xianzhu 2015/10/23 18:43:27 I think we can keep paintInvalidationRect in Layou
1421 1421
1422 void setIsBackgroundAttachmentFixedObject(bool); 1422 void setIsBackgroundAttachmentFixedObject(bool);
1423 1423
1424 void clearSelfNeedsOverflowRecalcAfterStyleChange() { m_bitfields.setSelfNee dsOverflowRecalcAfterStyleChange(false); } 1424 void clearSelfNeedsOverflowRecalcAfterStyleChange() { m_bitfields.setSelfNee dsOverflowRecalcAfterStyleChange(false); }
1425 void clearChildNeedsOverflowRecalcAfterStyleChange() { m_bitfields.setChildN eedsOverflowRecalcAfterStyleChange(false); } 1425 void clearChildNeedsOverflowRecalcAfterStyleChange() { m_bitfields.setChildN eedsOverflowRecalcAfterStyleChange(false); }
1426 void setShouldInvalidateOverflowForPaint() { m_bitfields.setShouldInvalidate OverflowForPaint(true); } 1426 void setShouldInvalidateOverflowForPaint() { m_bitfields.setShouldInvalidate OverflowForPaint(true); }
1427 void setEverHadLayout() { m_bitfields.setEverHadLayout(true); } 1427 void setEverHadLayout() { m_bitfields.setEverHadLayout(true); }
1428 1428
1429 // Remove this object and all descendants from the containing LayoutFlowThre ad. 1429 // Remove this object and all descendants from the containing LayoutFlowThre ad.
1430 void removeFromLayoutFlowThread(); 1430 void removeFromLayoutFlowThread();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1486 1486
1487 #if ENABLE(ASSERT) 1487 #if ENABLE(ASSERT)
1488 void checkBlockPositionedObjectsNeedLayout(); 1488 void checkBlockPositionedObjectsNeedLayout();
1489 #endif 1489 #endif
1490 1490
1491 bool isTextOrSVGChild() const { return isText() || (isSVG() && !isSVGRoot()) ; } 1491 bool isTextOrSVGChild() const { return isText() || (isSVG() && !isSVGRoot()) ; }
1492 1492
1493 static bool isAllowedToModifyLayoutTreeStructure(Document&); 1493 static bool isAllowedToModifyLayoutTreeStructure(Document&);
1494 1494
1495 // The passed rect is mutated into the coordinate space of the paint invalid ation container. 1495 // The passed rect is mutated into the coordinate space of the paint invalid ation container.
1496 const LayoutBoxModelObject* invalidatePaintRectangleInternal(LayoutRect&) co nst; 1496 const LayoutBoxModelObject* invalidatePaintRectangleInternal(const LayoutRec t&) const;
1497 1497
1498 static LayoutPoint uninitializedPaintOffset() { return LayoutPoint(LayoutUni t::max(), LayoutUnit::max()); } 1498 static LayoutPoint uninitializedPaintOffset() { return LayoutPoint(LayoutUni t::max(), LayoutUnit::max()); }
1499 1499
1500 RefPtr<ComputedStyle> m_style; 1500 RefPtr<ComputedStyle> m_style;
1501 1501
1502 // Oilpan: raw pointer back to the owning Node is considered safe. 1502 // Oilpan: raw pointer back to the owning Node is considered safe.
1503 GC_PLUGIN_IGNORE("http://crbug.com/509911") 1503 GC_PLUGIN_IGNORE("http://crbug.com/509911")
1504 Node* m_node; 1504 Node* m_node;
1505 1505
1506 LayoutObject* m_parent; 1506 LayoutObject* m_parent;
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
2001 void showTree(const blink::LayoutObject*); 2001 void showTree(const blink::LayoutObject*);
2002 void showLineTree(const blink::LayoutObject*); 2002 void showLineTree(const blink::LayoutObject*);
2003 void showLayoutTree(const blink::LayoutObject* object1); 2003 void showLayoutTree(const blink::LayoutObject* object1);
2004 // We don't make object2 an optional parameter so that showLayoutTree 2004 // We don't make object2 an optional parameter so that showLayoutTree
2005 // can be called from gdb easily. 2005 // can be called from gdb easily.
2006 void showLayoutTree(const blink::LayoutObject* object1, const blink::LayoutObjec t* object2); 2006 void showLayoutTree(const blink::LayoutObject* object1, const blink::LayoutObjec t* object2);
2007 2007
2008 #endif 2008 #endif
2009 2009
2010 #endif // LayoutObject_h 2010 #endif // LayoutObject_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698