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

Side by Side Diff: Source/core/rendering/RenderMedia.cpp

Issue 143323014: *** DO NOT LAND *** Attempt to understand Regions complexity Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010 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 11 matching lines...) Expand all
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
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 "config.h" 26 #include "config.h"
27 27
28 #include "core/rendering/RenderMedia.h" 28 #include "core/rendering/RenderMedia.h"
29 29
30 #include "core/html/HTMLMediaElement.h" 30 #include "core/html/HTMLMediaElement.h"
31 #include "core/rendering/LayoutRectRecorder.h" 31 #include "core/rendering/LayoutRectRecorder.h"
32 #include "core/rendering/RenderFlowThread.h"
33 #include "core/rendering/RenderView.h" 32 #include "core/rendering/RenderView.h"
34 33
35 namespace WebCore { 34 namespace WebCore {
36 35
37 RenderMedia::RenderMedia(HTMLMediaElement* video) 36 RenderMedia::RenderMedia(HTMLMediaElement* video)
38 : RenderImage(video) 37 : RenderImage(video)
39 { 38 {
40 setImageResource(RenderImageResource::create()); 39 setImageResource(RenderImageResource::create());
41 } 40 }
42 41
(...skipping 11 matching lines...) Expand all
54 LayoutRectRecorder recorder(*this); 53 LayoutRectRecorder recorder(*this);
55 LayoutSize oldSize = contentBoxRect().size(); 54 LayoutSize oldSize = contentBoxRect().size();
56 55
57 RenderImage::layout(); 56 RenderImage::layout();
58 57
59 RenderBox* controlsRenderer = toRenderBox(m_children.firstChild()); 58 RenderBox* controlsRenderer = toRenderBox(m_children.firstChild());
60 if (!controlsRenderer) 59 if (!controlsRenderer)
61 return; 60 return;
62 61
63 bool controlsNeedLayout = controlsRenderer->needsLayout(); 62 bool controlsNeedLayout = controlsRenderer->needsLayout();
64 // If the region chain has changed we also need to relayout the controls to update the region box info.
65 // FIXME: We can do better once we compute region box info for RenderReplace d, not only for RenderBlock.
66 const RenderFlowThread* flowThread = flowThreadContainingBlock();
67 if (flowThread && !controlsNeedLayout) {
68 if (flowThread->pageLogicalSizeChanged())
69 controlsNeedLayout = true;
70 }
71
72 LayoutSize newSize = contentBoxRect().size(); 63 LayoutSize newSize = contentBoxRect().size();
73 if (newSize == oldSize && !controlsNeedLayout) 64 if (newSize == oldSize && !controlsNeedLayout)
74 return; 65 return;
75 66
76 // When calling layout() on a child node, a parent must either push a Layout StateMaintainter, or 67 // When calling layout() on a child node, a parent must either push a Layout StateMaintainter, or
77 // instantiate LayoutStateDisabler. Since using a LayoutStateMaintainer is s lightly more efficient, 68 // instantiate LayoutStateDisabler. Since using a LayoutStateMaintainer is s lightly more efficient,
78 // and this method will be called many times per second during playback, use a LayoutStateMaintainer: 69 // and this method will be called many times per second during playback, use a LayoutStateMaintainer:
79 LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasTransfo rm() || hasReflection() || style()->isFlippedBlocksWritingMode()); 70 LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasTransfo rm() || hasReflection() || style()->isFlippedBlocksWritingMode());
80 71
81 controlsRenderer->setLocation(LayoutPoint(borderLeft(), borderTop()) + Layou tSize(paddingLeft(), paddingTop())); 72 controlsRenderer->setLocation(LayoutPoint(borderLeft(), borderTop()) + Layou tSize(paddingLeft(), paddingTop()));
82 controlsRenderer->style()->setHeight(Length(newSize.height(), Fixed)); 73 controlsRenderer->style()->setHeight(Length(newSize.height(), Fixed));
83 controlsRenderer->style()->setWidth(Length(newSize.width(), Fixed)); 74 controlsRenderer->style()->setWidth(Length(newSize.width(), Fixed));
84 controlsRenderer->forceLayout(); 75 controlsRenderer->forceLayout();
85 clearNeedsLayout(); 76 clearNeedsLayout();
86 77
87 statePusher.pop(); 78 statePusher.pop();
88 } 79 }
89 80
90 void RenderMedia::paintReplaced(PaintInfo&, const LayoutPoint&) 81 void RenderMedia::paintReplaced(PaintInfo&, const LayoutPoint&)
91 { 82 {
92 } 83 }
93 84
94 } // namespace WebCore 85 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderLayerStackingNode.cpp ('k') | Source/core/rendering/RenderMultiColumnBlock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698