You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2014/06/06 09:41:51 UTC

svn commit: r1600818 - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/context/ tobago-core/src/test/java/org/apache/myfaces/tobago/context/ tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/ tobago-example/tobago...

Author: lofwyr
Date: Fri Jun  6 07:41:50 2014
New Revision: 1600818

URL: http://svn.apache.org/r1600818
Log:
TOBAGO-1402: IE 11 detection
- PDF protection iframe size fixed (see TOBAGO-1401)
- also cleanup

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/UserAgent.java
    myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/context/UserAgentUnitTest.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-popup/popup.xhtml
    myfaces/tobago/trunk/tobago-extension/tobago-deprecation/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/RichTextEditorRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/style/tobago.css
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-in.js
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-popup.js
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/UserAgent.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/UserAgent.java?rev=1600818&r1=1600817&r2=1600818&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/UserAgent.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/UserAgent.java Fri Jun  6 07:41:50 2014
@@ -79,6 +79,10 @@ public final class UserAgent implements 
   public static final UserAgent MSIE_10_0 = new UserAgent(
       "msie", "10_0", EnumSet.of(Capability.CONTENT_TYPE_XHTML), CspHeader.X, CsproHeader.X);
 
+  // CSP is not fully supported, only sandboxing
+  public static final UserAgent MSIE_11_0 = new UserAgent(
+      "msie", "11_0", EnumSet.of(Capability.CONTENT_TYPE_XHTML), CspHeader.X, CsproHeader.X);
+
   /**
    * @deprecated no longer supported, since Tobago 1.5
    */
@@ -273,7 +277,7 @@ public final class UserAgent implements 
       return DEFAULT;
     }
 
