Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 if (updateSizes(toLayoutVideo(*mediaLayoutObject))) | 52 if (updateSizes(toLayoutVideo(*mediaLayoutObject))) |
| 53 toElement(node())->setInlineStyleProperty(CSSPropertyFontSize, m_fontSiz e, CSSPrimitiveValue::UnitType::Pixels); | 53 toElement(node())->setInlineStyleProperty(CSSPropertyFontSize, m_fontSiz e, CSSPrimitiveValue::UnitType::Pixels); |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool LayoutTextTrackContainer::updateSizes(const LayoutVideo& videoLayoutObject) | 56 bool LayoutTextTrackContainer::updateSizes(const LayoutVideo& videoLayoutObject) |
| 57 { | 57 { |
| 58 // FIXME: The video size is used to calculate the font size (a workaround | 58 // FIXME: The video size is used to calculate the font size (a workaround |
| 59 // for lack of per-spec vh/vw support) but the whole media element is used | 59 // for lack of per-spec vh/vw support) but the whole media element is used |
| 60 // for cue rendering. This is inconsistent. See also the somewhat related | 60 // for cue rendering. This is inconsistent. See also the somewhat related |
| 61 // spec bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28105 | 61 // spec bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28105 |
| 62 IntSize videoSize = videoLayoutObject.videoBox().size(); | 62 LayoutSize videoSize = videoLayoutObject.videoBox().size(); |
|
chrishtr
2016/07/21 18:02:31
Why the changes here? videoBox() has integer size.
| |
| 63 if (m_videoSize == videoSize) | |
| 64 return false; | |
| 65 m_videoSize = videoSize; | |
| 66 | 63 |
| 67 float smallestDimension = std::min(m_videoSize.height(), m_videoSize.width() ); | 64 float smallestDimension = std::min(videoSize.height(), videoSize.width()).to Float(); |
| 68 | 65 |
| 69 float fontSize = smallestDimension * 0.05f; | 66 float fontSize = smallestDimension * 0.05f; |
| 70 if (m_fontSize == fontSize) | 67 if (m_fontSize == fontSize) |
| 71 return false; | 68 return false; |
| 72 m_fontSize = fontSize; | 69 m_fontSize = fontSize; |
| 73 return true; | 70 return true; |
| 74 } | 71 } |
| 75 | 72 |
| 76 } // namespace blink | 73 } // namespace blink |
| OLD | NEW |