Author: [email protected]
Date: Thu Jul 16 17:54:03 2009
New Revision: 5751

Removed:
     
trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplOldMozilla.java
Modified:
    trunk/user/src/com/google/gwt/user/RichText.gwt.xml
     
trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplIE6.java
     
trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplMozilla.java
     
trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplOpera.java
     
trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplSafari.java
     
trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplStandard.java
    trunk/user/test/com/google/gwt/user/client/ui/RichTextAreaTest.java

Log:
Rolling back c5747 and c5742 due to broken build

Modified: trunk/user/src/com/google/gwt/user/RichText.gwt.xml
==============================================================================
--- trunk/user/src/com/google/gwt/user/RichText.gwt.xml (original)
+++ trunk/user/src/com/google/gwt/user/RichText.gwt.xml Thu Jul 16 17:54:03  
2009
@@ -34,15 +34,10 @@
      class="com.google.gwt.user.client.ui.impl.RichTextAreaImplMozilla">
      <when-type-is
        class="com.google.gwt.user.client.ui.impl.RichTextAreaImpl" />
-    <when-property-is name="user.agent" value="gecko1_8" />
-  </replace-with>
-
-  <!-- Old Mozilla-specific implementation -->
-  <replace-with
-    class="com.google.gwt.user.client.ui.impl.RichTextAreaImplOldMozilla">
-    <when-type-is
-      class="com.google.gwt.user.client.ui.impl.RichTextAreaImpl" />
-    <when-property-is name="user.agent" value="gecko" />
+    <any>
+      <when-property-is name="user.agent" value="gecko1_8" />
+      <when-property-is name="user.agent" value="gecko" />
+    </any>
    </replace-with>

    <!-- Safari-specific implementation -->

Modified:  
trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplIE6.java
==============================================================================
---  
trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplIE6.java      
 
(original)
+++  
trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplIE6.java      
 
