From: <asa...@us...> - 2012-12-31 13:36:35
|
Revision: 7929 http://sourceforge.net/p/htmlunit/code/7929 Author: asashour Date: 2012-12-31 13:36:31 +0000 (Mon, 31 Dec 2012) Log Message: ----------- CSS: support Selectors Level 3: - Remaining not() case will be resolved once the cssparser patch #6 is committed. Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleSheet.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSSelectorTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2012-12-31 08:07:59 UTC (rev 7928) +++ trunk/htmlunit/src/changes/changes.xml 2012-12-31 13:36:31 UTC (rev 7929) @@ -7,7 +7,10 @@ </properties> <body> - <release version="2.12" date="???" description="Bugfixes"> + <release version="2.12" date="???" description="Bugfixes, CSS3 Selectors"> + <action type="add" dev="asashour"> + CSS: support Selectors Level 3. + </action> <action type="update" dev="asashour"> JavaScript: fix document/element . querySelectorAll()/querySelector() (IE8). </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleSheet.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleSheet.java 2012-12-31 08:07:59 UTC (rev 7928) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleSheet.java 2012-12-31 13:36:31 UTC (rev 7929) @@ -36,6 +36,7 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; +import java.util.concurrent.atomic.AtomicBoolean; import net.sourceforge.htmlunit.corejs.javascript.Context; @@ -45,6 +46,7 @@ import org.apache.commons.logging.LogFactory; import org.w3c.css.sac.AttributeCondition; import org.w3c.css.sac.CSSException; +import org.w3c.css.sac.CSSParseException; import org.w3c.css.sac.CombinatorCondition; import org.w3c.css.sac.Condition; import org.w3c.css.sac.ConditionalSelector; @@ -136,7 +138,7 @@ "focus", "lang", "first-child"); private static final Collection<String> CSS3_PSEUDO_CLASSES = new ArrayList<String>(Arrays.asList( - "checked", "disabled", "indeterminated", "root", "target", + "checked", "disabled", "indeterminated", "root", "target", "not()", "nth-child()", "nth-last-child()", "nth-of-type()", "nth-last-of-type()", "last-child", "first-of-type", "last-of-type", "only-child", "only-of-type", "empty")); @@ -665,6 +667,38 @@ else if ("empty".equals(value)) { return element.getFirstChild() == null; } + else if (value.startsWith("not(")) { + final String selectors = value.substring(value.indexOf('(') + 1, value.length() - 1); + final AtomicBoolean errorOccured = new AtomicBoolean(false); + final ErrorHandler errorHandler = new ErrorHandler() { + public void warning(final CSSParseException exception) throws CSSException { + // ignore + } + + public void fatalError(final CSSParseException exception) throws CSSException { + errorOccured.set(true); + } + + public void error(final CSSParseException exception) throws CSSException { + errorOccured.set(true); + } + }; + final CSSOMParser parser = new CSSOMParser(new SACParserCSS3()); + parser.setErrorHandler(errorHandler); + try { + final SelectorList selectorList = parser.parseSelectors(new InputSource(new StringReader(selectors))); + if (errorOccured.get() || selectorList == null || selectorList.getLength() != 1) { + throw new CSSException("Invalid selectors: " + selectors); + } + + validateSelectors(selectorList, 9); + + return !CSSStyleSheet.selects(browserVersion, selectorList.item(0), element); + } + catch (final IOException e) { + throw new CSSException("Error parsing CSS selectors from '" + selectors + "': " + e.getMessage()); + } + } return false; } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSSelectorTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSSelectorTest.java 2012-12-31 08:07:59 UTC (rev 7928) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSSelectorTest.java 2012-12-31 13:36:31 UTC (rev 7929) @@ -14,11 +14,14 @@ */ package com.gargoylesoftware.htmlunit.javascript.host.css; +import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.FF; + import org.junit.Test; import org.junit.runner.RunWith; import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; +import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; import com.gargoylesoftware.htmlunit.WebDriverTestCase; import com.gargoylesoftware.htmlunit.html.HtmlPageTest; @@ -542,7 +545,7 @@ * @throws Exception if an error occurs */ @Test - @Alerts(DEFAULT = "id1", IE8 = "exception") + @Alerts(DEFAULT = "id2", IE8 = "exception") public void empty() throws Exception { final String html = "<html><head><title>First</title>\n" + "<meta http-equiv='X-UA-Compatible' content='IE=9'>\n" @@ -556,11 +559,37 @@ + "}\n" + "</script></head>\n" + "<body onload='test()'>\n" - + " <p id='id1'></p>\n" - + " <p id='id2'>Hello, World!</p>\n" + + " <p id='id1'>Hello, World!</p>\n" + + " <p id='id2'></p>\n" + "</body></html>"; loadPageWithAlerts2(html); } + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts(DEFAULT = "id2", IE8 = "exception") + @NotYetImplemented(FF) + public void not() throws Exception { + final String html = "<html><head><title>First</title>\n" + + "<meta http-equiv='X-UA-Compatible' content='IE=9'>\n" + + "<script>\n" + + "function test() {\n" + + " if (document.querySelectorAll) {\n" + + " try {\n" + + " alert(document.querySelectorAll('input:not([type=\"file\"])')[0].id);\n" + + " } catch(e) {alert('exception')}\n" + + " }\n" + + "}\n" + + "</script></head>\n" + + "<body onload='test()'>\n" + + " <input id='id1' type='file'>\n" + + " <input id='id2'>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } + } |
From: <asa...@us...> - 2013-01-05 07:24:27
|
Revision: 7935 http://sourceforge.net/p/htmlunit/code/7935 Author: asashour Date: 2013-01-05 07:24:24 +0000 (Sat, 05 Jan 2013) Log Message: ----------- Handle pages with "application/javascript" content type as JavaScriptPage. Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/DefaultPageCreator.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/DefaultPageCreatorTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2013-01-03 19:16:49 UTC (rev 7934) +++ trunk/htmlunit/src/changes/changes.xml 2013-01-05 07:24:24 UTC (rev 7935) @@ -8,6 +8,9 @@ <body> <release version="2.12" date="???" description="Bugfixes, CSS3 Selectors"> + <action type="fix" dev="asashour" issue="1471"> + Handle pages with "application/javascript" content type as JavaScriptPage. + </action> <action type="add" dev="asashour"> CSS: support Selectors Level 3. </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/DefaultPageCreator.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/DefaultPageCreator.java 2013-01-03 19:16:49 UTC (rev 7934) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/DefaultPageCreator.java 2013-01-05 07:24:24 UTC (rev 7935) @@ -112,7 +112,8 @@ return PageType.HTML; } - if ("text/javascript".equals(contentType) || "application/x-javascript".equals(contentType)) { + if ("text/javascript".equals(contentType) || "application/x-javascript".equals(contentType) + || "application/javascript".equals(contentType)) { return PageType.JAVASCRIPT; } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/DefaultPageCreatorTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/DefaultPageCreatorTest.java 2013-01-03 19:16:49 UTC (rev 7934) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/DefaultPageCreatorTest.java 2013-01-05 07:24:24 UTC (rev 7935) @@ -56,6 +56,7 @@ assertEquals(PageType.JAVASCRIPT, DefaultPageCreator.determinePageType("text/javascript")); assertEquals(PageType.JAVASCRIPT, DefaultPageCreator.determinePageType("application/x-javascript")); + assertEquals(PageType.JAVASCRIPT, DefaultPageCreator.determinePageType("application/javascript")); assertEquals(PageType.XML, DefaultPageCreator.determinePageType("text/xml")); assertEquals(PageType.XML, DefaultPageCreator.determinePageType("application/xml")); |
From: <mgu...@us...> - 2013-01-07 11:39:26
|
Revision: 7941 http://sourceforge.net/p/htmlunit/code/7941 Author: mguillem Date: 2013-01-07 11:39:23 +0000 (Mon, 07 Jan 2013) Log Message: ----------- Set max number of simultaneous connections per server to 6. Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2013-01-07 11:32:36 UTC (rev 7940) +++ trunk/htmlunit/src/changes/changes.xml 2013-01-07 11:39:23 UTC (rev 7941) @@ -8,6 +8,9 @@ <body> <release version="2.12" date="???" description="Bugfixes, CSS3 Selectors"> + <action type="update" dev="mguillem"> + Set max number of simultaneous connections per server to 6. + </action> <action type="fix" dev="asashour" issue="1471"> Handle pages with "application/javascript" content type as JavaScriptPage. </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java 2013-01-07 11:32:36 UTC (rev 7940) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java 2013-01-07 11:39:23 UTC (rev 7941) @@ -556,6 +556,7 @@ final PoolingClientConnectionManager connectionManager = new PoolingClientConnectionManager(schemeRegistry); + connectionManager.setDefaultMaxPerRoute(6); final DefaultHttpClient httpClient = new DefaultHttpClient(connectionManager, httpParams); httpClient.setCookieStore(new HtmlUnitCookieStore(webClient_.getCookieManager())); |
From: <mgu...@us...> - 2013-01-08 08:32:03
|
Revision: 7952 http://sourceforge.net/p/htmlunit/code/7952 Author: mguillem Date: 2013-01-08 08:32:00 +0000 (Tue, 08 Jan 2013) Log Message: ----------- fake Navigator.buildId for FF17 Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Navigator.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/NavigatorTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Navigator.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Navigator.java 2013-01-08 08:26:44 UTC (rev 7951) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Navigator.java 2013-01-08 08:32:00 UTC (rev 7952) @@ -273,6 +273,9 @@ @JsxGetter(@WebBrowser(FF)) public String getBuildID() { final BrowserVersion browser = getBrowserVersion(); + if ("FF17".equals(browser.getNickname())) { + return "20121129151842"; + } if ("FF3.6".equals(browser.getNickname())) { return "20120306064154"; } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/NavigatorTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/NavigatorTest.java 2013-01-08 08:26:44 UTC (rev 7951) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/NavigatorTest.java 2013-01-08 08:32:00 UTC (rev 7952) @@ -290,7 +290,7 @@ * @throws Exception if the test fails */ @Test - @Alerts(FF10 = "20120713134347", FF3_6 = "20120306064154", DEFAULT = "undefined") + @Alerts(FF10 = "20120713134347", FF3_6 = "20120306064154", FF17 = "20121129151842", DEFAULT = "undefined") public void buildID() throws Exception { final String html = "<html><head><title>First</title>\n" |
From: <mgu...@us...> - 2013-01-08 08:53:05
|
Revision: 7954 http://sourceforge.net/p/htmlunit/code/7954 Author: mguillem Date: 2013-01-08 08:52:59 +0000 (Tue, 08 Jan 2013) Log Message: ----------- fixed Storage tests for FF17 Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/StorageTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-01-08 08:40:45 UTC (rev 7953) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-01-08 08:52:59 UTC (rev 7954) @@ -1139,7 +1139,7 @@ SET_READONLY_PROPERTIES, /** Indicates [object StorageObsolete] instead of [object Storage]. */ - @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) + @BrowserFeature({ @WebBrowser(value = FF, maxVersion = 10), @WebBrowser(CHROME) }) STORAGE_OBSOLETE, /** Indicates that string.trim(), .trimLeft() and .trimRight() are supported. */ Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/StorageTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/StorageTest.java 2013-01-08 08:40:45 UTC (rev 7953) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/StorageTest.java 2013-01-08 08:52:59 UTC (rev 7954) @@ -43,7 +43,8 @@ */ @Test @Alerts(IE = { "undefined", "undefined", "undefined" }, IE8 = { "undefined", "[object]", "[object]" }, - FF = { "[object StorageList]", "[object Storage]", "[object Storage]" }) + FF = { "[object StorageList]", "[object Storage]", "[object Storage]" }, + FF17 = { "undefined", "[object Storage]", "[object Storage]" }) @NotYetImplemented(FF3_6) public void storage() throws Exception { final String html @@ -139,7 +140,8 @@ * @throws Exception if the test fails */ @Test - @Alerts(FF = { "[object StorageObsolete]", "error" }) + @Alerts(FF3_6 = { "[object StorageObsolete]", "error" }, + FF10 = { "[object StorageObsolete]", "error" }) public void globalStorage() throws Exception { final String html = "<html><head></head><body>\n" |
From: <mgu...@us...> - 2013-01-08 09:04:38
|
Revision: 7956 http://sourceforge.net/p/htmlunit/code/7956 Author: mguillem Date: 2013-01-08 09:04:33 +0000 (Tue, 08 Jan 2013) Log Message: ----------- implement Range.equivalentValues allowing SelectionTest.aLittleBitOfEverything_removeRange to work for FF10+ Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Range.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/SelectionTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Range.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Range.java 2013-01-08 09:03:12 UTC (rev 7955) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Range.java 2013-01-08 09:04:33 UTC (rev 7956) @@ -481,4 +481,16 @@ public String toString() { return toW3C().toString(); } + + @Override + protected Object equivalentValues(final Object value) { + if (!(value instanceof Range)) { + return false; + } + final Range other = (Range) value; + return startContainer_ == other.startContainer_ + && endContainer_ == other.endContainer_ + && startOffset_ == other.startOffset_ + && endOffset_ == other.endOffset_; + } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/SelectionTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/SelectionTest.java 2013-01-08 09:03:12 UTC (rev 7955) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/SelectionTest.java 2013-01-08 09:04:33 UTC (rev 7956) @@ -22,6 +22,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; +import com.gargoylesoftware.htmlunit.BrowserRunner.Browser; import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers; import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; import com.gargoylesoftware.htmlunit.WebDriverTestCase; @@ -141,15 +142,15 @@ */ @Test @Browsers(FF) - @NotYetImplemented @Alerts(FF3_6 = { "1:[object Text]/1/[object Text]/2/false/undefined/1/yzfo/yzfo", "2:[object Text]/1/[object Text]/2/true/undefined/0/", "false", "true" }, - FF10 = { + FF = { "1:[object Text]/1/[object Text]/2/false/undefined/1/yzfo/yzfo", "2:null/0/null/0/true/undefined/0/", "false", "true" }) + @NotYetImplemented(Browser.FF3_6) public void aLittleBitOfEverything_removeRange() throws Exception { final String jsSnippet = "" + " var range = document.createRange();\n" |
From: <mgu...@us...> - 2013-01-08 09:32:51
|
Revision: 7957 http://sourceforge.net/p/htmlunit/code/7957 Author: mguillem Date: 2013-01-08 09:32:48 +0000 (Tue, 08 Jan 2013) Log Message: ----------- fill HashChangeEvent's old and new URLs when set from JS (makes Location2Test.onHashChangeJS working for FF10+) Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/HashChangeEvent.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Location.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Location2Test.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/HashChangeEvent.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/HashChangeEvent.java 2013-01-08 09:04:33 UTC (rev 7956) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/HashChangeEvent.java 2013-01-08 09:32:48 UTC (rev 7957) @@ -14,6 +14,7 @@ */ package com.gargoylesoftware.htmlunit.javascript.host; +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.CHROME; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; @@ -30,12 +31,13 @@ * * @version $Revision$ * @author Ronald Brill + * @author Marc Guillemot */ -@JsxClass(browsers = { @WebBrowser(value = IE, minVersion = 8), @WebBrowser(FF) }) +@JsxClass(browsers = { @WebBrowser(value = IE, minVersion = 8), @WebBrowser(FF), @WebBrowser(CHROME) }) public class HashChangeEvent extends UIEvent { - private Object oldURL_; - private Object newURL_; + private String oldURL_; + private String newURL_; /** * Creates a new UI event instance. @@ -53,7 +55,7 @@ * @param newUrl the new url */ public HashChangeEvent(final SimpleScriptable scriptable, final String type, - final Object oldUrl, final Object newUrl) { + final String oldUrl, final String newUrl) { super(scriptable, type); oldURL_ = oldUrl; newURL_ = newUrl; @@ -63,7 +65,7 @@ * Returns the old URL. * @return the old URL */ - @JsxGetter + @JsxGetter({ @WebBrowser(value = FF, minVersion = 10), @WebBrowser(CHROME) }) public Object getOldURL() { return oldURL_; } @@ -72,7 +74,7 @@ * Returns the new URL. * @return the new URL */ - @JsxGetter + @JsxGetter({ @WebBrowser(value = FF, minVersion = 10), @WebBrowser(CHROME) }) public Object getNewURL() { return newURL_; } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Location.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Location.java 2013-01-08 09:04:33 UTC (rev 7956) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Location.java 2013-01-08 09:32:48 UTC (rev 7957) @@ -24,8 +24,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import net.sourceforge.htmlunit.corejs.javascript.Undefined; - import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -305,11 +303,13 @@ } } final boolean hasChanged = hash != null && !hash.equals(hash_); + final String oldUrl = getHref(); hash_ = hash; + final String newUrl = getHref(); if (hasChanged) { final HashChangeEvent event = new HashChangeEvent(getWindow(), Event.TYPE_HASH_CHANGE, - Undefined.instance, Undefined.instance); + oldUrl, newUrl); getWindow().executeEvent(event); } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Location2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Location2Test.java 2013-01-08 09:04:33 UTC (rev 7956) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Location2Test.java 2013-01-08 09:32:48 UTC (rev 7957) @@ -23,6 +23,8 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; +import com.gargoylesoftware.htmlunit.BrowserRunner.Browser; +import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** @@ -467,6 +469,7 @@ IE6 = { }, IE7 = { }, IE8 = { "supported", "onhashchange -" }) + @NotYetImplemented({ Browser.FF10, Browser.FF17 }) public void onHashChange() throws Exception { final String html = "<html><head>\n" |
From: <mgu...@us...> - 2013-01-08 10:39:42
|
Revision: 7963 http://sourceforge.net/p/htmlunit/code/7963 Author: mguillem Date: 2013-01-08 10:39:38 +0000 (Tue, 08 Jan 2013) Log Message: ----------- It looks likes TreeWalker.expandEntityReferences is always false for FF17. Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/TreeWalker.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/TreeWalkerTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-01-08 10:15:02 UTC (rev 7962) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-01-08 10:39:38 UTC (rev 7963) @@ -1050,6 +1050,11 @@ @BrowserFeature(@WebBrowser(IE)) JS_TEXT_AREA_SET_COLS_THROWS_EXCEPTION, + /** It looks likes TreeWalker.expandEntityReferences is always <code>false</code> for FF17. + */ + @BrowserFeature(@WebBrowser(value = FF, minVersion = 17)) + JS_TREEWALKER_EXPAND_ENTITY_REFERENCES_FALSE, + /** Changing the opener of an window to something not null * is not valid (in FF). */ Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/TreeWalker.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/TreeWalker.java 2013-01-08 10:15:02 UTC (rev 7962) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/TreeWalker.java 2013-01-08 10:39:38 UTC (rev 7963) @@ -64,7 +64,7 @@ public TreeWalker(final Node root, final long whatToShow, final NodeFilter filter, - final Boolean expandEntityReferences) throws DOMException { + final boolean expandEntityReferences) throws DOMException { if (root == null) { Context.throwAsScriptRuntimeEx(new DOMException(DOMException.NOT_SUPPORTED_ERR, "root must not be null")); @@ -72,7 +72,7 @@ root_ = root; whatToShow_ = whatToShow; filter_ = filter; - expandEntityReferences_ = expandEntityReferences.booleanValue(); + expandEntityReferences_ = expandEntityReferences; currentNode_ = root_; } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/TreeWalkerTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/TreeWalkerTest.java 2013-01-08 10:15:02 UTC (rev 7962) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/TreeWalkerTest.java 2013-01-08 10:39:38 UTC (rev 7963) @@ -98,6 +98,7 @@ */ @Test @Alerts(DEFAULT = { "A", "A", "4294967295", "true" }, + FF17 = { "A", "A", "4294967295", "false" }, IE = "exception") public void getters2() throws Exception { final String script = "var theA = document.getElementById('theA');\n" @@ -112,6 +113,7 @@ */ @Test @Alerts(DEFAULT = { "BODY", "DIV", "1", "true" }, + FF17 = { "BODY", "DIV", "1", "false" }, IE = "exception") public void firstChild() throws Exception { final String script = @@ -127,6 +129,7 @@ */ @Test @Alerts(DEFAULT = { "BODY", "SPAN", "1", "true" }, + FF17 = { "BODY", "SPAN", "1", "false" }, IE = "exception") public void firstChild2() throws Exception { final String script = @@ -143,6 +146,7 @@ */ @Test @Alerts(DEFAULT = { "BODY", "P", "1", "true" }, + FF17 = { "BODY", "P", "1", "false" }, IE = "exception") public void lastChild() throws Exception { final String script = @@ -158,6 +162,7 @@ */ @Test @Alerts(DEFAULT = { "BODY", "SPAN", "1", "true" }, + FF17 = { "BODY", "SPAN", "1", "false" }, IE = "exception") public void lastChild2() throws Exception { final String script = @@ -174,6 +179,7 @@ */ @Test @Alerts(DEFAULT = { "BODY", "BODY", "1", "true", "null" }, + FF17 = { "BODY", "BODY", "1", "false", "null" }, IE = "exception") public void parentNode() throws Exception { final String script = @@ -191,6 +197,7 @@ */ @Test @Alerts(DEFAULT = { "BODY", "DIV", "1", "true" }, + FF17 = { "BODY", "DIV", "1", "false" }, IE = "exception") public void parentNode2() throws Exception { final String script = @@ -207,6 +214,7 @@ */ @Test @Alerts(DEFAULT = { "BODY", "P", "1", "true", "null" }, + FF17 = { "BODY", "P", "1", "false", "null" }, IE = "exception") public void siblings() throws Exception { final String script = @@ -224,6 +232,7 @@ */ @Test @Alerts(DEFAULT = { "BODY", "DIV", "1", "true", "null" }, + FF17 = { "BODY", "DIV", "1", "false", "null" }, IE = "exception") public void siblings2() throws Exception { final String script1 = |
From: <mgu...@us...> - 2013-01-08 11:04:43
|
Revision: 7965 http://sourceforge.net/p/htmlunit/code/7965 Author: mguillem Date: 2013-01-08 11:04:39 +0000 (Tue, 08 Jan 2013) Log Message: ----------- FF17's toLocaleTimeString behaves like Chrome rather than like older FF versions Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeDateTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-01-08 10:58:41 UTC (rev 7964) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-01-08 11:04:39 UTC (rev 7965) @@ -758,7 +758,7 @@ JS_CONSTRUCTOR, /** Is Date.toLocaleTimeString() in 24-hour format. */ - @BrowserFeature(@WebBrowser(CHROME)) + @BrowserFeature({ @WebBrowser(CHROME), @WebBrowser(value = FF, minVersion = 17) }) JS_DATE_LOCATE_TIME_24, /** */ Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeDateTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeDateTest.java 2013-01-08 10:58:41 UTC (rev 7964) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeDateTest.java 2013-01-08 11:04:39 UTC (rev 7965) @@ -170,7 +170,7 @@ * @throws Exception if the test fails */ @Test - @Alerts(DEFAULT = "12:00:00 AM", CHROME = "00:00:00") + @Alerts(DEFAULT = "12:00:00 AM", FF17 = "00:00:00", CHROME = "00:00:00") public void toLocaleTimeString() throws Exception { final String html = "<html><head><title>foo</title><script>\n" |
From: <mgu...@us...> - 2013-01-08 11:21:38
|
Revision: 7968 http://sourceforge.net/p/htmlunit/code/7968 Author: mguillem Date: 2013-01-08 11:21:33 +0000 (Tue, 08 Jan 2013) Log Message: ----------- isXMLName is undefined for FF17 Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/GlobalFunctionsTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-01-08 11:16:28 UTC (rev 7967) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-01-08 11:21:33 UTC (rev 7968) @@ -872,6 +872,10 @@ @BrowserFeature(@WebBrowser(IE)) JS_FUNCTION_DECLARED_FORWARD_IN_BLOCK, + /** Indicates if the method isXmlName exists in the window scope. */ + @BrowserFeature(@WebBrowser(value = FF, maxVersion = 10)) + JS_FUNCTION_ISXMLNAME, + /** * Indicates that function can be defined as * <code>function object.property() {}</code> instead of <code>object.property = function() {}</code>. Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java 2013-01-08 11:16:28 UTC (rev 7967) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java 2013-01-08 11:21:33 UTC (rev 7968) @@ -20,6 +20,7 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DONT_ENUM_FUNCTIONS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_ECMA5_FUNCTIONS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_FUNCTION_BIND; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_FUNCTION_ISXMLNAME; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_FUNCTION_TOSOURCE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_HAS_OBJECT_WITH_PROTOTYPE_PROPERTY_IN_WINDOW_SCOPE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_XML; @@ -306,7 +307,7 @@ // only FF has toSource if (!browserVersion.hasFeature(JS_FUNCTION_TOSOURCE)) { - deleteProperties(window, "isXMLName", "uneval"); + deleteProperties(window, "uneval"); removePrototypeProperties(window, "Object", "toSource"); removePrototypeProperties(window, "Array", "toSource"); removePrototypeProperties(window, "Date", "toSource"); @@ -314,6 +315,9 @@ removePrototypeProperties(window, "Number", "toSource"); removePrototypeProperties(window, "String", "toSource"); } + if (!browserVersion.hasFeature(JS_FUNCTION_ISXMLNAME)) { + deleteProperties(window, "isXMLName"); + } NativeFunctionToStringFunction.installFix(window, webClient.getBrowserVersion()); Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/GlobalFunctionsTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/GlobalFunctionsTest.java 2013-01-08 11:16:28 UTC (rev 7967) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/GlobalFunctionsTest.java 2013-01-08 11:21:33 UTC (rev 7968) @@ -73,6 +73,7 @@ */ @Test @Alerts(FF = { "isXMLName: function", "uneval: function" }, + FF17 = { "isXMLName: undefined", "uneval: function" }, DEFAULT = { "isXMLName: undefined", "uneval: undefined" }) public void methods_different() throws Exception { final String[] methods = {"isXMLName", "uneval"}; |
From: <mgu...@us...> - 2013-01-08 11:41:17
|
Revision: 7969 http://sourceforge.net/p/htmlunit/code/7969 Author: mguillem Date: 2013-01-08 11:41:13 +0000 (Tue, 08 Jan 2013) Log Message: ----------- arguments is read-only for FF17 Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/ArgumentsTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-01-08 11:21:33 UTC (rev 7968) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-01-08 11:41:13 UTC (rev 7969) @@ -712,7 +712,7 @@ JS_ARGUMENTS_IS_OBJECT, /** Indicates that the "arguments" object is read-only. */ - @BrowserFeature(@WebBrowser(CHROME)) + @BrowserFeature({ @WebBrowser(CHROME), @WebBrowser(value = FF, minVersion = 17) }) JS_ARGUMENTS_IS_READ_ONLY, /** Indicates that the attributes map contains empty attr Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/ArgumentsTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/ArgumentsTest.java 2013-01-08 11:21:33 UTC (rev 7968) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/ArgumentsTest.java 2013-01-08 11:41:13 UTC (rev 7969) @@ -97,8 +97,8 @@ */ @Test @Alerts(FF = { "2", "hi", "undefined", "you" }, IE = { "2", "hi", "undefined", "you" }, + FF17 = { "2", "world", "undefined", "undefined" }, CHROME = { "2", "world", "undefined", "undefined" }) - //FF14 same as chrome public void readOnly() throws Exception { final String html = "<html><head><script>\n" |
From: <asa...@us...> - 2013-01-09 06:06:23
|
Revision: 7973 http://sourceforge.net/p/htmlunit/code/7973 Author: asashour Date: 2013-01-09 06:06:18 +0000 (Wed, 09 Jan 2013) Log Message: ----------- Some more elements to close "p": address, center, dd, dir, dl, dt, fieldset, listing, li, menu, ol, pre, ul and xmp. Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/DomNodeTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/YuiTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2013-01-08 17:22:19 UTC (rev 7972) +++ trunk/htmlunit/src/changes/changes.xml 2013-01-09 06:06:18 UTC (rev 7973) @@ -8,6 +8,10 @@ <body> <release version="2.12" date="???" description="Bugfixes, CSS3 Selectors"> + <action type="fix" dev="asashour"> + Some more elements close "p": address, center, dd, dir, dl, dt, fieldset, listing, li, menu, + ol, pre, ul and xmp. + </action> <action type="update" dev="mguillem"> Set max number of simultaneous connections per server to 6. </action> Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/DomNodeTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/DomNodeTest.java 2013-01-08 17:22:19 UTC (rev 7972) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/DomNodeTest.java 2013-01-09 06:06:18 UTC (rev 7973) @@ -322,7 +322,7 @@ public void testGetByXPath() throws Exception { final String htmlContent = "<html><head><title>my title</title></head><body>\n" - + "<p id='p1'><ul><li>foo 1</li><li>foo 2</li></li></p>\n" + + "<div id='d1'><ul><li>foo 1</li><li>foo 2</li></li></div>\n" + "<div><span>bla</span></div>\n" + "</body></html>"; final HtmlPage page = loadPage(htmlContent); @@ -338,13 +338,13 @@ assertEquals(0, head.getByXPath("/title").size()); assertEquals(results, head.getByXPath("title")); - final HtmlParagraph p = page.getFirstByXPath("//p"); - assertSame(p, page.getHtmlElementById("p1")); - final List<?> lis = p.getByXPath("ul/li"); + final HtmlElement div = page.getFirstByXPath("//div"); + assertSame(div, page.getHtmlElementById("d1")); + final List<?> lis = div.getByXPath("ul/li"); assertEquals(2, lis.size()); assertEquals(lis, page.getByXPath("//ul/li")); - assertEquals(2, p.<Number>getFirstByXPath("count(//li)").intValue()); + assertEquals(2, div.<Number>getFirstByXPath("count(//li)").intValue()); } /** @@ -405,7 +405,7 @@ public void testGetFirstByXPath() throws Exception { final String htmlContent = "<html><head><title>my title</title></head><body>\n" - + "<p id='p1'><ul><li>foo 1</li><li>foo 2</li></li></p>\n" + + "<div id='d1'><ul><li>foo 1</li><li>foo 2</li></li></div>\n" + "<div><span>bla</span></div>\n" + "</body></html>"; final HtmlPage page = loadPage(htmlContent); @@ -419,12 +419,12 @@ assertNull(head.getFirstByXPath("/title")); assertSame(title, head.getFirstByXPath("title")); - final HtmlParagraph p = (HtmlParagraph) page.getFirstByXPath("//p"); - assertSame(p, page.getHtmlElementById("p1")); - final HtmlListItem listItem = (HtmlListItem) p.getFirstByXPath("ul/li"); + final HtmlElement div = page.getFirstByXPath("//div"); + assertSame(div, page.getHtmlElementById("d1")); + final HtmlListItem listItem = (HtmlListItem) div.getFirstByXPath("ul/li"); assertSame(listItem, page.getFirstByXPath("//ul/li")); - assertEquals(2, ((Number) p.getFirstByXPath("count(//li)")).intValue()); + assertEquals(2, ((Number) div.getFirstByXPath("count(//li)")).intValue()); } /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser2Test.java 2013-01-08 17:22:19 UTC (rev 7972) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser2Test.java 2013-01-09 06:06:18 UTC (rev 7973) @@ -340,7 +340,6 @@ */ @Test @Alerts(IE = { "0", "0", "0", "0", "0", "0" }, FF = { "1", "0", "1", "1", "0", "1" }) - @NotYetImplemented public void childNodes_address() throws Exception { loadPageWithAlerts2(createHtmlForChildNodes("address")); } @@ -504,7 +503,6 @@ */ @Test @Alerts(IE = { "0", "0", "0", "0", "0", "0" }, FF = { "1", "0", "1", "1", "0", "1" }) - @NotYetImplemented public void childNodes_center() throws Exception { loadPageWithAlerts2(createHtmlForChildNodes("center")); } @@ -541,7 +539,6 @@ */ @Test @Alerts(IE = { "0", "0", "0", "0", "0", "0" }, FF = { "1", "0", "1", "1", "0", "1" }) - @NotYetImplemented public void childNodes_dd() throws Exception { loadPageWithAlerts2(createHtmlForChildNodes("dd")); } @@ -560,7 +557,6 @@ */ @Test @Alerts(IE = { "0", "0", "0", "0", "0", "0" }, FF = { "1", "0", "1", "1", "0", "1" }) - @NotYetImplemented public void childNodes_dir() throws Exception { loadPageWithAlerts2(createHtmlForChildNodes("dir")); } @@ -579,7 +575,6 @@ */ @Test @Alerts(IE = { "0", "0", "0", "0", "0", "0" }, FF = { "1", "0", "1", "1", "0", "1" }) - @NotYetImplemented public void childNodes_dl() throws Exception { loadPageWithAlerts2(createHtmlForChildNodes("dl")); } @@ -589,7 +584,6 @@ */ @Test @Alerts(IE = { "0", "0", "0", "0", "0", "0" }, FF = { "1", "0", "1", "1", "0", "1" }) - @NotYetImplemented public void childNodes_dt() throws Exception { loadPageWithAlerts2(createHtmlForChildNodes("dt")); } @@ -618,7 +612,6 @@ */ @Test @Alerts(IE = { "0", "0", "0", "0", "0", "0" }, FF = { "1", "0", "1", "1", "0", "1" }) - @NotYetImplemented public void childNodes_fieldset() throws Exception { loadPageWithAlerts2(createHtmlForChildNodes("fieldset")); } @@ -832,7 +825,6 @@ */ @Test @Alerts(IE = { "0", "0", "0", "0", "0", "0" }, FF = { "1", "0", "1", "1", "0", "1" }) - @NotYetImplemented public void childNodes_listing() throws Exception { loadPageWithAlerts2(createHtmlForChildNodes("listing")); } @@ -842,7 +834,6 @@ */ @Test @Alerts(IE = { "0", "0", "0", "0", "0", "0" }, FF = { "1", "0", "1", "1", "0", "1" }) - @NotYetImplemented public void childNodes_li() throws Exception { loadPageWithAlerts2(createHtmlForChildNodes("li")); } @@ -880,7 +871,6 @@ */ @Test @Alerts(IE = { "0", "0", "0", "0", "0", "0" }, FF = { "1", "0", "1", "1", "0", "1" }) - @NotYetImplemented public void childNodes_menu() throws Exception { loadPageWithAlerts2(createHtmlForChildNodes("menu")); } @@ -955,7 +945,6 @@ */ @Test @Alerts(IE = { "0", "0", "0", "0", "0", "0" }, FF = { "1", "0", "1", "1", "0", "1" }) - @NotYetImplemented public void childNodes_ol() throws Exception { loadPageWithAlerts2(createHtmlForChildNodes("ol")); } @@ -1014,7 +1003,6 @@ */ @Test @Alerts(IE = { "0", "0", "0", "0", "0", "0" }, FF = { "1", "0", "1", "1", "0", "1" }) - @NotYetImplemented public void childNodes_pre() throws Exception { loadPageWithAlerts2(createHtmlForChildNodes("pre")); } @@ -1283,7 +1271,6 @@ */ @Test @Alerts(IE = { "0", "0", "0", "0", "0", "0" }, FF = { "1", "0", "1", "1", "0", "1" }) - @NotYetImplemented public void childNodes_ul() throws Exception { loadPageWithAlerts2(createHtmlForChildNodes("ul")); } @@ -1322,7 +1309,6 @@ */ @Test @Alerts(IE = { "0", "0", "0", "0", "0", "0" }, FF = { "1", "0", "1", "1", "0", "1" }) - @NotYetImplemented public void childNodes_xmp() throws Exception { loadPageWithAlerts2(createHtmlForChildNodes("xmp")); } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/YuiTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/YuiTest.java 2013-01-08 17:22:19 UTC (rev 7972) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/YuiTest.java 2013-01-09 06:06:18 UTC (rev 7973) @@ -227,8 +227,6 @@ doTest(fileName, knownFailingTests, null, 0); } - /** - */ private void doTest(final String fileName, final List<String> knownFailingTests, final String buttonToPush, final long timeToWait) throws Exception { |
From: <asa...@us...> - 2013-01-10 04:09:54
|
Revision: 7982 http://sourceforge.net/p/htmlunit/code/7982 Author: asashour Date: 2013-01-10 04:09:49 +0000 (Thu, 10 Jan 2013) Log Message: ----------- Adding test case for "% class cast exception fix" Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java 2013-01-09 20:12:17 UTC (rev 7981) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java 2013-01-10 04:09:49 UTC (rev 7982) @@ -195,7 +195,7 @@ * @return all the descendant elements with the specified tag name */ @JsxFunction - public Object getElementsByTagName(final String tagName) { + public HTMLCollection getElementsByTagName(final String tagName) { final String tagNameLC = tagName.toLowerCase(); if (elementsByTagName_ == null) { Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java 2013-01-09 20:12:17 UTC (rev 7981) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java 2013-01-10 04:09:49 UTC (rev 7982) @@ -2511,8 +2511,8 @@ */ @Test @Alerts(IE = {"", "#0000aa", "#000000", "#ffebcd", "#ab00e0", "#b00e00" }, -// IE9 = {"", "#0000aa", "#0", "blanchedalmond", "#ab00e", "#b00e0" }, - FF = {"", "#0000aa", "x", "BlanchedAlmond", "aBlue", "bluex" }, + IE9 = {"", "#0000aa", "#0", "blanchedalmond", "#ab00e", "#b00e0" }, + DEFAULT = {"", "#0000aa", "x", "BlanchedAlmond", "aBlue", "bluex" }, FF3_6 = {"", "#0000aa", "#000000", "#ffebcd", "#ab00e0", "#b00e00" }) public void setColorAttribute() throws Exception { final String html = @@ -2635,7 +2635,7 @@ * @throws Exception on test failure */ @Test - @Alerts(IE = "", FF = "t") + @Alerts(IE = "", DEFAULT = "t") public void setAttribute_class() throws Exception { final String html = "<html><head>\n" + "<script>\n" @@ -2695,7 +2695,7 @@ * @throws Exception on test failure */ @Test - @Alerts(FF = { "null", "", "null", "undefined" }, IE = { "", "", "null", "undefined" }) + @Alerts(DEFAULT = { "null", "", "null", "undefined" }, IE = { "", "", "null", "undefined" }) public void getAttribute2() throws Exception { final String html = "<html>\n" + "<head>\n" @@ -3761,4 +3761,38 @@ loadPageWithAlerts2(html); } + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("null") + public void getAttribute_in_xml() throws Exception { + final String html = "<html><head><title>foo</title><script>\n" + + " function test() {\n" + + " var text='<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\\n';\n" + + " text += '<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://myNS\">\\n';\n" + + " text += ' <xsl:template match=\"/\">\\n';\n" + + " text += \" <html xmlns='http://www.w3.org/1999/xhtml'>\\n\";\n" + + " text += ' <body>\\n';\n" + + " text += ' </body>\\n';\n" + + " text += ' </html>\\n';\n" + + " text += ' </xsl:template>\\n';\n" + + " text += '</xsl:stylesheet>';\n" + + " if (window.ActiveXObject) {\n" + + " var doc=new ActiveXObject('Microsoft.XMLDOM');\n" + + " doc.async=false;\n" + + " doc.loadXML(text);\n" + + " } else {\n" + + " var parser=new DOMParser();\n" + + " var doc=parser.parseFromString(text,'text/xml');\n" + + " }\n" + + " try {\n" + + " alert(doc.documentElement.getElementsByTagName('html').item(0).getAttribute('hi'));\n" + + " } catch (e) { alert('exception'); }\n" + + " }\n" + + "</script></head><body onload='test()'>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } } |
From: <mgu...@us...> - 2013-01-11 11:12:55
|
Revision: 7985 http://sourceforge.net/p/htmlunit/code/7985 Author: mguillem Date: 2013-01-11 11:12:51 +0000 (Fri, 11 Jan 2013) Log Message: ----------- History.go: ignore invalid indexes (and avoid StackOverflowException) Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/History.java Added Paths: ----------- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/History2Test.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2013-01-10 17:23:13 UTC (rev 7984) +++ trunk/htmlunit/src/changes/changes.xml 2013-01-11 11:12:51 UTC (rev 7985) @@ -8,6 +8,9 @@ <body> <release version="2.12" date="???" description="Bugfixes, CSS3 Selectors"> + <action type="fix" dev="mguillem"> + JavaScript: ignore invalid indexes for History.go. + </action> <action type="fix" dev="asashour"> Some more elements to close "p": address, center, dd, dir, dl, dt, fieldset, listing, li, menu, ol, pre, ul and xmp. Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/History.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/History.java 2013-01-10 17:23:13 UTC (rev 7984) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/History.java 2013-01-11 11:12:51 UTC (rev 7985) @@ -131,8 +131,8 @@ final int i = index_ + relativeIndex; if (i < urls_.size() && i >= 0) { index_ = i; + goToUrlAtCurrentIndex(); } - goToUrlAtCurrentIndex(); return this; } Added: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/History2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/History2Test.java (rev 0) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/History2Test.java 2013-01-11 11:12:51 UTC (rev 7985) @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.gargoylesoftware.htmlunit.javascript.host; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import com.gargoylesoftware.htmlunit.BrowserRunner; +import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; +import com.gargoylesoftware.htmlunit.WebDriverTestCase; + +/** + * Tests for {@link History}. + * + * @version $Revision: 7931 $ + * @author Marc Guillemot + */ +@RunWith(BrowserRunner.class) +public class History2Test extends WebDriverTestCase { + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts("here") + public void goShouldIgnoreOutOfBoundIndex() throws Exception { + final String html = "<html><body><script>" + + "history.go(1);\n" + + "alert('here');\n" + + "</script></body></html>"; + + loadPageWithAlerts2(html); + assertEquals(1, getMockWebConnection().getRequestCount()); + } + +} |
From: <mgu...@us...> - 2013-01-11 14:08:29
|
Revision: 7987 http://sourceforge.net/p/htmlunit/code/7987 Author: mguillem Date: 2013-01-11 14:08:27 +0000 (Fri, 11 Jan 2013) Log Message: ----------- HTMLWBRElement doesn't exist for FF17 and Chrome Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLWBRElement.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlWordBreakTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLWBRElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLWBRElement.java 2013-01-11 13:49:20 UTC (rev 7986) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLWBRElement.java 2013-01-11 14:08:27 UTC (rev 7987) @@ -14,8 +14,12 @@ */ package com.gargoylesoftware.htmlunit.javascript.host.html; +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; + import com.gargoylesoftware.htmlunit.html.HtmlWordBreak; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; +import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; /** * A JavaScript object for {@link HtmlWordBreak}. @@ -23,7 +27,7 @@ * @version $Revision$ * @author Ahmed Ashour */ -@JsxClass(domClasses = HtmlWordBreak.class) +@JsxClass(domClasses = HtmlWordBreak.class, browsers = { @WebBrowser(IE), @WebBrowser(value = FF, maxVersion = 4) }) public class HTMLWBRElement extends HTMLElement { /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlWordBreakTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlWordBreakTest.java 2013-01-11 13:49:20 UTC (rev 7986) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlWordBreakTest.java 2013-01-11 14:08:27 UTC (rev 7987) @@ -21,6 +21,8 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; +import com.gargoylesoftware.htmlunit.BrowserRunner.Browser; +import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** @@ -36,6 +38,7 @@ * @throws Exception if the test fails */ @Test + @NotYetImplemented(Browser.FF17) @Alerts(FF3_6 = "[object HTMLWBRElement]", IE = "[object]", DEFAULT = "[object HTMLElement]") |
From: <mgu...@us...> - 2013-01-11 14:14:24
|
Revision: 7989 http://sourceforge.net/p/htmlunit/code/7989 Author: mguillem Date: 2013-01-11 14:14:18 +0000 (Fri, 11 Jan 2013) Log Message: ----------- JavaScript: fixed wrong trigger of focus event in special cases when field loses focus. Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElement.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLInputElement2Test.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2013-01-11 14:10:25 UTC (rev 7988) +++ trunk/htmlunit/src/changes/changes.xml 2013-01-11 14:14:18 UTC (rev 7989) @@ -9,6 +9,9 @@ <body> <release version="2.12" date="???" description="Bugfixes, CSS3 Selectors"> <action type="fix" dev="mguillem"> + JavaScript: fixed wrong trigger of focus event in special cases when field loses focus. + </action> + <action type="fix" dev="mguillem"> JavaScript: ignore invalid indexes for History.go. </action> <action type="fix" dev="asashour"> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElement.java 2013-01-11 14:10:25 UTC (rev 7988) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElement.java 2013-01-11 14:14:18 UTC (rev 7989) @@ -452,6 +452,9 @@ return getPage(); } + // make enclosing window the current one + getPage().getWebClient().setCurrentWindow(getPage().getEnclosingWindow()); + final HtmlPage page = (HtmlPage) getPage(); if (page.getFocusedElement() != this) { focus(); Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLInputElement2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLInputElement2Test.java 2013-01-11 14:10:25 UTC (rev 7988) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLInputElement2Test.java 2013-01-11 14:14:18 UTC (rev 7989) @@ -16,6 +16,9 @@ import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.FF; +import java.util.ArrayList; +import java.util.List; + import org.junit.Test; import org.junit.runner.RunWith; @@ -61,4 +64,29 @@ assertEquals("me te", input.getSelectedText()); } + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts("initial") + public void focus() throws Exception { + final String html = "<html><body>\n" + + "<iframe name='theFrame' src='" + URL_SECOND + "'></iframe>\n" + + "</body></html>"; + final String frame = "<html><body>\n" + + "<input id='input' value='initial' onfocus='alert(this.value)'>\n" + + "<div id='div'>click me</div>\n" + + "</body></html>"; + + getMockWebConnection().setResponse(URL_SECOND, frame); + + final List<String> collectedAlerts = new ArrayList<String>(); + final HtmlPage page = loadPage(html, collectedAlerts); + final HtmlPage framePage = (HtmlPage) page.getFrames().get(0).getEnclosedPage(); + + framePage.getHtmlElementById("input").type("foo"); + + framePage.getHtmlElementById("div").click(); + assertEquals(getExpectedAlerts(), collectedAlerts); + } } |
From: <mgu...@us...> - 2013-01-11 17:15:00
|
Revision: 7991 http://sourceforge.net/p/htmlunit/code/7991 Author: mguillem Date: 2013-01-11 17:14:57 +0000 (Fri, 11 Jan 2013) Log Message: ----------- JavaScript: elements nested within an element with "display: none" have offsetHeight = offsetWidth = 0. Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement2Test.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2013-01-11 15:33:45 UTC (rev 7990) +++ trunk/htmlunit/src/changes/changes.xml 2013-01-11 17:14:57 UTC (rev 7991) @@ -9,6 +9,8 @@ <body> <release version="2.12" date="???" description="Bugfixes, CSS3 Selectors"> <action type="fix" dev="mguillem"> + JavaScript: elements nested within an element with "display: none" have offsetHeight = offsetWidth = 0. + <action type="fix" dev="mguillem"> JavaScript: fixed wrong trigger of focus event in special cases when field loses focus. </action> <action type="fix" dev="mguillem"> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2013-01-11 15:33:45 UTC (rev 7990) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2013-01-11 17:14:57 UTC (rev 7991) @@ -1644,6 +1644,9 @@ */ @JsxGetter public int getOffsetHeight() { + if (isDislayNone()) { + return 0; + } final MouseEvent event = MouseEvent.getCurrentMouseEvent(); if (isAncestorOfEventTarget(event)) { // compute appropriate offset height to pretend mouse event was produced within this element @@ -1652,6 +1655,20 @@ return getCurrentStyle().getCalculatedHeight(true, true); } + private boolean isDislayNone() { + // if a parent is display:none there's nothing that a child can do to override it + HTMLElement element = this; + while (element != null) { + final CSSStyleDeclaration style = element.getCurrentStyle(); + final String display = style.getDisplay(); + if ("none".equals(display)) { + return true; + } + element = element.getParentHTMLElement(); + } + return false; + } + /** * Returns this element's <tt>offsetWidth</tt>, which is the element width plus the element's padding * plus the element's border. This method returns a dummy value compatible with mouse event coordinates @@ -1662,6 +1679,10 @@ */ @JsxGetter public int getOffsetWidth() { + if (isDislayNone()) { + return 0; + } + final MouseEvent event = MouseEvent.getCurrentMouseEvent(); if (isAncestorOfEventTarget(event)) { // compute appropriate offset width to pretend mouse event was produced within this element Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement2Test.java 2013-01-11 15:33:45 UTC (rev 7990) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement2Test.java 2013-01-11 17:14:57 UTC (rev 7991) @@ -442,7 +442,7 @@ * @throws Exception if an error occurs */ @Test - @Alerts({ "30px", "46", "55px", "71", "71", "0", "0" }) + @Alerts({ "30px", "46", "55px", "71", "71", "0", "0", "0", "0" }) public void offsetWidthAndHeight() throws Exception { final String html = "<html><head>\n" @@ -464,11 +464,14 @@ + " e.className = 'dontDisplay';\n" + " alert(e.offsetHeight);\n" + " alert(e.offsetWidth);\n" + + " var nested = document.getElementById('nested');\n" + + " alert(nested.offsetHeight);\n" + + " alert(nested.offsetWidth);\n" + " }\n" + "</script>\n" + "</head>\n" + "<body onload='test()'>\n" - + " <div id='myDiv' style='border: 3px solid #fff; padding: 5px;'></div>\n" + + " <div id='myDiv' style='border: 3px solid #fff; padding: 5px;'><div id='nested'>hello</div></div>\n" + "</body></html>"; loadPageWithAlerts2(html); } |
From: <mgu...@us...> - 2013-01-18 14:22:26
|
Revision: 8002 http://sourceforge.net/p/htmlunit/code/8002 Author: mguillem Date: 2013-01-18 14:22:21 +0000 (Fri, 18 Jan 2013) Log Message: ----------- JavaScript: execute onload handler of pages loaded in a frame, replacing a previous content (unit test adapted from test proposed by spaced30) Issue 1443 Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlFrame2Test.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2013-01-17 18:44:47 UTC (rev 8001) +++ trunk/htmlunit/src/changes/changes.xml 2013-01-18 14:22:21 UTC (rev 8002) @@ -8,6 +8,9 @@ <body> <release version="2.12" date="???" description="Bugfixes, CSS3 Selectors"> + <action type="fix" dev="mguillem" issue="1443"> + JavaScript: execute onload handler of pages loaded in a frame, replacing a previous content. + </action> <action type="update" dev="rbri"> Upgrade Apache HttpClient to 4.2.3. </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java 2013-01-17 18:44:47 UTC (rev 8001) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java 2013-01-18 14:22:21 UTC (rev 8002) @@ -221,11 +221,13 @@ // frame initialization has a different order final boolean framesetFirst = browserVersion.hasFeature(EVENT_ONLOAD_FRAMESET_FIRST); boolean isFrameWindow = enclosingWindow instanceof FrameWindow; + boolean isFirstPageInFrameWindow = false; if (isFrameWindow) { isFrameWindow = ((FrameWindow) enclosingWindow).getFrameElement() instanceof HtmlFrame; + isFirstPageInFrameWindow = enclosingWindow.getHistory().getLength() <= 2; // first is always about:blank } - if (framesetFirst && !isFrameWindow) { + if ((framesetFirst && !isFrameWindow) || (isFrameWindow && !isFirstPageInFrameWindow)) { executeEventHandlersIfNeeded(Event.TYPE_LOAD); } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlFrame2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlFrame2Test.java 2013-01-17 18:44:47 UTC (rev 8001) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlFrame2Test.java 2013-01-18 14:22:21 UTC (rev 8002) @@ -22,11 +22,13 @@ import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; +import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; +import com.gargoylesoftware.htmlunit.MockWebConnection; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** @@ -253,4 +255,35 @@ loadPageWithAlerts2(html); } + + /** + * Was failing as of HtmlUnit-2.11. + * @see <a href="sourceforge.net/p/htmlunit/bugs/1443/">Bug 1443</a> + * @throws Exception if the test fails + */ + @Test + @Alerts("foo") + public void onloadInNavigatedFrame() throws Exception { + final String html = "<html><head><title>first</title></head>\n" + + "<frameset cols='20%,80%'>\n" + + " <frame src='frame1.html' id='frame1'>\n" + + "</frameset></html>"; + + final String firstHtml = "<html><body>\n" + + "<a id='a1' href='frame2.html'>hello</a>\n" + + "</body></html>"; + + final String secondHtml = "<html><body onload='alert(\"foo\")'></body></html>"; + + final MockWebConnection webConnection = getMockWebConnection(); + webConnection.setResponse(new URL(getDefaultUrl(), "frame1.html"), firstHtml); + webConnection.setResponse(new URL(getDefaultUrl(), "frame2.html"), secondHtml); + + final WebDriver driver = loadPage2(html); + driver.switchTo().frame(0); + + driver.findElement(By.id("a1")).click(); + + assertEquals(getExpectedAlerts(), getCollectedAlerts(driver)); + } } |
From: <mgu...@us...> - 2013-01-18 14:38:16
|
Revision: 8003 http://sourceforge.net/p/htmlunit/code/8003 Author: mguillem Date: 2013-01-18 14:38:11 +0000 (Fri, 18 Jan 2013) Log Message: ----------- JavaScript: add support for CanvasRenderingContext2D.quadraticCurveTo Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/canvas/CanvasRenderingContext2D.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/canvas/CanvasRenderingContext2DTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2013-01-18 14:22:21 UTC (rev 8002) +++ trunk/htmlunit/src/changes/changes.xml 2013-01-18 14:38:11 UTC (rev 8003) @@ -8,6 +8,9 @@ <body> <release version="2.12" date="???" description="Bugfixes, CSS3 Selectors"> + <action type="fix" dev="mguillem"> + JavaScript: add support for CanvasRenderingContext2D.quadraticCurveTo (FF). + </action> <action type="fix" dev="mguillem" issue="1443"> JavaScript: execute onload handler of pages loaded in a frame, replacing a previous content. </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/canvas/CanvasRenderingContext2D.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/canvas/CanvasRenderingContext2D.java 2013-01-18 14:22:21 UTC (rev 8002) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/canvas/CanvasRenderingContext2D.java 2013-01-18 14:38:11 UTC (rev 8003) @@ -29,6 +29,7 @@ * * @version $Revision$ * @author Ahmed Ashour + * @author Marc Guillemot */ @JsxClass public class CanvasRenderingContext2D extends SimpleScriptable { @@ -273,6 +274,19 @@ } /** + * Draws a quadratic Bézier curve. + * @param controlPointX the x-coordinate of the control point + * @param controlPointY the y-coordinate of the control point + * @param endPointX the x-coordinate of the end point + * @param endPointY the y-coordinate of the end point + */ + @JsxFunction + public void quadraticCurveTo(final double controlPointX, final double controlPointY, + final double endPointX, final double endPointY) { + //empty + } + + /** * Fills the shape. */ @JsxFunction Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/canvas/CanvasRenderingContext2DTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/canvas/CanvasRenderingContext2DTest.java 2013-01-18 14:22:21 UTC (rev 8002) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/canvas/CanvasRenderingContext2DTest.java 2013-01-18 14:38:11 UTC (rev 8003) @@ -52,6 +52,12 @@ + " ctx.drawImage(canvas, 1, 1, 1, 1, 1, 1, 1, 1);\n" + " ctx.translate(10, 10);\n" + " ctx.scale(10, 10);\n" + + " ctx.fillRect(30, 30, 55, 50);\n" + + " ctx.beginPath();\n" + + " ctx.moveTo(0, 10);\n" + + " ctx.lineTo(10, 10);\n" + + " ctx.quadraticCurveTo(0, 10, 15, 10);\n" + + " ctx.closePath();\n" + " alert('done');\n" + " } catch(e) { alert('exception'); }\n" + "}\n" |
From: <mgu...@us...> - 2013-01-18 16:12:45
|
Revision: 8004 http://sourceforge.net/p/htmlunit/code/8004 Author: mguillem Date: 2013-01-18 16:12:40 +0000 (Fri, 18 Jan 2013) Log Message: ----------- FF17's document.implementation has features http://www.w3.org/TR/SVG11/feature#BasicStructure versions 1.0 and 1.1 Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DOMImplementation.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DOMImplementationTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DOMImplementation.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DOMImplementation.java 2013-01-18 14:38:11 UTC (rev 8003) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DOMImplementation.java 2013-01-18 16:12:40 UTC (rev 8004) @@ -63,6 +63,10 @@ else if ("XPath".equals(feature) && "3.0".equals(version)) { return true; } + else if ("http://www.w3.org/TR/SVG11/feature#BasicStructure".equals(feature) + && ("1.0".equals(version) || "1.1".equals(version))) { + return true; + } //TODO: other features. } return false; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DOMImplementationTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DOMImplementationTest.java 2013-01-18 14:38:11 UTC (rev 8003) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DOMImplementationTest.java 2013-01-18 16:12:40 UTC (rev 8004) @@ -86,6 +86,20 @@ hasFeature("XPath", "['3.0']"); } + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(DEFAULT = { "http://www.w3.org/TR/SVG11/feature#BasicStructure 1.0: true", + "http://www.w3.org/TR/SVG11/feature#BasicStructure 1.1: true", + "http://www.w3.org/TR/SVG11/feature#BasicStructure 1.2: false" }, + IE = { "http://www.w3.org/TR/SVG11/feature#BasicStructure 1.0: false", + "http://www.w3.org/TR/SVG11/feature#BasicStructure 1.1: false", + "http://www.w3.org/TR/SVG11/feature#BasicStructure 1.2: false" }) + public void hasFeature_SVG_BasicStructure() throws Exception { + hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "['1.0', '1.1', '1.2']"); + } + private void hasFeature(final String feature, final String versions) throws Exception { final String html = "<html><head>\n" + "<script>\n" |
From: <mgu...@us...> - 2013-01-21 09:49:26
|
Revision: 8013 http://sourceforge.net/p/htmlunit/code/8013 Author: mguillem Date: 2013-01-21 09:49:21 +0000 (Mon, 21 Jan 2013) Log Message: ----------- JavaScript: - SVGAngle and SVGMatrix: basic support - SVGSVGElement: property style and basic support for methods createSVGMatrix and getScreenCTM. - HTMLDocument.createElementNS can create SVG elements. . Window.getComputedStyle works with SVG elements Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Document.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DOMImplementation.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGSVGElement.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Window2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DOMImplementationTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocumentTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgSvgTest.java Added Paths: ----------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGAngle.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGMatrix.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgAngleTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgMatrixTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2013-01-21 09:07:00 UTC (rev 8012) +++ trunk/htmlunit/src/changes/changes.xml 2013-01-21 09:49:21 UTC (rev 8013) @@ -8,7 +8,17 @@ <body> <release version="2.12" date="???" description="Bugfixes, CSS3 Selectors"> + <action type="add" dev="mguillem"> + JavaScript: added basic support for SVGAngle and SVGMatrix. + </action> <action type="fix" dev="mguillem"> + JavaScript: HTMLDocument.createElementNS can create SVG elements. + </action> + <action type="add" dev="mguillem"> + JavaScript: add support for SVGSVGElement's style property and basic support + for methods createSVGMatrix and getScreenCTM. + </action> + <action type="fix" dev="mguillem"> JavaScript: add support for CanvasRenderingContext2D.quadraticCurveTo (FF). </action> <action type="fix" dev="mguillem" issue="1443"> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java 2013-01-21 09:07:00 UTC (rev 8012) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java 2013-01-21 09:49:21 UTC (rev 8013) @@ -195,6 +195,7 @@ import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLWBRElement; import com.gargoylesoftware.htmlunit.javascript.host.svg.SVGAElement; import com.gargoylesoftware.htmlunit.javascript.host.svg.SVGAltGlyphElement; +import com.gargoylesoftware.htmlunit.javascript.host.svg.SVGAngle; import com.gargoylesoftware.htmlunit.javascript.host.svg.SVGAnimateElement; import com.gargoylesoftware.htmlunit.javascript.host.svg.SVGAnimateMotionElement; import com.gargoylesoftware.htmlunit.javascript.host.svg.SVGAnimateTransformElement; @@ -236,6 +237,7 @@ import com.gargoylesoftware.htmlunit.javascript.host.svg.SVGLinearGradientElement; import com.gargoylesoftware.htmlunit.javascript.host.svg.SVGMarkerElement; import com.gargoylesoftware.htmlunit.javascript.host.svg.SVGMaskElement; +import com.gargoylesoftware.htmlunit.javascript.host.svg.SVGMatrix; import com.gargoylesoftware.htmlunit.javascript.host.svg.SVGMetadataElement; import com.gargoylesoftware.htmlunit.javascript.host.svg.SVGMpathElement; import com.gargoylesoftware.htmlunit.javascript.host.svg.SVGPathElement; @@ -313,7 +315,8 @@ MutationEvent.class, NamedNodeMap.class, Namespace.class, NamespaceCollection.class, Navigator.class, Node.class, NodeFilter.class, NodeList.class, OfflineResourceList.class, Plugin.class, PluginArray.class, Popup.class, Position.class, ProcessingInstruction.class, - Range.class, RowContainer.class, SVGAElement.class, SVGAltGlyphElement.class, SVGAnimateElement.class, + Range.class, RowContainer.class, + SVGAElement.class, SVGAltGlyphElement.class, SVGAngle.class, SVGAnimateElement.class, SVGAnimateMotionElement.class, SVGAnimateTransformElement.class, SVGCircleElement.class, SVGClipPathElement.class, SVGDefsElement.class, SVGDescElement.class, SVGElement.class, SVGEllipseElement.class, SVGFEBlendElement.class, SVGFEColorMatrixElement.class, @@ -325,7 +328,7 @@ SVGFEPointLightElement.class, SVGFESpecularLightingElement.class, SVGFESpotLightElement.class, SVGFETileElement.class, SVGFETurbulenceElement.class, SVGFilterElement.class, SVGForeignObjectElement.class, SVGGElement.class, SVGImageElement.class, SVGLineElement.class, SVGLinearGradientElement.class, - SVGMarkerElement.class, SVGMaskElement.class, SVGMetadataElement.class, SVGMpathElement.class, + SVGMarkerElement.class, SVGMaskElement.class, SVGMatrix.class, SVGMetadataElement.class, SVGMpathElement.class, SVGPathElement.class, SVGPatternElement.class, SVGPolygonElement.class, SVGPolylineElement.class, SVGRadialGradientElement.class, SVGRectElement.class, SVGSVGElement.class, SVGScriptElement.class, SVGSetElement.class, SVGStopElement.class, SVGStyleElement.class, SVGSwitchElement.class, Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Document.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Document.java 2013-01-21 09:07:00 UTC (rev 8012) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Document.java 2013-01-21 09:49:21 UTC (rev 8013) @@ -468,7 +468,8 @@ // simple hack, no need to implement the XUL objects (at least in a first time) element = new HtmlDivision(namespaceURI, qualifiedName, getPage(), null); } - else if (HTMLParser.XHTML_NAMESPACE.equals(namespaceURI)) { + else if (HTMLParser.XHTML_NAMESPACE.equals(namespaceURI) + || HTMLParser.SVG_NAMESPACE.equals(namespaceURI)) { element = getPage().createElementNS(namespaceURI, qualifiedName); } else { Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java 2013-01-21 09:07:00 UTC (rev 8012) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java 2013-01-21 09:49:21 UTC (rev 8013) @@ -37,6 +37,7 @@ import com.gargoylesoftware.htmlunit.javascript.configuration.JsxFunction; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter; import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; +import com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleDeclaration; import com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration; import com.gargoylesoftware.htmlunit.javascript.host.dom.DOMTokenList; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLCollection; @@ -55,7 +56,15 @@ private NamedNodeMap attributes_; private Map<String, HTMLCollection> elementsByTagName_; // for performance and for equality (==) + private CSSStyleDeclaration style_; + @Override + public void setDomNode(final DomNode domNode) { + super.setDomNode(domNode); + + style_ = new CSSStyleDeclaration(this); + } + /** * Applies the specified XPath expression to this node's context and returns the generated list of matching nodes. * @param expression a string specifying an XPath expression @@ -508,4 +517,31 @@ public void removeAttributeNS(final String namespaceURI, final String localName) { getDomNodeOrDie().removeAttributeNS(namespaceURI, localName); } + + /** + * Returns the style object for this element. + * @return the style object for this element + */ + @JsxGetter + public CSSStyleDeclaration getStyle() { + return style_; + } + + /** + * Returns the runtime style object for this element. + * @return the runtime style object for this element + */ + @JsxGetter(@WebBrowser(IE)) + public CSSStyleDeclaration getRuntimeStyle() { + return style_; + } + + /** + * Returns the current (calculated) style object for this element. + * @return the current (calculated) style object for this element + */ + @JsxGetter(@WebBrowser(IE)) + public ComputedCSSStyleDeclaration getCurrentStyle() { + return getWindow().getComputedStyle(this, null); + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java 2013-01-21 09:07:00 UTC (rev 8012) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java 2013-01-21 09:49:21 UTC (rev 8013) @@ -1576,7 +1576,7 @@ * @return the computed style */ @JsxFunction(@WebBrowser(FF)) - public ComputedCSSStyleDeclaration getComputedStyle(final HTMLElement element, final String pseudo) { + public ComputedCSSStyleDeclaration getComputedStyle(final Element element, final String pseudo) { ComputedCSSStyleDeclaration style; synchronized (computedStyles_) { Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java 2013-01-21 09:07:00 UTC (rev 8012) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java 2013-01-21 09:49:21 UTC (rev 8013) @@ -470,8 +470,8 @@ * Returns the element to which this style belongs. * @return the element to which this style belongs */ - protected HTMLElement getElement() { - return (HTMLElement) jsElement_; + protected Element getElement() { + return jsElement_; } /** @@ -5981,11 +5981,11 @@ * @return the integer number of pixels corresponding to the specified length CSS attribute value * @see #pixelValue(String) */ - protected static int pixelValue(final HTMLElement element, final CssValue value) { + protected static int pixelValue(final Element element, final CssValue value) { final String s = value.get(element); if (s.endsWith("%") || (s.isEmpty() && element instanceof HTMLHtmlElement)) { final int i = NumberUtils.toInt(TO_INT_PATTERN.matcher(s).replaceAll("$1"), 100); - final HTMLElement parent = (HTMLElement) element.getParentElement(); + final Element parent = (Element) element.getParentElement(); final int absoluteValue = (parent == null) ? value.getWindowDefaultValue() : pixelValue(parent, value); return (int) ((i / 100D) * absoluteValue); } @@ -6067,7 +6067,7 @@ * @param element the element for which the CSS attribute value is to be retrieved * @return the CSS attribute value for the specified element */ - public final String get(final HTMLElement element) { + public final String get(final Element element) { final ComputedCSSStyleDeclaration style = element.getCurrentStyle(); final String value = get(style); return value; 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-01-21 09:07:00 UTC (rev 8012) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java 2013-01-21 09:49:21 UTC (rev 8013) @@ -175,7 +175,7 @@ protected String getStyleAttribute(final String name, final Map<String, StyleElement> styleMap) { String s = super.getStyleAttribute(name, null); if (s.isEmpty() && isInheritable(name)) { - final HTMLElement parent = (HTMLElement) getElement().getParentElement(); + final Element parent = getElement().getParentElement(); if (parent != null) { s = getWindow().getComputedStyle(parent, null).getStyleAttribute(name, null); } @@ -2193,7 +2193,7 @@ * @return the specified length CSS attribute value as a pixel length value * @see #pixelString(String) */ - protected String pixelString(final HTMLElement element, final CssValue value) { + protected String pixelString(final Element element, final CssValue value) { final String s = value.get(element); if (getBrowserVersion().hasFeature(JS_LENGTH_WITHOUT_PX)) { return s; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DOMImplementation.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DOMImplementation.java 2013-01-21 09:07:00 UTC (rev 8012) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DOMImplementation.java 2013-01-21 09:49:21 UTC (rev 8013) @@ -67,6 +67,10 @@ && ("1.0".equals(version) || "1.1".equals(version))) { return true; } + else if ("http://www.w3.org/TR/SVG11/feature#Shape".equals(feature) + && ("1.0".equals(version) || "1.1".equals(version))) { + return true; + } //TODO: other features. } return false; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2013-01-21 09:07:00 UTC (rev 8012) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2013-01-21 09:49:21 UTC (rev 8013) @@ -177,7 +177,6 @@ private int scrollLeft_; private int scrollTop_; private String uniqueID_; - private CSSStyleDeclaration style_; static { COLORS_MAP_IE.put("AliceBlue", "#F0F8FF"); @@ -388,8 +387,6 @@ public void setDomNode(final DomNode domNode) { super.setDomNode(domNode); - style_ = new CSSStyleDeclaration(this); - /** * Convert JavaScript snippets defined in the attribute map to executable event handlers. * Should be called only on construction. @@ -2497,15 +2494,6 @@ } /** - * Returns the current (calculated) style object for this element. - * @return the current (calculated) style object for this element - */ - @JsxGetter(@WebBrowser(IE)) - public ComputedCSSStyleDeclaration getCurrentStyle() { - return getWindow().getComputedStyle(this, null); - } - - /** * Returns this element's <tt>offsetLeft</tt>, which is the calculated left position of this * element relative to the <tt>offsetParent</tt>. * @@ -2767,24 +2755,6 @@ } /** - * Returns the style object for this element. - * @return the style object for this element - */ - @JsxGetter - public CSSStyleDeclaration getStyle() { - return style_; - } - - /** - * Returns the runtime style object for this element. - * @return the runtime style object for this element - */ - @JsxGetter(@WebBrowser(IE)) - public CSSStyleDeclaration getRuntimeStyle() { - return style_; - } - - /** * Gets the token list of class attribute. * @return the token list of class attribute */ Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGAngle.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGAngle.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGAngle.java 2013-01-21 09:49:21 UTC (rev 8013) @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.gargoylesoftware.htmlunit.javascript.host.svg; + +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.CHROME; +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; + +import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable; +import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; +import com.gargoylesoftware.htmlunit.javascript.configuration.JsxConstant; +import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; + +/** + * A JavaScript object for SVGAngle. + * + * @version $Revision: 7931 $ + * @author Marc Guillemot + */ +@JsxClass(browsers = { @WebBrowser(value = IE, minVersion = 9), @WebBrowser(FF), @WebBrowser(CHROME) }) +public class SVGAngle extends SimpleScriptable { + + /** Invalid unit type. */ + @JsxConstant + public static final short SVG_ANGLETYPE_UNKNOWN = 0; + + /** Unspecified unit type. */ + @JsxConstant + public static final short SVG_ANGLETYPE_UNSPECIFIED = 1; + + /** Degree unit type. */ + @JsxConstant + public static final short SVG_ANGLETYPE_DEG = 2; + + /** Radian unit type. */ + @JsxConstant + public static final short SVG_ANGLETYPE_RAD = 3; + + /** Grad unit type. */ + @JsxConstant + public static final short SVG_ANGLETYPE_GRAD = 4; + + /** + * Creates an instance. JavaScript objects must have a default constructor. + */ + public SVGAngle() { + } +} Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGMatrix.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGMatrix.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGMatrix.java 2013-01-21 09:49:21 UTC (rev 8013) @@ -0,0 +1,276 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.gargoylesoftware.htmlunit.javascript.host.svg; + +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.CHROME; +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; +import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; + +import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable; +import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; +import com.gargoylesoftware.htmlunit.javascript.configuration.JsxFunction; +import com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter; +import com.gargoylesoftware.htmlunit.javascript.configuration.JsxSetter; +import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; +import com.gargoylesoftware.htmlunit.javascript.host.Window; + +/** + * A JavaScript object for SVGMatrix. + * @see <a href="https://developer.mozilla.org/en-US/docs/DOM/SVGMatrix">MDN doc</a> + * @version $Revision: 7931 $ + * @author Marc Guillemot + */ +@JsxClass(browsers = { @WebBrowser(value = IE, minVersion = 9), @WebBrowser(FF), @WebBrowser(CHROME) }) +public class SVGMatrix extends SimpleScriptable { + private double fieldA_ = 1; + private double fieldB_ = 0; + private double fieldC_ = 0; + private double fieldD_ = 1; + private double fieldE_ = 0; + private double fieldF_ = 0; + + /** + * Creates an instance. JavaScript objects must have a default constructor. + */ + public SVGMatrix() { + } + + /** + * Instantiates and configure scope and prototype. + * @param scope the parent scope + */ + public SVGMatrix(final Window scope) { + setParentScope(scope); + setPrototype(getPrototype(getClass())); + } + + /** + * Gets the <code>a</code> entry of the matrix. + * @return the field + **/ + @JsxGetter + public double getA() { + return fieldA_; + } + + /** + * Gets the <code>b</code> entry of the matrix. + * @return the field + **/ + @JsxGetter + public double getB() { + return fieldB_; + } + + /** + * Gets the <code>c</code> entry of the matrix. + * @return the field + **/ + @JsxGetter + public double getC() { + return fieldC_; + } + + /** + * Gets the <code>d</code> entry of the matrix. + * @return the field + **/ + @JsxGetter + public double getD() { + return fieldD_; + } + + /** + * Gets the <code>e</code> entry of the matrix. + * @return the field + **/ + @JsxGetter + public double getE() { + return fieldE_; + } + + /** + * Gets the <code>f</code> entry of the matrix. + * @return the field + **/ + @JsxGetter + public double getF() { + return fieldF_; + } + + /** + * Sets the <code>a</code> entry of the matrix. + * @param newValue the new value for the field + **/ + @JsxSetter + public void setA(final double newValue) { + fieldA_ = newValue; + } + + /** + * Sets the <code>b</code> entry of the matrix. + * @param newValue the new value for the field + **/ + @JsxSetter + public void setB(final double newValue) { + fieldB_ = newValue; + } + + /** + * Sets the <code>c</code> entry of the matrix. + * @param newValue the new value for the field + **/ + @JsxSetter + public void setC(final double newValue) { + fieldC_ = newValue; + } + + /** + * Sets the <code>d</code> entry of the matrix. + * @param newValue the new value for the field + **/ + @JsxSetter + public void setD(final double newValue) { + fieldD_ = newValue; + } + + /** + * Sets the <code>e</code> entry of the matrix. + * @param newValue the new value for the field + **/ + @JsxSetter + public void setE(final double newValue) { + fieldE_ = newValue; + } + + /** + * Sets the <code>f</code> entry of the matrix. + * @param newValue the new value for the field + **/ + @JsxSetter + public void setF(final double newValue) { + fieldF_ = newValue; + } + + /** + * Transforms the matrix. + * @return the resulting matrix + */ + @JsxFunction + public SVGMatrix flipX() { + return new SVGMatrix(getWindow()); // TODO: this is wrong, compute it! + } + + /** + * Transforms the matrix. + * @return the resulting matrix + */ + @JsxFunction + public SVGMatrix flipY() { + return new SVGMatrix(getWindow()); // TODO: this is wrong, compute it! + } + + /** + * Transforms the matrix. + * @return the resulting matrix + */ + @JsxFunction + public SVGMatrix inverse() { + return new SVGMatrix(getWindow()); // TODO: this is wrong, compute it! + } + + /** + * Transforms the matrix. + * @param by the matrix to multiply by + * @return the resulting matrix + */ + @JsxFunction + public SVGMatrix multiply(final SVGMatrix by) { + return new SVGMatrix(getWindow()); // TODO: this is wrong, compute it! + } + + /** + * Rotates the matrix. + * @param angle the rotation angle + * @return the resulting matrix + */ + @JsxFunction + public SVGMatrix rotate(final double angle) { + return new SVGMatrix(getWindow()); // TODO: this is wrong, compute it! + } + + /** + * Transforms the matrix. + * @param x the x-coordinate of the vector + * @param y the y-coordinate of the vector + * @return the resulting matrix + */ + @JsxFunction + public SVGMatrix rotateFromVector(final double x, final double y) { + return new SVGMatrix(getWindow()); // TODO: this is wrong, compute it! + } + + /** + * Transforms the matrix. + * @param factor the scale factor + * @return the resulting matrix + */ + @JsxFunction + public SVGMatrix scale(final double factor) { + return new SVGMatrix(getWindow()); // TODO: this is wrong, compute it! + } + + /** + * Transforms the matrix. + * @param factorX the factor for the x-axis + * @param factorY the factor for the y-axis + * @return the resulting matrix + */ + @JsxFunction + public SVGMatrix scaleNonUniform(final double factorX, final double factorY) { + return new SVGMatrix(getWindow()); // TODO: this is wrong, compute it! + } + + /** + * Transforms the matrix. + * @param angle the skew angle + * @return the resulting matrix + */ + @JsxFunction + public SVGMatrix skewX(final double angle) { + return new SVGMatrix(getWindow()); // TODO: this is wrong, compute it! + } + + /** + * Transforms the matrix. + * @param angle the skew angle + * @return the resulting matrix + */ + @JsxFunction + public SVGMatrix skewY(final double angle) { + return new SVGMatrix(getWindow()); // TODO: this is wrong, compute it! + } + + /** + * Translates the matrix. + * @param x the distance along the x-axis + * @param y the distance along the y-axis + * @return the resulting matrix + */ + @JsxFunction + public SVGMatrix translate(final double x, final double y) { + return new SVGMatrix(getWindow()); // TODO: this is wrong, compute it! + } +} Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGSVGElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGSVGElement.java 2013-01-21 09:07:00 UTC (rev 8012) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGSVGElement.java 2013-01-21 09:49:21 UTC (rev 8013) @@ -19,6 +19,7 @@ import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; +import com.gargoylesoftware.htmlunit.javascript.configuration.JsxFunction; import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; import com.gargoylesoftware.htmlunit.svg.SvgSvg; @@ -36,5 +37,24 @@ * Creates an instance. JavaScript objects must have a default constructor. */ public SVGSVGElement() { + // nothing } + + /** + * Creates a new {@link SVGMatrix}. + * @return the new matrix + */ + @JsxFunction + public SVGMatrix createSVGMatrix() { + return new SVGMatrix(getWindow()); + } + + /** + * Creates a new {@link SVGMatrix}. + * @return the new matrix + */ + @JsxFunction + public SVGMatrix getScreenCTM() { + return new SVGMatrix(getWindow()); + } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Window2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Window2Test.java 2013-01-21 09:07:00 UTC (rev 8012) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/Window2Test.java 2013-01-21 09:49:21 UTC (rev 8013) @@ -1008,4 +1008,25 @@ loadPageWithAlerts2(html); } + + /** + * JS code was throwing an exception as of 2.12-SNAPSHOT from 21.01.2013 due to the incorrect signature + * of getComputedStyle. + * @throws Exception if the test fails + */ + @Test + @Alerts(FF = "rgb(0, 0, 0)", IE = "exception") + public void getComputedStyle_svg() throws Exception { + final String html = "<html><body>\n" + + " <svg xmlns='http://www.w3.org/2000/svg' id='myId' version='1.1'></svg>\n" + + "<script>\n" + + " var e = document.getElementById('myId');\n" + + " try {\n" + + " alert(window.getComputedStyle(e, null).color);\n" + + " } catch(e) { alert('exception') }\n" + + "</script>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DOMImplementationTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DOMImplementationTest.java 2013-01-21 09:07:00 UTC (rev 8012) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DOMImplementationTest.java 2013-01-21 09:49:21 UTC (rev 8013) @@ -100,6 +100,20 @@ hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "['1.0', '1.1', '1.2']"); } + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(DEFAULT = { "http://www.w3.org/TR/SVG11/feature#Shape 1.0: true", + "http://www.w3.org/TR/SVG11/feature#Shape 1.1: true", + "http://www.w3.org/TR/SVG11/feature#Shape 1.2: false" }, + IE = { "http://www.w3.org/TR/SVG11/feature#Shape 1.0: false", + "http://www.w3.org/TR/SVG11/feature#Shape 1.1: false", + "http://www.w3.org/TR/SVG11/feature#Shape 1.2: false" }) + public void hasFeature_SVG_Shape() throws Exception { + hasFeature("http://www.w3.org/TR/SVG11/feature#Shape", "['1.0', '1.1', '1.2']"); + } + private void hasFeature(final String feature, final String versions) throws Exception { final String html = "<html><head>\n" + "<script>\n" Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocumentTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocumentTest.java 2013-01-21 09:07:00 UTC (rev 8012) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocumentTest.java 2013-01-21 09:49:21 UTC (rev 8013) @@ -282,6 +282,23 @@ * @throws Exception if the test fails */ @Test + @Alerts(DEFAULT = "[object SVGSVGElement]", IE = "exception") + public void createDocumentNS_svg() throws Exception { + final String html = "<html><body>\n" + + "<script>\n" + + "try {\n" + + " var elt = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n" + + " alert(elt);\n" + + "} catch (e) { alert('exception'); }\n" + + "</script></body></html>"; + + loadPageWithAlerts2(html); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts(DEFAULT = "exception", FF = "Hello", FF10 = "exception") public void createDocumentNS_xul() throws Exception { final String html = "<html><body>\n" Added: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgAngleTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgAngleTest.java (rev 0) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgAngleTest.java 2013-01-21 09:49:21 UTC (rev 8013) @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.gargoylesoftware.htmlunit.svg; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import com.gargoylesoftware.htmlunit.BrowserRunner; +import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; +import com.gargoylesoftware.htmlunit.WebDriverTestCase; +import com.gargoylesoftware.htmlunit.html.HtmlPageTest; + +/** + * Tests for {@link SvgAngle}. + * + * @version $Revision: 7931 $ + * @author Marc Guillemot + */ +@RunWith(BrowserRunner.class) +public class SvgAngleTest extends WebDriverTestCase { + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(DEFAULT = { "[object SVGAngle]", "0", "1", "2", "3", "4" }, IE = "undefined") + public void simpleScriptable() throws Exception { + final String html = HtmlPageTest.STANDARDS_MODE_PREFIX_ + + "<html><head>\n" + + "<script>\n" + + " function test() {\n" + + " alert(window.SVGAngle);\n" + + " if (window.SVGAngle) {\n" + + " alert(SVGAngle.SVG_ANGLETYPE_UNKNOWN);\n" + + " alert(SVGAngle.SVG_ANGLETYPE_UNSPECIFIED);\n" + + " alert(SVGAngle.SVG_ANGLETYPE_DEG);\n" + + " alert(SVGAngle.SVG_ANGLETYPE_RAD);\n" + + " alert(SVGAngle.SVG_ANGLETYPE_GRAD);\n" + + " }\n" + + " }\n" + + "</script>\n" + + "</head><body onload='test()'>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } +} Added: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgMatrixTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgMatrixTest.java (rev 0) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgMatrixTest.java 2013-01-21 09:49:21 UTC (rev 8013) @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.gargoylesoftware.htmlunit.svg; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import com.gargoylesoftware.htmlunit.BrowserRunner; +import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; +import com.gargoylesoftware.htmlunit.WebDriverTestCase; +import com.gargoylesoftware.htmlunit.html.HtmlPageTest; + +/** + * Tests for {@link com.gargoylesoftware.htmlunit.javascript.host.svg.SVGMatrix}. + * + * @version $Revision: 7931 $ + * @author Marc Guillemot + */ +@RunWith(BrowserRunner.class) +public class SvgMatrixTest extends WebDriverTestCase { + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(DEFAULT = "[object SVGMatrix]", IE = "undefined") + public void simpleScriptable() throws Exception { + final String html = HtmlPageTest.STANDARDS_MODE_PREFIX_ + + "<html><body>\n" + + "<script>\n" + + " alert(window.SVGMatrix);\n" + + "</script>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(DEFAULT = { "1, 0, 0, 1, 0, 0", "2, 3, 4, 5, 6, 7" }, IE = "exception") + public void fields() throws Exception { + final String html = HtmlPageTest.STANDARDS_MODE_PREFIX_ + + "<html><body>\n" + + " <svg xmlns='http://www.w3.org/2000/svg' id='myId' version='1.1'>\n" + + " </svg>\n" + + "<script>\n" + + "function alertFields(m) {\n" + + " var fields = ['a', 'b', 'c', 'd', 'e', 'f'];\n" + + " for (var i=0; i<fields.length; ++i) {\n" + + " fields[i] = m[fields[i]];\n" + + " }\n" + + " alert(fields.join(', '));\n" + + "}\n" + + "var svg = document.getElementById('myId');\n" + + "try {\n" + + " var m = svg.createSVGMatrix();\n" + + " alertFields(m);\n" + + " m.a = 2;\n" + + " m.b = 3;\n" + + " m.c = 4;\n" + + " m.d = 5;\n" + + " m.e = 6;\n" + + " m.f = 7;\n" + + " alertFields(m);\n" + + "} catch(e) { alert('exception'); }\n" + + "</script>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(DEFAULT = { "function", "function", "function", "function", "function", "function", "function", "function", + "function", "function", "function" }, IE = "exception") + public void methods() throws Exception { + final String html = HtmlPageTest.STANDARDS_MODE_PREFIX_ + + "<html><body>\n" + + " <svg xmlns='http://www.w3.org/2000/svg' id='myId' version='1.1'>\n" + + " </svg>\n" + + "<script>\n" + + " var svg = document.getElementById('myId');\n" + + "try {\n" + + " var m = svg.createSVGMatrix();\n" + + " alert(typeof m.flipX);\n" + + " alert(typeof m.flipY);\n" + + " alert(typeof m.inverse);\n" + + " alert(typeof m.multiply);\n" + + " alert(typeof m.rotate);\n" + + " alert(typeof m.rotateFromVector);\n" + + " alert(typeof m.scale);\n" + + " alert(typeof m.scaleNonUniform);\n" + + " alert(typeof m.skewX);\n" + + " alert(typeof m.skewY);\n" + + " alert(typeof m.translate);\n" + + "} catch(e) { alert('exception'); }\n" + + "</script>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } +} Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgSvgTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgSvgTest.java 2013-01-21 09:07:00 UTC (rev 8012) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgSvgTest.java 2013-01-21 09:49:21 UTC (rev 8013) @@ -64,4 +64,63 @@ } } } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("false") + public void style() throws Exception { + final String html = HtmlPageTest.STANDARDS_MODE_PREFIX_ + + "<html><body>\n" + + " <svg xmlns='http://www.w3.org/2000/svg' id='myId' version='1.1'>\n" + + " </svg>\n" + + "<script>\n" + + " alert(document.getElementById('myId').style == undefined);\n" + + "</script>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(DEFAULT = { "function", "function" }, IE = { "undefined", "undefined" }) + public void functions() throws Exception { + final String html = HtmlPageTest.STANDARDS_MODE_PREFIX_ + + "<html><body>\n" + + " <svg xmlns='http://www.w3.org/2000/svg' id='myId' version='1.1'>\n" + + " </svg>\n" + + "<script>\n" + + " var svg = document.getElementById('myId');\n" + + " alert(typeof svg.getScreenCTM);\n" + + " alert(typeof svg.createSVGMatrix);\n" + + "</script>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(DEFAULT = "[object SVGMatrix]", IE = "exception") + public void getScreenCTM() throws Exception { + final String html = HtmlPageTest.STANDARDS_MODE_PREFIX_ + + "<html><body>\n" + + " <svg xmlns='http://www.w3.org/2000/svg' id='myId' version='1.1'>\n" + + " </svg>\n" + + "<script>\n" + + " var svg = document.getElementById('myId');\n" + + " try {\n" + + " alert(svg.getScreenCTM());\n" + + " } catch(e) { alert('exception'); }\n" + + "</script>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } } |
From: <mgu...@us...> - 2013-01-21 09:53:15
|
Revision: 8014 http://sourceforge.net/p/htmlunit/code/8014 Author: mguillem Date: 2013-01-21 09:53:11 +0000 (Mon, 21 Jan 2013) Log Message: ----------- added missing SVN properties Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGAngle.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGMatrix.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgAngleTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgMatrixTest.java Property Changed: ---------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGAngle.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGMatrix.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgAngleTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgMatrixTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGAngle.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGAngle.java 2013-01-21 09:49:21 UTC (rev 8013) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGAngle.java 2013-01-21 09:53:11 UTC (rev 8014) @@ -26,7 +26,7 @@ /** * A JavaScript object for SVGAngle. * - * @version $Revision: 7931 $ + * @version $Revision$ * @author Marc Guillemot */ @JsxClass(browsers = { @WebBrowser(value = IE, minVersion = 9), @WebBrowser(FF), @WebBrowser(CHROME) }) Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGAngle.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGMatrix.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGMatrix.java 2013-01-21 09:49:21 UTC (rev 8013) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGMatrix.java 2013-01-21 09:53:11 UTC (rev 8014) @@ -29,7 +29,7 @@ /** * A JavaScript object for SVGMatrix. * @see <a href="https://developer.mozilla.org/en-US/docs/DOM/SVGMatrix">MDN doc</a> - * @version $Revision: 7931 $ + * @version $Revision$ * @author Marc Guillemot */ @JsxClass(browsers = { @WebBrowser(value = IE, minVersion = 9), @WebBrowser(FF), @WebBrowser(CHROME) }) Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGMatrix.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgAngleTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgAngleTest.java 2013-01-21 09:49:21 UTC (rev 8013) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgAngleTest.java 2013-01-21 09:53:11 UTC (rev 8014) @@ -25,7 +25,7 @@ /** * Tests for {@link SvgAngle}. * - * @version $Revision: 7931 $ + * @version $Revision$ * @author Marc Guillemot */ @RunWith(BrowserRunner.class) Property changes on: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgAngleTest.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgMatrixTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgMatrixTest.java 2013-01-21 09:49:21 UTC (rev 8013) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgMatrixTest.java 2013-01-21 09:53:11 UTC (rev 8014) @@ -25,7 +25,7 @@ /** * Tests for {@link com.gargoylesoftware.htmlunit.javascript.host.svg.SVGMatrix}. * - * @version $Revision: 7931 $ + * @version $Revision$ * @author Marc Guillemot */ @RunWith(BrowserRunner.class) Property changes on: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgMatrixTest.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property |
From: <mgu...@us...> - 2013-01-21 10:03:29
|
Revision: 8015 http://sourceforge.net/p/htmlunit/code/8015 Author: mguillem Date: 2013-01-21 10:03:26 +0000 (Mon, 21 Jan 2013) Log Message: ----------- fixed ClasCastException when fontSize is read for the style of a SVG element Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgTextTest.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-01-21 09:53:11 UTC (rev 8014) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java 2013-01-21 10:03:26 UTC (rev 8015) @@ -602,7 +602,7 @@ public String getFontSize() { String value = super.getFontSize(); if (value.isEmpty()) { - final HTMLElement parent = (HTMLElement) getElement().getParentElement(); + final Element parent = getElement().getParentElement(); if (parent != null) { value = parent.getCurrentStyle().getFontSize(); } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgTextTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgTextTest.java 2013-01-21 09:53:11 UTC (rev 8014) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/svg/SvgTextTest.java 2013-01-21 10:03:26 UTC (rev 8015) @@ -65,4 +65,24 @@ } } } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(FF = "16px", IE = "exception") + public void getFontSize() throws Exception { + final String html = HtmlPageTest.STANDARDS_MODE_PREFIX_ + + "<html><body>\n" + + " <svg xmlns='http://www.w3.org/2000/svg' version='1.1'>\n" + + " <text id='myId'/>\n" + + " </svg>\n" + + "<script>\n" + + "try {\n" + + " alert(window.getComputedStyle(document.getElementById('myId'), null).fontSize);\n" + + "} catch(e) { alert('exception'); }\n" + + "</script></body></html>"; + + loadPageWithAlerts2(html); + } } |
From: <mgu...@us...> - 2013-01-23 11:48:26
|
Revision: 8025 http://sourceforge.net/p/htmlunit/code/8025 Author: mguillem Date: 2013-01-23 11:48:21 +0000 (Wed, 23 Jan 2013) Log Message: ----------- - start moving style attributes definitions in dedicated structure able to hold definitions and default values per browser - fixed some FF17 expectations and marked NYI when needed Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/CodeStyleTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebDriverTestCase.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/NamedNodeMapTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclarationTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java Added Paths: ----------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/BrowserConfiguration.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/StyleAttributes.java trunk/htmlunit/src/test/resources/com/gargoylesoftware/htmlunit/javascript/host/css/ trunk/htmlunit/src/test/resources/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.properties.FF17.txt trunk/htmlunit/src/test/resources/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.properties.FF3.6.txt trunk/htmlunit/src/test/resources/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.properties.IE.txt Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-01-23 11:46:27 UTC (rev 8024) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-01-23 11:48:21 UTC (rev 8025) @@ -105,9 +105,6 @@ CSS_TEXT_SHADOW_DEFAULT_NONE, /** Default is 'normal'. */ - CSS_UNICODE_BIDI_DEFAULT_NORMAL, - - /** Default is 'normal'. */ CSS_WORD_SPACING_DEFAULT_NORMAL, /** Values for the zIndex are rounded to integer. */ Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/BrowserConfiguration.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/BrowserConfiguration.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/BrowserConfiguration.java 2013-01-23 11:48:21 UTC (rev 8025) @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2002-2013 Gargoyle Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.gargoylesoftware.htmlunit.javascript.host.css; + +import com.gargoylesoftware.htmlunit.BrowserVersion; + +/** + * Allows to specify for which {@link BrowserVersion} a style attribute is defined. + * Quite experimental: it allows to do more than what we had previously but let's see if + * this is the right way. + * + * @version $Revision$ + * @author Marc Guillemot + * + */ +class BrowserConfiguration { + private String browserFamily_; + private String defaultValue_; + private int minVersionNumber_ = -1; + private int maxVersionNumber_ = Integer.MAX_VALUE; + + public static BrowserConfiguration ff(final String defaultValue) { + final BrowserConfiguration browserConfiguration = new BrowserConfiguration(); + browserConfiguration.browserFamily_ = "FF"; + browserConfiguration.defaultValue_ = defaultValue; + return browserConfiguration; + } + + public static BrowserConfiguration ie(final String defaultValue) { + final BrowserConfiguration browserConfiguration = new BrowserConfiguration(); + browserConfiguration.browserFamily_ = "IE"; + browserConfiguration.defaultValue_ = defaultValue; + return browserConfiguration; + } + + public static BrowserConfiguration ffBelow17(final String defaultValue) { + return ff(defaultValue).upTo(16); + } + + public static BrowserConfiguration ff17up(final String defaultValue) { + return ff(defaultValue).startingWith(17); + } + + public static BrowserConfiguration ie8up(final String defaultValue) { + return ie(defaultValue).startingWith(8); + } + + public static boolean isDefined(final BrowserVersion browserVersion, + final BrowserConfiguration[] browserConfigurations) { + if (browserConfigurations == null) { + return true; // defined for all browsers + } + + return getMatchingConfiguration(browserVersion, browserConfigurations) != null; + } + + public static BrowserConfiguration getMatchingConfiguration( + final BrowserVersion browserVersion, + final BrowserConfiguration[] browserConfigurations) { + + for (final BrowserConfiguration browserConfiguration : browserConfigurations) { + if (browserVersion.getNickname().startsWith(browserConfiguration.browserFamily_) + && browserVersion.getBrowserVersionNumeric() >= browserConfiguration.minVersionNumber_ + && browserVersion.getBrowserVersionNumeric() <= browserConfiguration.maxVersionNumber_) { + return browserConfiguration; + } + } + + return null; + } + + public String getDefaultValue() { + return defaultValue_; + } + + public BrowserConfiguration startingWith(final int minVersionNumber) { + if (minVersionNumber_ != -1) { + throw new IllegalStateException("startingWith has already been set to " + minVersionNumber_); + } + minVersionNumber_ = minVersionNumber; + return this; + } + + public BrowserConfiguration upTo(final int maxVersionNumber) { + if (maxVersionNumber_ != Integer.MAX_VALUE) { + throw new IllegalStateException("below has already been set to " + maxVersionNumber_); + } + maxVersionNumber_ = maxVersionNumber; + return this; + } +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/BrowserConfiguration.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Author Date Id Revision \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java 2013-01-23 11:46:27 UTC (rev 8024) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java 2013-01-23 11:48:21 UTC (rev 8025) @@ -33,8 +33,10 @@ import java.io.StringReader; import java.text.MessageFormat; import java.text.ParseException; +import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; import java.util.SortedSet; import java.util.TreeSet; @@ -64,6 +66,7 @@ import com.gargoylesoftware.htmlunit.javascript.configuration.JsxSetter; import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser; import com.gargoylesoftware.htmlunit.javascript.host.Element; +import com.gargoylesoftware.htmlunit.javascript.host.css.StyleAttributes.Definition; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLCanvasElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLHtmlElement; @@ -89,7 +92,6 @@ /** Css important property constant. */ protected static final String PRIORITY_IMPORTANT = "important"; - private static final String AZIMUTH = "azimuth"; private static final String BACKGROUND = "background"; private static final String BACKGROUND_ATTACHMENT = "background-attachment"; private static final String BACKGROUND_COLOR = "background-color"; @@ -130,15 +132,10 @@ private static final String CONTENT = "content"; private static final String COUNTER_INCREMENT = "counter-increment"; private static final String COUNTER_RESET = "counter-reset"; - private static final String CUE = "cue"; - private static final String CUE_AFTER = "cue-after"; - private static final String CUE_BEFORE = "cue-before"; private static final String CURSOR = "cursor"; private static final String DIRECTION = "direction"; private static final String DISPLAY = "display"; - private static final String ELEVATION = "elevation"; private static final String EMPTY_CELLS = "empty-cells"; - private static final String FILTER = "filter"; private static final String FONT = "font"; private static final String FONT_FAMILY = "font-family"; private static final String FONT_SIZE = "font-size"; @@ -158,7 +155,6 @@ private static final String LEFT = "left"; private static final String LETTER_SPACING = "letter-spacing"; private static final String LINE_BREAK = "line-break"; - private static final String LINE_HEIGHT = "line-height"; private static final String LIST_STYLE = "list-style"; private static final String LIST_STYLE_IMAGE = "list-style-image"; private static final String LIST_STYLE_POSITION = "list-style-position"; @@ -174,71 +170,6 @@ private static final String MAX_WIDTH = "max-width"; private static final String MIN_HEIGHT = "min-height"; private static final String MIN_WIDTH = "min-width"; - private static final String MOZ_APPEARANCE = "-moz-appearance"; - private static final String MOZ_BACKGROUND_CLIP = "-moz-background-clip"; - private static final String MOZ_BACKGROUND_INLINE_POLICY = "-moz-background-inline-policy"; - private static final String MOZ_BACKGROUND_ORIGIN = "-moz-background-origin"; - private static final String MOZ_BACKGROUND_SIZE = "-moz-background-size"; - private static final String MOZ_BINDING = "-moz-binding"; - private static final String MOZ_BORDER_BOTTOM_COLORS = "-moz-border-bottom-colors"; - private static final String MOZ_BORDER_END = "-moz-border-end"; - private static final String MOZ_BORDER_END_COLOR = "-moz-border-end-color"; - private static final String MOZ_BORDER_END_STYLE = "-moz-border-end-style"; - private static final String MOZ_BORDER_END_WIDTH = "-moz-border-end-width"; - private static final String MOZ_BORDER_IMAGE = "-moz-border-image"; - private static final String MOZ_BORDER_LEFT_COLORS = "-moz-border-left-colors"; - private static final String MOZ_BORDER_RADIUS = "-moz-border-radius"; - private static final String MOZ_BORDER_RADIUS_BOTTOMLEFT = "-moz-border-radius-bottomleft"; - private static final String MOZ_BORDER_RADIUS_BOTTOMRIGHT = "-moz-border-radius-bottomright"; - private static final String MOZ_BORDER_RADIUS_TOPLEFT = "-moz-border-radius-topleft"; - private static final String MOZ_BORDER_RADIUS_TOPRIGHT = "-moz-border-radius-topright"; - private static final String MOZ_BORDER_RIGHT_COLORS = "-moz-border-right-colors"; - private static final String MOZ_BORDER_START = "-moz-border-start"; - private static final String MOZ_BORDER_START_COLOR = "-moz-border-start-color"; - private static final String MOZ_BORDER_START_STYLE = "-moz-border-start-style"; - private static final String MOZ_BORDER_START_WIDTH = "-moz-border-start-width"; - private static final String MOZ_BORDER_TOP_COLORS = "-moz-border-top-colors"; - private static final String MOZ_BOX_ALIGN = "-moz-box-align"; - private static final String MOZ_BOX_DIRECTION = "-moz-box-direction"; - private static final String MOZ_BOX_FLEX = "-moz-box-flex"; - private static final String MOZ_BOX_ORDINAL_GROUP = "-moz-box-ordinal-group"; - private static final String MOZ_BOX_ORIENT = "-moz-box-orient"; - private static final String MOZ_BOX_PACK = "-moz-box-pack"; - private static final String MOZ_BOX_SHADOW = "-moz-box-shadow"; - private static final String MOZ_BOX_SIZING = "-moz-box-sizing"; - private static final String MOZ_COLUMN_COUNT = "-moz-column-count"; - private static final String MOZ_COLUMN_GAP = "-moz-column-gap"; - private static final String MOZ_COLUMN_RULE = "-moz-column-rule"; - private static final String MOZ_COLUMN_RULE_COLOR = "-moz-column-rule-color"; - private static final String MOZ_COLUMN_RULE_STYLE = "-moz-column-rule-style"; - private static final String MOZ_COLUMN_RULE_WIDTH = "-moz-column-rule-width"; - private static final String MOZ_COLUMN_WIDTH = "-moz-column-width"; - private static final String MOZ_FLOAT_EDGE = "-moz-float-edge"; - private static final String MOZ_FORCE_BROKEN_IMAGE_ICON = "-moz-force-broken-image-icon"; - private static final String MOZ_IMAGE_REGION = "-moz-image-region"; - private static final String MOZ_MARGIN_END = "-moz-margin-end"; - private static final String MOZ_MARGIN_START = "-moz-margin-start"; - private static final String MOZ_OPACITY = "-moz-opacity"; - private static final String MOZ_OUTLINE = "-moz-outline"; - private static final String MOZ_OUTLINE_COLOR = "-moz-outline-color"; - private static final String MOZ_OUTLINE_OFFSET = "-moz-outline-offset"; - private static final String MOZ_OUTLINE_RADIUS = "-mz-outline-radius"; - private static final String MOZ_OUTLINE_RADIUS_BOTTOMLEFT = "-moz-outline-radius-bottomleft"; - private static final String MOZ_OUTLINE_RADIUS_BOTTOMRIGHT = "-moz-outline-radius-bottomright"; - private static final String MOZ_OUTLINE_RADIUS_TOPLEFT = "-moz-outline-radius-topleft"; - private static final String MOZ_OUTLINE_RADIUS_TOPRIGHT = "-moz-outline-radius-topright"; - private static final String MOZ_OUTLINE_STYLE = "-moz-outline-style"; - private static final String MOZ_OUTLINE_WIDTH = "-moz-outline-width"; - private static final String MOZ_PADDING_END = "-moz-padding-end"; - private static final String MOZ_PADDING_START = "-moz-padding-start"; - private static final String MOZ_STACK_SIZING = "-moz-stack-sizing"; - private static final String MOZ_TRANSFORM = "-moz-transform"; - private static final String MOZ_TRANSFORM_ORIGIN = "-moz-transform-origin"; - private static final String MOZ_USER_FOCUS = "-moz-user-focus"; - private static final String MOZ_USER_INPUT = "-moz-user-input"; - private static final String MOZ_USER_MODIFY = "-moz-user-modify"; - private static final String MOZ_USER_SELECT = "-moz-user-select"; - private static final String MOZ_WINDOW_SHADOW = "-moz-window-shadow"; private static final String MS_BLOCK_PROGRESSION = "ms-block-progression"; private static final String MS_INTERPOLATION_MODE = "ms-interpolation-mode"; private static final String OPACITY = "opacity"; @@ -260,15 +191,8 @@ private static final String PAGE_BREAK_AFTER = "page-break-after"; private static final String PAGE_BREAK_BEFORE = "page-break-before"; private static final String PAGE_BREAK_INSIDE = "page-break-inside"; - private static final String PAUSE = "pause"; - private static final String PAUSE_AFTER = "pause-after"; - private static final String PAUSE_BEFORE = "pause-before"; - private static final String PITCH = "pitch"; - private static final String PITCH_RANGE = "pitch-range"; private static final String POINTER_EVENTS = "pointer-events"; private static final String POSITION = "position"; - private static final String QUOTES = "quotes"; - private static final String RICHNESS = "richness"; private static final String RIGHT = "right"; private static final String RUBY_ALIGN = "ruby-align"; private static final String RUBY_OVERHANG = "ruby-overhang"; @@ -282,12 +206,6 @@ private static final String SCROLLBAR_SHADOW_COLOR = "scrollbar-shadow-color"; private static final String SCROLLBAR_TRACK_COLOR = "scrollbar-track-color"; private static final String SIZE = "size"; - private static final String SPEAK = "speak"; - private static final String SPEAK_HEADER = "speak-header"; - private static final String SPEAK_NUMERAL = "speak-numeral"; - private static final String SPEAK_PUNCTUATION = "speak-punctuation"; - private static final String SPEECH_RATE = "speech-rate"; - private static final String STRESS = "stress"; private static final String FLOAT = "float"; private static final String TABLE_LAYOUT = "table-layout"; private static final String TEXT_ALIGN = "text-align"; @@ -304,14 +222,10 @@ private static final String TEXT_TRANSFORM = "text-transform"; private static final String TEXT_UNDERLINE_POSITION = "text-underline-position"; private static final String TOP = "top"; - private static final String UNICODE_BIDI = "unicode-bidi"; private static final String VERTICAL_ALIGN = "vertical-align"; private static final String VISIBILITY = "visibility"; - private static final String VOICE_FAMILY = "voice-family"; - private static final String VOLUME = "volume"; private static final String WHITE_SPACE = "white-space"; private static final String WIDOWS = "widows"; - private static final String WORD_BREAK = "word-break"; private static final String WORD_SPACING = "word-spacing"; private static final String WORD_WRAP = "word-wrap"; private static final String WRITING_MODE = "writing-mode"; @@ -743,24 +657,6 @@ } /** - * Gets the "azimuth" style attribute. - * @return the style attribute - */ - @JsxGetter(@WebBrowser(FF)) - public String getAzimuth() { - return getStyleAttribute(AZIMUTH, null); - } - - /** - * Sets the "azimuth" style attribute. - * @param azimuth the new attribute - */ - @JsxSetter(@WebBrowser(FF)) - public void setAzimuth(final String azimuth) { - setStyleAttribute(AZIMUTH, azimuth); - } - - /** * Gets the "background" style attribute. * @return the style attribute */ @@ -1791,60 +1687,6 @@ } /** - * Gets the "cue" style attribute. - * @return the style attribute - */ - @JsxGetter(@WebBrowser(FF)) - public String getCue() { - return getStyleAttribute(CUE, null); - } - - /** - * Sets the "cue" style attribute. - * @param cue the new attribute - */ - @JsxSetter(@WebBrowser(FF)) - public void setCue(final String cue) { - setStyleAttribute(CUE, cue); - } - - /** - * Gets the "cueAfter" style attribute. - * @return the style attribute - */ - @JsxGetter(@WebBrowser(FF)) - public String getCueAfter() { - return getStyleAttribute(CUE_AFTER, null); - } - - /** - * Sets the "cueAfter" style attribute. - * @param cueAfter the new attribute - */ - @JsxSetter(@WebBrowser(FF)) - public void setCueAfter(final String cueAfter) { - setStyleAttribute(CUE_AFTER, cueAfter); - } - - /** - * Gets the "cueBefore" style attribute. - * @return the style attribute - */ - @JsxGetter(@WebBrowser(FF)) - public String getCueBefore() { - return getStyleAttribute(CUE_BEFORE, null); - } - - /** - * Sets the "cueBefore" style attribute. - * @param cueBefore the new attribute - */ - @JsxSetter(@WebBrowser(FF)) - public void setCueBefore(final String cueBefore) { - setStyleAttribute(CUE_BEFORE, cueBefore); - } - - /** * Gets the "cursor" style attribute. * @return the style attribute */ @@ -1899,24 +1741,6 @@ } /** - * Gets the "elevation" style attribute. - * @return the style attribute - */ - @JsxGetter(@WebBrowser(FF)) - public String getElevation() { - return getStyleAttribute(ELEVATION, null); - } - - /** - * Sets the "elevation" style attribute. - * @param elevation the new attribute - */ - @JsxSetter(@WebBrowser(FF)) - public void setElevation(final String elevation) { - setStyleAttribute(ELEVATION, elevation); - } - - /** * Gets the "emptyCells" style attribute. * @return the style attribute */ @@ -1935,28 +1759,6 @@ } /** - * Gets the object's filter (IE only). See the <a - * href="http://msdn2.microsoft.com/en-us/library/ms530752.aspx">MSDN documentation</a> for - * more information. - * @return the object's filter - */ - @JsxGetter(@WebBrowser(IE)) - public String getFilter() { - return getStyleAttribute(FILTER, null); - } - - /** - * Sets the object's filter (IE only). See the <a - * href="http://msdn2.microsoft.com/en-us/library/ms530752.aspx">MSDN documentation</a> for - * more information. - * @param filter the new filter - */ - @JsxSetter(@WebBrowser(IE)) - public void setFilter(final String filter) { - setStyleAttribute(FILTER, filter); - } - - /** * Gets the "font" style attribute. * @return the style attribute */ @@ -2308,24 +2110,6 @@ } /** - * Gets the "lineHeight" style attribute. - * @return the style attribute - */ - @JsxGetter - public String getLineHeight() { - return getStyleAttribute(LINE_HEIGHT, null); - } - - /** - * Sets the "lineHeight" style attribute. - * @param lineHeight the new attribute - */ - @JsxSetter - public void setLineHeight(final String lineHeight) { - setStyleAttribute(LINE_HEIGHT, lineHeight); - } - - /** * Gets the "listStyle" style attribute. * @return the style attribute */ @@ -2595,1177 +2379,76 @@ setStyleAttributePixel(MIN_WIDTH, minWidth); } - /** - * Gets the "MozAppearance" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozAppearance") - public String getMozAppearance() { - return getStyleAttribute(MOZ_APPEARANCE, null); - } + @Override + public Object get(final String name, final Scriptable start) { + if (this != start) { + return super.get(name, start); + } - /** - * Sets the "MozAppearance" style attribute. - * @param mozAppearance the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozAppearance") - public void setMozAppearance(final String mozAppearance) { - setStyleAttribute(MOZ_APPEARANCE, mozAppearance); - } + final Definition style = StyleAttributes.getDefinition(name, getBrowserVersion()); + if (style != null) { + return getStyleAttributeValue(style); + } - /** - * Gets the "MozBackgroundClip" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBackgroundClip") - public String getMozBackgroundClip() { - return getStyleAttribute(MOZ_BACKGROUND_CLIP, null); + return super.get(name, start); } /** - * Sets the "MozBackgroundClip" style attribute. - * @param mozBackgroundClip the new attribute + * Get the value for the style attribute. + * @param style the style + * @return the value */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBackgroundClip") - public void setMozBackgroundClip(final String mozBackgroundClip) { - setStyleAttribute(MOZ_BACKGROUND_CLIP, mozBackgroundClip); + protected String getStyleAttributeValue(final Definition style) { + return getStyleAttribute(style.getAttributeName(), null); } - /** - * Gets the "MozBackgroundInlinePolicy" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBackgroundInlinePolicy") - public String getMozBackgroundInlinePolicy() { - return getStyleAttribute(MOZ_BACKGROUND_INLINE_POLICY, null); - } + @Override + public void put(final String name, final Scriptable start, final Object value) { + if (this != start) { + super.put(name, start, value); + return; + } - /** - * Sets the "MozBackgroundInlinePolicy" style attribute. - * @param mozBackgroundInlinePolicy the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBackgroundInlinePolicy") - public void setMozBackgroundInlinePolicy(final String mozBackgroundInlinePolicy) { - setStyleAttribute(MOZ_BACKGROUND_INLINE_POLICY, mozBackgroundInlinePolicy); - } + final Definition style = StyleAttributes.getDefinition(name, getBrowserVersion()); + if (style != null) { + final String stringValue = Context.toString(value); + setStyleAttribute(style.getPropertyName(), stringValue); + return; + } - /** - * Gets the "MozBackgroundOrigin" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBackgroundOrigin") - public String getMozBackgroundOrigin() { - return getStyleAttribute(MOZ_BACKGROUND_ORIGIN, null); + super.put(name, start, value); } - /** - * Sets the "MozBackgroundOrigin" style attribute. - * @param mozBackgroundOrigin the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBackgroundOrigin") - public void setMozBackgroundOrigin(final String mozBackgroundOrigin) { - setStyleAttribute(MOZ_BACKGROUND_ORIGIN, mozBackgroundOrigin); - } + @Override + public boolean has(final String name, final Scriptable start) { + if (this != start) { + return super.has(name, start); + } - /** - * Gets the "MozBackgroundSize" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBackgroundSize") - public String getMozBackgroundSize() { - return getStyleAttribute(MOZ_BACKGROUND_SIZE, null); - } + final Definition style = StyleAttributes.getDefinition(name, getBrowserVersion()); + if (style != null) { + return true; + } - /** - * Sets the "MozBackgroundSize" style attribute. - * @param mozBackgroundSize the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBackgroundSize") - public void setMozBackgroundSize(final String mozBackgroundSize) { - setStyleAttribute(MOZ_BACKGROUND_SIZE, mozBackgroundSize); + return super.has(name, start); } - /** - * Gets the "MozBinding" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBinding") - public String getMozBinding() { - return getStyleAttribute(MOZ_BINDING, null); + @Override + public Object[] getIds() { + final List<Object> ids = new ArrayList<Object>(); + for (final Definition styleAttribute : StyleAttributes.getDefinitions(getBrowserVersion())) { + ids.add(styleAttribute.getPropertyName()); + } + final Object[] normalIds = super.getIds(); + for (final Object o : normalIds) { + if (!ids.contains(o)) { + ids.add(o); + } + } + return ids.toArray(); } /** - * Sets the "MozBinding" style attribute. - * @param mozBinding the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBinding") - public void setMozBinding(final String mozBinding) { - setStyleAttribute(MOZ_BINDING, mozBinding); - } - - /** - * Gets the "MozBorderBottomColors" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBorderBottomColors") - public String getMozBorderBottomColors() { - return getStyleAttribute(MOZ_BORDER_BOTTOM_COLORS, null); - } - - /** - * Sets the "MozBorderBottomColors" style attribute. - * @param mozBorderBottomColors the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBorderBottomColors") - public void setMozBorderBottomColors(final String mozBorderBottomColors) { - setStyleAttribute(MOZ_BORDER_BOTTOM_COLORS, mozBorderBottomColors); - } - - /** - * Gets the "MozBorderEnd" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBorderEnd") - public String getMozBorderEnd() { - return getStyleAttribute(MOZ_BORDER_END, null); - } - - /** - * Sets the "MozBorderEnd" style attribute. - * @param mozBorderEnd the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBorderEnd") - public void setMozBorderEnd(final String mozBorderEnd) { - setStyleAttribute(MOZ_BORDER_END, mozBorderEnd); - } - - /** - * Gets the "MozBorderEndColor" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBorderEndColor") - public String getMozBorderEndColor() { - return getStyleAttribute(MOZ_BORDER_END_COLOR, null); - } - - /** - * Sets the "MozBorderEndColor" style attribute. - * @param mozBorderEndColor the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBorderEndColor") - public void setMozBorderEndColor(final String mozBorderEndColor) { - setStyleAttribute(MOZ_BORDER_END_COLOR, mozBorderEndColor); - } - - /** - * Gets the "MozBorderEndStyle" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBorderEndStyle") - public String getMozBorderEndStyle() { - return getStyleAttribute(MOZ_BORDER_END_STYLE, null); - } - - /** - * Sets the "MozBorderEndStyle" style attribute. - * @param mozBorderEndStyle the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBorderEndStyle") - public void setMozBorderEndStyle(final String mozBorderEndStyle) { - setStyleAttribute(MOZ_BORDER_END_STYLE, mozBorderEndStyle); - } - - /** - * Gets the "MozBorderEndWidth" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBorderEndWidth") - public String getMozBorderEndWidth() { - return getStyleAttribute(MOZ_BORDER_END_WIDTH, null); - } - - /** - * Sets the "MozBorderEndWidth" style attribute. - * @param mozBorderEndWidth the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBorderEndWidth") - public void setMozBorderEndWidth(final String mozBorderEndWidth) { - setStyleAttribute(MOZ_BORDER_END_WIDTH, mozBorderEndWidth); - } - - /** - * Gets the "MozBorderImage" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBorderImage") - public String getMozBorderImage() { - return getStyleAttribute(MOZ_BORDER_IMAGE, null); - } - - /** - * Sets the "MozBorderImage" style attribute. - * @param mozBorderImage the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBorderImage") - public void setMozBorderImage(final String mozBorderImage) { - setStyleAttribute(MOZ_BORDER_IMAGE, mozBorderImage); - } - - /** - * Gets the "MozBorderLeftColors" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBorderLeftColors") - public String getMozBorderLeftColors() { - return getStyleAttribute(MOZ_BORDER_LEFT_COLORS, null); - } - - /** - * Sets the "MozBorderLeftColors" style attribute. - * @param mozBorderLeftColors the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBorderLeftColors") - public void setMozBorderLeftColors(final String mozBorderLeftColors) { - setStyleAttribute(MOZ_BORDER_LEFT_COLORS, mozBorderLeftColors); - } - - /** - * Gets the "MozBorderRadius" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBorderRadius") - public String getMozBorderRadius() { - return getStyleAttribute(MOZ_BORDER_RADIUS, null); - } - - /** - * Sets the "MozBorderRadius" style attribute. - * @param mozBorderRadius the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBorderRadius") - public void setMozBorderRadius(final String mozBorderRadius) { - setStyleAttribute(MOZ_BORDER_RADIUS, mozBorderRadius); - } - - /** - * Gets the "MozBorderRadiusBottomleft" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBorderRadiusBottomleft") - public String getMozBorderRadiusBottomleft() { - return getStyleAttribute(MOZ_BORDER_RADIUS_BOTTOMLEFT, null); - } - - /** - * Sets the "MozBorderRadiusBottomleft" style attribute. - * @param mozBorderRadiusBottomleft the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBorderRadiusBottomleft") - public void setMozBorderRadiusBottomleft(final String mozBorderRadiusBottomleft) { - setStyleAttribute(MOZ_BORDER_RADIUS_BOTTOMLEFT, mozBorderRadiusBottomleft); - } - - /** - * Gets the "MozBorderRadiusBottomright" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBorderRadiusBottomright") - public String getMozBorderRadiusBottomright() { - return getStyleAttribute(MOZ_BORDER_RADIUS_BOTTOMRIGHT, null); - } - - /** - * Sets the "MozBorderRadiusBottomright" style attribute. - * @param mozBorderRadiusBottomright the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBorderRadiusBottomright") - public void setMozBorderRadiusBottomright(final String mozBorderRadiusBottomright) { - setStyleAttribute(MOZ_BORDER_RADIUS_BOTTOMRIGHT, mozBorderRadiusBottomright); - } - - /** - * Gets the "MozBorderRadiusTopleft" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBorderRadiusTopleft") - public String getMozBorderRadiusTopleft() { - return getStyleAttribute(MOZ_BORDER_RADIUS_TOPLEFT, null); - } - - /** - * Sets the "MozBorderRadiusTopleft" style attribute. - * @param mozBorderRadiusTopleft the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBorderRadiusTopleft") - public void setMozBorderRadiusTopleft(final String mozBorderRadiusTopleft) { - setStyleAttribute(MOZ_BORDER_RADIUS_TOPLEFT, mozBorderRadiusTopleft); - } - - /** - * Gets the "MozBorderRadiusTopright" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBorderRadiusTopright") - public String getMozBorderRadiusTopright() { - return getStyleAttribute(MOZ_BORDER_RADIUS_TOPRIGHT, null); - } - - /** - * Sets the "MozBorderRadiusTopright" style attribute. - * @param mozBorderRadiusTopright the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBorderRadiusTopright") - public void setMozBorderRadiusTopright(final String mozBorderRadiusTopright) { - setStyleAttribute(MOZ_BORDER_RADIUS_TOPRIGHT, mozBorderRadiusTopright); - } - - /** - * Gets the "MozBorderRightColors" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBorderRightColors") - public String getMozBorderRightColors() { - return getStyleAttribute(MOZ_BORDER_RIGHT_COLORS, null); - } - - /** - * Sets the "MozBorderRightColors" style attribute. - * @param mozBorderRightColors the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBorderRightColors") - public void setMozBorderRightColors(final String mozBorderRightColors) { - setStyleAttribute(MOZ_BORDER_RIGHT_COLORS, mozBorderRightColors); - } - - /** - * Gets the "MozBorderStart" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBorderStart") - public String getMozBorderStart() { - return getStyleAttribute(MOZ_BORDER_START, null); - } - - /** - * Sets the "MozBorderStart" style attribute. - * @param mozBorderStart the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBorderStart") - public void setMozBorderStart(final String mozBorderStart) { - setStyleAttribute(MOZ_BORDER_START, mozBorderStart); - } - - /** - * Gets the "MozBorderStartColor" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBorderStartColor") - public String getMozBorderStartColor() { - return getStyleAttribute(MOZ_BORDER_START_COLOR, null); - } - - /** - * Sets the "MozBorderStartColor" style attribute. - * @param mozBorderStartColor the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBorderStartColor") - public void setMozBorderStartColor(final String mozBorderStartColor) { - setStyleAttribute(MOZ_BORDER_START_COLOR, mozBorderStartColor); - } - - /** - * Gets the "MozBorderStartStyle" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBorderStartStyle") - public String getMozBorderStartStyle() { - return getStyleAttribute(MOZ_BORDER_START_STYLE, null); - } - - /** - * Sets the "MozBorderStartStyle" style attribute. - * @param mozBorderStartStyle the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBorderStartStyle") - public void setMozBorderStartStyle(final String mozBorderStartStyle) { - setStyleAttribute(MOZ_BORDER_START_STYLE, mozBorderStartStyle); - } - - /** - * Gets the "MozBorderStartWidth" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBorderStartWidth") - public String getMozBorderStartWidth() { - return getStyleAttribute(MOZ_BORDER_START_WIDTH, null); - } - - /** - * Sets the "MozBorderStartWidth" style attribute. - * @param mozBorderStartWidth the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBorderStartWidth") - public void setMozBorderStartWidth(final String mozBorderStartWidth) { - setStyleAttribute(MOZ_BORDER_START_WIDTH, mozBorderStartWidth); - } - - /** - * Gets the "MozBorderTopColors" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBorderTopColors") - public String getMozBorderTopColors() { - return getStyleAttribute(MOZ_BORDER_TOP_COLORS, null); - } - - /** - * Sets the "MozBorderTopColors" style attribute. - * @param mozBorderTopColors the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBorderTopColors") - public void setMozBorderTopColors(final String mozBorderTopColors) { - setStyleAttribute(MOZ_BORDER_TOP_COLORS, mozBorderTopColors); - } - - /** - * Gets the "MozBoxAlign" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBoxAlign") - public String getMozBoxAlign() { - return getStyleAttribute(MOZ_BOX_ALIGN, null); - } - - /** - * Sets the "MozBoxAlign" style attribute. - * @param mozBoxAlign the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBoxAlign") - public void setMozBoxAlign(final String mozBoxAlign) { - setStyleAttribute(MOZ_BOX_ALIGN, mozBoxAlign); - } - - /** - * Gets the "MozBoxDirection" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBoxDirection") - public String getMozBoxDirection() { - return getStyleAttribute(MOZ_BOX_DIRECTION, null); - } - - /** - * Sets the "MozBoxDirection" style attribute. - * @param mozBoxDirection the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBoxDirection") - public void setMozBoxDirection(final String mozBoxDirection) { - setStyleAttribute(MOZ_BOX_DIRECTION, mozBoxDirection); - } - - /** - * Gets the "MozBoxFlex" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBoxFlex") - public String getMozBoxFlex() { - return getStyleAttribute(MOZ_BOX_FLEX, null); - } - - /** - * Sets the "MozBoxFlex" style attribute. - * @param mozBoxFlex the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBoxFlex") - public void setMozBoxFlex(final String mozBoxFlex) { - setStyleAttribute(MOZ_BOX_FLEX, mozBoxFlex); - } - - /** - * Gets the "MozBoxOrdinalGroup" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBoxOrdinalGroup") - public String getMozBoxOrdinalGroup() { - return getStyleAttribute(MOZ_BOX_ORDINAL_GROUP, null); - } - - /** - * Sets the "MozBoxOrdinalGroup" style attribute. - * @param mozBoxOrdinalGroup the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBoxOrdinalGroup") - public void setMozBoxOrdinalGroup(final String mozBoxOrdinalGroup) { - setStyleAttribute(MOZ_BOX_ORDINAL_GROUP, mozBoxOrdinalGroup); - } - - /** - * Gets the "MozBoxOrient" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBoxOrient") - public String getMozBoxOrient() { - return getStyleAttribute(MOZ_BOX_ORIENT, null); - } - - /** - * Sets the "MozBoxOrient" style attribute. - * @param mozBoxOrient the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBoxOrient") - public void setMozBoxOrient(final String mozBoxOrient) { - setStyleAttribute(MOZ_BOX_ORIENT, mozBoxOrient); - } - - /** - * Gets the "MozBoxPack" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBoxPack") - public String getMozBoxPack() { - return getStyleAttribute(MOZ_BOX_PACK, null); - } - - /** - * Sets the "MozBoxPack" style attribute. - * @param mozBoxPack the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBoxPack") - public void setMozBoxPack(final String mozBoxPack) { - setStyleAttribute(MOZ_BOX_PACK, mozBoxPack); - } - - /** - * Gets the "MozBoxShadow" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBoxShadow") - public String getMozBoxShadow() { - return getStyleAttribute(MOZ_BOX_SHADOW, null); - } - - /** - * Sets the "MozBoxShadow" style attribute. - * @param mozBoxShadow the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBoxShadow") - public void setMozBoxShadow(final String mozBoxShadow) { - setStyleAttribute(MOZ_BOX_SHADOW, mozBoxShadow); - } - - /** - * Gets the "MozBoxSizing" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozBoxSizing") - public String getMozBoxSizing() { - return getStyleAttribute(MOZ_BOX_SIZING, null); - } - - /** - * Sets the "MozBoxSizing" style attribute. - * @param mozBoxSizing the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozBoxSizing") - public void setMozBoxSizing(final String mozBoxSizing) { - setStyleAttribute(MOZ_BOX_SIZING, mozBoxSizing); - } - - /** - * Gets the "MozColumnCount" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozColumnCount") - public String getMozColumnCount() { - return getStyleAttribute(MOZ_COLUMN_COUNT, null); - } - - /** - * Sets the "MozColumnCount" style attribute. - * @param mozColumnCount the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozColumnCount") - public void setMozColumnCount(final String mozColumnCount) { - setStyleAttribute(MOZ_COLUMN_COUNT, mozColumnCount); - } - - /** - * Gets the "MozColumnGap" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozColumnGap") - public String getMozColumnGap() { - return getStyleAttribute(MOZ_COLUMN_GAP, null); - } - - /** - * Sets the "MozColumnGap" style attribute. - * @param mozColumnGap the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozColumnGap") - public void setMozColumnGap(final String mozColumnGap) { - setStyleAttribute(MOZ_COLUMN_GAP, mozColumnGap); - } - - /** - * Gets the "MozColumnRule" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozColumnRule") - public String getMozColumnRule() { - return getStyleAttribute(MOZ_COLUMN_RULE, null); - } - - /** - * Sets the "MozColumnRule" style attribute. - * @param mozColumnRule the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozColumnRule") - public void setMozColumnRule(final String mozColumnRule) { - setStyleAttribute(MOZ_COLUMN_RULE, mozColumnRule); - } - - /** - * Gets the "MozColumnRuleColor" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozColumnRuleColor") - public String getMozColumnRuleColor() { - return getStyleAttribute(MOZ_COLUMN_RULE_COLOR, null); - } - - /** - * Sets the "MozColumnRuleColor" style attribute. - * @param mozColumnRuleColor the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozColumnRuleColor") - public void setMozColumnRuleColor(final String mozColumnRuleColor) { - setStyleAttribute(MOZ_COLUMN_RULE_COLOR, mozColumnRuleColor); - } - - /** - * Gets the "MozColumnRuleStyle" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozColumnRuleStyle") - public String getMozColumnRuleStyle() { - return getStyleAttribute(MOZ_COLUMN_RULE_STYLE, null); - } - - /** - * Sets the "MozColumnRuleStyle" style attribute. - * @param mozColumnRuleStyle the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozColumnRuleStyle") - public void setMozColumnRuleStyle(final String mozColumnRuleStyle) { - setStyleAttribute(MOZ_COLUMN_RULE_STYLE, mozColumnRuleStyle); - } - - /** - * Gets the "MozColumnRuleWidth" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozColumnRuleWidth") - public String getMozColumnRuleWidth() { - return getStyleAttribute(MOZ_COLUMN_RULE_WIDTH, null); - } - - /** - * Sets the "MozColumnRuleWidth" style attribute. - * @param mozColumnRuleWidth the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozColumnRuleWidth") - public void setMozColumnRuleWidth(final String mozColumnRuleWidth) { - setStyleAttribute(MOZ_COLUMN_RULE_WIDTH, mozColumnRuleWidth); - } - - /** - * Gets the "MozColumnWidth" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozColumnWidth") - public String getMozColumnWidth() { - return getStyleAttribute(MOZ_COLUMN_WIDTH, null); - } - - /** - * Sets the "MozColumnWidth" style attribute. - * @param mozColumnWidth the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozColumnWidth") - public void setMozColumnWidth(final String mozColumnWidth) { - setStyleAttribute(MOZ_COLUMN_WIDTH, mozColumnWidth); - } - - /** - * Gets the "MozFloatEdge" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozFloatEdge") - public String getMozFloatEdge() { - return getStyleAttribute(MOZ_FLOAT_EDGE, null); - } - - /** - * Sets the "MozFloatEdge" style attribute. - * @param mozFloatEdge the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozFloatEdge") - public void setMozFloatEdge(final String mozFloatEdge) { - setStyleAttribute(MOZ_FLOAT_EDGE, mozFloatEdge); - } - - /** - * Gets the "MozForceBrokenImageIcon" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozForceBrokenImageIcon") - public String getMozForceBrokenImageIcon() { - return getStyleAttribute(MOZ_FORCE_BROKEN_IMAGE_ICON, null); - } - - /** - * Sets the "MozForceBrokenImageIcon" style attribute. - * @param mozForceBrokenImageIcon the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozForceBrokenImageIcon") - public void setMozForceBrokenImageIcon(final String mozForceBrokenImageIcon) { - setStyleAttribute(MOZ_FORCE_BROKEN_IMAGE_ICON, mozForceBrokenImageIcon); - } - - /** - * Gets the "MozImageRegion" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozImageRegion") - public String getMozImageRegion() { - return getStyleAttribute(MOZ_IMAGE_REGION, null); - } - - /** - * Sets the "MozImageRegion" style attribute. - * @param mozImageRegion the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozImageRegion") - public void setMozImageRegion(final String mozImageRegion) { - setStyleAttribute(MOZ_IMAGE_REGION, mozImageRegion); - } - - /** - * Gets the "MozMarginEnd" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozMarginEnd") - public String getMozMarginEnd() { - return getStyleAttribute(MOZ_MARGIN_END, null); - } - - /** - * Sets the "MozMarginEnd" style attribute. - * @param mozMarginEnd the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozMarginEnd") - public void setMozMarginEnd(final String mozMarginEnd) { - setStyleAttribute(MOZ_MARGIN_END, mozMarginEnd); - } - - /** - * Gets the "MozMarginStart" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozMarginStart") - public String getMozMarginStart() { - return getStyleAttribute(MOZ_MARGIN_START, null); - } - - /** - * Sets the "MozMarginStart" style attribute. - * @param mozMarginStart the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozMarginStart") - public void setMozMarginStart(final String mozMarginStart) { - setStyleAttribute(MOZ_MARGIN_START, mozMarginStart); - } - - /** - * Gets the "MozOpacity" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozOpacity") - public String getMozOpacity() { - return getStyleAttribute(MOZ_OPACITY, null); - } - - /** - * Sets the "MozOpacity" style attribute. - * @param mozOpacity the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozOpacity") - public void setMozOpacity(final String mozOpacity) { - setStyleAttribute(MOZ_OPACITY, mozOpacity); - } - - /** - * Gets the "MozOutline" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozOutline") - public String getMozOutline() { - return getStyleAttribute(MOZ_OUTLINE, null); - } - - /** - * Sets the "MozOutline" style attribute. - * @param mozOutline the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozOutline") - public void setMozOutline(final String mozOutline) { - setStyleAttribute(MOZ_OUTLINE, mozOutline); - } - - /** - * Gets the "MozOutlineColor" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozOutlineColor") - public String getMozOutlineColor() { - return getStyleAttribute(MOZ_OUTLINE_COLOR, null); - } - - /** - * Sets the "MozOutlineColor" style attribute. - * @param mozOutlineColor the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozOutlineColor") - public void setMozOutlineColor(final String mozOutlineColor) { - setStyleAttribute(MOZ_OUTLINE_COLOR, mozOutlineColor); - } - - /** - * Gets the "MozOutlineOffset" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozOutlineOffset") - public String getMozOutlineOffset() { - return getStyleAttribute(MOZ_OUTLINE_OFFSET, null); - } - - /** - * Sets the "MozOutlineOffset" style attribute. - * @param mozOutlineOffset the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozOutlineOffset") - public void setMozOutlineOffset(final String mozOutlineOffset) { - setStyleAttribute(MOZ_OUTLINE_OFFSET, mozOutlineOffset); - } - - /** - * Gets the "MozOutlineRadius" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozOutlineRadius") - public String getMozOutlineRadius() { - return getStyleAttribute(MOZ_OUTLINE_RADIUS, null); - } - - /** - * Sets the "MozOutlineRadius" style attribute. - * @param mozOutlineRadius the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozOutlineRadius") - public void setMozOutlineRadius(final String mozOutlineRadius) { - setStyleAttribute(MOZ_OUTLINE_RADIUS, mozOutlineRadius); - } - - /** - * Gets the "MozOutlineRadiusBottomleft" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozOutlineRadiusBottomleft") - public String getMozOutlineRadiusBottomleft() { - return getStyleAttribute(MOZ_OUTLINE_RADIUS_BOTTOMLEFT, null); - } - - /** - * Sets the "MozOutlineRadiusBottomleft" style attribute. - * @param mozOutlineRadiusBottomleft the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozOutlineRadiusBottomleft") - public void setMozOutlineRadiusBottomleft(final String mozOutlineRadiusBottomleft) { - setStyleAttribute(MOZ_OUTLINE_RADIUS_BOTTOMLEFT, mozOutlineRadiusBottomleft); - } - - /** - * Gets the "MozOutlineRadiusBottomright" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozOutlineRadiusBottomright") - public String getMozOutlineRadiusBottomright() { - return getStyleAttribute(MOZ_OUTLINE_RADIUS_BOTTOMRIGHT, null); - } - - /** - * Sets the "MozOutlineRadiusBottomright" style attribute. - * @param mozOutlineRadiusBottomright the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozOutlineRadiusBottomright") - public void setMozOutlineRadiusBottomright(final String mozOutlineRadiusBottomright) { - setStyleAttribute(MOZ_OUTLINE_RADIUS_BOTTOMRIGHT, mozOutlineRadiusBottomright); - } - - /** - * Gets the "MozOutlineRadiusTopleft" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozOutlineRadiusTopleft") - public String getMozOutlineRadiusTopleft() { - return getStyleAttribute(MOZ_OUTLINE_RADIUS_TOPLEFT, null); - } - - /** - * Sets the "MozOutlineRadiusTopleft" style attribute. - * @param mozOutlineRadiusTopleft the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozOutlineRadiusTopleft") - public void setMozOutlineRadiusTopleft(final String mozOutlineRadiusTopleft) { - setStyleAttribute(MOZ_OUTLINE_RADIUS_TOPLEFT, mozOutlineRadiusTopleft); - } - - /** - * Gets the "MozOutlineRadiusTopright" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozOutlineRadiusTopright") - public String getMozOutlineRadiusTopright() { - return getStyleAttribute(MOZ_OUTLINE_RADIUS_TOPRIGHT, null); - } - - /** - * Sets the "MozOutlineRadiusTopright" style attribute. - * @param mozOutlineRadiusTopright the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozOutlineRadiusTopright") - public void setMozOutlineRadiusTopright(final String mozOutlineRadiusTopright) { - setStyleAttribute(MOZ_OUTLINE_RADIUS_TOPRIGHT, mozOutlineRadiusTopright); - } - - /** - * Gets the "MozOutlineStyle" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozOutlineStyle") - public String getMozOutlineStyle() { - return getStyleAttribute(MOZ_OUTLINE_STYLE, null); - } - - /** - * Sets the "MozOutlineStyle" style attribute. - * @param mozOutlineStyle the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozOutlineStyle") - public void setMozOutlineStyle(final String mozOutlineStyle) { - setStyleAttribute(MOZ_OUTLINE_STYLE, mozOutlineStyle); - } - - /** - * Gets the "MozOutlineWidth" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozOutlineWidth") - public String getMozOutlineWidth() { - return getStyleAttribute(MOZ_OUTLINE_WIDTH, null); - } - - /** - * Sets the "MozOutlineWidth" style attribute. - * @param mozOutlineWidth the new attribute - */ - @JsxSetter(value = @WebBrowser(FF), propertyName = "MozOutlineWidth") - public void setMozOutlineWidth(final String mozOutlineWidth) { - setStyleAttribute(MOZ_OUTLINE_WIDTH, mozOutlineWidth); - } - - /** - * Gets the "MozPaddingEnd" style attribute. - * @return the style attribute - */ - @JsxGetter(value = @WebBrowser(FF), propertyName = "MozPaddingEnd") - public String getMozPaddingEnd() { - return getStyleAtt... [truncated message content] |
From: <mgu...@us...> - 2013-01-23 13:37:55
|
Revision: 8030 http://sourceforge.net/p/htmlunit/code/8030 Author: mguillem Date: 2013-01-23 13:37:53 +0000 (Wed, 23 Jan 2013) Log Message: ----------- form.encoding returns only valid values for FF17 Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElement.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElementTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-01-23 12:12:24 UTC (rev 8029) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-01-23 13:37:53 UTC (rev 8030) @@ -854,6 +854,10 @@ @BrowserFeature(@WebBrowser(IE)) JS_EVENT_NO_PARAMETER, + /** Indicates if form.encoding returns a recognized value when attribute is incorrect. */ + @BrowserFeature(@WebBrowser(value = FF, minVersion = 17)) + JS_FORM_ENCODING_NORMALIZED, + /** Indicates that the URL of parent window is used to resolve URLs in frames with javascript src. */ @BrowserFeature({ @WebBrowser(value = IE, maxVersion = 6), @WebBrowser(value = IE, minVersion = 8), @WebBrowser(FF), @WebBrowser(CHROME) }) Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElement.java 2013-01-23 12:12:24 UTC (rev 8029) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElement.java 2013-01-23 13:37:53 UTC (rev 8030) @@ -15,6 +15,7 @@ package com.gargoylesoftware.htmlunit.javascript.host.html; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.FORMFIELD_REACHABLE_BY_NEW_NAMES; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_FORM_ENCODING_NORMALIZED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_169; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_80; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_81; @@ -265,7 +266,13 @@ */ @JsxGetter public String getEncoding() { - return getHtmlForm().getEnctypeAttribute(); + final String encoding = getHtmlForm().getEnctypeAttribute(); + if (getBrowserVersion().hasFeature(JS_FORM_ENCODING_NORMALIZED)) { + if (!"application/x-www-form-urlencoded".equals(encoding) && !"multipart/form-data".equals(encoding)) { + return "application/x-www-form-urlencoded"; + } + } + return encoding; } /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElementTest.java 2013-01-23 12:12:24 UTC (rev 8029) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElementTest.java 2013-01-23 13:37:53 UTC (rev 8030) @@ -26,6 +26,7 @@ import org.openqa.selenium.NoSuchWindowException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; +import org.openqa.selenium.htmlunit.HtmlUnitDriver; import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; @@ -174,6 +175,7 @@ * @throws Exception if the test fails */ @Test + @Alerts({ "http://foo.com/", "mailto:me...@ba...", "mailto:me...@ba..." }) public void actionProperty() throws Exception { doTestProperty("action", "action", "http://foo.com/", "mailto:me...@ba..."); } @@ -182,6 +184,7 @@ * @throws Exception if the test fails */ @Test + @Alerts({ "myForm", "testForm", "testForm" }) public void nameProperty() throws Exception { doTestProperty("name", "name", "myForm", "testForm"); } @@ -190,7 +193,18 @@ * @throws Exception if the test fails */ @Test + @Alerts({ "multipart/form-data", "application/x-www-form-urlencoded", "application/x-www-form-urlencoded" }) public void encodingProperty() throws Exception { + doTestProperty("encoding", "enctype", "multipart/form-data", "application/x-www-form-urlencoded"); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(DEFAULT = { "myEncoding", "newEncoding", "newEncoding" }, + FF17 = { "application/x-www-form-urlencoded", "application/x-www-form-urlencoded", "newEncoding" }) + public void encodingProperty_dummyValues() throws Exception { doTestProperty("encoding", "enctype", "myEncoding", "newEncoding"); } @@ -198,6 +212,7 @@ * @throws Exception if the test fails */ @Test + @Alerts({ "get", "post", "post" }) public void methodProperty() throws Exception { doTestProperty("method", "method", "get", "post"); } @@ -206,6 +221,7 @@ * @throws Exception if the test fails */ @Test + @Alerts({ "_top", "_parent", "_parent" }) public void targetProperty() throws Exception { doTestProperty("target", "target", "_top", "_parent"); } @@ -219,6 +235,7 @@ + " alert(document.forms[0]." + jsProperty + ");\n" + " document.forms[0]." + jsProperty + "='" + newValue + "';\n" + " alert(document.forms[0]." + jsProperty + ");\n" + + " alert(document.forms[0].getAttribute('" + htmlProperty + "'));\n" + "}\n" + "</script></head><body onload='doTest()'>\n" + "<p>hello world</p>\n" @@ -227,11 +244,13 @@ + "</form>\n" + "</body></html>"; - setExpectedAlerts(oldValue, newValue); final WebDriver wd = loadPageWithAlerts2(html); final WebElement form = wd.findElement(By.xpath("//form")); - assertEquals(newValue, form.getAttribute(htmlProperty)); + if (wd instanceof HtmlUnitDriver) { + // form.getAttribute("enctype") returns form.getAttribute("encoding") with the FF driver. Bug or feature? + assertEquals(getExpectedAlerts()[2], form.getAttribute(htmlProperty)); + } } /** |