-    if (header.contains("MSIE")) {
+    if (header.contains("MSIE") || header.contains("Trident")) {
       if (header.contains("MSIE 6.0")) {
         return MSIE_6_0;
       } else if (header.contains("MSIE 7.0")) {
@@ -288,6 +292,8 @@ public final class UserAgent implements 
         return MSIE_9_0;
       } else if (header.contains("MSIE 10.0")) {
         return MSIE_10_0;
+      } else if (header.contains("rv:11")) {
+        return MSIE_11_0;
       } else {
         return MSIE;
       }

Modified: myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/context/UserAgentUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/context/UserAgentUnitTest.java?rev=1600818&r1=1600817&r2=1600818&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/context/UserAgentUnitTest.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/context/UserAgentUnitTest.java Fri Jun  6 07:41:50 2014
@@ -90,6 +90,12 @@ public class UserAgentUnitTest {
             UserAgent.MSIE_7_0_COMPAT,
             "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.2; WOW64; Trident/6.0; .NET4.0E; .NET4.0C)"},
 
+        {"Internet Explorer 11 - Windows 7",
+            UserAgent.MSIE_11_0,
+            "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; SLCC2; " +
+                ".NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; " +
+                "rv:11.0) like Gecko"},
+
         {"Firefox 3.6 - Ubuntu 10.4",
             UserAgent.GECKO_1_9,
             "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2) Gecko/20100308 Ubuntu/10.04 (lucid) Firefox/3.6"},

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml?rev=1600818&r1=1600817&r2=1600818&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml Fri Jun  6 07:41:50 2014
@@ -40,7 +40,7 @@
 
   <resource-dir>tobago-resource</resource-dir>
 
-  <content-security-policy mode="on">
+  <content-security-policy mode="report-only">
     <directive>frame-src https://maps.google.com</directive>
   </content-security-policy>
 

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-popup/popup.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-popup/popup.xhtml?rev=1600818&r1=1600817&r2=1600818&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-popup/popup.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-popup/popup.xhtml Fri Jun  6 07:41:50 2014
@@ -26,7 +26,8 @@
 
   <tc:panel>
     <f:facet name="layout">
-      <tc:gridLayout rows="auto;auto;auto;auto;auto;auto;auto;*"/>
+      <tc:gridLayout rows="auto;auto;*"/>
+      <!--<tc:gridLayout rows="auto;auto;auto;auto;auto;auto;*"/>-->
     </f:facet>
     <f:facet name="menuBar">
       <tc:menuBar>
@@ -173,6 +174,7 @@
 
     </tc:panel>
 
+<!--
     <tx:in readonly="true" label="The Boolean" value="#{reference.bool}"/>
 
     <tx:in readonly="true" label="The Text" value="#{reference.text}"/>
@@ -181,7 +183,17 @@
 
     <tx:selectOneChoice label="Select"/>
 
+-->
+    <!--<tc:object src="/wm2014.png" />-->
+    <tc:object src="/wm2014.pdf" />
+    <!--<tc:object src="/invoice.pdf" />-->
+    <!--<tc:object src="http://localhost:8080/wm2014.pdf" />-->
+
+ <!--   <tc:textarea />
+-->
+<!--
     <tc:panel/>
+-->
 
   </tc:panel>
 </ui:composition>

Modified: myfaces/tobago/trunk/tobago-extension/tobago-deprecation/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/RichTextEditorRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-extension/tobago-deprecation/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/RichTextEditorRenderer.java?rev=1600818&r1=1600817&r2=1600818&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-extension/tobago-deprecation/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/RichTextEditorRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-extension/tobago-deprecation/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/RichTextEditorRenderer.java Fri Jun  6 07:41:50 2014
@@ -200,7 +200,6 @@ public class RichTextEditorRenderer exte
         facesContext, UICommand.COMPONENT_TYPE, RendererTypes.MENU_COMMAND);
     toolbar.getChildren().add(command);
     command.getAttributes().put(Attributes.IMAGE, "image/config.gif");
-    command.getAttributes().put(Attributes.ONCLICK, "Tobago.doEditorCommand(this);");
 
     return toolbar;
   }

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/style/tobago.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/style/tobago.css?rev=1600818&r1=1600817&r2=1600818&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/style/tobago.css (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/style/tobago.css Fri Jun  6 07:41:50 2014
@@ -75,9 +75,10 @@ fieldset.tobago-box {
 
 .tobago-popup-iebugfix {
   position: absolute;
+  margin: 0;
+  border-width: 0;
+  padding: 0;
   width: 100%;
   height: 100%;
-  top: -2px;
-  left: -2px;
   filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0);
 }

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-in.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-in.js?rev=1600818&r1=1600817&r2=1600818&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-in.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-in.js Fri Jun  6 07:41:50 2014
@@ -58,24 +58,6 @@ Tobago.In.prototype.setup = function() {
     ctrl = Tobago.element(this.id);
     Tobago.addBindEventListener(ctrl, 'change', this, 'checkMaxLength');
     Tobago.addBindEventListener(ctrl, 'keypress', this, 'checkMaxLength');
-    if (Tobago.browser.isMsie) {
-      Tobago.addBindEventListener(ctrl, 'paste', this, 'checkMaxLengthOnPaste');
-    }
-  }
-};
-
-// XXX IE only
-Tobago.In.prototype.checkMaxLengthOnPaste = function(event) {
-  if (!event) {
-    event = window.event;
-  }
-  var input = Tobago.element(event);
-  var pasteText = window.clipboardData.getData('Text');
-  var range = document.selection.createRange();
-  if (input.value.length - range.text.length + pasteText.length > this.maxLength) {
-    pasteText = pasteText.substring(0, this.maxLength - input.value.length + range.text.length);
-    range.text = pasteText;
-    event.returnValue = false;
   }
 };
 

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-popup.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-popup.js?rev=1600818&r1=1600817&r2=1600818&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-popup.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-popup.js Fri Jun  6 07:41:50 2014
@@ -116,7 +116,13 @@ Tobago.Popup.init = function (elements) 
   jQuery('.tobago-popup').each(function () {
     if (Tobago.browser.isMsie) {
       // IE needs an iframe to protect embedded PDF against shining through.
-      jQuery(this).prepend("<iframe class='tobago-popup-iebugfix' src='" + Tobago.blankPage + "' />");
+      var popup = jQuery(this);
+      popup.prepend("<iframe/>");
+      var iframe = popup.children().eq(0);
+      iframe.addClass("tobago-popup-iebugfix");
+      iframe.attr("src", Tobago.blankPage);
+//      iframe.width(popup.outerWidth(true));
+//      iframe.height(popup.outerHeight(true));
     }
   });
 

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=1600818&r1=1600817&r2=1600818&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Fri Jun  6 07:41:50 2014
@@ -114,6 +114,7 @@ var Tobago = {
     isMsie67: false,
     isMsie678: false,
     isMsie6789: false,
+    isMsie678910: false,
     isGecko: false,
     isWebkit: false
   },