Thu Jul 16 17:54:03 2009
@@ -33,7 +33,7 @@
    @Override
    public native void initElement() /*-{
      var _this = this;
-     
_th...@com.google.gwt.user.client.ui.impl.richtextareaimplstandard::onElementInitializing()();
+     
_th...@com.google.gwt.user.client.ui.impl.richtextareaimplstandard::initializing
  
= true;

      setTimeout(function() {
        if  
(_th...@com.google.gwt.user.client.ui.impl.richtextareaimplstandard::initializing
  
== false) {
@@ -96,7 +96,7 @@
          // Weird: this code has the context of the script frame, but we  
need the
          // event from the edit iframe's window.
          var evt = elem.contentWindow.event;
-         
@com.google.gwt.user.client.DOM::dispatchEvent(Lcom/google/gwt/user/client/Event;Lcom/google/gwt/user/client/Element;Lcom/google/gwt/user/client/EventListener;)(evt,
  
elem, elem.__listener);
+         
[email protected]::onBrowserEvent(Lcom/google/gwt/user/client/Event;)(evt);
        }
      };


Modified:  
trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplMozilla.java
==============================================================================
---  
trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplMozilla.java  
 
(original)
+++  
trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplMozilla.java  
 
Thu Jul 16 17:54:03 2009
@@ -20,26 +20,22 @@
   */
  public class RichTextAreaImplMozilla extends RichTextAreaImplStandard {

-  /**
-   * Indicates that the RichTextArea has never received focus after
-   * initialization.
-   */
-  boolean isFirstFocus;
-
    @Override
    public native void initElement() /*-{
      // Mozilla doesn't allow designMode to be set reliably until the  
iframe is
      // fully loaded.
      var _this = this;
      var iframe =  
[email protected]::elem;
-     
_th...@com.google.gwt.user.client.ui.impl.richtextareaimplstandard::onElementInitializing()();
-     
_th...@com.google.gwt.user.client.ui.impl.richtextareaimplmozilla::isFirstFocus 
 
= true;
+     
_th...@com.google.gwt.user.client.ui.impl.richtextareaimplstandard::initializing
  
= true;

      iframe.onload = function() {
        // Some Mozillae have the nasty habit of calling onload again when  
you set
        // designMode, so let's avoid doing it more than once.
        iframe.onload = null;

+      // Send notification that the iframe has finished loading.
+       
_th...@com.google.gwt.user.client.ui.impl.richtextareaimplstandard::onElementInitialized()();
+
        // Don't set designMode until the RTA is targeted by an event. This  
is
        // necessary because editing won't work on Mozilla if the iframe is
        // *hidden, but attached*. Waiting for an event gets around this  
issue.
@@ -51,16 +47,17 @@
          iframe.contentWindow.onmouseover = null;
          iframe.contentWindow.document.designMode = 'On';
        };
-
+
        // Issue 1441: we also need to catch the onmouseover event because  
focus
        // occurs after mouse down, so the cursor will not appear until the  
user
        // clicks twice, making the RichTextArea look uneditable. Catching  
the
        // mouseover event allows us to set design mode earlier. The focus  
event
        // is still needed to handle tab selection.
-      iframe.contentWindow.onmouseover = iframe.contentWindow.onfocus;
-
-      // Send notification that the iframe has finished loading.
-       
_th...@com.google.gwt.user.client.ui.impl.richtextareaimplstandard::onElementInitialized()();
+      iframe.contentWindow.onmouseover = function() {
+        iframe.contentWindow.onfocus = null;
+        iframe.contentWindow.onmouseover = null;
+        iframe.contentWindow.document.designMode = 'On';
+      };
      };
    }-*/;

@@ -69,33 +66,5 @@
      // Gecko uses 'BackColor' for the *entire area's*  
background. 'HiliteColor'
      // does what we actually want.
      execCommand("HiliteColor", color);
-  }
-
-  /**
-   * Firefox will not display the caret the first time a RichTextArea is
-   * programmatically focused, so we need to focus, blur, and refocus the
-   * RichTextArea. This only needs to be done the first time after the
-   * RichTextArea is initialized. See issue 3503.
-   */
-  protected native void setFirstFocusImpl() /*-{
-    var elem =  
[email protected]::elem;
-    var wnd = elem.contentWindow;
-    wnd.removeEventListener('focus', elem.__gwt_focusHandler, true);
-    wnd.removeEventListener('blur', elem.__gwt_blurHandler, true);
-    wnd.focus();
-    wnd.blur();
-    wnd.addEventListener('focus', elem.__gwt_focusHandler, true);
-    wnd.addEventListener('blur', elem.__gwt_blurHandler, true);
-    wnd.focus();
-  }-*/;
-
-  @Override
-  protected void setFocusImpl(boolean focused) {
-    if (isFirstFocus) {
-      isFirstFocus = false;
-      setFirstFocusImpl();
-    } else {
-      super.setFocusImpl(focused);
-    }
    }
  }

Modified:  
trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplOpera.java
==============================================================================
---  
trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplOpera.java    
 
(original)
+++  
trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplOpera.java    
 
Thu Jul 16 17:54:03 2009
@@ -28,7 +28,7 @@
    }

    @Override
-  protected native void setFocusImpl(boolean focused) /*-{
+  public native void setFocus(boolean focused) /*-{
      // Opera needs the *iframe* focused, not its window.
      if (focused) {
         
[email protected]::elem.focus();

Modified:  
trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplSafari.java
==============================================================================
---  
trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplSafari.java   
 
(original)
+++  
trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplSafari.java   
 
Thu Jul 16 17:54:03 2009
@@ -39,7 +39,7 @@

      elem.__gwt_handler = function(evt) {
        if (elem.__listener) {
-         
@com.google.gwt.user.client.DOM::dispatchEvent(Lcom/google/gwt/user/client/Event;Lcom/google/gwt/user/client/Element;Lcom/google/gwt/user/client/EventListener;)(evt,
  
elem, elem.__listener);
+         
[email protected]::onBrowserEvent(Lcom/google/gwt/user/client/Event;)(evt);
        }
      };

@@ -57,15 +57,15 @@
      // doesn't work on the iframe element (at least not for focus/blur).  
Don't
      // dispatch through the normal handler method, as some of the querying  
we do
      // there interferes with focus.
-    wnd.onfocus = function(evt) {
+    elem.onfocus = function(evt) {
        if (elem.__listener) {
-         
@com.google.gwt.user.client.DOM::dispatchEvent(Lcom/google/gwt/user/client/Event;Lcom/google/gwt/user/client/Element;Lcom/google/gwt/user/client/EventListener;)(evt,
  
elem, elem.__listener);
+         
[email protected]::onBrowserEvent(Lcom/google/gwt/user/client/Event;)(evt);
        }
      };

-    wnd.onblur = function(evt) {
+    elem.onblur = function(evt) {
        if (elem.__listener) {
-         
@com.google.gwt.user.client.DOM::dispatchEvent(Lcom/google/gwt/user/client/Event;Lcom/google/gwt/user/client/Element;Lcom/google/gwt/user/client/EventListener;)(evt,
  
elem, elem.__listener);
+         
[email protected]::onBrowserEvent(Lcom/google/gwt/user/client/Event;)(evt);
        }
      };
    }-*/;

