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

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

Issue 949203002: Separate the text track container from the media controls (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: address nits 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
« no previous file with comments | « Source/core/layout/LayoutMedia.cpp ('k') | no next file » | 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) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Google Inc. 3 * Copyright (C) 2012 Google Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 29 matching lines...) Expand all
40 } 40 }
41 41
42 void LayoutTextTrackContainer::layout() 42 void LayoutTextTrackContainer::layout()
43 { 43 {
44 LayoutBlockFlow::layout(); 44 LayoutBlockFlow::layout();
45 if (style()->display() == NONE) 45 if (style()->display() == NONE)
46 return; 46 return;
47 47
48 DeprecatedScheduleStyleRecalcDuringLayout marker(node()->document().lifecycl e()); 48 DeprecatedScheduleStyleRecalcDuringLayout marker(node()->document().lifecycl e());
49 49
50 // Overlay enclosure -> Media controls -> Media element 50 LayoutObject* mediaLayoutObject = parent();
51 LayoutObject* mediaElementLayoutObject = parent()->parent()->parent(); 51 if (!mediaLayoutObject || !mediaLayoutObject->isVideo())
52 if (!mediaElementLayoutObject || !mediaElementLayoutObject->isVideo())
53 return; 52 return;
54 if (updateSizes(toLayoutVideo(*mediaElementLayoutObject))) 53 if (updateSizes(toLayoutVideo(*mediaLayoutObject)))
55 toElement(node())->setInlineStyleProperty(CSSPropertyFontSize, m_fontSiz e, CSSPrimitiveValue::CSS_PX); 54 toElement(node())->setInlineStyleProperty(CSSPropertyFontSize, m_fontSiz e, CSSPrimitiveValue::CSS_PX);
56 } 55 }
57 56
58 bool LayoutTextTrackContainer::updateSizes(const LayoutVideo& videoLayoutObject) 57 bool LayoutTextTrackContainer::updateSizes(const LayoutVideo& videoLayoutObject)
59 { 58 {
60 // FIXME: The video size is used to calculate the font size (a workaround 59 // FIXME: The video size is used to calculate the font size (a workaround
61 // for lack of per-spec vh/vw support) but the whole media element is used 60 // for lack of per-spec vh/vw support) but the whole media element is used
62 // for cue rendering. This is inconsistent. See also the somewhat related 61 // for cue rendering. This is inconsistent. See also the somewhat related
63 // spec bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28105 62 // spec bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28105
64 IntSize videoSize = videoLayoutObject.videoBox().size(); 63 IntSize videoSize = videoLayoutObject.videoBox().size();
65 if (m_videoSize == videoSize) 64 if (m_videoSize == videoSize)
66 return false; 65 return false;
67 m_videoSize = videoSize; 66 m_videoSize = videoSize;
68 67
69 float smallestDimension = std::min(m_videoSize.height(), m_videoSize.width() ); 68 float smallestDimension = std::min(m_videoSize.height(), m_videoSize.width() );
70 69
71 float fontSize = smallestDimension * 0.05f; 70 float fontSize = smallestDimension * 0.05f;
72 if (m_fontSize == fontSize) 71 if (m_fontSize == fontSize)
73 return false; 72 return false;
74 m_fontSize = fontSize; 73 m_fontSize = fontSize;
75 return true; 74 return true;
76 } 75 }
77 76
78 } // namespace blink 77 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutMedia.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698