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

Side by Side Diff: third_party/WebKit/Source/core/html/TimeRanges.cpp

Issue 2470233009: WTF/std normalization: replace WTF::Vector::first() with ::front() (Closed)
Patch Set: rebase 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2009, 2010 Apple Inc. All rights reserved.
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 59
60 void TimeRanges::invert() { 60 void TimeRanges::invert() {
61 TimeRanges* inverted = TimeRanges::create(); 61 TimeRanges* inverted = TimeRanges::create();
62 double posInf = std::numeric_limits<double>::infinity(); 62 double posInf = std::numeric_limits<double>::infinity();
63 double negInf = -std::numeric_limits<double>::infinity(); 63 double negInf = -std::numeric_limits<double>::infinity();
64 64
65 if (!m_ranges.size()) { 65 if (!m_ranges.size()) {
66 inverted->add(negInf, posInf); 66 inverted->add(negInf, posInf);
67 } else { 67 } else {
68 double start = m_ranges.first().m_start; 68 double start = m_ranges.front().m_start;
69 if (start != negInf) 69 if (start != negInf)
70 inverted->add(negInf, start); 70 inverted->add(negInf, start);
71 71
72 for (size_t index = 0; index + 1 < m_ranges.size(); ++index) 72 for (size_t index = 0; index + 1 < m_ranges.size(); ++index)
73 inverted->add(m_ranges[index].m_end, m_ranges[index + 1].m_start); 73 inverted->add(m_ranges[index].m_end, m_ranges[index + 1].m_start);
74 74
75 double end = m_ranges.back().m_end; 75 double end = m_ranges.back().m_end;
76 if (end != posInf) 76 if (end != posInf)
77 inverted->add(end, posInf); 77 inverted->add(end, posInf);
78 } 78 }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 if (delta < bestDelta || 202 if (delta < bestDelta ||
203 (delta == bestDelta && 203 (delta == bestDelta &&
204 std::abs(currentPlaybackPosition - match) < 204 std::abs(currentPlaybackPosition - match) <
205 std::abs(currentPlaybackPosition - bestMatch))) { 205 std::abs(currentPlaybackPosition - bestMatch))) {
206 bestDelta = delta; 206 bestDelta = delta;
207 bestMatch = match; 207 bestMatch = match;
208 } 208 }
209 } 209 }
210 return bestMatch; 210 return bestMatch;
211 } 211 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698