You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wave-commits@incubator.apache.org by wi...@apache.org on 2016/12/20 06:42:58 UTC

[1/3] incubator-wave git commit: Fix super dev launcher

Repository: incubator-wave
Updated Branches:
  refs/heads/master 835cc9e26 -> 3dc20d6ac


Fix super dev launcher


Project: http://git-wip-us.apache.org/repos/asf/incubator-wave/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-wave/commit/5d98dd1b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-wave/tree/5d98dd1b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-wave/diff/5d98dd1b

Branch: refs/heads/master
Commit: 5d98dd1bf88d2cf58d3b2d127f82a5afb69063bd
Parents: 835cc9e
Author: Pablo Ojanguren <pa...@gmail.com>
Authored: Tue Dec 6 11:35:59 2016 +0100
Committer: Pablo Ojanguren <pa...@gmail.com>
Committed: Tue Dec 6 11:35:59 2016 +0100

----------------------------------------------------------------------
 wave/build.gradle | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/5d98dd1b/wave/build.gradle
----------------------------------------------------------------------
diff --git a/wave/build.gradle b/wave/build.gradle
index 6dc56da..b84b303 100644
--- a/wave/build.gradle
+++ b/wave/build.gradle
@@ -409,7 +409,7 @@ task gwtDev {
     }
     doLast {
         javaexec {
-            main = "com.google.gwt.dev.DevMode"
+            main = "com.google.gwt.dev.codeserver.CodeServer"
             classpath {
                 [
                         sourceSets.main.java.srcDirs,
@@ -419,10 +419,11 @@ task gwtDev {
                 ]
             }
             args = [
-                    "-noserver",
                     "-bindAddress", "127.0.0.1",
-                    "-startupUrl", "http://localhost:9898",
+		    "-style", "PRETTY",
                     "-logLevel", "DEBUG",
+                    "-noprecompile",
+                    "-noincremental",
                     "org.waveprotocol.box.webclient.WebClientDev",
             ]
         }


[3/3] incubator-wave git commit: Fixes #197 dead accent characters at end of line

Posted by wi...@apache.org.
Fixes #197 dead accent characters at end of line 

Project: http://git-wip-us.apache.org/repos/asf/incubator-wave/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-wave/commit/3dc20d6a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-wave/tree/3dc20d6a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-wave/diff/3dc20d6a

Branch: refs/heads/master
Commit: 3dc20d6ac46e65be91002eb8db8dc1b3085405ce
Parents: 614d94b
Author: Pablo Ojanguren <pa...@gmail.com>
Authored: Fri Nov 4 18:08:19 2016 +0100
Committer: Pablo Ojanguren <pa...@gmail.com>
Committed: Tue Dec 6 12:24:28 2016 +0100

----------------------------------------------------------------------
 .../wave/client/common/util/FakeSignalEvent.java   |  7 +++++++
 .../wave/client/common/util/SignalEvent.java       |  6 +++++-
 .../wave/client/common/util/SignalEventImpl.java   | 17 +++++++++++++----
 .../client/editor/event/EditorEventHandler.java    |  7 ++++++-
 4 files changed, 31 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/3dc20d6a/wave/src/main/java/org/waveprotocol/wave/client/common/util/FakeSignalEvent.java
----------------------------------------------------------------------
diff --git a/wave/src/main/java/org/waveprotocol/wave/client/common/util/FakeSignalEvent.java b/wave/src/main/java/org/waveprotocol/wave/client/common/util/FakeSignalEvent.java
index 9dce0aa..a3c4b37 100644
--- a/wave/src/main/java/org/waveprotocol/wave/client/common/util/FakeSignalEvent.java
+++ b/wave/src/main/java/org/waveprotocol/wave/client/common/util/FakeSignalEvent.java
@@ -20,6 +20,7 @@
 package org.waveprotocol.wave.client.common.util;
 
 import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.EventTarget;
 
 import java.util.EnumSet;
 
@@ -93,6 +94,12 @@ public class FakeSignalEvent extends SignalEventImpl {
     public void stopPropagation() {
       propagationStopped = true;
     }
+
+    @Override
+    public EventTarget getEventTarget() {
+      // TODO Auto-generated method stub
+      return null;
+    }
   }
 
   public static FakeSignalEvent createKeyPress(

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/3dc20d6a/wave/src/main/java/org/waveprotocol/wave/client/common/util/SignalEvent.java
----------------------------------------------------------------------
diff --git a/wave/src/main/java/org/waveprotocol/wave/client/common/util/SignalEvent.java b/wave/src/main/java/org/waveprotocol/wave/client/common/util/SignalEvent.java
index 91dff61..67f6044 100644
--- a/wave/src/main/java/org/waveprotocol/wave/client/common/util/SignalEvent.java
+++ b/wave/src/main/java/org/waveprotocol/wave/client/common/util/SignalEvent.java
@@ -19,7 +19,6 @@
 
 package org.waveprotocol.wave.client.common.util;
 
-import com.google.gwt.core.client.GWT;
 import com.google.gwt.dom.client.Element;
 import com.google.gwt.dom.client.NativeEvent;
 import com.google.gwt.user.client.Event;
@@ -358,4 +357,9 @@ public interface SignalEvent {
    * See also {@link #stopPropagation()}.
    */
   public void preventDefault();
+
+  /**
+   * @return true if it is a DOMCharacterDataModified event
+   */
+  boolean isDOMCharacterEvent();
 }

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/3dc20d6a/wave/src/main/java/org/waveprotocol/wave/client/common/util/SignalEventImpl.java
----------------------------------------------------------------------
diff --git a/wave/src/main/java/org/waveprotocol/wave/client/common/util/SignalEventImpl.java b/wave/src/main/java/org/waveprotocol/wave/client/common/util/SignalEventImpl.java
index 1189ccd..005b842 100644
--- a/wave/src/main/java/org/waveprotocol/wave/client/common/util/SignalEventImpl.java
+++ b/wave/src/main/java/org/waveprotocol/wave/client/common/util/SignalEventImpl.java
@@ -20,6 +20,7 @@
 package org.waveprotocol.wave.client.common.util;
 
 import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.EventTarget;
 import com.google.gwt.user.client.Event;
 
 import org.waveprotocol.wave.client.common.util.SignalKeyLogic.OperatingSystem;
@@ -79,7 +80,8 @@ public class SignalEventImpl implements SignalEvent {
     boolean getAltKey();
     boolean getShiftKey();
     void preventDefault();
-    void stopPropagation();
+    void stopPropagation();    
+    EventTarget getEventTarget();    
   }
 
   /**
@@ -146,6 +148,8 @@ public class SignalEventImpl implements SignalEvent {
   private static final StringSet MOUSE_BUTTONLESS_EVENTS = CollectionUtils.createStringSet();
   private static final StringSet FOCUS_EVENTS = CollectionUtils.createStringSet();
   private static final StringSet CLIPBOARD_EVENTS = CollectionUtils.createStringSet();
+  
+  private static final String DOM_CHARDATAMOD_EVENT = "DOMCharacterDataModified";
 
   /**
    * Events affected by
@@ -321,7 +325,7 @@ public class SignalEventImpl implements SignalEvent {
   }-*/;
 
   public static native String getKeyIdentifier(Event event) /*-{
-    return event.keyIdentifier
+    return event.keyIdentifier;
   }-*/;
   
   public static native String getKey(Event event) /*-{
@@ -336,10 +340,10 @@ public class SignalEventImpl implements SignalEvent {
   }
 
   /**
-   * @return The target element of the event
+   * @return The target element of the event.
    */
   public Element getTarget() {
-    return asEvent().getTarget();
+    return Element.as(nativeEvent.getEventTarget());
   }
 
   /**
@@ -670,4 +674,9 @@ public class SignalEventImpl implements SignalEvent {
       nativeEvent.stopPropagation();
     }
   }
+  
+  @Override
+  public final boolean isDOMCharacterEvent() {
+    return DOM_CHARDATAMOD_EVENT.equalsIgnoreCase(nativeEvent.getType());
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/3dc20d6a/wave/src/main/java/org/waveprotocol/wave/client/editor/event/EditorEventHandler.java
----------------------------------------------------------------------
diff --git a/wave/src/main/java/org/waveprotocol/wave/client/editor/event/EditorEventHandler.java b/wave/src/main/java/org/waveprotocol/wave/client/editor/event/EditorEventHandler.java
index 05a0e51..f32a903 100644
--- a/wave/src/main/java/org/waveprotocol/wave/client/editor/event/EditorEventHandler.java
+++ b/wave/src/main/java/org/waveprotocol/wave/client/editor/event/EditorEventHandler.java
@@ -293,7 +293,12 @@ public final class EditorEventHandler {
     } else if (event.isMutationEvent()) {
       selectionAffinityMaybeChanged = false;
       if (!editorInteractor.isExpectingMutationEvents()) {
-        if (DomHelper.isTextNode(event.getTarget())) {
+         
+        // Don't trust in DomHelper.isTextNode(event.getTarget())
+        // to detect DOM mutations in text because target property
+        // is inconsistent among browsers {@DOMImplWebkit#eventGetTarget}
+        if (event.isDOMCharacterEvent()) {
+          
           cachedSelection = editorInteractor.getSelectionPoints();
           if (cachedSelection != null) {
             if (!cachedSelection.isCollapsed()) {


[2/3] incubator-wave git commit: Fixes Chromium 54 doesn't support KeyboardEvent.keyIdentifier

Posted by wi...@apache.org.
Fixes Chromium 54 doesn't support KeyboardEvent.keyIdentifier


Project: http://git-wip-us.apache.org/repos/asf/incubator-wave/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-wave/commit/614d94b8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-wave/tree/614d94b8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-wave/diff/614d94b8

Branch: refs/heads/master
Commit: 614d94b817df13a2a0ea75ddcc9094fde453d545
Parents: 5d98dd1
Author: Pablo Ojanguren <pa...@gmail.com>
Authored: Thu Nov 3 14:04:41 2016 +0100
Committer: Pablo Ojanguren <pa...@gmail.com>
Committed: Tue Dec 6 12:23:22 2016 +0100

----------------------------------------------------------------------
 .../client/common/util/SignalEventImpl.java     |   7 +-
 .../wave/client/common/util/SignalKeyLogic.java | 143 ++++++++++++-------
 2 files changed, 100 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/614d94b8/wave/src/main/java/org/waveprotocol/wave/client/common/util/SignalEventImpl.java
----------------------------------------------------------------------
diff --git a/wave/src/main/java/org/waveprotocol/wave/client/common/util/SignalEventImpl.java b/wave/src/main/java/org/waveprotocol/wave/client/common/util/SignalEventImpl.java
index 5d70221..1189ccd 100644
--- a/wave/src/main/java/org/waveprotocol/wave/client/common/util/SignalEventImpl.java
+++ b/wave/src/main/java/org/waveprotocol/wave/client/common/util/SignalEventImpl.java
@@ -269,9 +269,10 @@ public class SignalEventImpl implements SignalEvent {
       keySignalResult = computeKeySignalTypeResult;
 
       String keyIdentifier = getKeyIdentifier(event);
+      String key = getKey(event);
 
       logic.computeKeySignalType(keySignalResult,
-          event.getType(), getNativeKeyCode(event), getWhich(event), keyIdentifier,
+          event.getType(), getNativeKeyCode(event), getWhich(event), keyIdentifier, key,
           event.getMetaKey(), event.getCtrlKey(), event.getAltKey(), event.getShiftKey());
 
     } else {
@@ -322,6 +323,10 @@ public class SignalEventImpl implements SignalEvent {
   public static native String getKeyIdentifier(Event event) /*-{
     return event.keyIdentifier
   }-*/;
+  
+  public static native String getKey(Event event) /*-{
+    return event.key;
+  }-*/;
 
   /**
    * @return Event type as a string, e.g. "keypress"

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/614d94b8/wave/src/main/java/org/waveprotocol/wave/client/common/util/SignalKeyLogic.java
----------------------------------------------------------------------
diff --git a/wave/src/main/java/org/waveprotocol/wave/client/common/util/SignalKeyLogic.java b/wave/src/main/java/org/waveprotocol/wave/client/common/util/SignalKeyLogic.java
index 5da169a..9b8fb09 100644
--- a/wave/src/main/java/org/waveprotocol/wave/client/common/util/SignalKeyLogic.java
+++ b/wave/src/main/java/org/waveprotocol/wave/client/common/util/SignalKeyLogic.java
@@ -24,6 +24,7 @@ import com.google.gwt.event.dom.client.KeyCodes;
 import com.google.gwt.user.client.Event;
 
 import org.waveprotocol.wave.client.common.util.SignalEvent.KeySignalType;
+import org.waveprotocol.wave.client.editor.EditorStaticDeps;
 import org.waveprotocol.wave.model.util.CollectionUtils;
 import org.waveprotocol.wave.model.util.ReadableStringMap.ProcV;
 import org.waveprotocol.wave.model.util.StringMap;
@@ -71,6 +72,39 @@ public final class SignalKeyLogic {
       }
     });
   }
+  
+  /**
+   * KeyboardEvent.key values for navigation
+   * See https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values
+   */
+  private static final Set<String> NAVIGATION_KEY_VALUES = new HashSet<String>();
+  static {
+    NAVIGATION_KEY_VALUES.add("ArrowDown");
+    NAVIGATION_KEY_VALUES.add("ArrowLeft");
+    NAVIGATION_KEY_VALUES.add("ArrowRight");
+    NAVIGATION_KEY_VALUES.add("ArrowUp");
+    NAVIGATION_KEY_VALUES.add("End");
+    NAVIGATION_KEY_VALUES.add("Home");
+    NAVIGATION_KEY_VALUES.add("PageDown");
+    NAVIGATION_KEY_VALUES.add("PageUp");
+  }
+  
+  /**
+   * KeyboardEvent.key values for deletion
+   * See https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values
+   */
+  private static final Set<String> DELETE_KEY_VALUES = new HashSet<String>();
+  static {
+    DELETE_KEY_VALUES.add("Backspace");
+    DELETE_KEY_VALUES.add("Delete");
+  }
+  
+  /**
+   * KeyboardEvent.key special values we consider input
+   * See https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values
+   */
+  private static final String TAB_KEY_VALUE = "Tab";
+
 
   public enum UserAgentType {
     WEBKIT,
@@ -115,10 +149,12 @@ public final class SignalKeyLogic {
     return commandIsCtrl;
   }
 
+  
+  
   public void computeKeySignalType(
       Result result,
       String typeName,
-      int keyCode, int which, String keyIdentifier,
+      int keyCode, int which, String keyIdentifier, String key, 
       boolean metaKey, boolean ctrlKey, boolean altKey, boolean shiftKey) {
 
     boolean ret = true;
@@ -143,48 +179,31 @@ public final class SignalKeyLogic {
       computedKeyCode = KeyCodes.KEY_ENTER;
     }
 
+    // Some trace logging very useful to debug
+    EditorStaticDeps.logger.trace().log(
+        "KEY SIGNAL IN PROCESS identifier/key = " + (keyIdentifier == null ? key : "?") + " code = " + computedKeyCode
+            + " type = "
+            + (typeInt == Event.ONKEYDOWN ? "KeyDown" : "KeyPress") + (ctrlKey ? " CTRL" : "")
+            + (shiftKey ? " SHIFT" : "") + (altKey ? " ALT" : ""));
+
     // For non-firefox browsers, we only get keydown events for IME, no keypress
     boolean isIME = computedKeyCode == IME_CODE;
 
     boolean commandKey = commandIsCtrl ? ctrlKey : metaKey;
 
+
     switch (userAgent) {
       case WEBKIT:
-        // This is a bit tricky because there are significant differences
-        // between safari 3.0 and safari 3.1...
-
-        // We could probably actually almost use the same code that we use for IE
-        // for safari 3.1, because with 3.1 the webkit folks made a big shift to
-        // get the events to be in line with IE for compatibility. 3.0 events
-        // are a lot more similar to FF, but different enough to need special
-        // handling. However, it seems that using more advanced features like
-        // keyIdentifier for safaris is probably better and more future-proof,
-        // as well as being compatible between the two, so for now we're not
-        // using IE logic for safari 3.1
-
-        // Weird special large keycode numbers for safari 3.0, where it gives
-        // us keypress events (though they happen after the dom is changed,
-        // for some things like delete. So not too useful). The number
-        // 63200 is known as the cutoff mark.
-        if (typeInt == Event.ONKEYDOWN && computedKeyCode > 63200) {
-          result.type = null;
-          return;
-        } else if (typeInt == Event.ONKEYPRESS) {
-          // Skip keypress for tab and escape, because they are the only non-input keys
-          // that don't have keycodes above 63200. This is to prevent them from being treated
-          // as INPUT in the || = keypress below. See (X) below
-          if (computedKeyCode == KeyCodes.KEY_ESCAPE
-              || computedKeyCode == KeyCodes.KEY_TAB) {
-            result.type = null;
-            return;
-          }
-        }
-
         // boolean isPossiblyCtrlInput = typeInt == Event.ONKEYDOWN && ret.getCtrlKey();
         boolean isActuallyCtrlInput = false;
 
+        // Keep this for older Webkit versions (Chrome < v54) where normal typing
+        // is detected with keyIdentifier containing U+ prefix 
         boolean startsWithUPlus = keyIdentifier != null && keyIdentifier.startsWith("U+");
-
+        
+        // Mix older way to detect normal typing (keyIdentifier) with new one (key)
+        boolean normalTypingKeydown = startsWithUPlus || (key != null && !"undefined".equals(key) && !metaKey && !ctrlKey && !altKey);
+        
         // Need to use identifier for the delete key because the keycode conflicts
         // with the keycode for the full stop.
         if (isIME) {
@@ -192,26 +211,52 @@ public final class SignalKeyLogic {
           // but those are basically useless as the event is basically still an IME input
           // event (e.g. keyIdentifier might say "Up", but it's certainly not navigation,
           // it's just the user selecting from the IME dialog).
-          type = KeySignalType.INPUT;
-        } else if (DELETE_KEY_IDENTIFIER.equals(keyIdentifier) ||
-            computedKeyCode == KeyCodes.KEY_BACKSPACE) {
-
+          type = KeySignalType.INPUT;         
+        } else if (computedKeyCode == KeyCodes.KEY_BACKSPACE) {
+          type = KeySignalType.DELETE;  
+          
+        } else if (keyIdentifier != null && DELETE_KEY_IDENTIFIER.equals(keyIdentifier) && typeInt == Event.ONKEYDOWN) {           
+          // WAVE-407 Avoid missing the '.' char (KEYPRESS + CODE 46)
+          // ensuring it's a KEYDOWN event with a DELETE_KEY_IDENTIFIER
           type = KeySignalType.DELETE;
-        } else if (NAVIGATION_KEY_IDENTIFIERS.containsKey(keyIdentifier)) {
+         
+        } else if (keyIdentifier != null && NAVIGATION_KEY_IDENTIFIERS.containsKey(keyIdentifier) && typeInt == Event.ONKEYDOWN) {
+          // WAVE-407 Avoid missing chars with NAVIGATION_KEY_IDENTIFIERS but
+          // represeting a SHIFT + key char (! " � ...). Navigation events come
+          // with KEYDOWN, not with KEYPRESS
           type = KeySignalType.NAVIGATION;
-        // Escape, backspace and context-menu-key (U+0010) are, to my knowledge,
-        // the only non-navigation keys that
-        // have a "U+..." keyIdentifier, so we handle them explicitly.
-        // (Backspace was handled earlier).
-        } else if (computedKeyCode == KeyCodes.KEY_ESCAPE || "U+0010".equals(keyIdentifier)) {
+                    
+        } else if (key != null && NAVIGATION_KEY_VALUES.contains(key) && typeInt == Event.ONKEYDOWN) {        
+          // Starting chrome v54 KeyboardEvent.keyIdentifier is replaced by KeyboardEvent.key
+          type = KeySignalType.NAVIGATION;
+
+        } else if (key != null && DELETE_KEY_VALUES.contains(key) && typeInt == Event.ONKEYDOWN) {          
+          // Starting chrome v54 KeyboardEvent.keyIdentifier is replaced by KeyboardEvent.key
+          type = KeySignalType.DELETE;
+
+        } else if (computedKeyCode == KeyCodes.KEY_ESCAPE || "U+0010".equals(keyIdentifier)) {          
+          // Escape, backspace and context-menu-key (U+0010) are, to my knowledge,
+          // the only non-navigation keys that
+          // have a "U+..." keyIdentifier, so we handle them explicitly.
+          // (Backspace was handled earlier).
           type = KeySignalType.NOEFFECT;
-        } else if (
-            computedKeyCode < 63200 && // if it's not a safari 3.0 non-input key (See (X) above)
-            (typeInt == Event.ONKEYPRESS ||  // if it's a regular keypress
-                  startsWithUPlus || computedKeyCode == KeyCodes.KEY_ENTER)) {
+          
+        } else if (key != null && TAB_KEY_VALUE.equals(key) && typeInt == Event.ONKEYDOWN) {     
+          // ** EXPERIMENTAL ** 
+          // use tabs as input
+          // Starting chrome v54 KeyboardEvent.keyIdentifier is replaced by KeyboardEvent.key
+          type = KeySignalType.INPUT;
+
+        } else if (computedKeyCode == KeyCodes.KEY_TAB) {
+          // ** EXPERIMENTAL ** 
+          // use tabs as input          
+          type = KeySignalType.INPUT;
+          
+        } else if (typeInt == Event.ONKEYPRESS ||  // if it's a regular keypress        
+                  normalTypingKeydown || 
+                  computedKeyCode == KeyCodes.KEY_ENTER) {
           type = KeySignalType.INPUT;
-          isActuallyCtrlInput = ctrlKey
-              || (commandComboDoesntGiveKeypress && commandKey);
+          isActuallyCtrlInput = ctrlKey || (commandComboDoesntGiveKeypress && commandKey);
         } else {
           type = KeySignalType.NOEFFECT;
         }
@@ -224,7 +269,7 @@ public final class SignalKeyLogic {
           }
           // HACK(danilatos): Don't actually nullify isActuallyCtrlInput for key press.
           // We get that for AltGr combos on non-mac computers.
-        } else if (isIME || keyCode == KeyCodes.KEY_TAB) {
+        } else if (isIME || computedKeyCode == KeyCodes.KEY_TAB) {
           ret = typeInt == Event.ONKEYDOWN;
         } else {
           ret = maybeNullWebkitIE(ret, typeInt, type);