Reviewers: jgw,

Description:
If an element does not fit in its parent element,
DOMImpl.scrollIntoView(elem) will line up the right edge of the elem
with the right edge of the parent, which looks ugly.  The desired
behavior is for the elem to scroll into view and have its left edge
align with its parent's left edge.

For example, if you select a TreeItem that is too wide to fit in its
scrollable parent, some part of the TreeItem will need to be hidden.
Currently, you will see the right edge of the TreeItem and the left side
will be truncated.  With this patch, the left side will be visible and
the right side will be truncated.  It seems like this behavior would
always be preferable (except in RTL, which we can address in a separate
patch).

The same applies for vertical scrolling, and this patch addresses that
as well.

Please review this at http://gwt-code-reviews.appspot.com/22803

Affected files:
   eclipse/dev/linux/.project
   eclipse/dev/oophm/.classpath
   eclipse/samples/Showcase/.classpath
   eclipse/user/.classpath
   reference/code-museum/src/com/google/gwt/museum/SingleIssue.gwt.xml
   user/src/com/google/gwt/dom/client/DOMImpl.java


Index: eclipse/samples/Showcase/.classpath
===================================================================
--- eclipse/samples/Showcase/.classpath (revision 5233)
+++ eclipse/samples/Showcase/.classpath (working copy)
@@ -4,6 +4,6 @@
        <classpathentry kind="src" output="war" path="core/war"/>
        <classpathentry kind="con"  
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
        <classpathentry combineaccessrules="false" kind="src" path="/gwt-user"/>
-       <classpathentry combineaccessrules="false" kind="src"  
path="/gwt-dev-windows"/>
+       <classpathentry combineaccessrules="false" kind="src"  
path="/gwt-dev-linux"/>
        <classpathentry kind="output" path="war/WEB-INF/classes"/>
  </classpath>
Index: eclipse/dev/linux/.project
===================================================================
--- eclipse/dev/linux/.project  (revision 5233)
+++ eclipse/dev/linux/.project  (working copy)
@@ -22,14 +22,14 @@
        </natures>
        <linkedResources>
                <link>
-                       <name>linux</name>
+                       <name>core</name>
                        <type>2</type>
-                       <location>GWT_ROOT/dev/linux</location>
+                       <locationURI>GWT_ROOT/dev/core</locationURI>
                </link>
                <link>
-                       <name>core</name>
+                       <name>linux</name>
                        <type>2</type>
-                       <location>GWT_ROOT/dev/core</location>
+                       <locationURI>GWT_ROOT/dev/linux</locationURI>
                </link>
        </linkedResources>
  </projectDescription>
Index: eclipse/dev/oophm/.classpath
===================================================================
--- eclipse/dev/oophm/.classpath        (revision 5233)
+++ eclipse/dev/oophm/.classpath        (working copy)
@@ -4,6 +4,6 @@
        <classpathentry kind="src" path="oophm/overlay"/>
        <classpathentry exported="true" kind="con"  
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
        <classpathentry exported="true" kind="var"  
path="GWT_TOOLS/lib/sun/swingworker/swing-worker-1.1.jar"  
sourcepath="/GWT_TOOLS/lib/sun/swingworker/swing-worker-1.1-src.zip"/>
-       <classpathentry combineaccessrules="false" kind="src"  
path="/gwt-dev-windows"/>
+       <classpathentry combineaccessrules="false" kind="src"  
path="/gwt-dev-linux"/>
        <classpathentry kind="output" path="bin"/>
  </classpath>
Index: eclipse/user/.classpath
===================================================================
--- eclipse/user/.classpath     (revision 5233)
+++ eclipse/user/.classpath     (working copy)
@@ -10,6 +10,6 @@
        <classpathentry kind="var"  
path="GWT_TOOLS/lib/selenium/selenium-java-client-driver.jar"/>
        <classpathentry kind="var" path="GWT_TOOLS/lib/w3c/sac/sac-1.3.jar"/>
        <classpathentry kind="var" 
path="GWT_TOOLS/lib/w3c/flute/flute-1.3.jar"/>
-       <classpathentry combineaccessrules="false" kind="src"  
path="/gwt-dev-windows"/>
+       <classpathentry combineaccessrules="false" kind="src"  
path="/gwt-dev-linux"/>
        <classpathentry kind="output" path="bin"/>
  </classpath>
Index: reference/code-museum/src/com/google/gwt/museum/SingleIssue.gwt.xml
===================================================================
--- reference/code-museum/src/com/google/gwt/museum/SingleIssue.gwt.xml  
(revision 5233)
+++ reference/code-museum/src/com/google/gwt/museum/SingleIssue.gwt.xml  
(working copy)
@@ -6,9 +6,11 @@
      <inherits name="com.google.gwt.user.theme.standard.StandardResources"/>
      <inherits name="com.google.gwt.user.theme.chrome.ChromeResources"/>
      <inherits name="com.google.gwt.user.theme.dark.DarkResources"/>
+
+    <inherits name="com.google.gwt.user.flyweight.Flyweight"/>

      <!-- Specify the app entry point class.                   -->
-    <entry-point  
class='com.google.gwt.museum.client.defaultmuseum.VisualsForDateBox'/>
+    <entry-point  
class='com.google.gwt.museum.client.defaultmuseum.VisualsForDatePicker'/>
      <source path="client/common"/>
      <source path="client/defaultmuseum"/>
      <source path="client/viewer"/>
Index: user/src/com/google/gwt/dom/client/DOMImpl.java
===================================================================
--- user/src/com/google/gwt/dom/client/DOMImpl.java     (revision 5233)
+++ user/src/com/google/gwt/dom/client/DOMImpl.java     (working copy)
@@ -257,13 +257,13 @@
          cur.scrollLeft = left;
        }
        if (left + width > cur.scrollLeft + cur.clientWidth) {
-        cur.scrollLeft = (left + width) - cur.clientWidth;
+        cur.scrollLeft = Math.min(left, (left + width) - cur.clientWidth);
        }
        if (top < cur.scrollTop) {
          cur.scrollTop = top;
        }
        if (top + height > cur.scrollTop + cur.clientHeight) {
-        cur.scrollTop = (top + height) - cur.clientHeight;
+        cur.scrollTop = Math.min(top, (top + height) - cur.clientHeight);
        }

        var offsetLeft = cur.offsetLeft, offsetTop = cur.offsetTop;



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

Reply via email to