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

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

Issue 2208463003: First step of PaintInvalidator implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 years, 4 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) 2004, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 12 matching lines...) Expand all
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "core/layout/LayoutHTMLCanvas.h" 26 #include "core/layout/LayoutHTMLCanvas.h"
27 27
28 #include "core/frame/FrameView.h" 28 #include "core/frame/FrameView.h"
29 #include "core/frame/LocalFrame.h" 29 #include "core/frame/LocalFrame.h"
30 #include "core/html/HTMLCanvasElement.h" 30 #include "core/html/HTMLCanvasElement.h"
31 #include "core/layout/LayoutView.h" 31 #include "core/layout/LayoutView.h"
32 #include "core/page/Page.h" 32 #include "core/page/Page.h"
33 #include "core/paint/HTMLCanvasPaintInvalidator.h"
33 #include "core/paint/HTMLCanvasPainter.h" 34 #include "core/paint/HTMLCanvasPainter.h"
34 35
35 namespace blink { 36 namespace blink {
36 37
37 using namespace HTMLNames; 38 using namespace HTMLNames;
38 39
39 LayoutHTMLCanvas::LayoutHTMLCanvas(HTMLCanvasElement* element) 40 LayoutHTMLCanvas::LayoutHTMLCanvas(HTMLCanvasElement* element)
40 : LayoutReplaced(element, LayoutSize(element->size())) 41 : LayoutReplaced(element, LayoutSize(element->size()))
41 { 42 {
42 view()->frameView()->setIsVisuallyNonEmpty(); 43 view()->frameView()->setIsVisuallyNonEmpty();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // check above is insufficient because updateLogical{Width,Height} just 77 // check above is insufficient because updateLogical{Width,Height} just
77 // used the override size. We actually have to mark ourselves as needing 78 // used the override size. We actually have to mark ourselves as needing
78 // layout so the flex algorithm can run and compute our size correctly. 79 // layout so the flex algorithm can run and compute our size correctly.
79 return; 80 return;
80 } 81 }
81 82
82 if (!selfNeedsLayout()) 83 if (!selfNeedsLayout())
83 setNeedsLayout(LayoutInvalidationReason::SizeChanged); 84 setNeedsLayout(LayoutInvalidationReason::SizeChanged);
84 } 85 }
85 86
86 PaintInvalidationReason LayoutHTMLCanvas::invalidatePaintIfNeeded(const PaintInv alidationState& paintInvalidationState) 87 PaintInvalidationReason LayoutHTMLCanvas::invalidatePaintIfNeeded(const PaintInv alidatorContext& context) const
87 { 88 {
88 PaintInvalidationReason reason = LayoutBox::invalidatePaintIfNeeded(paintInv alidationState); 89 return HTMLCanvasPaintInvalidator(*this, context).invalidatePaintIfNeeded();
89 HTMLCanvasElement* element = toHTMLCanvasElement(node());
90 if (element->isDirty()) {
91 element->doDeferredPaintInvalidation();
92 if (reason < PaintInvalidationRectangle)
93 reason = PaintInvalidationRectangle;
94 }
95 return reason;
96 } 90 }
97 91
98 CompositingReasons LayoutHTMLCanvas::additionalCompositingReasons() const 92 CompositingReasons LayoutHTMLCanvas::additionalCompositingReasons() const
99 { 93 {
100 if (toHTMLCanvasElement(node())->shouldBeDirectComposited()) 94 if (toHTMLCanvasElement(node())->shouldBeDirectComposited())
101 return CompositingReasonCanvas; 95 return CompositingReasonCanvas;
102 return CompositingReasonNone; 96 return CompositingReasonNone;
103 } 97 }
104 98
105 void LayoutHTMLCanvas::styleDidChange(StyleDifference diff, const ComputedStyle* oldStyle) 99 void LayoutHTMLCanvas::styleDidChange(StyleDifference diff, const ComputedStyle* oldStyle)
106 { 100 {
107 LayoutReplaced::styleDidChange(diff, oldStyle); 101 LayoutReplaced::styleDidChange(diff, oldStyle);
108 toHTMLCanvasElement(node())->styleDidChange(oldStyle, styleRef()); 102 toHTMLCanvasElement(node())->styleDidChange(oldStyle, styleRef());
109 } 103 }
110 104
111 } // namespace blink 105 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutHTMLCanvas.h ('k') | third_party/WebKit/Source/core/layout/LayoutObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698