[gwt-contrib] Change in gwt[master]: Fix support for Document.{get,set}ScrollLeft() in RTL for sa...

2013-06-26 Thread Brian Slesinsky

Brian Slesinsky has submitted this change and it was merged.

Change subject: Fix support for Document.{get,set}ScrollLeft() in RTL for  
safari and ie9.

..


Fix support for Document.{get,set}ScrollLeft() in RTL for safari and ie9.

Change-Id: I8ce64ab4bbbae02ee7519ed8d24241cdfbc28617
Review-Link: https://gwt-review.googlesource.com/#/c/3420/
---
M user/src/com/google/gwt/dom/client/DOMImplIE9.java
M user/src/com/google/gwt/dom/client/DOMImplStandardBase.java
M user/test/com/google/gwt/dom/client/ElementTest.java
3 files changed, 41 insertions(+), 2 deletions(-)

Approvals:
  Leeroy Jenkins: Verified
  Brian Slesinsky: Verified; Looks good to me, approved



diff --git a/user/src/com/google/gwt/dom/client/DOMImplIE9.java  
b/user/src/com/google/gwt/dom/client/DOMImplIE9.java

index 6564bb2..a49c651 100644
--- a/user/src/com/google/gwt/dom/client/DOMImplIE9.java
+++ b/user/src/com/google/gwt/dom/client/DOMImplIE9.java
@@ -91,6 +91,11 @@
 setScrollLeftImpl(elem, left);
   }

+  @Override
+  public void setScrollLeft(Document doc, int left) {
+setScrollLeft(doc.getDocumentElement(), left);
+  }
+
   protected native int getBoundingClientRectLeft(Element elem) /*-{
   // getBoundingClientRect() throws a JS exception if the elem is not  
attached

   // to the document, so we wrap it in a try/catch block
diff --git a/user/src/com/google/gwt/dom/client/DOMImplStandardBase.java  
b/user/src/com/google/gwt/dom/client/DOMImplStandardBase.java

index 5d698f7..acd9c0a 100644
--- a/user/src/com/google/gwt/dom/client/DOMImplStandardBase.java
+++ b/user/src/com/google/gwt/dom/client/DOMImplStandardBase.java
@@ -223,7 +223,7 @@

   @Override
   public int getScrollLeft(Element elem) {
-if (isRTL(elem)) {
+if (!elem.hasTagName(BodyElement.TAG) && isRTL(elem)) {
   return super.getScrollLeft(elem)
   - (elem.getScrollWidth() - elem.getClientWidth());
 }
@@ -253,7 +253,7 @@

   @Override
   public void setScrollLeft(Element elem, int left) {
-if (isRTL(elem)) {
+if (!elem.hasTagName(BodyElement.TAG) && isRTL(elem)) {
   left += elem.getScrollWidth() - elem.getClientWidth();
 }
 super.setScrollLeft(elem, left);
diff --git a/user/test/com/google/gwt/dom/client/ElementTest.java  
b/user/test/com/google/gwt/dom/client/ElementTest.java

index c4a2acf..23d19f0 100644
--- a/user/test/com/google/gwt/dom/client/ElementTest.java
+++ b/user/test/com/google/gwt/dom/client/ElementTest.java
@@ -599,6 +599,40 @@
 assertEquals(0, outer.getScrollLeft());
   }

+  @DoNotRunWith({Platform.HtmlUnitLayout})
+  public void testDocumentScrollLeftInRtl() {
+Document.get().getDocumentElement().setDir("rtl");
+Document.get().getBody().getStyle().setProperty("direction", "rtl");
+
+final DivElement bigdiv = Document.get().createDivElement();
+
+bigdiv.getStyle().setProperty("position", "absolute");
+bigdiv.getStyle().setProperty("top", "0px");
+bigdiv.getStyle().setProperty("right", "0px");
+bigdiv.getStyle().setProperty("width", "1px");  // Bigger than  
window size.

+bigdiv.getStyle().setProperty("height", "400px");
+
+Document.get().getBody().appendChild(bigdiv);
+
+// The important thing is that setting and retrieving scrollLeft  
values in

+// RTL mode works only for negative numbers, and that they round-trip
+// correctly.
+try {
+  assertEquals(0, Document.get().getScrollLeft());
+
+  Document.get().setScrollLeft(-32);
+  assertEquals(-32, Document.get().getScrollLeft());
+
+  Document.get().setScrollLeft(32);
+  assertEquals(0, Document.get().getScrollLeft());
+} finally {
+  // Restore direction unconditionally to not break all other tests.
+  Document.get().getBody().removeChild(bigdiv);
+  Document.get().getBody().getStyle().setProperty("direction", "ltr");
+  Document.get().getDocumentElement().setDir("ltr");
+}
+  }
+
   /**
* innerHTML.
*/

