This commit is a cherry-pick of 19f7778.
The current draft of the [filter spec](https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html)
describes brightness, contrast, hue-rotate, and saturate functions that
roughly match our layer's setBrightness, setContrast, setHue, and
setSaturation methods. These changes make the range of our methods match
the corresponding functions in the spec. The one exception is the
brightness function. The spec says it has a range of 0 to positive infinity.
The WebKit implementation accepts a range of -1 to 1 (as of
https://github.com/WebKit/webkit/commit/8f4765e569). There's an open
(ticket)[https://www.w3.org/Bugs/Public/show_bug.cgi?id=15647] recommending
that the spec be changed to match.
I'm not stuck on having our methods match those of the filter spec, but the
parity would be nice.
These changes leave the WebGL map renderer "broken" (whacky colors). It would
be straightforward to update the current fragment shader to handle the new
range of hue, but the brightness, contrast, and saturation handling will
need to be reworked.
For inspiration, here are the color transformation
matrix calculations the WebKit filters:
8f4765e569/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurfaceFilters.cpp (L64-80)
Conflicts:
src/ol/renderer/dom/domlayerrenderer.js
132 lines
4.7 KiB
HTML
132 lines
4.7 KiB
HTML
<!DOCTYPE html>
|
|
|
|
<!-- FIXME console reporter output does not include name of top-level describe -->
|
|
<!-- FIXME console reporter requires window.console_reporter. This is to be
|
|
reported to phantom-jasmine -->
|
|
|
|
|
|
<!--
|
|
|
|
Note: we assume that Plovr is available at <hostname>:9810, where
|
|
<hostname> is the name of the host used for loading that page. This
|
|
can be overriden by setting plovr_host in the query string. E.g.
|
|
|
|
http://localhost/ol3/test/ol.html?plovr_host=192.168.1.2:9810
|
|
-->
|
|
|
|
|
|
<html>
|
|
<head>
|
|
<title>OL Spec Runner</title>
|
|
|
|
<link rel="shortcut icon" type="image/png" href="jasmine-1.2.0/jasmine_favicon.png">
|
|
<link rel="stylesheet" type="text/css" href="jasmine-1.2.0/jasmine.css">
|
|
<script type="text/javascript" src="jasmine-1.2.0/jasmine.js"></script>
|
|
<script type="text/javascript" src="jasmine-1.2.0/jasmine-html.js"></script>
|
|
<script type="text/javascript" src="phantom-jasmine/console-runner.js"></script>
|
|
<script type="text/javascript" src="jasmine-extensions.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
|
|
(function(doc, l) {
|
|
|
|
var regexResult = /[\\?&]plovr_host=([^&#]*)/.exec(l.href);
|
|
var plovrHost = (regexResult && regexResult[1]) ?
|
|
decodeURIComponent(regexResult[1]) : l.hostname ?
|
|
l.hostname + ':9810' : 'localhost:9810';
|
|
|
|
// Create the script tag which includes the derived variables from above
|
|
var script = '<sc' + 'ript type="text/javascript" '
|
|
+ 'src="http://' + plovrHost + '/compile?id=ol-all&mode=RAW">'
|
|
+ '</scr' + 'ipt>';
|
|
|
|
// this function will fix the links of the result to also include
|
|
// the once defined URL Parametrs passed to the testsuite.
|
|
function fixLinks() {
|
|
if (doc.getElementsByTagName) {
|
|
var candidates = doc.getElementsByTagName('a'),
|
|
link,
|
|
hrefExpression = /\?spec/,
|
|
i = 0, len = candidates.length;
|
|
for(; i < len; i++){
|
|
link = candidates[i];
|
|
if (hrefExpression.test(link.href)) {
|
|
link.href += '&plov_host=' + encodeURIComponent(plovrHost);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// write out the script-tag to load the compiled result
|
|
doc.write(script);
|
|
|
|
// overwrite jasmines finishCallback to fix the links
|
|
jasmine.Runner.prototype.finishCallback = function() {
|
|
jasmine.getEnv().reporter.reportRunnerResults(this);
|
|
fixLinks();
|
|
};
|
|
})(document, location);
|
|
|
|
</script>
|
|
|
|
<!-- include spec files here... -->
|
|
<script type="text/javascript" src="spec/ol/array.test.js"></script>
|
|
<script type="text/javascript" src="spec/ol/collection.test.js"></script>
|
|
<script type="text/javascript" src="spec/ol/extent.test.js"></script>
|
|
<script type="text/javascript" src="spec/ol/map.test.js"></script>
|
|
<script type="text/javascript" src="spec/ol/object.test.js"></script>
|
|
<script type="text/javascript" src="spec/ol/projection.test.js"></script>
|
|
<script type="text/javascript" src="spec/ol/rectangle.test.js"></script>
|
|
<script type="text/javascript" src="spec/ol/resolutionconstraint.test.js"></script>
|
|
<script type="text/javascript" src="spec/ol/layer/layer.test.js"></script>
|
|
<script type="text/javascript" src="spec/ol/source/xyz.test.js"></script>
|
|
<script type="text/javascript" src="spec/ol/tilecoord.test.js"></script>
|
|
<script type="text/javascript" src="spec/ol/tilegrid.test.js"></script>
|
|
<script type="text/javascript" src="spec/ol/tilerange.test.js"></script>
|
|
<script type="text/javascript" src="spec/ol/tileurlfunction.test.js"></script>
|
|
<script type="text/javascript" src="spec/ol/control/control.test.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
|
|
(function() {
|
|
var jasmineEnv = jasmine.getEnv();
|
|
jasmineEnv.updateInterval = 1000;
|
|
|
|
// HTML reporter
|
|
|
|
var htmlReporter = new jasmine.HtmlReporter();
|
|
jasmineEnv.addReporter(htmlReporter);
|
|
jasmineEnv.specFilter = function(spec) {
|
|
return htmlReporter.specFilter(spec);
|
|
};
|
|
|
|
// Console reporter (for headless testing)
|
|
|
|
var consoleReporter = new jasmine.ConsoleReporter();
|
|
jasmineEnv.addReporter(consoleReporter);
|
|
// The run_jasmine_test.coffee script (from phantom-jasmine)
|
|
// assumes that the console reporter instance is available
|
|
// in the global namespace object as "console_reporter".
|
|
// Stupid.
|
|
window.console_reporter = consoleReporter;
|
|
|
|
var currentWindowOnload = window.onload;
|
|
|
|
window.onload = function() {
|
|
if (currentWindowOnload) {
|
|
currentWindowOnload();
|
|
}
|
|
jasmineEnv.execute();
|
|
};
|
|
|
|
})();
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
<div id="map"></div>
|
|
</body>
|
|
</html>
|