2011-05-18 Emil A Eklund <eae@chromium.org>
authoreae@chromium.org <eae@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 May 2011 00:16:40 +0000 (00:16 +0000)
committereae@chromium.org <eae@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 May 2011 00:16:40 +0000 (00:16 +0000)
        Reviewed by Darin Adler.

        Change RenderTextControl::hitInnerTextElement to use IntPoint
        https://bugs.webkit.org/show_bug.cgi?id=61003

        Covered by existing tests.

        * rendering/RenderTextControl.cpp:
        (WebCore::RenderTextControl::hitInnerTextElement):
        * rendering/RenderTextControl.h:
        * rendering/RenderTextControlMultiLine.cpp:
        (WebCore::RenderTextControlMultiLine::nodeAtPoint):
        * rendering/RenderTextControlSingleLine.cpp:
        (WebCore::RenderTextControlSingleLine::nodeAtPoint):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@86807 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderTextControl.cpp
Source/WebCore/rendering/RenderTextControl.h
Source/WebCore/rendering/RenderTextControlMultiLine.cpp
Source/WebCore/rendering/RenderTextControlSingleLine.cpp

index 700be13..c4030f9 100644 (file)
@@ -1,3 +1,20 @@
+2011-05-18  Emil A Eklund  <eae@chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Change RenderTextControl::hitInnerTextElement to use IntPoint
+        https://bugs.webkit.org/show_bug.cgi?id=61003
+
+        Covered by existing tests.
+
+        * rendering/RenderTextControl.cpp:
+        (WebCore::RenderTextControl::hitInnerTextElement):
+        * rendering/RenderTextControl.h:
+        * rendering/RenderTextControlMultiLine.cpp:
+        (WebCore::RenderTextControlMultiLine::nodeAtPoint):
+        * rendering/RenderTextControlSingleLine.cpp:
+        (WebCore::RenderTextControlSingleLine::nodeAtPoint):
+
 2011-05-18  Chris Fleizach  <cfleizach@apple.com>
 
         Reviewed by Maciej Stachowiak.
 2011-05-18  Chris Fleizach  <cfleizach@apple.com>
 
         Reviewed by Maciej Stachowiak.
index 0a97492..658a5ff 100644 (file)
@@ -465,12 +465,12 @@ void RenderTextControl::computeLogicalHeight()
     RenderBlock::computeLogicalHeight();
 }
 
     RenderBlock::computeLogicalHeight();
 }
 
-void RenderTextControl::hitInnerTextElement(HitTestResult& result, int xPos, int yPos, int tx, int ty)
+void RenderTextControl::hitInnerTextElement(HitTestResult& result, const IntPoint& pointInContainer, int tx, int ty)
 {
     result.setInnerNode(m_innerText.get());
     result.setInnerNonSharedNode(m_innerText.get());
 {
     result.setInnerNode(m_innerText.get());
     result.setInnerNonSharedNode(m_innerText.get());
-    result.setLocalPoint(IntPoint(xPos - tx - x() - m_innerText->renderBox()->x(),
-                                  yPos - ty - y() - m_innerText->renderBox()->y()));
+    result.setLocalPoint(pointInContainer -
+        IntSize(tx + x() + m_innerText->renderBox()->x(), ty + y() + m_innerText->renderBox()->y()));
 }
 
 void RenderTextControl::forwardEvent(Event* event)
 }
 
 void RenderTextControl::forwardEvent(Event* event)
index 0c30ed6..67f3946 100644 (file)
@@ -63,7 +63,7 @@ protected:
     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
 
     void createSubtreeIfNeeded(TextControlInnerElement* innerBlock);
     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
 
     void createSubtreeIfNeeded(TextControlInnerElement* innerBlock);
-    void hitInnerTextElement(HitTestResult&, int x, int y, int tx, int ty);
+    void hitInnerTextElement(HitTestResult&, const IntPoint& pointInContainer, int tx, int ty);
     void forwardEvent(Event*);
 
     int textBlockWidth() const;
     void forwardEvent(Event*);
 
     int textBlockWidth() const;
index 7d9c850..382f31a 100644 (file)
@@ -63,7 +63,7 @@ bool RenderTextControlMultiLine::nodeAtPoint(const HitTestRequest& request, HitT
         return false;
 
     if (result.innerNode() == node() || result.innerNode() == innerTextElement())
         return false;
 
     if (result.innerNode() == node() || result.innerNode() == innerTextElement())
-        hitInnerTextElement(result, pointInContainer.x(), pointInContainer.y(), tx, ty);
+        hitInnerTextElement(result, pointInContainer, tx, ty);
 
     return true;
 }
 
     return true;
 }
index 655883c..9ecf2f0 100644 (file)
@@ -348,7 +348,7 @@ bool RenderTextControlSingleLine::nodeAtPoint(const HitTestRequest& request, Hit
     // and if we hit our node (e.g. we're over the border or padding), also say that we hit the
     // inner text element so that it gains focus.
     if (result.innerNode()->isDescendantOf(innerTextElement()) || result.innerNode() == node())
     // and if we hit our node (e.g. we're over the border or padding), also say that we hit the
     // inner text element so that it gains focus.
     if (result.innerNode()->isDescendantOf(innerTextElement()) || result.innerNode() == node())
-        hitInnerTextElement(result, pointInContainer.x(), pointInContainer.y(), tx, ty);
+        hitInnerTextElement(result, pointInContainer, tx, ty);
 
     // If we found a spin button, we're done.
     if (m_innerSpinButton && result.innerNode() == m_innerSpinButton)
 
     // If we found a spin button, we're done.
     if (m_innerSpinButton && result.innerNode() == m_innerSpinButton)