Title: [113466] trunk/Source/WebCore
Revision
113466
Author
[email protected]
Date
2012-04-06 11:34:43 -0700 (Fri, 06 Apr 2012)

Log Message

Update LayoutUnit usage in Editor and Frame
https://bugs.webkit.org/show_bug.cgi?id=83278

Reviewed by Eric Seidel.

Frame and Editor both take input from the embedder, which passes along coordinates in screen
coordinates, which aren't fractional. Updating a few remaining functions to show this, and correcting
some inconsistencies in LayoutUnit usage.

No new tests. No change in behavior.

* editing/Editor.cpp:
(WebCore::Editor::rangeForPoint): windowToContents returns an IntPoint.
(WebCore::Editor::countMatchesForText): Using enclosingIntRect since we're (fake) repainting the entire
view rect.
* editing/Editor.h:
(Editor): Correcting mismatched function signature.
* page/Frame.cpp:
(WebCore::Frame::visiblePositionForPoint): Frame takes points in screen coordinates, usually from the
embedder. Changing these functions to be in IntPoints.
(WebCore::Frame::documentAtPoint): Ditto.
(WebCore::Frame::rangeForPoint): Ditto.
* page/Frame.h:
(Frame):
* platform/graphics/IntRect.h:
(enclosingIntRect): Adding an inline no-op copy of the FractionalLayoutRect method enclosingIntRect.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (113465 => 113466)


--- trunk/Source/WebCore/ChangeLog	2012-04-06 18:34:23 UTC (rev 113465)
+++ trunk/Source/WebCore/ChangeLog	2012-04-06 18:34:43 UTC (rev 113466)
@@ -1,3 +1,32 @@
+2012-04-06  Levi Weintraub  <[email protected]>
+
+        Update LayoutUnit usage in Editor and Frame
+        https://bugs.webkit.org/show_bug.cgi?id=83278
+
+        Reviewed by Eric Seidel.
+
+        Frame and Editor both take input from the embedder, which passes along coordinates in screen
+        coordinates, which aren't fractional. Updating a few remaining functions to show this, and correcting
+        some inconsistencies in LayoutUnit usage.
+
+        No new tests. No change in behavior.
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::rangeForPoint): windowToContents returns an IntPoint.
+        (WebCore::Editor::countMatchesForText): Using enclosingIntRect since we're (fake) repainting the entire
+        view rect.
+        * editing/Editor.h:
+        (Editor): Correcting mismatched function signature.
+        * page/Frame.cpp:
+        (WebCore::Frame::visiblePositionForPoint): Frame takes points in screen coordinates, usually from the
+        embedder. Changing these functions to be in IntPoints.
+        (WebCore::Frame::documentAtPoint): Ditto.
+        (WebCore::Frame::rangeForPoint): Ditto.
+        * page/Frame.h:
+        (Frame):
+        * platform/graphics/IntRect.h:
+        (enclosingIntRect): Adding an inline no-op copy of the FractionalLayoutRect method enclosingIntRect.
+
 2012-04-06  Tommy Widenflycht  <[email protected]>
 
         MediaStream API: Deleting the chromium bridge class MediaStreamCenterInternal

Modified: trunk/Source/WebCore/editing/Editor.cpp (113465 => 113466)


--- trunk/Source/WebCore/editing/Editor.cpp	2012-04-06 18:34:23 UTC (rev 113465)
+++ trunk/Source/WebCore/editing/Editor.cpp	2012-04-06 18:34:43 UTC (rev 113466)
@@ -2248,7 +2248,7 @@
     FrameView* frameView = frame->view();
     if (!frameView)
         return 0;
-    LayoutPoint framePoint = frameView->windowToContents(windowPoint);
+    IntPoint framePoint = frameView->windowToContents(windowPoint);
     VisibleSelection selection(frame->visiblePositionForPoint(framePoint));
     return avoidIntersectionWithNode(selection.toNormalizedRange().get(), m_deleteButtonController->containerElement());
 }
@@ -2868,7 +2868,7 @@
 
                 PaintBehavior oldBehavior = m_frame->view()->paintBehavior();
                 m_frame->view()->setPaintBehavior(oldBehavior | PaintBehaviorFlattenCompositingLayers);
