[jbosstools-commits] JBoss Tools SVN: r13083 - in trunk/vpe: tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/core and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Jan 16 10:44:03 EST 2009


Author: mareshkau
Date: 2009-01-16 10:44:03 -0500 (Fri, 16 Jan 2009)
New Revision: 13083

Modified:
   trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlImgTemplate.java
   trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/core/img.html
   trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/core/img.html.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-3465

Modified: trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlImgTemplate.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlImgTemplate.java	2009-01-16 15:31:00 UTC (rev 13082)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlImgTemplate.java	2009-01-16 15:44:03 UTC (rev 13083)
@@ -37,7 +37,6 @@
 		boolean jsfc = false;
 		 
 		nsIDOMElement img = visualDocument.createElement(HTML.TAG_IMG);
-
 		/*
 		 * Copy all attributes from source node to "img" tag except for "src", 
 		 * store "alt" attribute state, check if facelets "jsfc" attribute presents.
@@ -52,15 +51,6 @@
 				jsfc = true;
 				continue;
 			}
-			
-			if (HTML.ATTR_ALT.equalsIgnoreCase(name)) {
-				if ((null == value)
-						|| ((null != value) && (value.trim()
-								.equalsIgnoreCase(VpeStyleUtil.EMPTY_STRING)))) {
-					showUnresolvedImage = true;
-					continue;
-				}
-			}
 			try{
 				img.setAttribute(name, value);
 			}catch(XPCOMException ex ) {
@@ -68,32 +58,28 @@
 			}
 		}
 		
-		/*
-		 * Add "src" attribute in consideration of "alt" and "jsfc" attributes
-		 */
-		for (int i = 0; i < sourceNode.getAttributes().getLength(); i++) {
-			String name = sourceNode.getAttributes().item(i).getNodeName();
-			String value = sourceNode.getAttributes().item(i).getNodeValue();
-			if (!jsfc && (HTML.ATTR_SRC.equalsIgnoreCase(name))) {
-				value = VpeStyleUtil.addFullPathToImgSrc(value, pageContext,
+
+			Element  image = (Element) sourceNode;
+		
+			if (!jsfc && image.hasAttribute(HTML.ATTR_SRC)) {
+				String src = VpeStyleUtil.addFullPathToImgSrc(image.getAttribute(HTML.ATTR_SRC), pageContext,
 						showUnresolvedImage);
 				try {
-					img.setAttribute(HTML.ATTR_SRC, value);
+					img.setAttribute(HTML.ATTR_SRC, src);
 				} catch (XPCOMException ex) {
 					// just ignore it
 				}
-			} else if ((jsfc) && (HTML.ATTR_VALUE.equalsIgnoreCase(name))) {
+			} else if ((jsfc) && image.hasAttribute(HTML.ATTR_VALUE)) {
 				/*
 				 * in this case the tag is a facelets's tag
 				 */
-				value = VpeStyleUtil.addFullPathToImgSrc(value, pageContext,
+				String value = VpeStyleUtil.addFullPathToImgSrc(image.getAttribute(HTML.ATTR_VALUE), pageContext,
 						showUnresolvedImage);
 				try {
 					img.setAttribute(HTML.ATTR_SRC, value);
 				} catch (XPCOMException ex) {
 					// just ignore it
 				}
-			}
 		}
 		
 		
@@ -102,11 +88,4 @@
 		return creationData;
 	}
 
-	@Override
-	public boolean isRecreateAtAttrChange(VpePageContext pageContext,
-			Element sourceElement, nsIDOMDocument visualDocument,
-			nsIDOMElement visualNode, Object data, String name, String value) {
-		return true;
-	}
-
 }

Modified: trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/core/img.html
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/core/img.html	2009-01-16 15:31:00 UTC (rev 13082)
+++ trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/core/img.html	2009-01-16 15:44:03 UTC (rev 13083)
@@ -4,8 +4,10 @@
 <body>
 
 <h1>img</h1>
-
+<div id="img">
 <img alt="img" src="img/image.jpeg" id="img" align="top" class="imgClass" border="10" dir="ltr" height="100" hspace="20" ismap="ismap" style="color:red;" vspace="10" width="100" >
-
+<!-- Test for JBIDE-3465 -->
+<IMG alt="" src="http://www.google.com.by/logos/holiday08_4.gif" />
+</div>
 </body>
 </html>
\ No newline at end of file

Modified: trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/core/img.html.xml
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/core/img.html.xml	2009-01-16 15:31:00 UTC (rev 13082)
+++ trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/core/img.html.xml	2009-01-16 15:44:03 UTC (rev 13083)
@@ -1,6 +1,11 @@
 <tests>
 	<test id="img">
-		<IMG WIDTH="100" VSPACE="10" HSPACE="20" HEIGHT="100" BORDER="10" ALIGN="top" ALT="img" ID="img" CLASS="imgClass" DIR="ltr" ISMAP="ismap" STYLE="color: red;" SRC="/.*htmlTest/WebContent/pages/components/core/img/image.jpeg/"/>
+		<DIV ID="img" STYLE="-moz-user-modify: read-write;" >
+<IMG WIDTH="100" VSPACE="10" HSPACE="20" HEIGHT="100" BORDER="10" ALIGN="top" ALT="img" ID="img" CLASS="imgClass" ISMAP="ismap" STYLE="color: red;" SRC="/.*htmlTest/WebContent/pages/components/core/img/image.jpeg/"/>
 
+<!-- Test for JBIDE-3465 -->
+<IMG ALT="" SRC="http://www.google.com.by/logos/holiday08_4.gif"/>
+
+</DIV>
 	</test>
-</tests>
\ No newline at end of file
+</tests>




More information about the jbosstools-commits mailing list