OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2015 Google Inc. All rights reserved. | 2 * Copyright (C) 2015 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 replace(/\.$/, ''). | 203 replace(/\.$/, ''). |
204 replace(/^-0$/, '0'); | 204 replace(/^-0$/, '0'); |
205 }); | 205 }); |
206 } | 206 } |
207 | 207 |
208 var anchor = document.createElement('a'); | 208 var anchor = document.createElement('a'); |
209 function sanitizeUrls(value) { | 209 function sanitizeUrls(value) { |
210 var matches = value.match(/url\([^\)]*\)/g); | 210 var matches = value.match(/url\([^\)]*\)/g); |
211 if (matches !== null) { | 211 if (matches !== null) { |
212 for (var i = 0; i < matches.length; ++i) { | 212 for (var i = 0; i < matches.length; ++i) { |
213 var url = /url\(([^\)]*)\)/g.exec(matches[i])[1]; | 213 var url; |
214 if (/url\("([^\)]*)"\)/g.test(matches[i])) | |
Timothy Loh
2015/09/25 14:22:05
Are you sure it doesn't work if we just update the
nainar
2015/09/28 01:19:17
Done.
| |
215 url = /url\("([^\)]*)"\)/g.exec(matches[i])[1]; | |
216 else | |
217 url = /url\(([^\)]*)\)/g.exec(matches[i])[1]; | |
214 anchor.href = url; | 218 anchor.href = url; |
215 anchor.pathname = '...' + anchor.pathname.substring(anchor.pathname.last IndexOf('/')); | 219 anchor.pathname = '...' + anchor.pathname.substring(anchor.pathname.last IndexOf('/')); |
216 value = value.replace(matches[i], 'url(' + anchor.href + ')'); | 220 value = value.replace(matches[i], 'url(' + anchor.href + ')'); |
217 } | 221 } |
218 } | 222 } |
219 return value; | 223 return value; |
220 } | 224 } |
221 | 225 |
222 function normalizeValue(value) { | 226 function normalizeValue(value) { |
223 return roundNumbers(sanitizeUrls(value)). | 227 return roundNumbers(sanitizeUrls(value)). |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
407 loadScript('../../resources/testharness.js').then(function() { | 411 loadScript('../../resources/testharness.js').then(function() { |
408 return loadScript('../../resources/testharnessreport.js'); | 412 return loadScript('../../resources/testharnessreport.js'); |
409 }).then(function() { | 413 }).then(function() { |
410 var asyncHandle = async_test('This test uses interpolation-test.js.') | 414 var asyncHandle = async_test('This test uses interpolation-test.js.') |
411 requestAnimationFrame(function() { | 415 requestAnimationFrame(function() { |
412 runTests(); | 416 runTests(); |
413 asyncHandle.done() | 417 asyncHandle.done() |
414 }); | 418 }); |
415 }); | 419 }); |
416 })(); | 420 })(); |
OLD | NEW |