From: <rb...@us...> - 2013-06-30 15:43:24
|
Revision: 8362 http://sourceforge.net/p/htmlunit/code/8362 Author: rbri Date: 2013-06-30 15:43:20 +0000 (Sun, 30 Jun 2013) Log Message: ----------- more defaults for the display property fixed Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java 2013-06-30 12:44:17 UTC (rev 8361) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java 2013-06-30 15:43:20 UTC (rev 8362) @@ -146,7 +146,24 @@ map.put("FONT", "inline"); map.put("FOOTER", "inline"); map.put("HEADER", "inline"); + map.put("I", "inline"); + map.put("IFRAME", "inline"); + map.put("IMG", "inline"); + map.put("INPUT", "inline-block"); + map.put("INS", "inline"); + map.put("KBD", "inline"); + map.put("KEYGEN", "inline"); + map.put("LABEL", "inline"); + map.put("LEGEND", "inline"); + map.put("LI", "list-item"); map.put("SPAN", "inline"); + + map.put("TABLE", "table"); + map.put("TBODY", "table-row-group"); + map.put("TD", "table-cell"); + map.put("TH", "table-cell"); + map.put("THEAD", "table-header-group"); + map.put("TR", "table-row"); DEFAULT_DISPLAYS = Collections.unmodifiableMap(map); map = new HashMap<String, String>(map); @@ -159,15 +176,9 @@ map.put("FIGURE", "block"); map.put("FOOTER", "block"); map.put("HEADER", "block"); - map.put("SPAN", "inline"); + map.put("INPUT", "inline"); + map.put("LEGEND", "block"); - map.put("LI", "list-item"); - map.put("TABLE", "table"); - map.put("TBODY", "table-row-group"); - map.put("TD", "table-cell"); - map.put("TH", "table-cell"); - map.put("THEAD", "table-header-group"); - map.put("TR", "table-row"); DEFAULT_DISPLAYS_CSS = Collections.unmodifiableMap(map); } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java 2013-06-30 12:44:17 UTC (rev 8361) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java 2013-06-30 15:43:20 UTC (rev 8362) @@ -531,10 +531,105 @@ * @throws Exception if an error occurs */ @Test - @Alerts(IE = "block block block block block block block block", - FF = "table table-header-group table-row-group table-cell table-row table-cell block list-item") + @Alerts(DEFAULT = { "inline", "inline", "inline", "inline", "inline", "inline", + "inline", "inline", "inline", "inline" }, + IE = { "inline", "inline", "inline", "inline-block", "inline-block", + "inline-block", "inline-block", "inline-block", "inline-block", "inline" }) + public void defaultDisplayValues_I() throws Exception { + final String html = "<!DOCTYPE HTML>\n<html><body>\n" + + " <p id='p'>\n" + + " <i id='i'></i>\n" + + " <ins id='ins'></ins>\n" + + " </p>\n" + + + " <iframe id='iframe'></iframe>\n" + + " <img id='img'></img>\n" + + + " <form id='form'>\n" + + " <input id='submit' type='submit'>\n" + + " <input id='reset' type='reset'>\n" + + " <input id='text' type='text'>\n" + + " <input id='password' type='password'>\n" + + " <input id='checkbox' type='checkbox'>\n" + + " <input id='radio' type='radio'>\n" + + " </form>\n" + + + " <script>\n" + + " function x(id) {\n" + + " var e = document.getElementById(id);\n" + + " return e.currentStyle ? e.currentStyle.display : window.getComputedStyle(e, '').display;\n" + + " }\n" + + " </script>\n" + + " <script>\n" + + " alert(x('i'));\n" + + " alert(x('iframe'));\n" + + " alert(x('img'));\n" + + + " alert(x('submit'));\n" + + " alert(x('reset'));\n" + + " alert(x('text'));\n" + + " alert(x('password'));\n" + + " alert(x('checkbox'));\n" + + " alert(x('radio'));\n" + + + " alert(x('ins'));\n" + + + " </script>\n" + + "</body></html>"; + loadPageWithAlerts2(html); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts(DEFAULT = { "inline", "inline", "inline", "block", "list-item" }, + IE = { "inline", "inline", "inline", "inline", "list-item" }) + public void defaultDisplayValues_KL() throws Exception { + final String html = "<!DOCTYPE HTML>\n<html><body>\n" + + " <p id='p'>\n" + + " <kbd id='kbd'></kbd>\n" + + " <ins id='ins'></ins>\n" + + " </p>\n" + + + " <ol>\n" + + " <li id='li'></li>\n" + + " </ol>\n" + + + " <form id='form'>\n" + + " <keygen id='keygen'>\n" + + " <label id='label'>\n" + + " <fieldset id='fieldset'>\n" + + " <legend id='legend'></legend>\n" + + " </fieldset>\n" + + " </form>\n" + + + " <script>\n" + + " function x(id) {\n" + + " var e = document.getElementById(id);\n" + + " return e.currentStyle ? e.currentStyle.display : window.getComputedStyle(e, '').display;\n" + + " }\n" + + " </script>\n" + + " <script>\n" + + " alert(x('kbd'));\n" + + " alert(x('keygen'));\n" + + + " alert(x('label'));\n" + + " alert(x('legend'));\n" + + " alert(x('li'));\n" + + + " </script>\n" + + "</body></html>"; + loadPageWithAlerts2(html); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts("table table-header-group table-row-group table-cell table-row table-cell block list-item") public void defaultDisplayValuesTable() throws Exception { - final String html = "<html><body>\n" + final String html = "<!DOCTYPE HTML>\n<html><body>\n" + " <table id='table'>\n" + " <thead id='thead'><tr id='tr'><th id='th'>header</th></tr></thead>\n" + " <tbody id='tbody'><tr><td id='td'>body</td></tr></tbody>\n" |