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

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

Issue 2111623002: Canvas objects did not mark themselves for layout when they're a flex item (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 void LayoutHTMLCanvas::paintReplaced(const PaintInfo& paintInfo, const LayoutPoi nt& paintOffset) const 50 void LayoutHTMLCanvas::paintReplaced(const PaintInfo& paintInfo, const LayoutPoi nt& paintOffset) const
51 { 51 {
52 HTMLCanvasPainter(*this).paintReplaced(paintInfo, paintOffset); 52 HTMLCanvasPainter(*this).paintReplaced(paintInfo, paintOffset);
53 } 53 }
54 54
55 void LayoutHTMLCanvas::canvasSizeChanged() 55 void LayoutHTMLCanvas::canvasSizeChanged()
56 { 56 {
57 IntSize canvasSize = toHTMLCanvasElement(node())->size(); 57 IntSize canvasSize = toHTMLCanvasElement(node())->size();
58 LayoutSize zoomedSize(canvasSize.width() * style()->effectiveZoom(), canvasS ize.height() * style()->effectiveZoom()); 58 LayoutSize zoomedSize(canvasSize.width() * style()->effectiveZoom(), canvasS ize.height() * style()->effectiveZoom());
59 59
60 if (zoomedSize == intrinsicSize()) 60 if (zoomedSize == intrinsicSize()) {
eae 2016/06/29 20:20:13 Please either revert this style only change or cha
cbiesinger 2016/06/29 20:36:51 Ah, oops, that was an accidental leftover.
61 return; 61 return;
62 }
62 63
63 setIntrinsicSize(zoomedSize); 64 setIntrinsicSize(zoomedSize);
64 65
65 if (!parent()) 66 if (!parent()) {
66 return; 67 return;
68 }
67 69
68 if (!preferredLogicalWidthsDirty()) 70 if (!preferredLogicalWidthsDirty())
69 setPreferredLogicalWidthsDirty(); 71 setPreferredLogicalWidthsDirty();
70 72
71 LayoutSize oldSize = size(); 73 LayoutSize oldSize = size();
72 updateLogicalWidth(); 74 updateLogicalWidth();
73 updateLogicalHeight(); 75 updateLogicalHeight();
74 if (oldSize == size()) 76 if (oldSize == size() && !hasOverrideLogicalContentWidth() && !hasOverrideLo gicalContentHeight()) {
77 // If we have an override size, then we're probably a flex item, and the
eae 2016/06/29 20:20:13 Nice comment!
78 // check above is insufficient because updateLogical{Width,Height} just
79 // used the override size. We actually have to mark ourselves as needing
80 // layout so the flex algorithm can run and compute our size correctly.
75 return; 81 return;
82 }
76 83
77 if (!selfNeedsLayout()) 84 if (!selfNeedsLayout())
78 setNeedsLayout(LayoutInvalidationReason::SizeChanged); 85 setNeedsLayout(LayoutInvalidationReason::SizeChanged);
79 } 86 }
80 87
81 PaintInvalidationReason LayoutHTMLCanvas::invalidatePaintIfNeeded(const PaintInv alidationState& paintInvalidationState) 88 PaintInvalidationReason LayoutHTMLCanvas::invalidatePaintIfNeeded(const PaintInv alidationState& paintInvalidationState)
82 { 89 {
83 PaintInvalidationReason reason = LayoutBox::invalidatePaintIfNeeded(paintInv alidationState); 90 PaintInvalidationReason reason = LayoutBox::invalidatePaintIfNeeded(paintInv alidationState);
84 HTMLCanvasElement* element = toHTMLCanvasElement(node()); 91 HTMLCanvasElement* element = toHTMLCanvasElement(node());
85 if (element->isDirty()) { 92 if (element->isDirty()) {
(...skipping 11 matching lines...) Expand all
97 return CompositingReasonNone; 104 return CompositingReasonNone;
98 } 105 }
99 106
100 void LayoutHTMLCanvas::styleDidChange(StyleDifference diff, const ComputedStyle* oldStyle) 107 void LayoutHTMLCanvas::styleDidChange(StyleDifference diff, const ComputedStyle* oldStyle)
101 { 108 {
102 LayoutReplaced::styleDidChange(diff, oldStyle); 109 LayoutReplaced::styleDidChange(diff, oldStyle);
103 toHTMLCanvasElement(node())->styleDidChange(oldStyle, styleRef()); 110 toHTMLCanvasElement(node())->styleDidChange(oldStyle, styleRef());
104 } 111 }
105 112
106 } // namespace blink 113 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698