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

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

Issue 2173363002: Improve code readibility of PaintPropertyTreeBuilder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove extra "const" (might be a typo) Created 4 years, 5 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutObject.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 virtual bool createsAnonymousWrapper() const { return false; } 401 virtual bool createsAnonymousWrapper() const { return false; }
402 ////////////////////////////////////////// 402 //////////////////////////////////////////
403 403
404 // Sets the parent of this object but doesn't add it as a child of the paren t. 404 // Sets the parent of this object but doesn't add it as a child of the paren t.
405 void setDangerousOneWayParent(LayoutObject*); 405 void setDangerousOneWayParent(LayoutObject*);
406 406
407 // For SPv2 only. The ObjectPaintProperties structure holds references to th e 407 // For SPv2 only. The ObjectPaintProperties structure holds references to th e
408 // property tree nodes that are created by the layout object for painting. 408 // property tree nodes that are created by the layout object for painting.
409 // The property nodes are only updated during InUpdatePaintProperties phase 409 // The property nodes are only updated during InUpdatePaintProperties phase
410 // of the document lifecycle and shall remain immutable during other phases. 410 // of the document lifecycle and shall remain immutable during other phases.
411 ObjectPaintProperties* objectPaintProperties() const; 411 const ObjectPaintProperties* objectPaintProperties() const;
412
413 private:
412 ObjectPaintProperties& ensureObjectPaintProperties(); 414 ObjectPaintProperties& ensureObjectPaintProperties();
413 void clearObjectPaintProperties();
414 415
415 private: 416 private:
416 ////////////////////////////////////////// 417 //////////////////////////////////////////
417 // Helper functions. Dangerous to use! 418 // Helper functions. Dangerous to use!
418 void setPreviousSibling(LayoutObject* previous) { m_previous = previous; } 419 void setPreviousSibling(LayoutObject* previous) { m_previous = previous; }
419 void setNextSibling(LayoutObject* next) { m_next = next; } 420 void setNextSibling(LayoutObject* next) { m_next = next; }
420 void setParent(LayoutObject* parent) 421 void setParent(LayoutObject* parent)
421 { 422 {
422 m_parent = parent; 423 m_parent = parent;
423 424
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 1381
1381 void invalidateDisplayItemClientsIncludingNonCompositingDescendants(PaintInv alidationReason) const; 1382 void invalidateDisplayItemClientsIncludingNonCompositingDescendants(PaintInv alidationReason) const;
1382 1383
1383 // Called before anonymousChild.setStyle(). Override to set custom styles fo r the child. 1384 // Called before anonymousChild.setStyle(). Override to set custom styles fo r the child.
1384 virtual void updateAnonymousChildStyle(const LayoutObject& anonymousChild, C omputedStyle& style) const { } 1385 virtual void updateAnonymousChildStyle(const LayoutObject& anonymousChild, C omputedStyle& style) const { }
1385 1386
1386 // Painters can use const methods only, except for these explicitly declared methods. 1387 // Painters can use const methods only, except for these explicitly declared methods.
1387 class MutableForPainting { 1388 class MutableForPainting {
1388 public: 1389 public:
1389 void setPreviousPaintOffset(const LayoutPoint& paintOffset) { m_layoutOb ject.setPreviousPaintOffset(paintOffset); } 1390 void setPreviousPaintOffset(const LayoutPoint& paintOffset) { m_layoutOb ject.setPreviousPaintOffset(paintOffset); }
1390 ObjectPaintProperties& ensureObjectPaintProperties() { return m_layoutOb ject.ensureObjectPaintProperties(); }
1391 void clearObjectPaintProperties() { m_layoutObject.clearObjectPaintPrope rties(); }
1392 PaintInvalidationReason invalidatePaintIfNeeded(const PaintInvalidationS tate& paintInvalidationState) { return m_layoutObject.invalidatePaintIfNeeded(pa intInvalidationState); } 1391 PaintInvalidationReason invalidatePaintIfNeeded(const PaintInvalidationS tate& paintInvalidationState) { return m_layoutObject.invalidatePaintIfNeeded(pa intInvalidationState); }
1393 void clearPaintInvalidationFlags(const PaintInvalidationState& paintInva lidationState) { m_layoutObject.clearPaintInvalidationFlags(paintInvalidationSta te); } 1392 void clearPaintInvalidationFlags(const PaintInvalidationState& paintInva lidationState) { m_layoutObject.clearPaintInvalidationFlags(paintInvalidationSta te); }
1394 void setShouldDoDelayedFullPaintInvalidation() { m_layoutObject.setShoul dDoFullPaintInvalidation(PaintInvalidationDelayedFull); } 1393 void setShouldDoDelayedFullPaintInvalidation() { m_layoutObject.setShoul dDoFullPaintInvalidation(PaintInvalidationDelayedFull); }
1395 1394
1396 private: 1395 private:
1396 friend class PaintPropertyTreeBuilder;
1397 // The following two functions can be called from PaintPropertyTreeBuild er only.
1398 ObjectPaintProperties& ensureObjectPaintProperties() { return m_layoutOb ject.ensureObjectPaintProperties(); }
1399 ObjectPaintProperties* objectPaintProperties() { return const_cast<Objec tPaintProperties*>(m_layoutObject.objectPaintProperties()); }
1400
1397 friend class LayoutObject; 1401 friend class LayoutObject;
1398 MutableForPainting(const LayoutObject& layoutObject) : m_layoutObject(co nst_cast<LayoutObject&>(layoutObject)) { } 1402 MutableForPainting(const LayoutObject& layoutObject) : m_layoutObject(co nst_cast<LayoutObject&>(layoutObject)) { }
1399 1403
1400 LayoutObject& m_layoutObject; 1404 LayoutObject& m_layoutObject;
1401 }; 1405 };
1402 MutableForPainting getMutableForPainting() const { return MutableForPainting (*this); } 1406 MutableForPainting getMutableForPainting() const { return MutableForPainting (*this); }
1403 1407
1404 void setIsScrollAnchorObject() { m_bitfields.setIsScrollAnchorObject(true); } 1408 void setIsScrollAnchorObject() { m_bitfields.setIsScrollAnchorObject(true); }
1405 // Clears the IsScrollAnchorObject bit, unless any ScrollAnchor still refers to us. 1409 // Clears the IsScrollAnchorObject bit, unless any ScrollAnchor still refers to us.
1406 void maybeClearIsScrollAnchorObject(); 1410 void maybeClearIsScrollAnchorObject();
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
2183 void showTree(const blink::LayoutObject*); 2187 void showTree(const blink::LayoutObject*);
2184 void showLineTree(const blink::LayoutObject*); 2188 void showLineTree(const blink::LayoutObject*);
2185 void showLayoutTree(const blink::LayoutObject* object1); 2189 void showLayoutTree(const blink::LayoutObject* object1);
2186 // We don't make object2 an optional parameter so that showLayoutTree 2190 // We don't make object2 an optional parameter so that showLayoutTree
2187 // can be called from gdb easily. 2191 // can be called from gdb easily.
2188 void showLayoutTree(const blink::LayoutObject* object1, const blink::LayoutObjec t* object2); 2192 void showLayoutTree(const blink::LayoutObject* object1, const blink::LayoutObjec t* object2);
2189 2193
2190 #endif 2194 #endif
2191 2195
2192 #endif // LayoutObject_h 2196 #endif // LayoutObject_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698