[323933] WCAG 2.0/JIS support
diff --git a/plugins/org.eclipse.actf.visualization.engines.blind.html/src/org/eclipse/actf/visualization/internal/engines/blind/html/util/VisualizeViewUtil.java b/plugins/org.eclipse.actf.visualization.engines.blind.html/src/org/eclipse/actf/visualization/internal/engines/blind/html/util/VisualizeViewUtil.java index 5b3d46f..1541ce5 100644 --- a/plugins/org.eclipse.actf.visualization.engines.blind.html/src/org/eclipse/actf/visualization/internal/engines/blind/html/util/VisualizeViewUtil.java +++ b/plugins/org.eclipse.actf.visualization.engines.blind.html/src/org/eclipse/actf/visualization/internal/engines/blind/html/util/VisualizeViewUtil.java
@@ -88,9 +88,8 @@ // div for arrow Element div = result.createElement(DIV); - div - .setAttribute(STYLE, - "position:absolute;pixelLeft= 10;pixelTop=10; color:red;font-size=12pt"); + div.setAttribute(STYLE, + "position:absolute;pixelLeft= 10;pixelTop=10; color:red;font-size=12pt"); div.setAttribute(ID, "test"); // bodyEl.item(bodyEl.getLength() - 1).appendChild(div); @@ -144,9 +143,7 @@ if (!alreadySet.contains(href)) { Element imgel2 = doc.createElement(IMG); - imgel2 - .setAttribute(ALT, "Intra-page link destination: " - + href); + imgel2.setAttribute(ALT, "Intra-page link destination: " + href); imgel2.setAttribute(TITLE, "Intra-page link destination: " + href); imgel2.setAttribute(SRC, baseUrl + "img/dest.gif"); @@ -168,10 +165,9 @@ private static void insertControlPane(Document result) { NodeList bodyEl = result.getElementsByTagName(BODY); Element div = result.createElement(DIV); - div - .setAttribute( - STYLE, - "position:absolute;font-size: medium; background-color: #FFFFFF; border-color: #333333 #000000 #000000; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px"); + div.setAttribute( + STYLE, + "position:absolute;font-size: medium; background-color: #FFFFFF; border-color: #333333 #000000 #000000; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px"); div.setAttribute(ID, "control_pane"); Element input1 = result.createElement(INPUT); @@ -294,10 +290,9 @@ } Element div = result.createElement(DIV); - div - .setAttribute( - STYLE, - "position:absolute;font-size: medium; background-color: #FFFFFF; border-color: #333333 #000000 #000000; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px"); + div.setAttribute( + STYLE, + "position:absolute;font-size: medium; background-color: #FFFFFF; border-color: #333333 #000000 #000000; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px"); div.setAttribute(ID, "balloon"); Element messageDiv = result.createElement(DIV); @@ -345,7 +340,12 @@ VisualizationNodeInfo info = mapData.getNodeInfo(node); if (info != null) { - info.appendComment(prob.getDescription()); + if (IBlindProblem.WRONG_NBSP_ALT_IMG == prob.getSubType()) { + info.appendComment(prob.getDescription().replaceAll("&", + "&")); + } else { + info.appendComment(prob.getDescription()); + } } else { if (node != null && node.getNodeType() == Node.ELEMENT_NODE) { try { @@ -364,6 +364,7 @@ switch (prob.getSubType()) { case IBlindProblem.NO_ALT_IMG: case IBlindProblem.WRONG_ALT_IMG: + case IBlindProblem.WRONG_NBSP_ALT_IMG: Element el = (Element) node; Node replacement = mapData.getReplacement(el); if (replacement != null) { @@ -439,7 +440,12 @@ IProblemItem prob, Integer idObj, String baseUrlS) { Element img = target.getOwnerDocument().createElement(IMG); img.setAttribute(ALT, "error icon"); - img.setAttribute(TITLE, prob.getDescription()); + if (IBlindProblem.WRONG_NBSP_ALT_IMG == prob.getSubType()) { + img.setAttribute(TITLE, + prob.getDescription().replaceAll("&", "&")); + } else { + img.setAttribute(TITLE, prob.getDescription()); + } img.setAttribute("onmouseover", "updateBaloon('id" + idObj + "');"); img.setAttribute(SRC, baseUrlS + "img/" + VisualizeEngine.ERROR_ICON_NAME);
diff --git a/plugins/org.eclipse.actf.visualization.engines.blind/src/org/eclipse/actf/visualization/engines/blind/TextChecker.java b/plugins/org.eclipse.actf.visualization.engines.blind/src/org/eclipse/actf/visualization/engines/blind/TextChecker.java index 9b5d2b9..c4fa01c 100644 --- a/plugins/org.eclipse.actf.visualization.engines.blind/src/org/eclipse/actf/visualization/engines/blind/TextChecker.java +++ b/plugins/org.eclipse.actf.visualization.engines.blind/src/org/eclipse/actf/visualization/engines/blind/TextChecker.java
@@ -40,7 +40,6 @@ private static final String NIHONGO = "(\\p{InCJKUnifiedIdeographs}|\\p{InHiragana}|\\p{InKatakana})"; //$NON-NLS-1$ - @SuppressWarnings("unused") private static final String KANJI = "(\\p{InCJKUnifiedIdeographs})"; //$NON-NLS-1$ private static final String ALT_TEXT_PROPERTIES_FILE = "altText.properties"; //$NON-NLS-1$ @@ -55,8 +54,7 @@ private Set<String> ngwordset2 = new TreeSet<String>(); - // private Preferences pref = BlindVizEnginePlugin.getDefault() - // .getPluginPreferences(); + private Set<String> ngPatterns = new HashSet<String>(); private IPreferenceStore pref = BlindVizEnginePlugin.getDefault() .getPreferenceStore(); @@ -112,6 +110,8 @@ } } } + + ngPatterns.add("\u753B\u50CF\\s*\\d+"); } /** @@ -186,7 +186,7 @@ * <li>3: space separated chars</li> * </ul> */ - public int checkInappropriateAlt(String alt) { + public int checkInappropriateAlt(final String alt) { String[] tmpSA = alt.toLowerCase().split( "(" + KIGOU + "|\\p{Punct}|\\p{Space})"); //$NON-NLS-1$ //$NON-NLS-2$ int count = 0; @@ -256,13 +256,15 @@ String tmpS = target.trim(); tmpS = tmpS.toLowerCase(); - // \u3000 = double byte space - String regexp1 = ".*(" + NIHONGO //$NON-NLS-1$ - + "((\\p{Space}|\u3000|\u00A0)+" + NIHONGO + ")+).*"; //$NON-NLS-1$ //$NON-NLS-2$ - // String regexp2 = ".*" + KANJI + ".*"; //$NON-NLS-1$ //$NON-NLS-2$ // TODO rewrite regexp (combination of Japanese and English) + // \u3000 = double byte space + // \u00A0 = + @SuppressWarnings("unused") + String regexp1 = ".*" + KANJI + ".*"; //$NON-NLS-1$ //$NON-NLS-2$ + String regexp2 = ".*\\b" + NIHONGO + "[\\p{Space}\u3000\u00A0]+" + + NIHONGO + "\\b.*"; - if (tmpS.matches(regexp1)) { + if (tmpS.matches(regexp2)) { return true; } else { return false; @@ -345,6 +347,7 @@ */ public TextCheckResult checkAlt(String alt, String src, Set<String> ngWords) { // First do not trim the given ALT string! + String origAlt = alt; int origLength = alt.length(); alt = alt.toLowerCase(); @@ -366,6 +369,11 @@ if (ngwordset.contains(alt) || ngWords.contains(alt)) return TextCheckResult.NG_WORD; + for (String patterns : ngPatterns) { + if (alt.matches(patterns)) + return TextCheckResult.NG_WORD; + } + if (src != null) { Matcher m = Pattern.compile(".*?([^/]+)") .matcher(src.toLowerCase()); @@ -401,9 +409,8 @@ } } - if (origLength > 0 && ((double) charLength / (double) origLength) < 0.5) { + if (isAsciiArtString(origAlt)) return TextCheckResult.ASCII_ART; // case 1 - } if (((double) wordCountNG / (double) wordCountAll) > 0.6) return TextCheckResult.INCLUDING_MANY_NG_WORD; // case 2 @@ -413,4 +420,20 @@ return TextCheckResult.OK; } + + public boolean isAsciiArtString(String str) { + int origLength = str.length(); + str = str.toLowerCase(); + List<String> wordList = Arrays.asList(str.toLowerCase().split( + "(" + KIGOU + "|\\p{Punct}|\\p{Space})")); //$NON-NLS-1$ //$NON-NLS-2$ + int charLength = 0; + for (String word : wordList) { + charLength += word.length(); + } + + boolean isBlank = str.matches("[\\p{Space}\\u3000\\u00A0]*"); + + return (origLength > 0 + && ((double) charLength / (double) origLength) < 0.5 && !isBlank); + } }
diff --git a/plugins/org.eclipse.actf.visualization.eval/resources/checkitem.xml b/plugins/org.eclipse.actf.visualization.eval/resources/checkitem.xml index 019156a..ba375ce 100644 --- a/plugins/org.eclipse.actf.visualization.eval/resources/checkitem.xml +++ b/plugins/org.eclipse.actf.visualization.eval/resources/checkitem.xml
@@ -709,10 +709,10 @@ </checkitem> <checkitem type="user" id="L_10"> <guideline> - <gItem techniques="G18, G145" id="7.1.4.3" name="JIS"/> - <gItem techniques="G17, G18" id="7.1.4.6" name="JIS"/> - <gItem techniques="G18, G145" id="1.4.3" name="WCAG 2.0"/> - <gItem techniques="G17, G18" id="1.4.6" name="WCAG 2.0"/> + <gItem techniques="F83, G18, G145" id="7.1.4.3" name="JIS"/> + <gItem techniques="F83, G17, G18" id="7.1.4.6" name="JIS"/> + <gItem techniques="F83, G18, G145" id="1.4.3" name="WCAG 2.0"/> + <gItem techniques="F83, G17, G18" id="1.4.6" name="WCAG 2.0"/> </guideline> <metrics> <mItem name="Perceivable"/>
diff --git a/plugins/org.eclipse.actf.visualization.eval/resources/description_ja.properties b/plugins/org.eclipse.actf.visualization.eval/resources/description_ja.properties index cd75ab4..c46c589 100644 --- a/plugins/org.eclipse.actf.visualization.eval/resources/description_ja.properties +++ b/plugins/org.eclipse.actf.visualization.eval/resources/description_ja.properties
@@ -40,7 +40,7 @@ B_35 = \u30da\u30fc\u30b8\u5185\u30ea\u30f3\u30af\uff0c {0} \uff0c\u306f\u5229\u7528\u3067\u304d\u306a\u3044\u3068\u601d\u308f\u308c\u307e\u3059\uff0e\uff08display:none\u3084display:hidden\u306e\u4ee3\u308f\u308a\u306b\uff0c\u30ea\u30f3\u30af\u5185\u306balt\u5c5e\u6027\u3092\u4ed8\u3051\u305f\u5c0f\u3055\u306a\u753b\u50cf\u3092\u914d\u7f6e\u3059\u308b\u306a\u3069\u3057\u3066\u4e0b\u3055\u3044\uff09 B_36 = \u30dc\u30bf\u30f3(input)\u306b\u306fvalue\u5c5e\u6027\u3092\u63d0\u4f9b\u3057\u3066\u304f\u3060\u3055\u3044 \u3002 B_37 = \u201d{0}\u201d\u30dc\u30bf\u30f3\uff08input\u306evalue\u5c5e\u6027\uff09\u306f\u6587\u5b57\u9593\u306b\u7a7a\u767d\u3092\u542b\u3093\u3067\u3044\u308b\u305f\u3081\u3001\u97f3\u58f0\u3067\u6b63\u78ba\u306b\u8aad\u307f\u4e0a\u3052\u308b\u3053\u3068\u304c\u51fa\u6765\u306a\u3044\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002 -B_38 = "{0}"\uff08 \u3092\u542b\u3080\u7a7a\u767d\u6587\u5b57\u306e\u307f\uff09\u306f\u753b\u50cf\u306ealt\u5c5e\u6027\u3068\u3057\u3066\u4e0d\u9069\u5207\u3067\u3059\u3002 ( \u3067\u8868\u3055\u308c\u308b\u6587\u5b57\u3092\u542b\u3093\u3067\u3044\u307e\u3059)\u3002(\u3082\u3057\u652f\u63f4\u6280\u8853\u304c\u3053\u306e\u753b\u50cf\u3092\u7121\u8996\u3059\u308b\u3079\u304d\u5834\u5408\u306f\u3001 alt="" \u3068\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044) +B_38 = "{0}"\uff08 \u3092\u542b\u3080\u7a7a\u767d\u6587\u5b57\u306e\u307f\uff09\u306f\u753b\u50cf\u306ealt\u5c5e\u6027\u3068\u3057\u3066\u4e0d\u9069\u5207\u3067\u3059\u3002 (\u3082\u3057\u652f\u63f4\u6280\u8853\u304c\u3053\u306e\u753b\u50cf\u3092\u7121\u8996\u3059\u308b\u3079\u304d\u5834\u5408\u306f\u3001 alt="" \u3068\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044) C_1000.0 = \u3053\u306e\u30da\u30fc\u30b8\u306b\u306f\u8907\u6570\u306ebody\u8981\u7d20\u304c\u3042\u308b\u3088\u3046\u3067\u3059\uff0eHTML\u3092\u4fee\u6b63\u3057\u3066\u304f\u3060\u3055\u3044 C_1000.1 = body\u8981\u7d20\u306e\u4e2d\u306bhead\u8981\u7d20\u304c\u3042\u308b\u3088\u3046\u3067\u3059\uff0eHTML\u3092\u4fee\u6b63\u3057\u3066\u304f\u3060\u3055\u3044
diff --git a/plugins/org.eclipse.actf.visualization.eval/src/org/eclipse/actf/visualization/eval/html/HtmlEvalUtil.java b/plugins/org.eclipse.actf.visualization.eval/src/org/eclipse/actf/visualization/eval/html/HtmlEvalUtil.java index c4ff04a..49395c6 100644 --- a/plugins/org.eclipse.actf.visualization.eval/src/org/eclipse/actf/visualization/eval/html/HtmlEvalUtil.java +++ b/plugins/org.eclipse.actf.visualization.eval/src/org/eclipse/actf/visualization/eval/html/HtmlEvalUtil.java
@@ -15,18 +15,15 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; -import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.TreeSet; import java.util.Vector; import org.eclipse.actf.util.xpath.XPathService; import org.eclipse.actf.util.xpath.XPathServiceFactory; -import org.eclipse.actf.visualization.eval.EvaluationUtil; import org.eclipse.actf.visualization.eval.html.statistics.FlashData; import org.eclipse.actf.visualization.eval.html.statistics.HeadingsData; import org.eclipse.actf.visualization.eval.html.statistics.ImageStatData; @@ -69,8 +66,8 @@ private static final XPathService xpathService = XPathServiceFactory .newService(); - private static final Object EXP1 = xpathService.compile(".//a[@" //$NON-NLS-1$ - + ATTR_HREF + "]"); //$NON-NLS-1$ + private static final Object EXP1 = xpathService.compile(".//a[@href]"); //$NON-NLS-1$ + private static final Object EXP2 = xpathService .compile("//h1|//h2|//h3|//h4|//h5|//h6"); //$NON-NLS-1$ @@ -160,17 +157,20 @@ private PageData pageData; - private int invisibleElementCount = 0; - - private String[] invisibleLinkStrings = new String[0]; - - private HashSet<String> notExistHrefSet = new HashSet<String>(); + // private int invisibleElementCount = 0; + // + // private String[] invisibleLinkStrings = new String[0]; + // + // private HashSet<String> notExistHrefSet = new HashSet<String>(); // for new JIS private List<Element> imageButtonList; private List<Element> textButtonList; private List<Element> areaList; private List<Element> appletList; + private List<Element> accessKeyList; + private List<Element> styleList; + private List<Element> styleElementList; /** * Constructor of the class. @@ -228,7 +228,7 @@ * true if target is live DOM */ @SuppressWarnings("nls") - public HtmlEvalUtil(Document target, Document resultDoc, String url, + private HtmlEvalUtil(Document target, Document resultDoc, String url, Map<Node, Integer> document2IdMap, Document srcDom, Document liveDom, PageData pageData, int invisibleElementCount, String[] invisibleLinkStrings, boolean isDBCS, boolean isLive) { @@ -250,10 +250,10 @@ } this.invalidLinkRatio = 0; - this.invisibleElementCount = invisibleElementCount; - if (invisibleLinkStrings != null) { - this.invisibleLinkStrings = invisibleLinkStrings; - } + // this.invisibleElementCount = invisibleElementCount; + // if (invisibleLinkStrings != null) { + // this.invisibleLinkStrings = invisibleLinkStrings; + // } this.document2IdMap = document2IdMap; // this.html2ViewMapData = html2ViewMapData; @@ -447,9 +447,10 @@ if (PERFORMANCE_DEBUG) System.out.println("collectScriptElements\t" + (new Date()).getTime()); - calcDomDifference(); - if (PERFORMANCE_DEBUG) - System.out.println("calcDomDifference\t" + (new Date()).getTime()); + /* + * calcDomDifference(); if (PERFORMANCE_DEBUG) + * System.out.println("calcDomDifference\t" + (new Date()).getTime()); + */ } private Element[] getElementsArray(Document target, String tagName) { @@ -508,6 +509,17 @@ return result; } + private List<Element> getElementsListByXPath(Document target, String xpath) { + NodeList tmpNL = xpathService.evalPathForNodeList(xpath, target); + int length = tmpNL.getLength(); + // Element[] result = new Element[length]; + List<Element> elements = new ArrayList<Element>(); + for (int i = 0; i < length; i++) { + elements.add((Element) tmpNL.item(i)); + } + return elements; + } + @SuppressWarnings("nls") private void collectScriptElements() { script_elements = getElementsArray(target, "script"); @@ -565,71 +577,71 @@ pageData.setHasJavascript(hasJavascript); } - private void calcDomDifference() { - - if (EvaluationUtil.isOriginalDOM()) { - // target = orig DOM - if (isLiveDom || null == liveDom) { - // parse error - return; - } - - TreeSet<String> existSet = new TreeSet<String>( - Arrays.asList(aWithHref_hrefs)); - // trim()? - - for (String href : aWithHref_hrefs) { - if (!href.startsWith("http://") && !href.startsWith("https://")) { - try { - existSet.add(new URL(baseUrl, href).toString()); - // System.out.println(href +" : "+new - // URL(baseUrl,href)); - } catch (MalformedURLException e) { - } - } - } - - /* - * NodeList ieNL = xpathService.evalForNodeList(EXP1, liveDom); int - * size = ieNL.getLength(); - */ - - NodeList ieNL = liveDom.getElementsByTagName("a"); - int size = ieNL.getLength(); - - for (int i = 0; i < size; i++) { - Element tmpE = (Element) ieNL.item(i); - if (!tmpE.hasAttribute(ATTR_HREF)) { - continue; - } - String tmpS = tmpE.getAttribute(ATTR_HREF); - if (!existSet.contains(tmpS)) { - // System.out.println("ie:"+tmpS); - notExistHrefSet.add(tmpS); - } - } - } else { - // target = IE DOM - NodeList orgNL = xpathService.evalForNodeList(EXP1, srcDom); - int size = orgNL.getLength(); - TreeSet<String> existSet = new TreeSet<String>(); - for (int i = 0; i < size; i++) { - existSet.add(((Element) orgNL.item(i)).getAttribute(ATTR_HREF)); - // System.out.println("Src:"+((Element) - // orgNL.item(i)).getAttribute(ATTR_HREF)); - } - - size = aWithHref_hrefs.length; - for (int i = 0; i < size; i++) { - if (!existSet.contains(aWithHref_hrefs[i])) { - notExistHrefSet.add(aWithHref_hrefs[i]); - } - // System.out.println("IE:"+aWithHref_hrefs[i]); - } - - } - - } + // private void calcDomDifference() { + // + // if (EvaluationUtil.isOriginalDOM()) { + // // target = orig DOM + // if (isLiveDom || null == liveDom) { + // // parse error + // return; + // } + // + // TreeSet<String> existSet = new TreeSet<String>( + // Arrays.asList(aWithHref_hrefs)); + // // trim()? + // + // for (String href : aWithHref_hrefs) { + // if (!href.startsWith("http://") && !href.startsWith("https://")) { + // try { + // existSet.add(new URL(baseUrl, href).toString()); + // // System.out.println(href +" : "+new + // // URL(baseUrl,href)); + // } catch (MalformedURLException e) { + // } + // } + // } + // + // /* + // * NodeList ieNL = xpathService.evalForNodeList(EXP1, liveDom); int + // * size = ieNL.getLength(); + // */ + // + // NodeList ieNL = liveDom.getElementsByTagName("a"); + // int size = ieNL.getLength(); + // + // for (int i = 0; i < size; i++) { + // Element tmpE = (Element) ieNL.item(i); + // if (!tmpE.hasAttribute(ATTR_HREF)) { + // continue; + // } + // String tmpS = tmpE.getAttribute(ATTR_HREF); + // if (!existSet.contains(tmpS)) { + // // System.out.println("ie:"+tmpS); + // notExistHrefSet.add(tmpS); + // } + // } + // } else { + // // target = IE DOM + // NodeList orgNL = xpathService.evalForNodeList(EXP1, srcDom); + // int size = orgNL.getLength(); + // TreeSet<String> existSet = new TreeSet<String>(); + // for (int i = 0; i < size; i++) { + // existSet.add(((Element) orgNL.item(i)).getAttribute(ATTR_HREF)); + // // System.out.println("Src:"+((Element) + // // orgNL.item(i)).getAttribute(ATTR_HREF)); + // } + // + // size = aWithHref_hrefs.length; + // for (int i = 0; i < size; i++) { + // if (!existSet.contains(aWithHref_hrefs[i])) { + // notExistHrefSet.add(aWithHref_hrefs[i]); + // } + // // System.out.println("IE:"+aWithHref_hrefs[i]); + // } + // + // } + // + // } private boolean is1Row1ColTable(Element el) { NodeList cellNl = el.getElementsByTagName("tr"); //$NON-NLS-1$ @@ -743,21 +755,57 @@ } /** - * Get all applet elements. for new JIS + * Get all elements that has accessKey. + * + * @return + */ + public List<Element> getAccessKeyElements() { + if (accessKeyList == null) { + accessKeyList = getElementsListByXPath(target, "//*[@accesskey]"); + } + return accessKeyList; + } + + /** + * Get all elements that has style attribute. + * + * @return + */ + public List<Element> getElementsWithStyle() { + if (styleList == null) { + styleList = getElementsListByXPath(target, "//*[@style]"); + } + return styleList; + } + + /** + * Get all style elements. + * + * @return + */ + public List<Element> getStyleElements() { + if (styleElementList == null) { + styleElementList = new ArrayList<Element>(); + for (Element applet : getElementsList(target, "style")) + styleElementList.add(applet); + } + return styleElementList; + } + + /** + * Get all applet elements. * * @return */ public List<Element> getAppletElements() { if (appletList == null) { - appletList = new ArrayList<Element>(); - for (Element applet : getElementsList(target, "applet")) - appletList.add(applet); + appletList = getElementsList(target, "applet"); } return appletList; } /** - * Get all area elements. for new JIS + * Get all area elements. * * @return */ @@ -930,7 +978,7 @@ } /** - * Get all image button (input elements whose type is "image"). For new JIS + * Get all image button (input elements whose type is "image"). * * @return */ @@ -948,12 +996,12 @@ } /** - * Get all text-based button. For new JIS + * Get all text-based button. * * @return */ // TODO treat button elements... - // for new JIS + // public List<Element> getTextButtons() { if (textButtonList == null) { textButtonList = new ArrayList<Element>(); @@ -979,18 +1027,22 @@ * Get number of invisible {@link Element} * * @return number of invisible elements + * @deprecated */ public int getInvisibleElementCount() { - return invisibleElementCount; + // return invisibleElementCount; + return 0; } /** * Get array of link target urls of invisible anchor {@link Element} * * @return array of link target urls of invisible anchor elements + * @deprecated */ public String[] getInvisibleLinkStrings() { - return invisibleLinkStrings; + // return invisibleLinkStrings; + return new String[0]; } /** @@ -1016,9 +1068,11 @@ * live DOM. (might be inaccessible without JavaScript) * * @return + * @deprecated */ public HashSet<String> getNotExistHrefSet() { - return notExistHrefSet; + // return notExistHrefSet; + return new HashSet<String>(); } /**
diff --git a/plugins/org.eclipse.actf.visualization.eval/src/org/eclipse/actf/visualization/eval/html/HtmlTagUtil.java b/plugins/org.eclipse.actf.visualization.eval/src/org/eclipse/actf/visualization/eval/html/HtmlTagUtil.java index ebad80c..ee9b10d 100644 --- a/plugins/org.eclipse.actf.visualization.eval/src/org/eclipse/actf/visualization/eval/html/HtmlTagUtil.java +++ b/plugins/org.eclipse.actf.visualization.eval/src/org/eclipse/actf/visualization/eval/html/HtmlTagUtil.java
@@ -11,10 +11,14 @@ package org.eclipse.actf.visualization.eval.html; +import java.util.ArrayList; import java.util.HashSet; +import java.util.List; import java.util.Set; import java.util.Stack; +import org.eclipse.actf.util.xpath.XPathServiceFactory; +import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -227,4 +231,16 @@ return (false); } + public static List<Element> getImgElementsFromMap(Document target, + Element map) { + List<Element> result = new ArrayList<Element>(); + String mapName = map.getAttribute("name"); + NodeList images = XPathServiceFactory.newService().evalPathForNodeList( + "//img[@usemap='#" + mapName + "']", target); + for (int i = 0; i < images.getLength(); i++) { + Element image = (Element) images.item(i); + result.add(image); + } + return result; + } }