@@ -523,7 +524,7 @@ var Tobago = {
             // console.debug("submit form with action: " + Tobago.action.value);
             Tobago.form.submit();
             if (Tobago.browser.isMsie) {
-              // without this "redundant" code the animation will not be animated in IE
+              // without this "redundant" code the animation will not be animated in IE (tested with 6,7,8,9,10,11)
               var image = jQuery(".tobago-page-overlayCenter img");
               image.appendTo(image.parent());
             }
@@ -1470,57 +1471,36 @@ var Tobago = {
 
   /**
    * Returns the absolute left, related to the body element, value for an HTML element.
+   * @deprecated since Tobago 2.0.0
    */
   getAbsoluteLeft: function(element) {
-    var left = 0;
-    var parent = false;
-    while (element && element.offsetParent) {
-      left += element.offsetLeft;
-      left -= element.scrollLeft;
-      if (parent && element.currentStyle) {  // IE only
-        left += element.currentStyle.borderLeftWidth.replace(/\D/g, '') - 0;
-      }
-      element = element.offsetParent;
-      parent = true;
-    }
-    return left;
+    console.error("getAbsoluteLeft() is no long functional!"); // @DEV_ONLY
+    return 0;
   },
 
   /**
    * Returns the scroll-x value of the body element.
+   * @deprecated since Tobago 2.0.0
    */
   getBrowserInnerLeft: function() {
-    var innerLeft;
-    if (Tobago.browser.isMsie) {
-      innerLeft = document.body.scrollLeft;
-    } else {
-      innerLeft = window.scrollX;
-    }
-    return innerLeft;
+    console.error("getBrowserInnerLeft() is no long functional!"); // @DEV_ONLY
+    return 0;
   },
 
   /**
    * Returns the scroll-y value of the body element.
+   * @deprecated since Tobago 2.0.0
    */
   getBrowserInnerTop: function() {
-    var innerTop;
-    if (Tobago.browser.isMsie) {
-      innerTop = document.body.scrollTop;
-    } else {
-      innerTop = window.scrollY;
-    }
-    return innerTop;
+    console.error("getBrowserInnerTop() is no long functional!"); // @DEV_ONLY
+    return 0;
   },
 
-  // TODO check if this is still ok
+  /**
+   *  @deprecated since Tobago 2.0.0
+   */
   doEditorCommand: function(element, id) {
-    console.debug('doEditorCommand()'); // @DEV_ONLY
-    var ta = this.element(id);
-    var selection = ta.value.substring(ta.selectionStart, ta.selectionEnd); // @DEV_ONLY
-    console.debug('text = ' + selection); // @DEV_ONLY
-    console.debug('start = ' + ta.selectionStart + ' end =' + ta.selectionEnd); // @DEV_ONLY
-    ta.selectionStart--;
-    ta.focus();
+    console.error("doEditorCommand() is no long functional!"); // @DEV_ONLY
   },
 
   /**
@@ -1576,16 +1556,9 @@ var Tobago = {
     // we need only an implementation in the IE6 file.
   },
 
+  /** @deprecated since Tobago 2.0.0 */
   replaceElement: function(item, newTag) {
-    if (typeof window.Range != 'undefined' && typeof Range.prototype.createContextualFragment == 'function') {
-      var range = document.createRange();
-      range.setStartBefore(item);
-      var fragment = range.createContextualFragment(newTag);
-      item.parentNode.replaceChild(fragment, item);
-    } else {
-      item.insertAdjacentHTML('beforeBegin', newTag);
-      item.parentNode.removeChild(item);
-    }
+    console.error("replaceElement() is no long functional!"); // @DEV_ONLY
   },
 
   parsePartialIds: function(ajaxComponentIds) {
@@ -1597,7 +1570,7 @@ var Tobago = {
 
   /** @deprecated since Tobago 1.5.7 and 2.0.0 */
   setDefaultAction: function(defaultActionId) {
-    console.warn("setDefaultAction is deprecated");
+    console.error("setDefaultAction() is no long functional!"); // @DEV_ONLY
   },
 
   isFunction: function(func) {
@@ -1605,14 +1578,15 @@ var Tobago = {
   },
 
   raiseEvent: function(eventType, element) {
+    var event;
     if (document.createEvent) {
-      var evt = document.createEvent('Events');
-      evt.initEvent(eventType, true, true);
-      element.dispatchEvent(evt);
+      event = document.createEvent('Events');
+      event.initEvent(eventType, true, true);
+      element.dispatchEvent(event);
     }
     else if (document.createEventObject) {
-      var evt = document.createEventObject();
-      element.fireEvent('on' + eventType, evt);
+      event = document.createEventObject();
+      element.fireEvent('on' + eventType, event);
     }
   },
 
@@ -1631,22 +1605,28 @@ var Tobago = {
 
   initBrowser: function() {
     var ua = navigator.userAgent;
-    if (ua.indexOf("MSIE") > -1) {
+    if (ua.indexOf("MSIE") > -1 || ua.indexOf("Trident") > -1) {
       Tobago.browser.isMsie = true;
       if (ua.indexOf("MSIE 6") > -1) {
         Tobago.browser.isMsie6 = true;
         Tobago.browser.isMsie67 = true;
         Tobago.browser.isMsie678 = true;
         Tobago.browser.isMsie6789 = true;
+        Tobago.browser.isMsie678910 = true;
       } else if (ua.indexOf("MSIE 7") > -1) {
         Tobago.browser.isMsie67 = true;
         Tobago.browser.isMsie678 = true;
         Tobago.browser.isMsie6789 = true;
+        Tobago.browser.isMsie678910 = true;
       } else if (ua.indexOf("MSIE 8") > -1) {
         Tobago.browser.isMsie678 = true;
         Tobago.browser.isMsie6789 = true;
+        Tobago.browser.isMsie678910 = true;
       } else if (ua.indexOf("MSIE 9") > -1) {
         Tobago.browser.isMsie6789 = true;
+        Tobago.browser.isMsie678910 = true;
+      } else if (ua.indexOf("MSIE 10") > -1) {
+        Tobago.browser.isMsie678910 = true;
       }
     } else if (ua.indexOf("AppleWebKit") > -1) {
       Tobago.browser.isWebkit = true;
@@ -1820,9 +1800,11 @@ Tobago.AcceleratorKey = function(func, k
       var aPrefix = '<a id=\"' + this.ieHelperElementId + '\" href=\"javascript:;\" tabindex=\"-1\" accesskey=\"';
       var aPostfix = '\" onclick=\"return false;\" ></a>';
       span.innerHTML = aPrefix + key.toLowerCase() + aPostfix;
-      span.firstChild.attachEvent('onfocus', function(event) {
-        func(event);
-      });
+      if (span.firstChild.addEventListener) { // this is DOM2
+        span.firstChild.addEventListener('focus', func, false);
+      } else { // old IE
+        span.firstChild.attachEvent('onfocus', func);
+      }
       Tobago.acceleratorKeys.set(this);
     } else {
       console.warn('Cannot observe key event for ' + modifier + '-' + key); // @DEV_ONLY