| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Victor Carbune (victor@rosedu.org) | 2 * Copyright (C) 2012 Victor Carbune (victor@rosedu.org) |
| 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 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| 38 class SnapToLinesLayouter { | 38 class SnapToLinesLayouter { |
| 39 STACK_ALLOCATED(); | 39 STACK_ALLOCATED(); |
| 40 | 40 |
| 41 public: | 41 public: |
| 42 SnapToLinesLayouter(LayoutVTTCue& cueBox, const IntRect& controlsRect) | 42 SnapToLinesLayouter(LayoutVTTCue& cueBox, const IntRect& controlsRect) |
| 43 : m_cueBox(cueBox), m_controlsRect(controlsRect), m_margin(0.0) { | 43 : m_cueBox(cueBox), m_controlsRect(controlsRect), m_margin(0.0) { |
| 44 if (Settings* settings = m_cueBox.document().settings()) | 44 if (Settings* settings = m_cueBox.document().settings()) |
| 45 m_margin = settings->textTrackMarginPercentage() / 100.0; | 45 m_margin = settings->getTextTrackMarginPercentage() / 100.0; |
| 46 } | 46 } |
| 47 | 47 |
| 48 void layout(); | 48 void layout(); |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 bool isOutside(const IntRect&) const; | 51 bool isOutside(const IntRect&) const; |
| 52 bool isOverlapping() const; | 52 bool isOverlapping() const; |
| 53 LayoutUnit computeInitialPositionAdjustment(LayoutUnit&, | 53 LayoutUnit computeInitialPositionAdjustment(LayoutUnit&, |
| 54 LayoutUnit, | 54 LayoutUnit, |
| 55 LayoutUnit) const; | 55 LayoutUnit) const; |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 LayoutState state(*this); | 358 LayoutState state(*this); |
| 359 | 359 |
| 360 // http://dev.w3.org/html5/webvtt/#dfn-apply-webvtt-cue-settings - step 13. | 360 // http://dev.w3.org/html5/webvtt/#dfn-apply-webvtt-cue-settings - step 13. |
| 361 if (!std::isnan(m_snapToLinesPosition)) | 361 if (!std::isnan(m_snapToLinesPosition)) |
| 362 SnapToLinesLayouter(*this, computeControlsRect()).layout(); | 362 SnapToLinesLayouter(*this, computeControlsRect()).layout(); |
| 363 else | 363 else |
| 364 repositionCueSnapToLinesNotSet(); | 364 repositionCueSnapToLinesNotSet(); |
| 365 } | 365 } |
| 366 | 366 |
| 367 } // namespace blink | 367 } // namespace blink |
| OLD | NEW |