<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>Benjamin Stover &#187; mozilla</title>
	<atom:link href="http://stechz.com/tag/mozilla/feed/" rel="self" type="application/rss+xml" />
	<link>http://stechz.com</link>
	<description></description>
	<lastBuildDate>Fri, 09 Dec 2011 17:57:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Obituary watch</title>
		<link>http://stechz.com/2011/426/</link>
		<comments>http://stechz.com/2011/426/#comments</comments>
		<pubDate>Thu, 08 Dec 2011 20:03:13 +0000</pubDate>
		<dc:creator>Benjamin Stover</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bloat]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[web development]]></category>
		<guid isPermaLink="false">http://stechz.com/?p=426</guid>
		<description><![CDATA[Marco writes an obituary for Firefox: I’m a bit sad for Firefox. It used to be the fast, powerful, progressive browser that finally broke IE’s era of stagnant dominance and saved web developers’ sanity. Now, it’s a bloated, slow, unstable monster that’s often a pain in this web developer’s ass. Siegler nods in assent. It&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.marco.org/2011/12/03/firefox-faces-uncertain-future">Marco</a> writes an obituary for Firefox:</p>
<blockquote><p>I’m a bit sad for Firefox. It used to be the fast, powerful, progressive browser that finally broke IE’s era of stagnant dominance and saved web developers’ sanity. Now, it’s a bloated, slow, unstable monster that’s often a pain in this web developer’s ass.</p></blockquote>
<p>Siegler <a href="http://parislemon.com/post/13698115578/microsoft-as-the-firefox-savior">nods in assent</a>. It&#8217;s funny to me because in my sphere Firefox is alive, full of new life due to efforts like memshrink and Jaegermonkey. The stability cry also rings hollow; this is a non-issue for me.</p>
<p>Then again, I have a few tricks up my sleeve that you may not. For web developers out there who love Firefox and its mission but worry about the bloat, I have a few suggestions:</p>
<ul>
<li>Try the <a href="http://www.mozilla.org/en-US/firefox/channel/">Aurora or Beta</a> channel to reap <a href="http://blog.mozilla.com/nnethercote/">some</a> <a href="http://blog.mozilla.com/tglek/2011/12/01/introducing-project-snappy/">performance</a> <a href="http://blog.mozilla.com/dmandelin/2011/12/06/mozilla-js-development-newsletter-1130-1206/">benefits</a>.
<li>Be stingy about your extensions. Mozilla is only beginning to address the tip of the iceberg that is extension performance, but for you, know that performance can be <i>dramatically</i> affected by them. If you&#8217;re using Chrome now, you&#8217;ve probably paired down anyway; try being zen about Firefox and you might be surprised. The same goes for plugins.
<li>Speaking of extensions, Firebug is one of the worst offenders for bloat. There were several memory leaks fixed recently that you may not know about, and I recommend using the latest and greatest here as well. Or: try some of the built-in developer tools that the Aurora channel now has.
<li>If you crash, be sure to look at about:crashes. If you report it, an issue will be created and you can check out any progress on it. In my experience, it&#8217;s usually Flash. If you are worried about bloat, keep an eye on about:memory.
<li><a href="https://bugzilla.mozilla.org/enter_bug.cgi?product=Firefox">File bugs</a>! Firefox is a community effort, and web developers have a responsibility for the future of the web. If you don&#8217;t want the big three (Google, Apple, and Microsoft) in a room deciding where the web goes next, Mozilla is truly the one voice that continues to make a difference in these discussions.
</ul>
]]></content:encoded>
			<wfw:commentRss>http://stechz.com/2011/426/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Brainstorm session: what would you like writing tests to look like?</title>
		<link>http://stechz.com/2011/brainstorm-session-what-would-you-like-writing-tests-to-look-like/</link>
		<comments>http://stechz.com/2011/brainstorm-session-what-would-you-like-writing-tests-to-look-like/#comments</comments>
		<pubDate>Thu, 11 Aug 2011 17:44:10 +0000</pubDate>
		<dc:creator>Benjamin Stover</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[testing]]></category>
		<guid isPermaLink="false">http://stechz.com/?p=381</guid>
		<description><![CDATA[There&#8217;s a good thread about building features into Firefox on dev.planning. The recurring problem of writing quality frontend code came up, and I found myself ranting about our testing framework. Is it tacky to quote yourself? I&#8217;m in a devil-may-care frame of mind this morning, so I&#8217;m doing it anyway! From this post: I&#8217;m an [...]]]></description>
			<content:encoded><![CDATA[<p><a href="https://groups.google.com/d/topic/mozilla.dev.planning/K1fr4VqtQTA/discussion">There&#8217;s a good thread</a> about building features into Firefox on dev.planning. The recurring problem of writing quality frontend code came up, and I found myself ranting about our testing framework.</p>
<p>Is it tacky to quote yourself? I&#8217;m in a devil-may-care frame of mind this morning, so I&#8217;m doing it anyway!</p>
<p>From <a href="https://groups.google.com/d/msg/mozilla.dev.planning/K1fr4VqtQTA/uEysYDHpm0sJ">this post</a>:</p>
<blockquote><p>
I&#8217;m an imperfect being and I know I should write much more tests than I do.<br />
I will continue fighting the urge to just ignore tests and keep telling<br />
myself why they are so crucial. I&#8217;m trying to be part of the solution, and<br />
I&#8217;ve committed a few mochitest patches along the way. What Mozilla could do<br />
to help me significantly is to give me great tools&#8230;
</p></blockquote>
<p><a href="https://groups.google.com/d/msg/mozilla.dev.planning/n6lCfvNBCqs/GN7OJkc7WfkJ">And then</a>:</p>
<blockquote><p>
It&#8217;s worth noting that the details matter. I know we devs tend to think of<br />
ourselves as very practical and rationally minded, but the longer I make<br />
stuff the more I am convinced that an emotional feeling of using these tools<br />
is crucial to a happy developer. So let&#8217;s get some ideas, and I&#8217;ll be happy<br />
to file some bugs!
</p></blockquote>
<p>Etherpad here:<br />
<a href="http://ietherpad.com/mozilla-test-tools">http://ietherpad.com/mozilla-test-tools</a></p>
<p>Brainstorm your ideas. We&#8217;ll sort them out and file some bugs! I&#8217;m particularly interested in what the web developers in the crowd have to say, as in my experience the tools there are a pleasure to use.</p>
]]></content:encoded>
			<wfw:commentRss>http://stechz.com/2011/brainstorm-session-what-would-you-like-writing-tests-to-look-like/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Evolution of the web</title>
		<link>http://stechz.com/2011/evolution-of-the-web/</link>
		<comments>http://stechz.com/2011/evolution-of-the-web/#comments</comments>
		<pubDate>Mon, 08 Aug 2011 18:05:47 +0000</pubDate>
		<dc:creator>Benjamin Stover</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[url]]></category>
		<guid isPermaLink="false">http://stechz.com/?p=373</guid>
		<description><![CDATA[Fellow Mozillian and web hacker Atul Varma struggles with a recent streamlining of the Firefox interface, the removal of &#8220;http&#8221; from the address in the URL bar: &#8230;[B]rowsers have historically been very friendly to learning web-making, in part because they keep protocol information in the address bar. My guess is that removing the http:// neither [...]]]></description>
			<content:encoded><![CDATA[<p>Fellow Mozillian and web hacker Atul Varma <a href="http://www.toolness.com/wp/2011/08/the-decline-and-fall-of-the-url/">struggles with</a> a recent streamlining of the Firefox interface, the removal of &#8220;http&#8221; from the address in the URL bar:</p>
<blockquote><p>
&#8230;[B]rowsers have historically been very friendly to learning web-making, in part because they keep protocol information in the address bar. My guess is that removing the http:// neither helps nor hinders someone from using the basics of the web—but it definitely makes it harder to learn what hypertext is.
</p></blockquote>
<p>Atul is rightly worried. The web is evolving rapidly, and one of its genes stands trial: the URL. It faces mounting pressure of extinction as a prominent piece of our user interfaces. The removal of the protocol is one minor example. Take the native application trend on mobile. Although the URL still remains the technical heart pumping data through our web, the URL no longer stands as the canonical <i>identity</i> of our web. On my phone, I don&#8217;t go to twitter.com. I tap on Twitter. I find myself spending more time outside the browser than ever before.</p>
<p>In truth, Mozilla is beginning to embrace this trend. We are now dreaming up open application markets and painting pictures of web applications that appear no different than their native cousins. The trend feels obvious. In this manner, native has already triumphantly secured its place in the gene pool.</p>
<p>Will the URL ultimately fade into oblivion? I can&#8217;t predict the future, but I can ask a better question. If the URL no longer stands as the bulwark defending the hackability and transparency of our web, what new things will we build up to replace it?</p>
]]></content:encoded>
			<wfw:commentRss>http://stechz.com/2011/evolution-of-the-web/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Shrinking startup time for Android</title>
		<link>http://stechz.com/2011/shrinking-startup-time-for-android/</link>
		<comments>http://stechz.com/2011/shrinking-startup-time-for-android/#comments</comments>
		<pubDate>Fri, 29 Jul 2011 18:23:27 +0000</pubDate>
		<dc:creator>Benjamin Stover</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[startup]]></category>
		<guid isPermaLink="false">http://stechz.com/?p=363</guid>
		<description><![CDATA[A few of us have started an effort to reduce startup time on Android devices. This is a critical aspect of Firefox&#8217;s user experience. More often than not, Firefox is killed in the background as you are using your Android device. When you then find an interesting link on Twitter or need to look at [...]]]></description>
			<content:encoded><![CDATA[<p>A few of us have started <a href="https://wiki.mozilla.org/Firefox/Projects/Mobile_Startup_Shrink">an effort</a> to reduce startup time on Android devices. This is a critical aspect of Firefox&#8217;s user experience. More often than not, Firefox is killed in the background as you are using your Android device. When you then find an interesting link on Twitter or need to look at the weather, you are presented with the lovely Firefox logo for several seconds while we get ready to show the UI and load your web page. Multiply this flow by a few times a day, and you&#8217;ll feel some pain as you impatiently wait for Firefox.</p>
<p>Then, imagine tapping on a link and immediately seeing a familiar interface that is loading your web page in place of a loading screen. This is the goal for startup shrink.</p>
<p>It&#8217;s been a week since <a href="https://wiki.mozilla.org/Firefox/Projects/Mobile_Startup_Shrink/Meeting_July_21_2011">our first meeting</a>. Some important bugs:</p>
<ul>
<li>Near term</li>
<ul>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=94199">Bug 94199</a>: Fastload XBL methods and properties. A critical part of startup is loading Javascript methods and properties inside our XBL widgets. Next action: a leak needs to be squashed. Owner: Enn
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=616057">Bug 616057</a>: Rebuild NDK5 with PIC. PIC stands for <a href="http://en.wikipedia.org/wiki/Position-independent_code">position independent code</a>. If we generate non-PIC, the runtime linker must go through the binary code and replace code locations. Owner: bear
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=668838">Bug 668838</a>: Implement improved flow for language choice. This means Firefox will normally only load one locale and hyphenation file during startup. Owner: wesj
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=673253">Bug 673253</a>: Delay sqlite usage until first paint. Improve perceived performance by painting earlier. Owner: me
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=673262">Bug 673262</a>: Gold linking on Android. Gold is a smarter linker than ld, and can typically generate smaller binaries. And, using LTO, gold can remove even more code. Owner: glandium
</ul>
<li>Long term</li>
<ul>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=632954">Bug 632954</a>: Enable PGO for Android. Using PGO, we can figure what code needs to run at startup and what code runs later and reorder the binary appropriately. Later, we can even generate two different libraries that separate hot startup code from the rest. Owner: glandium
</ul>
</ul>
<p>As usual, measuring startup time is generally very tricky. Using wall clock time for a warm startup doesn&#8217;t accurately represent real world scenarios. Here are some bugs that might help us with instrumentation:</p>
<ul>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=675233">Bug 675233</a>: Show when components are initialized. Useful for the bigger picture. This is wall clock time, so it&#8217;s important to try to swap out Fennec before starting it up. There are steps in the bug.
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=673258">Bug 673258</a>: I/O data for startup using systemtap. No progress to report here.
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=674986">Bug 674986</a>: Build profiler for Android devices. This is about getting a custom ROM that includes useful kernel modules, like oprofile and perf.
</ul>
<p>If you have ideas for improving startup time or ideas for tools, get in touch! Better yet, maybe you&#8217;d like to contribute some code. We can be found in #startup on irc.mozilla.org.</p>
]]></content:encoded>
			<wfw:commentRss>http://stechz.com/2011/shrinking-startup-time-for-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing browser chrome mochitests</title>
		<link>http://stechz.com/2011/writing-browser-chrome-mochitests/</link>
		<comments>http://stechz.com/2011/writing-browser-chrome-mochitests/#comments</comments>
		<pubDate>Thu, 28 Apr 2011 21:20:35 +0000</pubDate>
		<dc:creator>Benjamin Stover</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mochitests]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[testing]]></category>
		<guid isPermaLink="false">http://stechz.com/?p=336</guid>
		<description><![CDATA[My fellow developers, You may already be writing good browser chrome tests that properly reset any side effects your test may have caused, but do you always clean up? Instead of manually cleaning up your test after a successful run, please consider using registerCleanupFunction. You can register as many functions as you like, and they [...]]]></description>
			<content:encoded><![CDATA[<p>My fellow developers,</p>
<p>You may already be writing good browser chrome tests that properly reset any side effects your test may have caused, but do you <i>always</i> clean up? Instead of manually cleaning up your test after a successful run, please consider using <a href="https://developer.mozilla.org/en/Browser_chrome_tests#Cleaning_up_after_Yourself">registerCleanupFunction</a>. You can register as many functions as you like, and they are guaranteed to run at the end of the test! I didn&#8217;t know this technique existed until recently, so I thought I&#8217;d pass it along.</p>
<p>Unfortunately, I&#8217;m not aware of anything similar for other mochitests.</p>
]]></content:encoded>
			<wfw:commentRss>http://stechz.com/2011/writing-browser-chrome-mochitests/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Bugzilla Happy URLs</title>
		<link>http://stechz.com/2011/bugzilla-happy-urls/</link>
		<comments>http://stechz.com/2011/bugzilla-happy-urls/#comments</comments>
		<pubDate>Wed, 06 Apr 2011 22:40:10 +0000</pubDate>
		<dc:creator>Benjamin Stover</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bugzilla]]></category>
		<category><![CDATA[jetpack]]></category>
		<category><![CDATA[mozilla]]></category>
		<guid isPermaLink="false">http://stechz.com/?p=313</guid>
		<description><![CDATA[Ever accidentally copy-pasted a process_bug.cgi link? I&#8217;ve just written a quick extension that uses the history API to fix Bugzilla so that it shows the proper canonical URL for a resource after POSTing. Download the Extension GitHub page Update: Bugzilla Tweaks already has this functionality.]]></description>
			<content:encoded><![CDATA[<p>Ever accidentally copy-pasted a process_bug.cgi link? I&#8217;ve just written a quick extension that uses the history API to fix Bugzilla so that it shows the proper canonical URL for a resource after POSTing.</p>
<p><b><a href="https://github.com/downloads/stechz/Bugzilla-Happy-URLs/bugzilla-url.xpi">Download the Extension</a></b><br />
<small><a href="https://github.com/stechz/Bugzilla-Happy-URLs">GitHub page</a></small></p>
<p><b>Update</b>: <a href="https://addons.mozilla.org/en-US/firefox/addon/bugzilla-tweaks/">Bugzilla Tweaks</a> already has this functionality.</p>
]]></content:encoded>
			<wfw:commentRss>http://stechz.com/2011/bugzilla-happy-urls/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Responsive panning and zooming</title>
		<link>http://stechz.com/2011/responsive-panning-and-zooming/</link>
		<comments>http://stechz.com/2011/responsive-panning-and-zooming/#comments</comments>
		<pubDate>Tue, 29 Mar 2011 01:24:15 +0000</pubDate>
		<dc:creator>Benjamin Stover</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mozilla]]></category>
		<guid isPermaLink="false">http://stechz.com/?p=316</guid>
		<description><![CDATA[The Firefox release candidate for mobile is now out, and things are looking a lot zippier since 1.1. Improving panning and zooming was a huge focus during development. We&#8217;ve eliminated major delays between user input and rendering the results on the screen, and we&#8217;ve significantly improved the animation smoothness. So, how did we do it? [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.mozilla.com/en-US/mobile/">Firefox</a> release candidate for mobile is now out, and things are looking a lot zippier since 1.1. Improving panning and zooming was a huge focus during development. We&#8217;ve eliminated major delays between user input and rendering the results on the screen, and we&#8217;ve significantly improved the animation smoothness.</p>
<p>So, how did we do it? Through a major effort across the Firefox platform team and the front-end team, we split the rendering and processing done by web content into a separate process from the one that handles Firefox&#8217;s user interface. Firefox developers internally refer to this split as electrolysis, and you may be familiar with the concept from other browsers like Internet Explorer and Chrome. Furthermore, the content process can asynchronously render more content than is visible so that our main process can quickly pan and zoom by transforming the rendered content appropriately. In the meanwhile, the content process is informed of the new visible region and computes the new rendering quietly in the background.</p>
<p>For this post, I&#8217;d like to cover the platform foundation that made this possible for mobile Firefox.</p>
<h3>Layers</h3>
<p>One of the largest projects completed for Firefox 4 was the ability to quickly render common kinds of transitions and animations by splitting up rendering into separate parts and compositing them together quickly using.hardware acceleration. The <a href="http://weblogs.mozillazine.org/roc/archives/2010/04/layers.html">layers</a> system is responsible for compositing.</p>
<p>The layers are stored in a tree. A container layer holds child layers, and the leaf nodes are populated by layers that render content, such as thebes layers or color layers. Each node has properties like a transformation, a clip rectangle, and an opacity, which affect the rendering of it and its children. You can see what a node looks like in <a href="http://mxr.mozilla.org/mozilla-central/source/gfx/layers/Layers.h">Layers.h</a>. Applying transforms, clipping, and opacities are the kinds of operations that are straightforward operations for DirectX and OpenGL pipelines, so we can generate these accelerated layers on demand for fast web page animations.</p>
<p>For our desktop platforms, layers are already being composited using hardware acceleration, but we have disabled it for mobile platforms for now. We hope to significantly reduce mobile Firefox&#8217;s CPU load in a near-term release through hardware acceleration.</p>
<h3>Shadow Layers</h3>
<p>Layers are not only useful for fast animations. They also demonstrate a semantically clean break between expensive rendering and simple rendering for web pages. The expensive rendering is done in the content process, and the simple layers compositing is done in the main process. These layers generated in the content process and forwarded to the parent process are called shadow layers. In the main process, we manipulate these shadow layers using translation and scale transformations to achieve the effect of panning and zooming. When the layers are updated from the content process, we carefully compensate for any changes in the layers so that the procedure is seamless to the user.</p>
<p>Our first implementation of shadow layers used sockets to transport pixels back and forth, but we quickly found this was too slow. The main process would spend too much time shoving pixels to and fro, emitting obvious stalls during panning. We now use shared double buffered memory between the processes. The main process manipulates how the read-only front buffer is rendered, while the content process refreshes invalidated content in the back buffer.</p>
<h3>Displayports</h3>
<p>The final component allows Firefox to render more than what is visible on the screen. Otherwise, there would be no content to render for hundred of milliseconds when the user pans. We render extraneously by setting a displayport, which overrides the visible region and paints the specified rectangle we give it. The web page is none the wiser.</p>
<h3>Conclusion</h3>
<p>Using these APIs provided by our platform, mobile Firefox is able to give an experience that is responsive and fast. The experience isn&#8217;t perfect yet, but we have a solid foundation to iterate on top of.</p>
<p>The majority of this great work was done by <a href="http://blog.mozilla.com/cjones/">Chris Jones</a> with the assistance of <a href="http://weblogs.mozillazine.org/roc/">Robert O&#8217;Callahan</a> and <a href="http://tinikkel.wordpress.com/">Timothy Nikkel</a>. Without them, this project would not have happened. Thanks guys!</p>
]]></content:encoded>
			<wfw:commentRss>http://stechz.com/2011/responsive-panning-and-zooming/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>What you should understand about Mozilla</title>
		<link>http://stechz.com/2010/what-you-should-understand-about-mozilla/</link>
		<comments>http://stechz.com/2010/what-you-should-understand-about-mozilla/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 18:02:32 +0000</pubDate>
		<dc:creator>Benjamin Stover</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[choice]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[open web]]></category>
		<guid isPermaLink="false">http://stechz.com/?p=284</guid>
		<description><![CDATA[Disclaimer: Like usual, it&#8217;s just a little post from me (just some developer), not from Mozilla. Mozilla is a unique force in the browser market whose primary goal is to keep the web available for everybody. Recently, we acted on our mission statement by taking a stand on the Ogg Theora video decoder. For HTML5 [...]]]></description>
			<content:encoded><![CDATA[<p>Disclaimer: Like usual, it&#8217;s just a little post from me (just some developer), not from Mozilla.</p>
<p>Mozilla is a unique force in the browser market whose primary goal is to <a href="http://www.mozilla.org/">keep the web available for everybody</a>.  Recently, we acted on our mission statement by <a href="http://blog.mozilla.com/blog/2009/01/26/in-support-of-open-video/">taking a stand</a> on the Ogg Theora video decoder. For HTML5 video, Mozilla chose to support Theora (and only Theora) for two reasons:</p>
<ul>
<li>Desire: We want (really, really want) an unencumbered video format for everyone.</li>
<li>Ability: We think we can use our market share to make a difference.</li>
</ul>
<p>Frankly, this isn&#8217;t about idealism or sophomoric zealotry, it&#8217;s about ensuring a healthy future for the web.  We, after careful consideration, decided this was <a href="http://www.0xdeadbeef.com/weblog/2009/01/why-open-video/">worth fighting for</a>.  I can&#8217;t tell you what the future holds for video formats, but Mozilla will ultimately do what&#8217;s best for consumers and publishers.</p>
<p>What&#8217;s more interesting to me is our <i>ability</i> to cause such a stir.  Our stand loses its meaning without our market share, illuminating how important our user base is.  In general, take a step back and recall where the web was just 4 years ago.  Mozilla and our users played an (dare I say the?) important role in where the web is today.  That&#8217;s actually pretty amazing for free software with grassroots origins.</p>
<p>I&#8217;ve come to see Mozilla in a different light from this video debate.  As Firefox users, our choice is not <i>only</i> colored by features, or speed, or extensibility.  It&#8217;s also about using a browser built by people whose vested interest is, well, everyone.  You really are voting with your software, with every vote adding a discrete boost in volume to Mozilla&#8217;s voice.  For us, it&#8217;s about the big picture.  So let me gush a little here: <i>thank you</i>, our amazing users <3!  For my part I will do my best to repay your choice with a better browser that gets out of the way and lets you get things done.</p>
]]></content:encoded>
			<wfw:commentRss>http://stechz.com/2010/what-you-should-understand-about-mozilla/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Firefox for Maemo RC3 is out</title>
		<link>http://stechz.com/2010/rc3-is-out/</link>
		<comments>http://stechz.com/2010/rc3-is-out/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 18:22:43 +0000</pubDate>
		<dc:creator>Benjamin Stover</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[n900]]></category>
		<guid isPermaLink="false">http://stechz.com/?p=279</guid>
		<description><![CDATA[For our N900 folks who have been trying out the RCs, give the third a try. Location bar, panning, zooming, and tile prefetching performance have all been tweaked. The net result is a large step ahead in terms of daily browser use. We&#8217;ve made some good strides in these final releases before 1.0, and if [...]]]></description>
			<content:encoded><![CDATA[<p>For our N900 folks who have been trying out the RCs, give the third a try.  Location bar, panning, zooming, and tile prefetching performance have all been tweaked.  The net result is a large step ahead in terms of daily browser use.  We&#8217;ve made some good strides in these final releases before 1.0, and if you&#8217;ve tried Firefox for Maemo before, you will notice.</p>
<p>One other thing: we&#8217;ve turned off Flash and are keeping it off for 1.0.  We tried hard to get Flash performant, consistent, and stable in 1.0, but at the end of the day it wasn&#8217;t up to our standard of quality.  At the cusp of releasing, a hard decision was made to cut out a bullet point for the sake of usability.  We have a stopgap solution in the works targeted particularly at YouTube (because it&#8217;s the one Flash site that works pretty well and adds a lot of value), and we still want Flash in mobile Firefox long term.</p>
<p>1.0, here we come!</p>
]]></content:encoded>
			<wfw:commentRss>http://stechz.com/2010/rc3-is-out/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Creating a robust kinetic animation</title>
		<link>http://stechz.com/2010/robust-kinetic-animation/</link>
		<comments>http://stechz.com/2010/robust-kinetic-animation/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 00:22:27 +0000</pubDate>
		<dc:creator>Benjamin Stover</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[kinetic]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[n900]]></category>
		<guid isPermaLink="false">http://stechz.com/?p=119</guid>
		<description><![CDATA[Sometimes it&#8217;s the little things that make all the difference in an application. That&#8217;s probably why I&#8217;ve rewritten our kinetic scrolling in some fashion three different times. Kinetic scrolling is the animation you see on touchscreen phones when you move your finger across a web page and let go. The content will continue to scroll [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes it&#8217;s the little things that make all the difference in an application.  That&#8217;s probably why I&#8217;ve rewritten our kinetic scrolling in some fashion three different times.  Kinetic scrolling is the animation you see on touchscreen phones when you move your finger across a web page and let go.  The content will continue to scroll for a couple of seconds, slowing down to a halt at the end.  This gives scrolling a feeling of physical weight, as if you had pushed a coin across your desktop and friction slowed it to a stop.  It&#8217;s one of those algorithms anyone can implement, but few manage to perfect.</p>
<p>Fennec&#8217;s kinetic scroller needed some tweaking, though I didn&#8217;t start out knowing exactly what it needed.  As I played with a few algorithms I eventually came up with three goals:</p>
<ul>
<li>Predictability.  The same gesture should roughly get you exactly the same distance every time, independent of outside factors like frame skipping.</li>
<li>Smoothness.  Your eyes are good at noticing changes in distance.  If a frame or two is out of step, you will notice or possibly even see something unexpected!  More on that later.</li>
<li>Speed.  The total time the animation takes should be reigned in; the animation is there to give weight to the content with subtlety, and stay out of the way.</li>
</ul>
<p>Each goal isn&#8217;t so hard in itself, but I found when I focused on one the other two would slip out of my grasp.  As far as I&#8217;ve seen, only the iPhone really gets it right.  You can spin an hour or minute scroll wheel with amazing consistency once you get the hang of it.  Android gets it all wrong.  The friction is so low that the animation can last forever.  If Android misses a few beats while you are dragging your fingers, it will interpret that as a super-fast finger pan and will set your initial velocity to infinity minus one.  Android also has poor responsiveness: sometimes on my Cliq I don&#8217;t know if I&#8217;ve panned until I&#8217;ve let go of my finger.  By then it&#8217;s far too late.</p>
<p>My work focused on changing how we determine the distance moved in every frame of the animation.  In Fennec, we keep it simple and assume we can get away with friction being a constant deceleration.  Given an initial velocity and deceleration rate, how do we get from our start position to our end position?</p>
<h3>Previous solution: Newtonian approximations with fixed dt</h3>
<p><a href="http://stechz.com/wp-content/uploads/2010/01/GodfreyKneller-IsaacNewton-1689.jpg"><img src="http://stechz.com/wp-content/uploads/2010/01/GodfreyKneller-IsaacNewton-1689-218x300.jpg" alt="" title="Isaac Newton. A major contributor to optics, calculus, and laws of planetary motion.  Also an alchemist, go figure." width="260" height="300" class="alignleft size-medium wp-image-141" /></a></p>
<p>Don&#8217;t let any of those words scare you if your math is a little rusty.  Think of the position of the scrollbox as a function of time.  At the beginning, position(t=0) is where the scrollbox was at before moving.  At some final time, the scrollbox&#8217;s position will have settled to a stop further down the page.  <a href="http://www.ugrad.math.ubc.ca/coursedoc/math100/notes/approx/newton.html">Newton&#8217;s approximation</a> is just a very simple application of a derivative:</p>
<div class="wp_syntax"><div class="code"><pre class="math" style="font-family:monospace;"># general application
f(x+dx)=f(x) + dx*f'(dx)
&nbsp;
# physics application
# note: velocity is the derivative of position
pos(t+dt)=pos(t) + dt*vel(t)
vel(t+dt)=vel(t) + dt*acc</pre></div></div>
<p>Derivatives tell how a function&#8217;s value changes.  For this algorithm, a derivative helps approximate a function&#8217;s value at nearby places.  If I know the velocity at a given time (vel(t)) and the position at a given time (pos(t)), I can make a really good guess about what the position will be at a small time increment from now (pos(t+dt)).  Set dt to a fixed constant (like if the position is updating every 15 msecs, 15 msecs might be a good value for dt).  So subtract a fraction of the velocity from the position, subtract a fraction of the acceleration from the velocity, and bam!  Newtonian approximation.  Many programmers have written this algorithm without knowing an iota of calculus just because it&#8217;s so intuitive.  Maybe Newton and his fancy calculus aren&#8217;t so precious after all.  You going to take that Newton?  Oh, you have to because you&#8217;re dead!</p>
<h4>Downsides</h4>
<p><img src="http://stechz.com/wp-content/uploads/2010/01/3386190147_cc8fe92f81-150x150.jpg" alt="" title="Not actually fat. To be fair, I haven't actually seen Falstaff. Attribution: http://www.flickr.com/photos/chuckeye/" width="150" height="150" class="alignright size-thumbnail wp-image-159" /></p>
<p>By fixing dt, the animation is not over until the fat lady sings.  And operas last a really long time.  Yeah the sets are cool and the singer-actors are amazing virtuosos, but god don&#8217;t you get tired of watching the subtexts?  It&#8217;s like Italian is only capable of conveying shock and melancholy.  If my phone is crunching and each frame takes an average of 100 milliseconds, the scrolling animation is going to last more than six times longer than it should!  Although holding a note 12 seconds is nothing for an opera superstar, an animation of similar length isn&#8217;t acceptable.</p>
<h3>Newtonian with varying dt</h3>
<p>The first fix I tried is the obvious one.  Plug the real elapsed time between frames into dt and problem solved.  This is where the reality of programming comes in and shouts &#8220;oh no you didn&#8217;t&#8221; and twists your tidy algorithm into the user experience equivalent of a pretzel.  All of the sudden, everything&#8217;s jerking around a lot!  And oh crap how did I get to the bottom of the stupid-long planet.mozilla.org so fast?  All I did was smudge my finger on the screen.</p>
<h4>Downsides</h4>
<p>Let&#8217;s plug in some numbers and see what happens:</p>
<div class="wp_syntax"><div class="code"><pre class="math" style="font-family:monospace;">50msec elapse: pos(0+.050) = 0 + .050 * 600 = 30 respectable pixels
800msec elapse: pos(0+.8) = 0 + .8 * 600 = 480 I guess that's OK pixels
3200msec elapse: pos(0+3.2)=0 + 3.2 * 600 = 1920 ridiculous pixels</pre></div></div>
<p>Unfortunately during intensive operations like page load, Fennec can often see three second delays between timer callbacks.  This is the antithesis of smooth; it&#8217;s possible to completely lose your context of what you are reading.  Not only that, but the total distance traveled is now dependent on how much time Fennec spent <a href="http://code.google.com/p/chromium/issues/detail?id=31482">teleporting goats</a> or whatever the hell it&#8217;s doing.  This is why I consider good kinetic panning a &#8220;slippery&#8221; problem; here I&#8217;ve fixed the speed problem at the total expense of predictability and smoothness.</p>
<h3>Verlet integration</h3>
<p>This is a more sophisticated way of calculating the scroll position based on the previous step, with less error.  I won&#8217;t delve into the details, but <a href="http://en.wikipedia.org/wiki/Verlet_integration<br />
">verlet integration</a> had the same basic problems as Newtonian approximation did.  Ultimately, step-based solutions were not getting me the results I wanted.  Taking a step back, I realized I was using approximations of a function that I could easily calculate myself.</p>
<h3>Closed form of position: a parabola</h3>
<p><img src="http://stechz.com/wp-content/uploads/2010/01/Gorillas_screenshot.png" alt="" title="GORILLAS.BAS, one of the first programs I ever looked at. (c) Microsoft." width="320" height="175" class="alignright wp-image-167" /></p>
<p>If the scrolling animation has a velocity that decelerates constantly, the movement is actually that of a parabola.  I don&#8217;t want to dive into integration methods here, but there&#8217;s an easier way to explain it.  If you are a gorilla and you&#8217;re throwing exploding bananas at buildings, the arc that your banana makes with deadly grace as it moves through the air is a parabola.  The banana initially has an upward velocity, but gravity decelerates the velocity at a constant rate causing the banana to come down and hit unsuspecting office workers, detonating on impact.  This motion is analogous to our scrollbox movement over time, except at the peak of the scrollbox&#8217;s parabola the motion is cut off.</p>
<p>Here&#8217;s the formula:</p>
<div class="wp_syntax"><div class="code"><pre class="math" style="font-family:monospace;">pos(t) = v0*t + 1/2*a*t^2
vel(t) = v0 + a*t</pre></div></div>
<div class="plot">
<!--<br />
  (function() {<br />
    var d1 = [];<br />
    for (var i = 0; i < 10.5; i += 0.5)<br />
      d1.push([i, 5 * i - .5 * i * i]);</p>
<p>    var d2 = [];<br />
    for (var i = 0; i < 10.5; i += 0.5)<br />
      d2.push([i, 5 - i]);</p>
<p>    var markings = [<br />
      { color: '#000', lineWidth: 1, color: 'red', xaxis: { from: 5.0, to: 5.0 } },<br />
    ];</p>
<p>    var ticks = [[5, "final time"]];</p>
<p>    $.plot(this, [{ label: "Position pos(t)" , data: d1 }, { label: "Velocity vel(t)", data: d2 }], { grid: { markings: markings }, xaxis: { ticks: ticks } });<br />
  })<br />
-->
</p></div>
<p>Now I was getting somewhere.  I could calculate the time and position at which the movement is at its peak, when the velocity is zero:</p>
<div class="wp_syntax"><div class="code"><pre class="_1" style="font-family:monospace;">vel(tf) = 0 = v0 + a * t
tf = -v0 / a
&nbsp;
pos(-v0 / a) = v0 * (-v0 / a) + 1/2 * a * (-v0 / a) ^ 2
pos(-v0 / a) = -1/2 * v0^2 / a</pre></div></div>
<p>So I now have an equation that gives me exactly what I want: when the animation should end, and more importantly, where the animation should end.  Assuming the initial velocity is calculated robustly, I can pan down a page and consistently get the same distance covered every time.</p>
<h4>Downsides</h4>
<p>This formula nails down the animation&#8217;s speed and predictability as best as anything can, but smoothness has suffered.  To add insult to injury, our <a href="http://dailythemes.wordpress.com/">mobile VP Jay</a> noticed something bizarre: the scrolling sometimes sped up in the middle!  I checked my algorithm with a data dump:</p>
<div class="plot alignright">
<!-- (function() {<br />
var d1 =<br />
[[30,-50],<br />
[72,-67],<br />
[119,-70],<br />
[167,-67],<br />
[215,-63],<br />
[263,-58],<br />
[310,-52],<br />
[358,-49],<br />
[405,-44],<br />
[463,-48],<br />
[510,-34],<br />
[558,-30],<br />
[606,-25],<br />
[655,-21],<br />
[703,-16],<br />
[750,-11],<br />
[798,-7],<br />
[856,-2]];<br />
var total2 = 0;<br />
for (var i = 0; i < d1.length; i++) {<br />
  d1[i][0] += 50;<br />
  total2 += d1[i][1];<br />
  d1[i][1] = total2;<br />
}<br />
$.plot(this, [{ label: "Position versus time", data: d1 }], { points: { show: true }, lines: { show: true }});<br />
}) -->
</div>
<div class="wp_syntax"><div class="code"><pre class="math" style="font-family:monospace;">time 30 distance -50
time 72 distance -67
time 119 distance -70
time 167 distance -67
time 215 distance -63
time 263 distance -58
time 310 distance -52
time 358 distance -49
time 405 distance -44
time 463 distance -48
time 510 distance -34
time 558 distance -30
time 606 distance -25
time 655 distance -21
time 703 distance -16
time 750 distance -11
time 798 distance -7
time 856 distance -2</pre></div></div>
<p>The numbers look pretty good, but  unfortunately the time dumps are in Javascript and don&#8217;t reflect exactly when the screen is repainted.  If the times between the scroll call and the repaint are constant, the graph would just shift (and still look like a parabola).  My theory is that this time offset varies in a specific way per animation causing the velocity hump.</p>
<h3>Parabola with time mean</h3>
<p>I then fudged time a little, like I imagine the protagonist in Braid would do in a similar spot.  I wanted all the smoothness of a fixed dt solution but with the ability to control how long the animation takes like in varying dt.  The velocity hump also needed to be flattened out.  After some experimentation, it hit me that I could literally blend the two solutions together with a time average:</p>
<div class="wp_syntax"><div class="code"><pre class="math" style="font-family:monospace;">time = (elapsed time + elapsed frames * update interval) / 2)</pre></div></div>
<p>It&#8217;s immediately obvious that the animation can last no longer than two times the &#8220;ideal time&#8221; the animation should take (plug in final time for time, 0 for elapsed frames as a worst case, and solve for elapsed time).  In contrast, if the animation is lagging behind the ideal time, the frame skipping will be blended in with a smoother animation.  If the above formula is made to be a weighted average, the trade-off between smoothness and total animation time can be tweaked with predictable results.</p>
<p>Putting the algorithm to the test, I noticed that the velocity hump is smoothed out by the time interpolation as well, so I had finally approached a robust kinetic panning algorithm that hit all three of my goals.</p>
<h3>Final thoughts</h3>
<p>Because I&#8217;m fortunate enough to be at Mozilla, you can find the distilled version of my efforts <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=538682">in code</a>.  If you&#8217;re a Javascript hacker, you&#8217;ll find this a satisfying thing to play with because you don&#8217;t really need to know a lot about Fennec beforehand.  It might be a great way to get into Fennec development (here&#8217;s how to <a href="https://wiki.mozilla.org/Mobile/Build/Fennec">set up a build</a>; ignore anything Maemo-specific to build on your desktop).</p>
<p>This problem required lots of neat stuff: basic calculus, data analysis, attention to detail and polish, a surprising roadblock, and a neatly contained end result.  These are the kinds of problems that keep me excited about programming.</p>
]]></content:encoded>
			<wfw:commentRss>http://stechz.com/2010/robust-kinetic-animation/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

