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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // for cue rendering. This is inconsistent. See also the somewhat related | 58 // for cue rendering. This is inconsistent. See also the somewhat related |
59 // spec bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28105 | 59 // spec bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28105 |
60 LayoutSize videoSize = videoLayoutObject.replacedContentRect().size(); | 60 LayoutSize videoSize = videoLayoutObject.replacedContentRect().size(); |
61 | 61 |
62 float smallestDimension = | 62 float smallestDimension = |
63 std::min(videoSize.height().toFloat(), videoSize.width().toFloat()); | 63 std::min(videoSize.height().toFloat(), videoSize.width().toFloat()); |
64 | 64 |
65 float fontSize = smallestDimension * 0.05f; | 65 float fontSize = smallestDimension * 0.05f; |
66 | 66 |
67 // Avoid excessive FP precision issue. | 67 // Avoid excessive FP precision issue. |
68 // C11 5.2.4.2.2:9 requires assignment and cast to remove extra precision, but
the behavior | 68 // C11 5.2.4.2.2:9 requires assignment and cast to remove extra precision, but |
69 // is currently not portable. fontSize may have precision higher than m_fontSi
ze thus | 69 // the behavior is currently not portable. fontSize may have precision higher |
70 // straight comparison can fail despite they cast to the same float value. | 70 // than m_fontSize thus straight comparison can fail despite they cast to the |
| 71 // same float value. |
71 volatile float& m_fontSize = this->m_fontSize; | 72 volatile float& m_fontSize = this->m_fontSize; |
72 float oldFontSize = m_fontSize; | 73 float oldFontSize = m_fontSize; |
73 m_fontSize = fontSize; | 74 m_fontSize = fontSize; |
74 return m_fontSize != oldFontSize; | 75 return m_fontSize != oldFontSize; |
75 } | 76 } |
76 | 77 |
77 } // namespace blink | 78 } // namespace blink |
OLD | NEW |