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

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

Issue 1391753005: (WIP) Invalidation during painting (for synchronized painting) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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) 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 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 } 560 }
561 561
562 void setIsInsideFlowThreadIncludingDescendants(bool); 562 void setIsInsideFlowThreadIncludingDescendants(bool);
563 563
564 bool isInsideFlowThread() const { return m_bitfields.isInsideFlowThread(); } 564 bool isInsideFlowThread() const { return m_bitfields.isInsideFlowThread(); }
565 void setIsInsideFlowThread(bool insideFlowThread) { m_bitfields.setIsInsideF lowThread(insideFlowThread); } 565 void setIsInsideFlowThread(bool insideFlowThread) { m_bitfields.setIsInsideF lowThread(insideFlowThread); }
566 566
567 // FIXME: Until all SVG layoutObjects can be subclasses of LayoutSVGModelObj ect we have 567 // FIXME: Until all SVG layoutObjects can be subclasses of LayoutSVGModelObj ect we have
568 // to add SVG layoutObject methods to LayoutObject with an ASSERT_NOT_REACHE D() default implementation. 568 // to add SVG layoutObject methods to LayoutObject with an ASSERT_NOT_REACHE D() default implementation.
569 bool isSVG() const { return isOfType(LayoutObjectSVG); } 569 bool isSVG() const { return isOfType(LayoutObjectSVG); }
570 bool isSVGModelObject() const { return isOfType(LayoutObjectSVGModelObject); }
570 bool isSVGRoot() const { return isOfType(LayoutObjectSVGRoot); } 571 bool isSVGRoot() const { return isOfType(LayoutObjectSVGRoot); }
571 bool isSVGContainer() const { return isOfType(LayoutObjectSVGContainer); } 572 bool isSVGContainer() const { return isOfType(LayoutObjectSVGContainer); }
572 bool isSVGTransformableContainer() const { return isOfType(LayoutObjectSVGTr ansformableContainer); } 573 bool isSVGTransformableContainer() const { return isOfType(LayoutObjectSVGTr ansformableContainer); }
573 bool isSVGViewportContainer() const { return isOfType(LayoutObjectSVGViewpor tContainer); } 574 bool isSVGViewportContainer() const { return isOfType(LayoutObjectSVGViewpor tContainer); }
574 bool isSVGGradientStop() const { return isOfType(LayoutObjectSVGGradientStop ); } 575 bool isSVGGradientStop() const { return isOfType(LayoutObjectSVGGradientStop ); }
575 bool isSVGHiddenContainer() const { return isOfType(LayoutObjectSVGHiddenCon tainer); } 576 bool isSVGHiddenContainer() const { return isOfType(LayoutObjectSVGHiddenCon tainer); }
576 bool isSVGShape() const { return isOfType(LayoutObjectSVGShape); } 577 bool isSVGShape() const { return isOfType(LayoutObjectSVGShape); }
577 bool isSVGText() const { return isOfType(LayoutObjectSVGText); } 578 bool isSVGText() const { return isOfType(LayoutObjectSVGText); }
578 bool isSVGTextPath() const { return isOfType(LayoutObjectSVGTextPath); } 579 bool isSVGTextPath() const { return isOfType(LayoutObjectSVGTextPath); }
579 bool isSVGInline() const { return isOfType(LayoutObjectSVGInline); } 580 bool isSVGInline() const { return isOfType(LayoutObjectSVGInline); }
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 1266
1266 // Called when the previous paint invalidation rect(s) is no longer valid. 1267 // Called when the previous paint invalidation rect(s) is no longer valid.
1267 virtual void clearPreviousPaintInvalidationRects(); 1268 virtual void clearPreviousPaintInvalidationRects();
1268 1269
1269 // Only adjusts if the paint invalidation container is not a composited scro ller. 1270 // Only adjusts if the paint invalidation container is not a composited scro ller.
1270 void adjustPreviousPaintInvalidationForScrollIfNeeded(const DoubleSize& scro llDelta); 1271 void adjustPreviousPaintInvalidationForScrollIfNeeded(const DoubleSize& scro llDelta);
1271 1272
1272 // The previous position of the top-left corner of the object in its previou s paint backing. 1273 // The previous position of the top-left corner of the object in its previou s paint backing.
1273 const LayoutPoint& previousPositionFromPaintInvalidationBacking() const 1274 const LayoutPoint& previousPositionFromPaintInvalidationBacking() const
1274 { 1275 {
1275 ASSERT(!RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled()); 1276 ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled());
1276 return m_previousPositionFromPaintInvalidationBacking; 1277 return m_previousPositionFromPaintInvalidationBacking;
1277 } 1278 }
1278 void setPreviousPositionFromPaintInvalidationBacking(const LayoutPoint& posi tionFromPaintInvalidationBacking) 1279 void setPreviousPositionFromPaintInvalidationBacking(const LayoutPoint& posi tionFromPaintInvalidationBacking)
1279 { 1280 {
1280 ASSERT(!RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled()); 1281 ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled());
1281 m_previousPositionFromPaintInvalidationBacking = positionFromPaintInvali dationBacking; 1282 m_previousPositionFromPaintInvalidationBacking = positionFromPaintInvali dationBacking;
1282 } 1283 }
1283 1284
1284 bool paintOffsetChanged(const LayoutPoint& newPaintOffset) const 1285 bool paintOffsetChanged(const LayoutPoint& newPaintOffset) const
1285 { 1286 {
1286 ASSERT(RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled()); 1287 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
1287 return m_previousPositionFromPaintInvalidationBacking != uninitializedPa intOffset() && m_previousPositionFromPaintInvalidationBacking != newPaintOffset; 1288 return m_previousPositionFromPaintInvalidationBacking != newPaintOffset;
1288 } 1289 }
1289 void setPreviousPaintOffset(const LayoutPoint& paintOffset) 1290 void setPreviousPaintOffset(const LayoutPoint& paintOffset)
1290 { 1291 {
1291 ASSERT(RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled()); 1292 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
1292 m_previousPositionFromPaintInvalidationBacking = paintOffset; 1293 m_previousPositionFromPaintInvalidationBacking = paintOffset;
1293 } 1294 }
1294 1295
1295 PaintInvalidationReason fullPaintInvalidationReason() const { return m_bitfi elds.fullPaintInvalidationReason(); } 1296 PaintInvalidationReason fullPaintInvalidationReason() const { return m_bitfi elds.fullPaintInvalidationReason(); }
1296 bool shouldDoFullPaintInvalidation() const { return m_bitfields.fullPaintInv alidationReason() != PaintInvalidationNone; } 1297 bool shouldDoFullPaintInvalidation() const { return m_bitfields.fullPaintInv alidationReason() != PaintInvalidationNone; }
1297 void setShouldDoFullPaintInvalidation(PaintInvalidationReason = PaintInvalid ationFull); 1298 void setShouldDoFullPaintInvalidation(PaintInvalidationReason = PaintInvalid ationFull);
1298 void clearShouldDoFullPaintInvalidation() { m_bitfields.setFullPaintInvalida tionReason(PaintInvalidationNone); } 1299 void clearShouldDoFullPaintInvalidation() { m_bitfields.setFullPaintInvalida tionReason(PaintInvalidationNone); }
1299 1300
1300 bool shouldInvalidateOverflowForPaint() const { return m_bitfields.shouldInv alidateOverflowForPaint(); } 1301 bool shouldInvalidateOverflowForPaint() const { return m_bitfields.shouldInv alidateOverflowForPaint(); }
1301 1302
(...skipping 26 matching lines...) Expand all
1328 1329
1329 void invalidateDisplayItemClient(const DisplayItemClient&) const; 1330 void invalidateDisplayItemClient(const DisplayItemClient&) const;
1330 void invalidateDisplayItemClientsIncludingNonCompositingDescendants(const La youtBoxModelObject* paintInvalidationContainer, PaintInvalidationReason) const; 1331 void invalidateDisplayItemClientsIncludingNonCompositingDescendants(const La youtBoxModelObject* paintInvalidationContainer, PaintInvalidationReason) const;
1331 1332
1332 // Called before anonymousChild.setStyle(). Override to set custom styles fo r the child. 1333 // Called before anonymousChild.setStyle(). Override to set custom styles fo r the child.
1333 virtual void updateAnonymousChildStyle(const LayoutObject& anonymousChild, C omputedStyle& style) const { } 1334 virtual void updateAnonymousChildStyle(const LayoutObject& anonymousChild, C omputedStyle& style) const { }
1334 1335
1335 // Painters can use const methods only, except for these explicitly declared methods. 1336 // Painters can use const methods only, except for these explicitly declared methods.
1336 class MutableForPainting { 1337 class MutableForPainting {
1337 public: 1338 public:
1338 void setPreviousPaintOffset(const LayoutPoint& paintOffset) { m_layoutOb ject.setPreviousPaintOffset(paintOffset); } 1339 void invalidatePaintIfNeeded(const PaintInfo& paintInfo, const LayoutPoi nt& paintOffset) { m_layoutObject.invalidatePaintIfNeededForSlimmingPaintV2(pain tInfo, paintOffset); }
1339 1340
1340 private: 1341 private:
1341 friend class LayoutObject; 1342 friend class LayoutObject;
1342 MutableForPainting(const LayoutObject& layoutObject) : m_layoutObject(co nst_cast<LayoutObject&>(layoutObject)) { } 1343 MutableForPainting(const LayoutObject& layoutObject) : m_layoutObject(co nst_cast<LayoutObject&>(layoutObject)) { }
1343 1344
1344 LayoutObject& m_layoutObject; 1345 LayoutObject& m_layoutObject;
1345 }; 1346 };
1346 MutableForPainting mutableForPainting() const { return MutableForPainting(*t his); } 1347 MutableForPainting mutableForPainting() const { return MutableForPainting(*t his); }
1347 1348
1348 void setIsScrollAnchorObject() { m_bitfields.setIsScrollAnchorObject(true); } 1349 void setIsScrollAnchorObject() { m_bitfields.setIsScrollAnchorObject(true); }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 LayoutObjectTableCell, 1395 LayoutObjectTableCell,
1395 LayoutObjectTableRow, 1396 LayoutObjectTableRow,
1396 LayoutObjectTableSection, 1397 LayoutObjectTableSection,
1397 LayoutObjectTextArea, 1398 LayoutObjectTextArea,
1398 LayoutObjectTextControl, 1399 LayoutObjectTextControl,
1399 LayoutObjectTextField, 1400 LayoutObjectTextField,
1400 LayoutObjectVideo, 1401 LayoutObjectVideo,
1401 LayoutObjectWidget, 1402 LayoutObjectWidget,
1402 1403
1403 LayoutObjectSVG, /* Keep by itself? */ 1404 LayoutObjectSVG, /* Keep by itself? */
1405 LayoutObjectSVGModelObject,
1404 LayoutObjectSVGRoot, 1406 LayoutObjectSVGRoot,
1405 LayoutObjectSVGContainer, 1407 LayoutObjectSVGContainer,
1406 LayoutObjectSVGTransformableContainer, 1408 LayoutObjectSVGTransformableContainer,
1407 LayoutObjectSVGViewportContainer, 1409 LayoutObjectSVGViewportContainer,
1408 LayoutObjectSVGHiddenContainer, 1410 LayoutObjectSVGHiddenContainer,
1409 LayoutObjectSVGGradientStop, 1411 LayoutObjectSVGGradientStop,
1410 LayoutObjectSVGShape, 1412 LayoutObjectSVGShape,
1411 LayoutObjectSVGText, 1413 LayoutObjectSVGText,
1412 LayoutObjectSVGTextPath, 1414 LayoutObjectSVGTextPath,
1413 LayoutObjectSVGInline, 1415 LayoutObjectSVGInline,
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 // relationship. 1502 // relationship.
1501 // 1503 //
1502 // The function is overridden to handle special children 1504 // The function is overridden to handle special children
1503 // (e.g. percentage height descendants or reflections). 1505 // (e.g. percentage height descendants or reflections).
1504 virtual void invalidatePaintOfSubtreesIfNeeded(PaintInvalidationState& child PaintInvalidationState); 1506 virtual void invalidatePaintOfSubtreesIfNeeded(PaintInvalidationState& child PaintInvalidationState);
1505 1507
1506 // This function generates the invalidation for this object only. 1508 // This function generates the invalidation for this object only.
1507 // It doesn't recurse into other object, as this is handled 1509 // It doesn't recurse into other object, as this is handled
1508 // by invalidatePaintOfSubtreesIfNeeded. 1510 // by invalidatePaintOfSubtreesIfNeeded.
1509 virtual PaintInvalidationReason invalidatePaintIfNeeded(PaintInvalidationSta te&, const LayoutBoxModelObject& paintInvalidationContainer); 1511 virtual PaintInvalidationReason invalidatePaintIfNeeded(PaintInvalidationSta te&, const LayoutBoxModelObject& paintInvalidationContainer);
1512 void invalidatePaintIfNeededForSlimmingPaintV2(const PaintInfo&, const Layou tPoint& paintOffset);
1510 1513
1511 // When this object is invalidated for paint, this method is called to inval idate any DisplayItemClients 1514 // When this object is invalidated for paint, this method is called to inval idate any DisplayItemClients
1512 // owned by this object, including the object itself, LayoutText/LayoutInlin e line boxes, etc., 1515 // owned by this object, including the object itself, LayoutText/LayoutInlin e line boxes, etc.,
1513 // not including children which will be invalidated normally during invalida teTreeIfNeeded() and 1516 // not including children which will be invalidated normally during invalida teTreeIfNeeded() and
1514 // parts which are invalidated separately (e.g. scrollbars). 1517 // parts which are invalidated separately (e.g. scrollbars).
1515 // The caller should ensure the enclosing layer has been setNeedsRepaint bef ore calling this function. 1518 // The caller should ensure the enclosing layer has been setNeedsRepaint bef ore calling this function.
1516 virtual void invalidateDisplayItemClients(const LayoutBoxModelObject& paintI nvalidationContainer, PaintInvalidationReason) const; 1519 virtual void invalidateDisplayItemClients(const LayoutBoxModelObject& paintI nvalidationContainer, PaintInvalidationReason) const;
1517 1520
1518 // Sets enclosing layer needsRepaint, then calls invalidateDisplayItemClient s(). 1521 // Sets enclosing layer needsRepaint, then calls invalidateDisplayItemClient s().
1519 // Should use this version when PaintInvalidationState is available. 1522 // Should use this version when PaintInvalidationState is available.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1596 void checkBlockPositionedObjectsNeedLayout(); 1599 void checkBlockPositionedObjectsNeedLayout();
1597 #endif 1600 #endif
1598 1601
1599 bool isTextOrSVGChild() const { return isText() || (isSVG() && !isSVGRoot()) ; } 1602 bool isTextOrSVGChild() const { return isText() || (isSVG() && !isSVGRoot()) ; }
1600 1603
1601 static bool isAllowedToModifyLayoutTreeStructure(Document&); 1604 static bool isAllowedToModifyLayoutTreeStructure(Document&);
1602 1605
1603 // The passed rect is mutated into the coordinate space of the paint invalid ation container. 1606 // The passed rect is mutated into the coordinate space of the paint invalid ation container.
1604 const LayoutBoxModelObject* invalidatePaintRectangleInternal(const LayoutRec t&) const; 1607 const LayoutBoxModelObject* invalidatePaintRectangleInternal(const LayoutRec t&) const;
1605 1608
1606 static LayoutPoint uninitializedPaintOffset() { return LayoutPoint(LayoutUni t::max(), LayoutUnit::max()); }
1607
1608 RefPtr<ComputedStyle> m_style; 1609 RefPtr<ComputedStyle> m_style;
1609 1610
1610 // Oilpan: This untraced pointer to the owning Node is considered safe. 1611 // Oilpan: This untraced pointer to the owning Node is considered safe.
1611 RawPtrWillBeUntracedMember<Node> m_node; 1612 RawPtrWillBeUntracedMember<Node> m_node;
1612 1613
1613 LayoutObject* m_parent; 1614 LayoutObject* m_parent;
1614 LayoutObject* m_previous; 1615 LayoutObject* m_previous;
1615 LayoutObject* m_next; 1616 LayoutObject* m_next;
1616 1617
1617 #if ENABLE(ASSERT) 1618 #if ENABLE(ASSERT)
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1883 // Store state between styleWillChange and styleDidChange 1884 // Store state between styleWillChange and styleDidChange
1884 static bool s_affectsParentBlock; 1885 static bool s_affectsParentBlock;
1885 1886
1886 // This stores the paint invalidation rect from the previous frame. This rec t does *not* account for composited scrolling. See 1887 // This stores the paint invalidation rect from the previous frame. This rec t does *not* account for composited scrolling. See
1887 // adjustInvalidationRectForCompositedScrolling(). 1888 // adjustInvalidationRectForCompositedScrolling().
1888 LayoutRect m_previousPaintInvalidationRect; 1889 LayoutRect m_previousPaintInvalidationRect;
1889 1890
1890 // This stores the position in the paint invalidation backing's coordinate. 1891 // This stores the position in the paint invalidation backing's coordinate.
1891 // It is used to detect layoutObject shifts that forces a full invalidation. 1892 // It is used to detect layoutObject shifts that forces a full invalidation.
1892 // This point does *not* account for composited scrolling. See adjustInvalid ationRectForCompositedScrolling(). 1893 // This point does *not* account for composited scrolling. See adjustInvalid ationRectForCompositedScrolling().
1893 // For slimmingPaintOffsetCaching, this stores the previous paint offset. 1894 // For slimmingPaintV2, this stores the previous paint offset.
1894 // TODO(wangxianzhu): Rename this to m_previousPaintOffset when we enable sl immingPaintOffsetCaching. 1895 // TODO(wangxianzhu): Rename this to m_previousPaintOffset when we enable sl immingPaintV2.
1895 LayoutPoint m_previousPositionFromPaintInvalidationBacking; 1896 LayoutPoint m_previousPositionFromPaintInvalidationBacking;
1896 }; 1897 };
1897 1898
1898 // FIXME: remove this once the layout object lifecycle ASSERTS are no longer hit . 1899 // FIXME: remove this once the layout object lifecycle ASSERTS are no longer hit .
1899 class DeprecatedDisableModifyLayoutTreeStructureAsserts { 1900 class DeprecatedDisableModifyLayoutTreeStructureAsserts {
1900 STACK_ALLOCATED(); 1901 STACK_ALLOCATED();
1901 WTF_MAKE_NONCOPYABLE(DeprecatedDisableModifyLayoutTreeStructureAsserts); 1902 WTF_MAKE_NONCOPYABLE(DeprecatedDisableModifyLayoutTreeStructureAsserts);
1902 public: 1903 public:
1903 DeprecatedDisableModifyLayoutTreeStructureAsserts(); 1904 DeprecatedDisableModifyLayoutTreeStructureAsserts();
1904 1905
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2124 void showTree(const blink::LayoutObject*); 2125 void showTree(const blink::LayoutObject*);
2125 void showLineTree(const blink::LayoutObject*); 2126 void showLineTree(const blink::LayoutObject*);
2126 void showLayoutTree(const blink::LayoutObject* object1); 2127 void showLayoutTree(const blink::LayoutObject* object1);
2127 // We don't make object2 an optional parameter so that showLayoutTree 2128 // We don't make object2 an optional parameter so that showLayoutTree
2128 // can be called from gdb easily. 2129 // can be called from gdb easily.
2129 void showLayoutTree(const blink::LayoutObject* object1, const blink::LayoutObjec t* object2); 2130 void showLayoutTree(const blink::LayoutObject* object1, const blink::LayoutObjec t* object2);
2130 2131
2131 #endif 2132 #endif
2132 2133
2133 #endif // LayoutObject_h 2134 #endif // LayoutObject_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698