Archive for January, 2011

CSS value autocompletion, window.onerror and Interactive Validation

Published on in Google Chrome, Last Week, tech, WebKit. Version: Chrome 10

Last week brought 649 commits to the Chromium repository, and 575 to the WebKit one. Among the changes are support for auto incrementing keys for IndexedDB and interactive validation which will now be available by default in Chromium. The Web Inspector team has been active again as well!

After a few weeks of behind-the-scenes work, Web Inspector has received some very interesting updates again. Following auto-completion for properties, many values will now be suggested and completed for you as well. The heap snapshot table may be sorted again, CPU profiles will survive refreshes and using the console.trace method won’t cause a crash anymore. Web Inspector has also been taught application/x-font-woff as a valid MIME type for WOFF fonts.

Furthermore, a change has been committed which is a first step in supporting breakpoints on arbitrary positions on a line, which would be convenient for compressed scripts. Additionally, UglifyJS will be assisting in that as well, considering it’ll be included with WebKit in preparation for a script beautifier feature!

There have been quite a few specification-related updates this week as well. Interactive Validation has been enabled by default for Chromium, color changes in <select multiple> will be visible immediately and clipping backgrounds to the content-box now is a possibility. Furthermore, keygen elements won’t identify themselves any more as select elements. Mozilla’s requestAnimationFrame has been implemented, including on the Chromium side.

As for HTML5, two new form-related events have been implemented: onformchange and onforminput. Per the request of Jeremy Keith, datalist elements will be visible by default again, and uncaught JavaScript exceptions will now trigger the onerror event on the window object.

One performance-related change by Stephen White is the implementation of accelerated path drawing and clipping for the 2D Canvas GPU-path, done using a simple curve interpolator and the GLU tesselator. It speeds up Microsoft’s Galactic demo by three to five times —quite impressive.

Other changes from last week include:

  • More efficient, in-browser thumbnail generation is now available via a command line flag.
  • The –remoting flag and setting in about:flags are now available for all platforms.
  • Basic printing routines have been implemented in the WebKit2 API.
  • Some revalidation checks have been removed from the pre-rendering conditionals.
  • The languages and spell-check pages are now available in the DOMUI Settings for Chromium.
  • Style sharing optimizations have been improved, with 25-40% of the styles being shared.
  • An onBeforeRetarget callback has been introduced to the Web Navigation Extension API.
  • Happy New Year to Chromium’s about:version page!
  • The state of  the set about:flags has been moved out of a user’s profile.
  • The about:version page in Chromium now reports the used WebKit branch and revision number.
  • Various matrix multiplications will now be done in the in a column-major order.
  • The OES standard derivatives WebGL extension has been implemented in WebCore.
  • The IndexedDB implementation now is capable of handling auto incrementing keys.
  • Regular Expression objects in JavaScript aren’t callable anymore in Safari.
  • Support for YV16-video frames has been added to Chromium’s WebKit port.
  • In preparation of accelerating more drawing via the GPU, Chrome has updated the Skia version.
  • Enforced throttling for URL requests has been disabled in Chromium, pending further analysis.
  • Loads of JavaScript stability fixes by Apple’s JavaScript team.
  • Password input fields will now show a warning when caps-lock is enabled, on GTK WebKit.
  • The -webkit-mask-* CSS properties can now be rendered using accelerated compositing.

And that’d be all again! Be sure to have a peek at this week’s update on the WHATWG blog, with topics like a proposal for XSS mitigation in browsers and a Change Proposal for a muted attribute for media elements.

Read more (5 comments) »

CSS Variables and mixins, Interactive Validation and pre-rendering

Published on in Google Chrome, HTML, Last Week, tech, WebKit. Version: Chrome 10

With 1,134 commits in the last week, development certainly is getting back on track after the holidays. This week’s highlights include some plans for improving the CSSOM, implementation plans for CSS Variables and the landing of Interactive Validation within WebKit. I won’t address H.264. Enough people have done that.

If you’re interested in updates related to HTML, Anne van Kesteren published an item on recent changes happening around the WHATWG. The article mostly covers discussions which took place on the whatwg@whatwg.org mailing list, and certainly is an interesting read!

Tab Atkins, member of the CSS Working Group and the Google Chrome team, has published the slides of a presentation he hosted last Wednesday. It talks about how the CSSOM, the interface between JavaScript and CSS, basically sucks. The presentation demonstrates four relatively new concepts:

  • CSS Variables
    By declaring a variable through the @var rule, its type and the value, anything from colors to lengths, rotations and functions can be defined and will be available to all CSS used in the document. Support for local variables will be available as well, through the @local at-rule.

