Automated reasoning for web page layout

Web pages define their appearance using Cascading Style Sheets, a modular language for layout of tree-structured documents. In principle, using CSS is easy: the developer specifies declarative constraints on the layout of an HTML document (such as the positioning of nodes in the HTML tree), and the browser solves the constraints to produce a box-based rendering of that document. In practice, however, the subtleties of CSS semantics make it difficult to develop stylesheets that produce the intended layout across different user preferences and browser settings. This paper presents the first mechanized formalization of a substantial fragment of the CSS semantics. This formalization is equipped with an efficient reduction to the theory of quantifier-free linear real arithmetic, enabling effective automated reasoning about CSS stylesheets and their behavior. We implement this reduction in Cassius, a solver-aided framework for building semantics-aware tools for CSS. To demonstrate the utility of Cassius, we prototype new tools for automated verification, debugging, and synthesis of CSS code. We show that these tools work on fragments of real-world websites, and that Cassius is a practical first step toward solver-aided programming for the web.

[1]  Ranjitha Kumar,et al.  Webzeitgeist: design mining the web , 2013, CHI.

[2]  Jeffrey Heer,et al.  ReVision: automated classification, analysis and redesign of chart images , 2011, UIST.

[3]  Sorin Lerner,et al.  Proving optimizations correct using parameterized program equivalence , 2009, PLDI '09.

[4]  Nikolaj Bjørner,et al.  Z3: An Efficient SMT Solver , 2008, TACAS.

[5]  Mike Y. Chen,et al.  SeeSS: seeing what i broke -- visualizing change impact of cascading style sheets (css) , 2013, UIST.

[6]  Peter J. Stuckey,et al.  Constraint cascading style sheets for the Web , 1999, UIST '99.

[7]  Sanjit A. Seshia,et al.  Combinatorial sketching for finite programs , 2006, ASPLOS XII.

[8]  Ranjitha Kumar,et al.  Bricolage: example-based retargeting for web design , 2011, CHI.

[9]  Tuan Anh Nguyen,et al.  Reverse Engineering Mobile Application User Interfaces with REMAUI (T) , 2015, 2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE).

[10]  Clark W. Barrett,et al.  The SMT-LIB Standard Version 2.0 , 2010 .

[11]  Emina Torlak,et al.  A lightweight symbolic virtual machine for solver-aided host languages , 2014, PLDI.

[12]  K. Rustan M. Leino,et al.  This is Boogie 2 , 2016 .

[13]  C.-H. Luke Ong,et al.  Detecting redundant CSS rules in HTML5 applications: a tree rewriting approach , 2014, OOPSLA.

[14]  Leo A. Meyerovich,et al.  Fast and parallel webpage layout , 2010, WWW '10.

[15]  K. Rustan M. Leino,et al.  Dafny: An Automatic Program Verifier for Functional Correctness , 2010, LPAR.

[16]  Rastislav Bodík,et al.  Programming by manipulation for layout , 2014, UIST.

[17]  John Regehr,et al.  Provably correct peephole optimizations with alive , 2015, PLDI.

[18]  Maneesh Agrawala,et al.  Deconstructing and restyling D3 visualizations , 2014, UIST.

[19]  Nirav Dave,et al.  Smten with satisfiability-based search , 2014, OOPSLA 2014.

[20]  Emina Torlak,et al.  Growing solver-aided languages with rosette , 2013, Onward!.

[21]  Ramesh Govindan,et al.  A General Approach to Network Configuration Analysis , 2015, NSDI.