selenium-webdriver
Version:
The official WebDriver JavaScript bindings from the Selenium project
10 lines (9 loc) • 13.1 kB
HTML
<meta charset="UTF-8"><meta http-equiv="Content-Language" content="en" /><title>goog.math.Size</title><link href="dossier.css" rel="stylesheet" type="text/css"><div id="main-wrapper"><input type="checkbox" id="sidenav-toggle" /><main><header><h1>Class goog.math.Size</h1><a class="source" href="source/lib/goog/math/size.js.src.html#l31">code »</a></header><section><p>Class for representing sizes consisting of a width and height. Undefined
width and height support is deprecated and results in compiler warning.<h2>Constructor</h2><div class="ctor wrap-details public"><div><div class="ctor"><span class="member">goog.math.Size <span class="args">( width, height )</span></span></div><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>width: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>Width.<dt>height: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>Height.</dl></table></div></div></div></section><div id="visibility-controls"><b>Show:</b><label for="show-public"><span><input type="checkbox" id="show-public" checked/></span>Public</label><label for="show-protected"><span><input type="checkbox" id="show-protected"/></span>Protected</label><label for="show-private"><span><input type="checkbox" id="show-private"/></span>Private</label></div><section id="instance-methods"><h2>Instance Methods</h2><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/size.js.src.html#l103">code »</a><span class="member"><a name="area">area</a> <span class="args">( )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div></summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>The area of the size (width * height).</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/size.js.src.html#l119">code »</a><span class="member"><a name="aspectRatio">aspectRatio</a> <span class="args">( )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div></summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>The ratio of the size's width to its height.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/size.js.src.html#l137">code »</a><span class="member"><a name="ceil">ceil</a> <span class="args">( )</span> ⇒ <code class="type">!<a href="class_goog_math_Size.html">goog.math.Size</a></code></span></div><p>Clamps the width and height parameters upward to integer values.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>This size with ceil'd components.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/size.js.src.html#l67">code »</a><span class="member"><a name="clone">clone</a> <span class="args">( )</span> ⇒ <code class="type">!<a href="class_goog_math_Size.html">goog.math.Size</a></code></span></div></summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>A new copy of the Size.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/size.js.src.html#l149">code »</a><span class="member"><a name="fitsInside">fitsInside</a> <span class="args">( target )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div></summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>target: <code class="type">!<a href="class_goog_math_Size.html">goog.math.Size</a></code><dd>The target size.</dl><tr><th>Returns<tr><td><dl>True if this Size is the same size or smaller than the
target size in both dimensions.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/size.js.src.html#l158">code »</a><span class="member"><a name="floor">floor</a> <span class="args">( )</span> ⇒ <code class="type">!<a href="class_goog_math_Size.html">goog.math.Size</a></code></span></div><p>Clamps the width and height parameters downward to integer values.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>This size with floored components.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/size.js.src.html#l87">code »</a><span class="member"><a name="getLongest">getLongest</a> <span class="args">( )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div></summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>The longer of the two dimensions in the size.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/size.js.src.html#l95">code »</a><span class="member"><a name="getShortest">getShortest</a> <span class="args">( )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div></summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>The shorter of the two dimensions in the size.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/size.js.src.html#l128">code »</a><span class="member"><a name="isEmpty">isEmpty</a> <span class="args">( )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div></summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>True if the size has zero area, false if both dimensions
are non-zero numbers.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/size.js.src.html#l111">code »</a><span class="member"><a name="perimeter">perimeter</a> <span class="args">( )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div></summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>The perimeter of the size (width + height) * 2.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/size.js.src.html#l169">code »</a><span class="member"><a name="round">round</a> <span class="args">( )</span> ⇒ <code class="type">!<a href="class_goog_math_Size.html">goog.math.Size</a></code></span></div><p>Rounds the width and height parameters to integer values.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>This size with rounded components.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/size.js.src.html#l184">code »</a><span class="member"><a name="scale">scale</a> <span class="args">( sx, opt_sy )</span> ⇒ <code class="type">!<a href="class_goog_math_Size.html">goog.math.Size</a></code></span></div><p>Scales this size by the given scale factors. The width and height are scaled
by <code >sx</code> and <code >opt_sy</code> respectively. If <code >opt_sy</code> is not
given, then <code >sx</code> is used for both the width and height.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>sx: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The scale factor to use for the width.<dt>opt_sy: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>=</code><dd>The scale factor to use for the height.</dl><tr><th>Returns<tr><td><dl>This Size object after scaling.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/size.js.src.html#l200">code »</a><span class="member"><a name="scaleToFit">scaleToFit</a> <span class="args">( target )</span> ⇒ <code class="type">!<a href="class_goog_math_Size.html">goog.math.Size</a></code></span></div><p>Uniformly scales the size to fit inside the dimensions of a given size. The
original aspect ratio will be preserved.
This function assumes that both Sizes contain strictly positive dimensions.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>target: <code class="type">!<a href="class_goog_math_Size.html">goog.math.Size</a></code><dd>The target size.</dl><tr><th>Returns<tr><td><dl>This Size object, after optional scaling.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/size.js.src.html#l78">code »</a><span class="member"><a name="toString">toString</a> <span class="args">( )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Returns a nice string representing size.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>In the form (50 x 73).</dl></table></div></details></div></div></section><section id="instance-properties"><h2>Instance Properties</h2><div class="wrap-details public"><div><details><summary><div><a class="source" href="source/lib/goog/math/size.js.src.html#l42">code »</a><span class="member"><a name="height">height</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Height</summary></details></div></div><div class="wrap-details public"><div><details><summary><div><a class="source" href="source/lib/goog/math/size.js.src.html#l36">code »</a><span class="member"><a name="width">width</a> : <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Width</summary></details></div></div></section><section id="static-functions"><h2>Static Functions</h2><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/size.js.src.html#l53">code »</a><span class="member"><a name="goog.math.Size.equals">goog.math.Size.equals</a> <span class="args">( a, b )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Compares sizes for equality.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>a: <code class="type"><a href="class_goog_math_Size.html">goog.math.Size</a></code><dd>A Size.<dt>b: <code class="type"><a href="class_goog_math_Size.html">goog.math.Size</a></code><dd>A Size.</dl><tr><th>Returns<tr><td><dl>True iff the sizes have equal widths and equal
heights, or if both are null.</dl></table></div></details></div></div></section></main><nav id="topnav"><div><div id="menubutton"><label for="sidenav-toggle">Menu</label></div><form id="searchbox"><div><input type="search" placeholder="Search" tabindex="1"></div></form></div></nav><nav id="sidenav"><input type="checkbox" id="sidenav-types-ctrl" /><input type="checkbox" id="sidenav-files-ctrl" /><input type="checkbox" id="sidenav-modules-ctrl" /><a id="sidenav-overview"><div><h4>Overview</h4></div></a><div id="sidenav-types"><label for="sidenav-types-ctrl"><h4>Types</h4></label><i>Loading</i></div><div id="sidenav-modules"><label for="sidenav-modules-ctrl"><h4>Modules</h4></label><i>Loading</i></div><div id="sidenav-files"><label for="sidenav-files-ctrl"><h4>Files</h4></label><i>Loading</i></div><a href="license.html"><div><h4>License</h4></div></a></nav><div id="push-footer"></div></div><footer><a href="https://github.com/jleyba/js-dossier">Generated by dossier</a></footer><script src="types.js"></script><script src="dossier.js"></script>