@var petersh-paragraph-size length 12px;
@var petersh-paragraph-color color rgba(0,0,0,0);
p {
. color: var(petersh-paragraph-color);
. font-size: var(petersh-paragraph-size);
}

  • CSS Mixins
    Mixins come down to being able to extend any rule with certain, common properties. They take parameters similarly to CSS Variables, including the ability to have default values for them.
  • CSS Nesting
    Nesting in CSS, especially when used without classes or IDs, can be a pain. The @this at-rule will be introduced for usage in CSS rules. The selector you supply behind it will apply only to descendants of elements matched by the current rule. That clears the way for structures like this:

header {
. color: red;
. @this a {
. . color: blue;
. }
}

  • CSS Modules
    No, not the CSS Modules which make up CSS Level 3. CSS Modules basically are namespaces for CSS Variables and Mixins. Mixins and variables can still be referred to by prepending their name with the namespace’s name, or by including the @use at-rule to have the parser include all of them.

    While the idea is fine, I personally think this shouldn’t be part of the specification. The use-case is easily obtainable by advocating authors to prefix their variable names, like “petersh-header-color” instead of “header-color”. Two types of namespacing, sharing similar syntax, is just going to cause confusion.

While the current code is only available on a few machines in Sydney, Google is planning to publish an initial specification this quarter, and implement the changes before the end of the year. Considering neither these plans for CSS Variables nor the CSS Mixins and Nesting have been shared on the www-style mailing list yet, it’ll be interesting to see how it will be received by other vendors. Related discussion from a few years ago has shown that it’s a fairly controversial issue, with many opinions being far apart.

Last Thursday, Kent Tamura landed support for the Interactive Validation UI using the new Shadow DOM model. With most bugs out of the way, messages and an –albeit internal– API being available for Chromium to enable the feature, it won’t be long before it becomes available in the nightlies.

In other specification-related news, the scroll event will now be fired asynchronously. The WebKitCSSMatrix object in the DOM now accepts none as a valid keyword, and using the toDataURL method for a canvas on Chromium will now composite onto a black surface when the destination format does not support an alpha channel.

Other changes which happened last week:

  • Tony Gentilcore now is a WebKit reviewer, congratulations!
  • Adam Barth is working on a proposal for embedding a security policy in an HTML document.
  • He also announced to have finished moving WebKit’s source files to a separate directory.
  • The about:sync page has been updated to use the new DOM UI displaying system.
  • The media player from WebKit’s GTK port now features a slider to change the volume.
  • Simon Fraser wrote an excellent article on his CSS3 Gradients implementation.
  • Support for dropping data to WebKit2 has been implemented for Mac OS systems.
  • Password synchronization has been enabled by default for Google Chrome.
  • Some issues with Safari’s strict mode implementations have been fixed.
  • The security model used chrome://-URLs has been updated, as described in this message.
  • Three fixes in Safari’s JavaScript engine found via Mozilla’s jsfunfuzz.
  • Crashed extensions will now be visible on the chrome://extensions page.
  • Following this very commit, the –enable-page-prerender will now actually pre-render your pages.
  • Chris Rogers added part of the Chromium-side for low-latency output for the Web Audio API.

And that’s all for this week!

Read more (7 comments) »

JavaScript Full Screen API, Navigation Timing and repeating CSS Gradients

Published on in Google Chrome, Last Week, Standards, tech, Trident, WebKit. Version: Chrome 10

Development is slowly getting back on track with the 851 commits which were done last week. This week’s highlights include the availability of a per element JavaScript full screen API, a prefixless Navigation Timing implementation and the addition of support for repeating CSS gradients.

With both Microsoft and Google strongly pushing the Navigation Timing specification, both vendors finished most of their implementation and a Last Call specification will be published tomorrow. Because of this, WebKit has dropped the vendor prefix and Microsoft is very likely to do the same. Opera and Mozilla have expressed concerns, but seem supportive as well. It’ll certainly become an interesting Last Call phase.

As for other specification-related changes, text emphasis marks won’t appear over characters that have ruby annotations anymore. Support for repeating gradients has been added as well, completing the set of gradient related CSS properties. Negated selectors will be given the specificity of the selector they’re negating, and parsing of the argument for the :nth-child CSS selector has been updated and now accepts whitespace, but rejects invalid values.

...
var elem = document.getElementById("my-element");
elem.onwebkitfullscreenchange = function () {
console.log ("We went fullscreen!");
};
elem.webkitRequestFullScreen ();
..

After several months of writing and updating patches, Jer Noble landed the final part of his work on supporting per-element full screen last Friday. While the implementation is only available in WebKit nightlies on Mac OS systems so far, I’d expect a Windows nightly rather soon and Chromium is interested as well.

WebKit’s implementation follows Mozilla’s proposal with only a few exceptions: instead of accepting flags for requestFullScreen, an additional method called requestFullScreenWithKeys has been made available. The following three methods have been added for the Document and all Elements in the DOM:

void webkitRequestFullScreen();
void webkitRequestFullScreenWithKeys();
void webkitCancelFullScreen(); // only on Document

