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

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

Issue 2802593004: Move RarePaintData to its own file (Closed)
Patch Set: Created 3 years, 8 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. 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2009 Google Inc. All rights reserved. 8 * Copyright (C) 2009 Google Inc. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 23 matching lines...) Expand all
34 #include "core/layout/LayoutObjectChildList.h" 34 #include "core/layout/LayoutObjectChildList.h"
35 #include "core/layout/MapCoordinatesFlags.h" 35 #include "core/layout/MapCoordinatesFlags.h"
36 #include "core/layout/ScrollAlignment.h" 36 #include "core/layout/ScrollAlignment.h"
37 #include "core/layout/SubtreeLayoutScope.h" 37 #include "core/layout/SubtreeLayoutScope.h"
38 #include "core/layout/api/HitTestAction.h" 38 #include "core/layout/api/HitTestAction.h"
39 #include "core/layout/api/SelectionState.h" 39 #include "core/layout/api/SelectionState.h"
40 #include "core/layout/compositing/CompositingState.h" 40 #include "core/layout/compositing/CompositingState.h"
41 #include "core/loader/resource/ImageResourceObserver.h" 41 #include "core/loader/resource/ImageResourceObserver.h"
42 #include "core/paint/LayerHitTestRects.h" 42 #include "core/paint/LayerHitTestRects.h"
43 #include "core/paint/PaintPhase.h" 43 #include "core/paint/PaintPhase.h"
44 #include "core/paint/RarePaintData.h"
44 #include "core/style/ComputedStyle.h" 45 #include "core/style/ComputedStyle.h"
45 #include "platform/geometry/FloatQuad.h" 46 #include "platform/geometry/FloatQuad.h"
46 #include "platform/geometry/LayoutRect.h" 47 #include "platform/geometry/LayoutRect.h"
47 #include "platform/geometry/TransformState.h" 48 #include "platform/geometry/TransformState.h"
48 #include "platform/graphics/CompositingReasons.h" 49 #include "platform/graphics/CompositingReasons.h"
49 #include "platform/graphics/PaintInvalidationReason.h" 50 #include "platform/graphics/PaintInvalidationReason.h"
50 #include "platform/graphics/paint/DisplayItemClient.h" 51 #include "platform/graphics/paint/DisplayItemClient.h"
51 #include "platform/transforms/TransformationMatrix.h" 52 #include "platform/transforms/TransformationMatrix.h"
52 #include "wtf/AutoReset.h" 53 #include "wtf/AutoReset.h"
53 54
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); 409 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled());
409 if (m_rarePaintData) 410 if (m_rarePaintData)
410 return m_rarePaintData->localBorderBoxProperties(); 411 return m_rarePaintData->localBorderBoxProperties();
411 return nullptr; 412 return nullptr;
412 } 413 }
413 414
414 // The complete set of property nodes that should be used as a starting point 415 // The complete set of property nodes that should be used as a starting point
415 // to paint contents of this LayoutObject. See: m_contentsProperties comment. 416 // to paint contents of this LayoutObject. See: m_contentsProperties comment.
416 const PropertyTreeState* contentsProperties() const { 417 const PropertyTreeState* contentsProperties() const {
417 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); 418 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled());
418 if (m_rarePaintData) 419 return m_rarePaintData ? m_rarePaintData->contentsProperties() : nullptr;
419 return m_rarePaintData->contentsProperties();
420 return nullptr;
421 } 420 }
422 421
423 private: 422 private:
424 // This is for paint-related data that is not needed on all LayoutObjects.
425 // TODO(pdr): Store LayoutBoxModelObject's m_paintLayer in this structure.
426 class CORE_EXPORT RarePaintData {
427 WTF_MAKE_NONCOPYABLE(RarePaintData);
428 USING_FAST_MALLOC(RarePaintData);
429
430 public:
431 RarePaintData();
432 ~RarePaintData();
433
434 ObjectPaintProperties* paintProperties() const {
435 return m_paintProperties.get();
436 }
437 ObjectPaintProperties& ensurePaintProperties();
438
439 PropertyTreeState* localBorderBoxProperties() const {
440 return m_localBorderBoxProperties.get();
441 }
442
443 void clearLocalBorderBoxProperties();
444 void setLocalBorderBoxProperties(PropertyTreeState&);
445 const PropertyTreeState* contentsProperties() const;
446
447 private:
448 // Holds references to the paint property nodes created by this object.
449 std::unique_ptr<ObjectPaintProperties> m_paintProperties;
450
451 // This is a complete set of property nodes that should be used as a
452 // starting point to paint a LayoutObject. This data is cached because some
453 // properties inherit from the containing block chain instead of the
454 // painting parent and cannot be derived in O(1) during the paint walk.
455 //
456 // For example: <div style='opacity: 0.3;'/>
457 // The div's local border box properties would have an opacity 0.3 effect
458 // node. Even though the div has no transform, its local border box
459 // properties would have a transform node that points to the div's
460 // ancestor transform space.
461 std::unique_ptr<PropertyTreeState> m_localBorderBoxProperties;
462
463 // This is the complete set of property nodes that can be used to paint the
464 // contents of this object. It is similar to m_localBorderBoxProperties but
465 // includes properties (e.g., overflow clip, scroll translation) that apply
466 // to contents. This cached value is derived from m_localBorderBoxProperties
467 // and m_paintProperties and should be invalidated when these change.
468 mutable std::unique_ptr<PropertyTreeState> m_contentsProperties;
469 };
470
471 RarePaintData& ensureRarePaintData(); 423 RarePaintData& ensureRarePaintData();
472 RarePaintData* rarePaintData() { return m_rarePaintData.get(); } 424 RarePaintData* rarePaintData() { return m_rarePaintData.get(); }
473 425
474 ////////////////////////////////////////// 426 //////////////////////////////////////////
475 // Helper functions. Dangerous to use! 427 // Helper functions. Dangerous to use!
476 void setPreviousSibling(LayoutObject* previous) { m_previous = previous; } 428 void setPreviousSibling(LayoutObject* previous) { m_previous = previous; }
477 void setNextSibling(LayoutObject* next) { m_next = next; } 429 void setNextSibling(LayoutObject* next) { m_next = next; }
478 void setParent(LayoutObject* parent) { 430 void setParent(LayoutObject* parent) {
479 m_parent = parent; 431 m_parent = parent;
480 432
(...skipping 2382 matching lines...) Expand 10 before | Expand all | Expand 10 after
2863 CORE_EXPORT void showLineTree(const blink::LayoutObject*); 2815 CORE_EXPORT void showLineTree(const blink::LayoutObject*);
2864 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); 2816 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1);
2865 // We don't make object2 an optional parameter so that showLayoutTree 2817 // We don't make object2 an optional parameter so that showLayoutTree
2866 // can be called from gdb easily. 2818 // can be called from gdb easily.
2867 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, 2819 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1,
2868 const blink::LayoutObject* object2); 2820 const blink::LayoutObject* object2);
2869 2821
2870 #endif 2822 #endif
2871 2823
2872 #endif // LayoutObject_h 2824 #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