--
To view, visit https://gwt-review.googlesource.com/3420
To unsubscribe, visit https://gwt-review.googlesource.com/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8ce64ab4bbbae02ee7519ed8d24241cdfbc28617
Gerrit-PatchSet: 4
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: Emmanuel Pellereau 
Gerrit-Reviewer: Brian Slesinsky 
Gerrit-Reviewer: Emmanuel Pellereau 
Gerrit-Reviewer: Leeroy Jenkins 
Gerrit-Reviewer: Thomas Broyer 

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- 
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[gwt-contrib] Change in gwt[master]: Fix support for Document.{get,set}ScrollLeft() in RTL for sa...

2013-06-26 Thread Brian Slesinsky

Brian Slesinsky has posted comments on this change.

Change subject: Fix support for Document.{get,set}ScrollLeft() in RTL for  
safari and ie9.

..


Patch Set 4: Verified+1 Code-Review+2

Looks like all issues have been resolved.

--
To view, visit https://gwt-review.googlesource.com/3420
To unsubscribe, visit https://gwt-review.googlesource.com/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I8ce64ab4bbbae02ee7519ed8d24241cdfbc28617
Gerrit-PatchSet: 4
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: Emmanuel Pellereau 
Gerrit-Reviewer: Brian Slesinsky 
Gerrit-Reviewer: Emmanuel Pellereau 
Gerrit-Reviewer: Leeroy Jenkins 
Gerrit-Reviewer: Thomas Broyer 
Gerrit-HasComments: No

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- 
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[gwt-contrib] Change in gwt[master]: Fix support for Document.{get,set}ScrollLeft() in RTL for sa...

2013-06-13 Thread Thomas Broyer

Thomas Broyer has posted comments on this change.

Change subject: Fix support for Document.{get,set}ScrollLeft() in RTL for  
safari and ie9.

..


Patch Set 2:

(1 comment)


File user/src/com/google/gwt/dom/client/DOMImplStandardBase.java
Line 226: if (!"BODY".equals(elem.getTagName()) && isRTL(elem)) {
I've just merged Ib24bee7fa494c0345a7bc97e1b5df1095a05d024 so you can now  
use hasTagName(BodyElement.TAG)



--
To view, visit https://gwt-review.googlesource.com/3420
To unsubscribe, visit https://gwt-review.googlesource.com/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I8ce64ab4bbbae02ee7519ed8d24241cdfbc28617
Gerrit-PatchSet: 2
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: Emmanuel Pellereau 
Gerrit-Reviewer: Emmanuel Pellereau 
Gerrit-Reviewer: Leeroy Jenkins 
Gerrit-Reviewer: Thomas Broyer 
Gerrit-HasComments: Yes

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- 
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[gwt-contrib] Change in gwt[master]: Fix support for Document.{get,set}ScrollLeft() in RTL for sa...

2013-06-13 Thread Thomas Broyer

Thomas Broyer has posted comments on this change.

Change subject: Fix support for Document.{get,set}ScrollLeft() in RTL for  
safari and ie9.

..


Patch Set 2:

(1 comment)


File user/src/com/google/gwt/dom/client/DOMImplStandardBase.java
Line 226: if (!"BODY".equals(elem.getTagName()) && isRTL(elem)) {
Ib24bee7fa494c0345a7bc97e1b5df1095a05d024 is only waiting for Verified+1  
(for some reason, Jenkins doesn't verifies it). You can rebase your change  
on top of it (or I14aa6163e52adb2f71cd1ca3557ff3514571a6a2 for  
BodyElement.is(elem))



--
To view, visit https://gwt-review.googlesource.com/3420
To unsubscribe, visit https://gwt-review.googlesource.com/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I8ce64ab4bbbae02ee7519ed8d24241cdfbc28617
Gerrit-PatchSet: 2
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: Emmanuel Pellereau 
Gerrit-Reviewer: Emmanuel Pellereau 
Gerrit-Reviewer: Leeroy Jenkins 
Gerrit-Reviewer: Thomas Broyer 
Gerrit-HasComments: Yes

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- 
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[gwt-contrib] Change in gwt[master]: Fix support for Document.{get,set}ScrollLeft() in RTL for sa...

2013-06-13 Thread Thomas Broyer

Thomas Broyer has posted comments on this change.

Change subject: Fix support for Document.{get,set}ScrollLeft() in RTL for  
safari and ie9.

..


Patch Set 2: Code-Review+1

(1 comment)


File user/src/com/google/gwt/dom/client/DOMImplStandardBase.java
Line 226: if (!"BODY".equals(elem.getTagName()) && isRTL(elem)) {
Use

 !elem.hasTagName(BodyElement.TAG)

We should soon have BodyElement.is(elem) to make it even more readable:  
I14aa6163e52adb2f71cd1ca3557ff3514571a6a2



--
To view, visit https://gwt-review.googlesource.com/3420
To unsubscribe, visit https://gwt-review.googlesource.com/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I8ce64ab4bbbae02ee7519ed8d24241cdfbc28617
Gerrit-PatchSet: 2
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: Emmanuel Pellereau 
Gerrit-Reviewer: Leeroy Jenkins 
Gerrit-Reviewer: Thomas Broyer 
Gerrit-HasComments: Yes

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- 
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.