Backed out changeset 3fc6728e81a8 because of Windows 7 orange
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 19 Jan 2011 16:09:50 -0500
changeset 60879 cb7ba24ca60d205d1237f913e68b92ccbeac17e8
parent 60872 3fc6728e81a838b092ef50c7dd53b037e2a279bc
child 60880 c729839a60342fd84db21877be5799845e49a25d
push idunknown
push userunknown
push dateunknown
milestone2.0b10pre
backs out3fc6728e81a838b092ef50c7dd53b037e2a279bc
Backed out changeset 3fc6728e81a8 because of Windows 7 orange
layout/base/nsCaret.cpp
layout/base/nsCaret.h
layout/reftests/editor/caret_on_input_edge-ref.html
layout/reftests/editor/caret_on_input_edge.html
layout/reftests/editor/reftest.list
--- a/layout/base/nsCaret.cpp
+++ b/layout/base/nsCaret.cpp
@@ -255,20 +255,20 @@ nsCaret::Metrics nsCaret::ComputeMetrics
   if (DrawCJKCaret(aFrame, aOffset)) {
     caretWidth += nsPresContext::CSSPixelsToAppUnits(1);
   }
   nscoord bidiIndicatorSize = nsPresContext::CSSPixelsToAppUnits(kMinBidiIndicatorPixels);
   bidiIndicatorSize = NS_MAX(caretWidth, bidiIndicatorSize);
 
   // Round them to device pixels. Always round down, except that anything
   // between 0 and 1 goes up to 1 so we don't let the caret disappear.
+  PRUint32 tpp = aFrame->PresContext()->AppUnitsPerDevPixel();
   Metrics result;
-  result.mAppPerDev = aFrame->PresContext()->AppUnitsPerDevPixel();
-  result.mCaretWidth = NS_ROUND_BORDER_TO_PIXELS(caretWidth, result.mAppPerDev);
-  result.mBidiIndicatorSize = NS_ROUND_BORDER_TO_PIXELS(bidiIndicatorSize, result.mAppPerDev);
+  result.mCaretWidth = NS_ROUND_BORDER_TO_PIXELS(caretWidth, tpp);
+  result.mBidiIndicatorSize = NS_ROUND_BORDER_TO_PIXELS(bidiIndicatorSize, tpp);
   return result;
 }
 
 //-----------------------------------------------------------------------------
 void nsCaret::Terminate()
 {
   // this doesn't erase the caret if it's drawn. Should it? We might not have
   // a good drawing environment during teardown.
@@ -378,23 +378,18 @@ nsCaret::GetGeometryForFrame(nsIFrame* a
     nsIScrollableFrame *sf = do_QueryFrame(scrollFrame);
     nsIFrame *scrolled = sf->GetScrolledFrame();
     nsRect caretInScroll = *aRect + aFrame->GetOffsetTo(scrolled);
 
     // Now see if thet caret extends beyond the view's bounds. If it does,
     // then snap it back, put it as close to the edge as it can.
     nscoord overflow = caretInScroll.XMost() -
       scrolled->GetVisualOverflowRectRelativeToSelf().width;
-    if (overflow > 0) {
+    if (overflow > 0)
       aRect->x -= overflow;
-      // Make sure that the caret falls on a device pixel boundary so that
-      // it doesn't fall outside of the view. We round the X coordinate
-      // down to the nearest device pixel unit.
-      aRect->x = floor(double(aRect->x) / caretMetrics.mAppPerDev) * caretMetrics.mAppPerDev;
-    }
   }
 
   if (aBidiIndicatorSize)
     *aBidiIndicatorSize = caretMetrics.mBidiIndicatorSize;
 
   return NS_OK;
 }
 
--- a/layout/base/nsCaret.h
+++ b/layout/base/nsCaret.h
@@ -210,17 +210,16 @@ protected:
                                          PRInt32 aOffset,
                                          nsFrameSelection::HINT aFrameHint,
                                          PRUint8 aBidiLevel,
                                          PRBool aInvalidate);
 
     struct Metrics {
       nscoord mBidiIndicatorSize; // width and height of bidi indicator
       nscoord mCaretWidth;        // full caret width including bidi indicator
-      PRUint32 mAppPerDev;        // App units per device units metric
     };
     Metrics ComputeMetrics(nsIFrame* aFrame, PRInt32 aOffset, nscoord aCaretHeight);
     nsresult GetGeometryForFrame(nsIFrame* aFrame,
                                  PRInt32   aFrameOffset,
                                  nsRect*   aRect,
                                  nscoord*  aBidiIndicatorSize);
 
     // Returns true if the caret should be drawn. When |mDrawn| is true,
deleted file mode 100644
--- a/layout/reftests/editor/caret_on_input_edge-ref.html
+++ /dev/null
@@ -1,6 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <body>
-    <input autofocus style="text-align: right">
-  </body>
-</html>
deleted file mode 100644
--- a/layout/reftests/editor/caret_on_input_edge.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <body onload="focusInput()">
-    <input value="                                                                                                                 ">
-    <script>
-      function focusInput() {
-        var i = document.querySelector("input");
-        var len = i.value.length;
-        i.setSelectionRange(len, len);
-        i.focus();
-      }
-    </script>
-  </body>
-</html>
--- a/layout/reftests/editor/reftest.list
+++ b/layout/reftests/editor/reftest.list
@@ -42,9 +42,8 @@ asserts(1) == passwd-4.html passwd-ref.h
 != spellcheck-textarea-property-dynamic-override-inherit.html spellcheck-textarea-ref.html
 == caret_on_focus.html caret_on_focus-ref.html
 != caret_on_textarea_lastline.html caret_on_textarea_lastline-ref.html
 == input-text-onfocus-reframe.html input-text-onfocus-reframe-ref.html
 == input-text-notheme-onfocus-reframe.html input-text-notheme-onfocus-reframe-ref.html
 == caret_after_reframe.html caret_after_reframe-ref.html
 == nobogusnode-1.html nobogusnode-ref.html
 == nobogusnode-2.html nobogusnode-ref.html
-== caret_on_input_edge.html caret_on_input_edge-ref.html