quixote
Version:
CSS unit and integration testing
27 lines (21 loc) • 1.09 kB
JavaScript
// Copyright (c) 2014 Titanium I.T. LLC. All rights reserved. For license, see "README" or "LICENSE" file.
"use strict";
var ensure = require("./util/ensure.js");
var ViewportEdge = require("./descriptors/viewport_edge.js");
var Center = require("./descriptors/center.js");
var Assertable = require("./assertable.js");
var Span = require("./descriptors/span.js");
var Me = module.exports = function QViewport(browsingContext) {
var BrowsingContext = require("./browsing_context"); // break circular dependency
ensure.signature(arguments, [ BrowsingContext ]);
// properties
this.top = ViewportEdge.top(browsingContext);
this.right = ViewportEdge.right(browsingContext);
this.bottom = ViewportEdge.bottom(browsingContext);
this.left = ViewportEdge.left(browsingContext);
this.width = Span.create(this.left, this.right, "width of viewport");
this.height = Span.create(this.top, this.bottom, "height of viewport");
this.center = Center.x(this.left, this.right, "center of viewport");
this.middle = Center.y(this.top, this.bottom, "middle of viewport");
};
Assertable.extend(Me);