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

Side by Side Diff: Source/core/html/track/vtt/VTTRegion.cpp

Issue 99083002: WIP: Migrate generated bindings to new ExceptionState constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase. Created 7 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 | « Source/core/html/track/vtt/VTTCue.cpp ('k') | Source/core/loader/appcache/ApplicationCache.cpp » ('j') | 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 // Default region line-height (vh units) 64 // Default region line-height (vh units)
65 static const float lineHeight = 5.33; 65 static const float lineHeight = 5.33;
66 66
67 // Default scrolling animation time period (s). 67 // Default scrolling animation time period (s).
68 static const float scrollTime = 0.433; 68 static const float scrollTime = 0.433;
69 69
70 static bool isInfiniteOrNonNumberOrNonPercentage(double value, const char* metho d, ExceptionState& exceptionState) 70 static bool isInfiniteOrNonNumberOrNonPercentage(double value, const char* metho d, ExceptionState& exceptionState)
71 { 71 {
72 if (!std::isfinite(value)) { 72 if (!std::isfinite(value)) {
73 exceptionState.throwTypeError(ExceptionMessages::failedToSet(method, "VT TRegion", ExceptionMessages::notAFiniteNumber(value))); 73 exceptionState.throwTypeError(ExceptionMessages::notAFiniteNumber(value) );
74 return true; 74 return true;
75 } 75 }
76 if (value < 0 || value > 100) { 76 if (value < 0 || value > 100) {
77 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::fail edToSet(method, "VTTRegion", "The value provided (" + String::number(value) + ") is not between 0 and 100.")); 77 exceptionState.throwDOMException(IndexSizeError, "The value provided (" + String::number(value) + ") is not between 0 and 100.");
78 return true; 78 return true;
79 } 79 }
80 return false; 80 return false;
81 } 81 }
82 82
83 VTTRegion::VTTRegion() 83 VTTRegion::VTTRegion()
84 : m_id(emptyString()) 84 : m_id(emptyString())
85 , m_width(defaultWidth) 85 , m_width(defaultWidth)
86 , m_heightInLines(defaultHeightInLines) 86 , m_heightInLines(defaultHeightInLines)
87 , m_regionAnchor(FloatPoint(defaultAnchorPointX, defaultAnchorPointY)) 87 , m_regionAnchor(FloatPoint(defaultAnchorPointX, defaultAnchorPointY))
(...skipping 23 matching lines...) Expand all
111 { 111 {
112 if (isInfiniteOrNonNumberOrNonPercentage(value, "width", exceptionState)) 112 if (isInfiniteOrNonNumberOrNonPercentage(value, "width", exceptionState))
113 return; 113 return;
114 114
115 m_width = value; 115 m_width = value;
116 } 116 }
117 117
118 void VTTRegion::setHeight(long value, ExceptionState& exceptionState) 118 void VTTRegion::setHeight(long value, ExceptionState& exceptionState)
119 { 119 {
120 if (value < 0) { 120 if (value < 0) {
121 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::fail edToSet("height", "VTTRegion", "The height provided (" + String::number(value) + ") is negative.")); 121 exceptionState.throwDOMException(IndexSizeError, "The height provided (" + String::number(value) + ") is negative.");
122 return; 122 return;
123 } 123 }
124 124
125 m_heightInLines = value; 125 m_heightInLines = value;
126 } 126 }
127 127
128 void VTTRegion::setRegionAnchorX(double value, ExceptionState& exceptionState) 128 void VTTRegion::setRegionAnchorX(double value, ExceptionState& exceptionState)
129 { 129 {
130 if (isInfiniteOrNonNumberOrNonPercentage(value, "regionAnchorX", exceptionSt ate)) 130 if (isInfiniteOrNonNumberOrNonPercentage(value, "regionAnchorX", exceptionSt ate))
131 return; 131 return;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 return upScrollValueKeyword; 165 return upScrollValueKeyword;
166 166
167 return ""; 167 return "";
168 } 168 }
169 169
170 void VTTRegion::setScroll(const AtomicString& value, ExceptionState& exceptionSt ate) 170 void VTTRegion::setScroll(const AtomicString& value, ExceptionState& exceptionSt ate)
171 { 171 {
172 DEFINE_STATIC_LOCAL(const AtomicString, upScrollValueKeyword, ("up", AtomicS tring::ConstructFromLiteral)); 172 DEFINE_STATIC_LOCAL(const AtomicString, upScrollValueKeyword, ("up", AtomicS tring::ConstructFromLiteral));
173 173
174 if (value != emptyString() && value != upScrollValueKeyword) { 174 if (value != emptyString() && value != upScrollValueKeyword) {
175 exceptionState.throwDOMException(SyntaxError, ExceptionMessages::failedT oSet("scroll", "VTTRegion", "The value provided ('" + value + "') is invalid. Th e 'scroll' property must be either the empty string, or 'up'.")); 175 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + value + "') is invalid. The 'scroll' property must be either the empty string, o r 'up'.");
176 return; 176 return;
177 } 177 }
178 178
179 m_scroll = value == upScrollValueKeyword; 179 m_scroll = value == upScrollValueKeyword;
180 } 180 }
181 181
182 void VTTRegion::updateParametersFromRegion(VTTRegion* region) 182 void VTTRegion::updateParametersFromRegion(VTTRegion* region)
183 { 183 {
184 m_heightInLines = region->height(); 184 m_heightInLines = region->height();
185 m_width = region->width(); 185 m_width = region->width();
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 466
467 void VTTRegion::scrollTimerFired(Timer<VTTRegion>*) 467 void VTTRegion::scrollTimerFired(Timer<VTTRegion>*)
468 { 468 {
469 WTF_LOG(Media, "VTTRegion::scrollTimerFired"); 469 WTF_LOG(Media, "VTTRegion::scrollTimerFired");
470 470
471 stopTimer(); 471 stopTimer();
472 displayLastVTTCueBox(); 472 displayLastVTTCueBox();
473 } 473 }
474 474
475 } // namespace WebCore 475 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/track/vtt/VTTCue.cpp ('k') | Source/core/loader/appcache/ApplicationCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698