-                m_frame->view()->paintContents(&context, visibleRect);
+                m_frame->view()->paintContents(&context, enclosingIntRect(visibleRect));
                 m_frame->view()->setPaintBehavior(oldBehavior);
             }
         }

Modified: trunk/Source/WebCore/editing/Editor.h (113465 => 113466)


--- trunk/Source/WebCore/editing/Editor.h	2012-04-06 18:34:23 UTC (rev 113465)
+++ trunk/Source/WebCore/editing/Editor.h	2012-04-06 18:34:43 UTC (rev 113466)
@@ -300,7 +300,7 @@
 
     void setStartNewKillRingSequence(bool);
 
-    PassRefPtr<Range> rangeForPoint(const LayoutPoint& windowPoint);
+    PassRefPtr<Range> rangeForPoint(const IntPoint& windowPoint);
 
     void clear();
 

Modified: trunk/Source/WebCore/page/Frame.cpp (113465 => 113466)


--- trunk/Source/WebCore/page/Frame.cpp	2012-04-06 18:34:23 UTC (rev 113465)
+++ trunk/Source/WebCore/page/Frame.cpp	2012-04-06 18:34:43 UTC (rev 113466)
@@ -725,7 +725,7 @@
     return document() ? document()->displayStringModifiedByEncoding(str) : str;
 }
 
-VisiblePosition Frame::visiblePositionForPoint(const LayoutPoint& framePoint)
+VisiblePosition Frame::visiblePositionForPoint(const IntPoint& framePoint)
 {
     HitTestResult result = eventHandler()->hitTestResultAtPoint(framePoint, true);
     Node* node = result.innerNonSharedNode();
@@ -745,7 +745,7 @@
     if (!view())
         return 0;
 
-    LayoutPoint pt = view()->windowToContents(point);
+    IntPoint pt = view()->windowToContents(point);
     HitTestResult result = HitTestResult(pt);
 
     if (contentRenderer())
@@ -753,7 +753,7 @@
     return result.innerNode() ? result.innerNode()->document() : 0;
 }
 
-PassRefPtr<Range> Frame::rangeForPoint(const LayoutPoint& framePoint)
+PassRefPtr<Range> Frame::rangeForPoint(const IntPoint& framePoint)
 {
     VisiblePosition position = visiblePositionForPoint(framePoint);
     if (position.isNull())

Modified: trunk/Source/WebCore/page/Frame.h (113465 => 113466)


--- trunk/Source/WebCore/page/Frame.h	2012-04-06 18:34:23 UTC (rev 113465)
+++ trunk/Source/WebCore/page/Frame.h	2012-04-06 18:34:43 UTC (rev 113466)
@@ -179,9 +179,9 @@
         DragImageRef nodeImage(Node*);
         DragImageRef dragImageForSelection();
 
-        VisiblePosition visiblePositionForPoint(const LayoutPoint& framePoint);
+        VisiblePosition visiblePositionForPoint(const IntPoint& framePoint);
         Document* documentAtPoint(const IntPoint& windowPoint);
-        PassRefPtr<Range> rangeForPoint(const LayoutPoint& framePoint);
+        PassRefPtr<Range> rangeForPoint(const IntPoint& framePoint);
 
         String searchForLabelsAboveCell(RegularExpression*, HTMLTableCellElement*, size_t* resultDistanceFromStartOfCell);
         String searchForLabelsBeforeElement(const Vector<String>& labels, Element*, size_t* resultDistance, bool* resultIsInCellAbove);

Modified: trunk/Source/WebCore/platform/graphics/IntRect.h (113465 => 113466)


--- trunk/Source/WebCore/platform/graphics/IntRect.h	2012-04-06 18:34:23 UTC (rev 113465)
+++ trunk/Source/WebCore/platform/graphics/IntRect.h	2012-04-06 18:34:43 UTC (rev 113466)
@@ -272,6 +272,13 @@
     return a.location() != b.location() || a.size() != b.size();
 }
 
+// FIXME: This method is here only to ease the transition to sub-pixel layout. It should
+// be removed when we close http://webkit.org/b/60318
+inline IntRect enclosingIntRect(const IntRect& rect)
+{
+    return rect;
+}
+
 #if USE(CG) || USE(SKIA_ON_MAC_CHROMIUM)
 IntRect enclosingIntRect(const CGRect&);
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to