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 15:56:59 UTC

svn commit: r1600890 - in /myfaces/tobago/branches/tobago-3.0.x: ./ tobago-core/src/main/java/org/apache/myfaces/tobago/context/ tobago-core/src/test/java/org/apache/myfaces/tobago/context/ tobago-theme/tobago-theme-scarborough/src/main/resources/org/a...

Author: lofwyr
Date: Fri Jun  6 13:56:58 2014
New Revision: 1600890

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

Modified:
    myfaces/tobago/branches/tobago-3.0.x/   (props changed)
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/context/UserAgent.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/context/UserAgentUnitTest.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/style/tobago.css
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-in.js
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-popup.js
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js   (contents, props changed)

Propchange: myfaces/tobago/branches/tobago-3.0.x/
------------------------------------------------------------------------------
  Merged /myfaces/tobago/trunk:r1600818

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/context/UserAgent.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/context/UserAgent.java?rev=1600890&r1=1600889&r2=1600890&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/context/UserAgent.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/context/UserAgent.java Fri Jun  6 13:56:58 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
    */
@@ -277,7 +281,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")) {
@@ -292,6 +296,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/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/context/UserAgentUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/context/UserAgentUnitTest.java?rev=1600890&r1=1600889&r2=1600890&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/context/UserAgentUnitTest.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/context/UserAgentUnitTest.java Fri Jun  6 13:56:58 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/branches/tobago-3.0.x/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/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/style/tobago.css?rev=1600890&r1=1600889&r2=1600890&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/style/tobago.css (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/msie/style/tobago.css Fri Jun  6 13:56:58 2014
@@ -49,3 +49,12 @@ fieldset.tobago-box {
 .tobago-popup-shield {
   filter: alpha( opacity = 40 );
 }
+
+.tobago-popup-iebugfix {
+  position: absolute;
+  width: 100%;
+  height: 100%;
+  top: -2px;
+  left: -2px;
+  filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0);
+}

Modified: myfaces/tobago/branches/tobago-3.0.x/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/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-in.js?rev=1600890&r1=1600889&r2=1600890&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-in.js (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-in.js Fri Jun  6 13:56:58 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/branches/tobago-3.0.x/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/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-popup.js?rev=1600890&r1=1600889&r2=1600890&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-popup.js (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-popup.js Fri Jun  6 13:56:58 2014
@@ -111,6 +111,21 @@ Tobago.Popup.init = function (elements) 
           doc.bind("mouseup", Tobago.Popup.mouseup);
         });
   }
+
+  // Fix for TOBAGO-1401 popup is overlayed by PDF in IE
+  jQuery('.tobago-popup').each(function () {
+    if (Tobago.browser.isMsie) {
+      // IE needs an iframe to protect embedded PDF against shining through.
+      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));
+    }
+  });
+
 };
 
 Tobago.Popup.getDisabledElements = function(popupId) {

Modified: myfaces/tobago/branches/tobago-3.0.x/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/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=1600890&r1=1600889&r2=1600890&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Fri Jun  6 13:56:58 2014
@@ -114,6 +114,7 @@ var Tobago = {
     isMsie67: false,
     isMsie678: false,
     isMsie6789: false,
+    isMsie678910: false,
     isGecko: false,
     isWebkit: false
   },
@@ -522,7 +523,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());
             }
@@ -1453,57 +1454,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
   },
 
   /**
@@ -1559,16 +1539,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) {
@@ -1580,7 +1553,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) {
@@ -1588,14 +1561,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);
     }
   },
 
@@ -1614,22 +1588,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;
@@ -1803,9 +1783,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

Propchange: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
------------------------------------------------------------------------------
  Merged /myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js:r1600818