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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutVTTCue.cpp

Issue 2595833002: Replaced usages of WritingMode to use inline utility functions instead (Closed)
Patch Set: Rebase and fixed ::blink with just blink:: Created 4 years 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTableCell.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) 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 LayoutUnit maxDimension, 78 LayoutUnit maxDimension,
79 LayoutUnit margin) const { 79 LayoutUnit margin) const {
80 DCHECK(std::isfinite(m_cueBox.snapToLinesPosition())); 80 DCHECK(std::isfinite(m_cueBox.snapToLinesPosition()));
81 81
82 // 6. Let line be cue's computed line. 82 // 6. Let line be cue's computed line.
83 // 7. Round line to an integer by adding 0.5 and then flooring it. 83 // 7. Round line to an integer by adding 0.5 and then flooring it.
84 LayoutUnit linePosition(floorf(m_cueBox.snapToLinesPosition() + 0.5f)); 84 LayoutUnit linePosition(floorf(m_cueBox.snapToLinesPosition() + 0.5f));
85 85
86 WritingMode writingMode = m_cueBox.style()->getWritingMode(); 86 WritingMode writingMode = m_cueBox.style()->getWritingMode();
87 // 8. Vertical Growing Left: Add one to line then negate it. 87 // 8. Vertical Growing Left: Add one to line then negate it.
88 if (writingMode == RightToLeftWritingMode) 88 if (isFlippedBlocksWritingMode(writingMode))
89 linePosition = -(linePosition + 1); 89 linePosition = -(linePosition + 1);
90 90
91 // 9. Let position be the result of multiplying step and line offset. 91 // 9. Let position be the result of multiplying step and line offset.
92 LayoutUnit position = step * linePosition; 92 LayoutUnit position = step * linePosition;
93 93
94 // 10. Vertical Growing Left: Decrease position by the width of the 94 // 10. Vertical Growing Left: Decrease position by the width of the
95 // bounding box of the boxes in boxes, then increase position by step. 95 // bounding box of the boxes in boxes, then increase position by step.
96 if (writingMode == RightToLeftWritingMode) { 96 if (isFlippedBlocksWritingMode(writingMode)) {
97 position -= m_cueBox.size().width(); 97 position -= m_cueBox.size().width();
98 position += step; 98 position += step;
99 } 99 }
100 100
101 // 11. If line is less than zero... 101 // 11. If line is less than zero...
102 if (linePosition < 0) { 102 if (linePosition < 0) {
103 // ... then increase position by max dimension ... 103 // ... then increase position by max dimension ...
104 position += maxDimension; 104 position += maxDimension;
105 105
106 // ... and negate step. 106 // ... and negate step.
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTableCell.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698