Modified:  
trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplStandard.java
==============================================================================
---  
trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplStandard.java 
 
(original)
+++  
trunk/user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplStandard.java 
 
Thu Jul 16 17:54:03 2009
@@ -52,11 +52,6 @@
    protected boolean initializing;

    /**
-   * Indicates that the text area should be focused as soon as it is  
loaded.
-   */
-  private boolean isPendingFocus;
-
-  /**
     * True when the element has been attached.
     */
    private boolean isReady;
@@ -94,7 +89,7 @@
      // the iframe becomes attached to the DOM. Any non-zero timeout will do
      // just fine.
      var _this = this;
-     
_th...@com.google.gwt.user.client.ui.impl.richtextareaimplstandard::onElementInitializing()();
+     
_th...@com.google.gwt.user.client.ui.impl.richtextareaimplstandard::initializing
  
= true;
      setTimeout(function() {
        // Turn on design mode.
         
[email protected]::elem.contentWindow.document.designMode
  
= 'On';
@@ -177,15 +172,13 @@
    }

    @Override
-  public void setFocus(boolean focused) {
-    if (initializing) {
-      // Issue 3503: if we focus before the iframe is in design mode, the  
text
-      // caret will not appear.
-      isPendingFocus = focused;
+  public native void setFocus(boolean focused) /*-{
+    if (focused) {
+       
[email protected]::elem.contentWindow.focus();
      } else {
-      setFocusImpl(focused);
-    }
-  }
+       
[email protected]::elem.contentWindow.blur();
+    }
+  }-*/;

    public void setFontName(String name) {
      execCommand("FontName", name);
@@ -295,7 +288,7 @@

      elem.__gwt_handler = function(evt) {
        if (elem.__listener) {
-         
@com.google.gwt.user.client.DOM::dispatchEvent(Lcom/google/gwt/user/client/Event;Lcom/google/gwt/user/client/Element;Lcom/google/gwt/user/client/EventListener;)(evt,
  
elem, elem.__listener);
+         
[email protected]::onBrowserEvent(Lcom/google/gwt/user/client/Event;)(evt);
        }
      };

@@ -348,26 +341,7 @@
        setHTMLImpl(DOM.getInnerHTML(beforeInitPlaceholder));
        beforeInitPlaceholder = null;
      }
-
-    // Focus on the element now that it is initialized
-    if (isPendingFocus) {
-      isPendingFocus = false;
-      setFocus(true);
-    }
-  }
-
-  protected void onElementInitializing() {
-    initializing = true;
-    isPendingFocus = false;
    }
-
-  protected native void setFocusImpl(boolean focused) /*-{
-    if (focused) {
-       
[email protected]::elem.contentWindow.focus();
-    } else {
-       
[email protected]::elem.contentWindow.blur();
-    }
-  }-*/;

    protected native void setHTMLImpl(String html) /*-{
       
[email protected]::elem.contentWindow.document.body.innerHTML
  
= html;

Modified:  
trunk/user/test/com/google/gwt/user/client/ui/RichTextAreaTest.java
==============================================================================
--- trunk/user/test/com/google/gwt/user/client/ui/RichTextAreaTest.java  
(original)
+++ trunk/user/test/com/google/gwt/user/client/ui/RichTextAreaTest.java Thu  
Jul 16 17:54:03 2009
@@ -16,21 +16,10 @@
  package com.google.gwt.user.client.ui;

  import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Document;
-import com.google.gwt.dom.client.NativeEvent;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.dom.client.FocusEvent;
-import com.google.gwt.event.dom.client.FocusHandler;
  import com.google.gwt.junit.client.GWTTestCase;
-import com.google.gwt.user.client.Element;
-import com.google.gwt.user.client.Event;
  import com.google.gwt.user.client.Timer;
  import com.google.gwt.user.client.ui.RichTextArea.BasicFormatter;

-import java.util.ArrayList;
-import java.util.List;
-
  /**
   * Tests the {...@link RichTextArea} widget.
   */
@@ -68,57 +57,6 @@
      }.schedule(500);
    }