Furthermore, a new attribute called allowFullScreen has been introduced for iframe elements, the fullScreenChange event has been added and three CSS pseudo-classes have been added, namely :full-screen, :full-screen-doc and :full-screen-root-with-target. Mind that each of these additions has been prefixed with “webkit” or “-webkit-“, depending on the context.

Want to try the feature yourself?
All you need is a Mac OS X system on which you can run WebKit nightlies. Download and install the latest one and open up Terminal. Within it, execute the following command to enable the feature:

defaults write com.apple.Safari WebKitFullScreenEnabled 1

After (re)starting the nightly, the exposed API will actually launch an element in full screen. Click on the icon to the left of this paragraph to display this very article in full screen. Using it to display a single element in full screen can be done too, but still is a bit unstable at the time of writing.

Other changes which occurred last week:

  • The disabled property on stylesheet elements will now disable the sheet altogether.
  • Adam Barth moved the WebCore directory, containing most of WebKit’s code, to Source.
  • A memory sampler has been added to WebKit, primarily for usage in Safari on Mac OS X.
  • The onbeforeunload event is now available for framesets as well.
  • SGML-style comments within <style> elements will now be ignored when using XHTML.
  • Tabbed options (also known as WebUI) have been enabled by default in Chromium.
  • Per an update in the HTML5 specification, framesets will now be allowed after hidden inputs.
  • The Web Audio API received some more work for the Chromium port.
  • Mihai Parparita now is a WebKit reviewer, congratulations!
  • The PNG compression settings for Chromium have been optimized for performance.
  • Inline script execution will now block on pending stylesheet loads, as other browsers do.
  • The O3D Plugin API will now work with Opera 11 as well.
  • Web Inspector has been enabled for all internal chrome:// pages.
  • The icon for active background extensions over the wrench menu in Chrome has been updated.
  • The position of Notifications can now be changed via a notification’s option menu.

This week might bring four times faster JavaScript to Samsung’s EFL port, support for the object-fit CSS property and, hopefully, much more patches from the Web Inspector team. Have a good week!

Read more (19 comments) »

Gradients, two new range based CSS selectors and background extensions

Published on in CSS, Google Chrome, Last Week, Standards, tech, WebKit. Version: Chrome 10

Happy New Year! Even though there were only 354 commits in total, there certainly were some interesting subjects to write about. Highlights include cleaner gradient syntax for WebKit, support for the :in-range and :out-of-range CSS Selectors and background extensions enabled by default.

There are two things which I’ll change with the weekly updates, starting at this article. Firstly, I’m no longer forcing external links to open up in new tabs/windows: clicking them will navigate away from the article. Furthermore, I have added tags indicating the latest Chromium version at the time of publishing, making it easier to determine what changed in a major Chrome release: version 7, 8, 9 and the latest: Chrome 10.

Following Tab Atkins’ promise that the gradient part of the CSS3 Images specification won’t change anymore, Simon Fraser was quick to jump in and implement the gradient syntax in WebKit. This is good news for the cutting-edge developer, as WebKit’s own proprietary syntax won’t be nessesary anymore in the near feature.

So far, two patches for supporting the new gradient syntax have landed. The first one implements the syntax for non-repeating linear gradients, including support for non-percent based and negative lengths. The second patch adds support for radial gradients through the -webkit-radial-gradient property, which includes shapes and sizing for the ellipse. Mind that only circular ellipses are supported for now.

Hopefully the new CSS3 Images module will be published as a Working Draft soon, as Tab Atkins is intending to request it. The new draft introduces the ability to use elements as backgrounds, as well as a more convenient way of cross fading background images.

The Web Inspector team didn’t seem to care about the New Year either and landed various patches. The protocol has been cleaned up and was enriched with Network, DOM Storage and Database domains. Disabled style properties get enabled when they’re edited and pasting a full property declaration will now split it up in a property and value automatically.

Other changes in this week include:

  • Support for HTML5’s :in-range and :out-of-range CSS selectors has been added.
  • Viewing the source of a pinned/app window won’t clone the tab’s state anymore.
  • The JSON.parse method in JavaScriptCore now properly exists as a function taking two parameters.
  • With the addition of the Surface3D class, the Pepper3D API is now complete, but not fully functional yet.
  • JavaScriptCore now recognizes vertical tabs and form feeds as valid JSON whitespace characters.
  • Accidental white-space for Chromium OS usernames will now be removed.
  • Sandboxed iframes no longer have access to the top.history methods.
  • Periods in Google Apps account names won’t be ignored anymore in Chromium OS.
  • WebKit’s client-based GeoLocation has been enabled for Chromium.
  • Background extensions have been enabled for all platforms, except for Chromium OS.
  • Submitting forms using the GET method to the current location as its action won’t reload the page.

Where my first day of work in 2011 has already passed, yours might just be beginning. See you next week!

Read more (7 comments) »