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

Side by Side Diff: Source/core/layout/LayoutMedia.cpp

Issue 1018593004: Implement <video controls> dodging for text track layout (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ready for review Created 5 years, 9 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 void LayoutMedia::layout() 50 void LayoutMedia::layout()
51 { 51 {
52 LayoutSize oldSize = contentBoxRect().size(); 52 LayoutSize oldSize = contentBoxRect().size();
53 53
54 LayoutImage::layout(); 54 LayoutImage::layout();
55 55
56 LayoutSize newSize = contentBoxRect().size(); 56 LayoutSize newSize = contentBoxRect().size();
57 57
58 LayoutState state(*this, locationOffset()); 58 LayoutState state(*this, locationOffset());
59 59
60 for (LayoutObject* child = m_children.firstChild(); child; child = child->ne xtSibling()) { 60 // Iterate the children in reverse order so that the media controls are laid
61 ASSERT(child->node()->isMediaControls() || child->node()->isTextTrackCon tainer()); 61 // out before the text track container. This is to ensure that the text
62 // track rendering has an up-to-date position of the media controls for
63 // overlap checking, see LayoutVTTCue.
64 #if ENABLE(ASSERT)
65 bool seenTextTrackContainer = false;
philipj_slow 2015/03/20 05:58:19 What do you think, way overkill? If you prefer I c
fs 2015/03/20 09:58:54 I don't mind that much, but it does give the impre
philipj_slow 2015/03/20 16:46:33 Yeah, it's ugly alright. I've tinkered a bit on a
66 #endif
67 for (LayoutObject* child = m_children.lastChild(); child; child = child->pre viousSibling()) {
68 #if ENABLE(ASSERT)
69 if (child->node()->isMediaControls())
70 ASSERT(!seenTextTrackContainer);
71 else if (child->node()->isTextTrackContainer())
72 seenTextTrackContainer = true;
73 else
74 ASSERT_NOT_REACHED();
75 #endif
62 76
63 if (newSize == oldSize && !child->needsLayout()) 77 if (newSize == oldSize && !child->needsLayout())
64 continue; 78 continue;
65 79
66 LayoutBox* layoutBox = toLayoutBox(child); 80 LayoutBox* layoutBox = toLayoutBox(child);
67 layoutBox->setLocation(LayoutPoint(borderLeft(), borderTop()) + LayoutSi ze(paddingLeft(), paddingTop())); 81 layoutBox->setLocation(LayoutPoint(borderLeft(), borderTop()) + LayoutSi ze(paddingLeft(), paddingTop()));
68 layoutBox->style()->setHeight(Length(newSize.height(), Fixed)); 82 layoutBox->style()->setHeight(Length(newSize.height(), Fixed));
69 layoutBox->style()->setWidth(Length(newSize.width(), Fixed)); 83 layoutBox->style()->setWidth(Length(newSize.width(), Fixed));
70 layoutBox->forceLayout(); 84 layoutBox->forceLayout();
71 } 85 }
(...skipping 20 matching lines...) Expand all
92 return true; 106 return true;
93 107
94 return false; 108 return false;
95 } 109 }
96 110
97 void LayoutMedia::paintReplaced(const PaintInfo&, const LayoutPoint&) 111 void LayoutMedia::paintReplaced(const PaintInfo&, const LayoutPoint&)
98 { 112 {
99 } 113 }
100 114
101 } // namespace blink 115 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698