-  public void testBlurAfterAttach() {
-    final RichTextArea rta = new RichTextArea();
-    final List<String> actual = new ArrayList<String>();
-    rta.addFocusHandler(new FocusHandler() {
-      public void onFocus(FocusEvent event) {
-        actual.add("test");
-      }
-    });
-    RootPanel.get().add(rta);
-    rta.setFocus(true);
-    rta.setFocus(false);
-
-    // This has to be done on a timer because the rta can take some time to
-    // finish initializing (on some browsers).
-    this.delayTestFinish(1000);
-    new Timer() {
-      @Override
-      public void run() {
-        assertEquals(0, actual.size());
-        RootPanel.get().remove(rta);
-        finishTest();
-      }
-    }.schedule(500);
-  }
-
-  public void testFocusAfterAttach() {
-    final RichTextArea rta = new RichTextArea();
-    final List<String> actual = new ArrayList<String>();
-    rta.addFocusHandler(new FocusHandler() {
-      public void onFocus(FocusEvent event) {
-        actual.add("test");
-      }
-    });
-    RootPanel.get().add(rta);
-    rta.setFocus(true);
-
-    // This has to be done on a timer because the rta can take some time to
-    // finish initializing (on some browsers).
-    this.delayTestFinish(3000);
-    new Timer() {
-      @Override
-      public void run() {
-        // IE focuses automatically, resulting in an extra event, so all  
we can
-        // test is that we got at least one focus.
-        assertTrue(actual.size() > 0);
-        RootPanel.get().remove(rta);
-        finishTest();
-      }
-    }.schedule(2000);
-  }
-
    /**
     * Test that adding and removing an RTA before initialization completes
     * doesn't throw an exception.
@@ -211,37 +149,6 @@
    }

    /**
-   * Test that events are dispatched correctly to handlers.
-   */
-  public void testEventDispatch() {
-    final RichTextArea rta = new RichTextArea();
-    RootPanel.get().add(rta);
-
-    final List<String> actual = new ArrayList<String>();
-    rta.addClickHandler(new ClickHandler() {
-      public void onClick(ClickEvent event) {
-        assertNotNull(Event.getCurrentEvent());
-        actual.add("test");
-      }
-    });
-
-    // Fire a click event after the iframe is available
-    delayTestFinish(1000);
-    new Timer() {
-      @Override
-      public void run() {
-        assertEquals(0, actual.size());
-        NativeEvent event = getDocument(rta).createClickEvent(0, 0, 0, 0,  
0,
-            false, false, false, false);
-        getBodyElement(rta).dispatchEvent(event);
-        assertEquals(1, actual.size());
-        RootPanel.get().remove(rta);
-        finishTest();
-      }
-    }.schedule(500);
-  }
-
-  /**
     * Test that a delayed set of HTML is reflected. Some platforms have  
timing
     * subtleties that need to be tested.
     */
@@ -314,29 +221,4 @@
      }.schedule(200);
      delayTestFinish(1000);
    }
-
-  /**
-   * Get the body element from a RichTextArea.
-   *
-   * @param rta the {...@link RichTextArea}
-   * @return the body element
-   */
-  private Element getBodyElement(RichTextArea rta) {
-    return getDocument(rta).getBody().cast();
-  }
-
-  /**
-   * Get the iframe's Document. This is useful for creating events, which  
must
-   * be created in the iframe's document to work correctly.
-   *
-   * @param rta the {...@link RichTextArea}
-   * @return the document element
-   */
-  private Document getDocument(RichTextArea rta) {
-    return getDocumentImpl(rta.getElement());
-  }
-
-  private native Document getDocumentImpl(Element iframe) /*-{
-      return iframe.contentWindow.document;
-    }-*/;
  }

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to