Title: [125427] trunk/Source
Revision
125427
Author
[email protected]
Date
2012-08-13 10:42:55 -0700 (Mon, 13 Aug 2012)

Log Message

[Chromium] Fix nits in the find-in-page match rects API
https://bugs.webkit.org/show_bug.cgi?id=93817

Reviewed by Adam Barth.

This patch fixes a few pending nits from 93111.

Source/WebCore:

Tests: existing WebKit unit test WebFrameTest.FindInPageMatchRects

* dom/Range.cpp:
(WebCore::Range::transformFriendlyBoundingBox): add call to updateLayoutIgnorePendingStylesheets.

Source/WebKit/chromium:

* src/FindInPageCoordinates.cpp: replace a pointer by a reference in an output argument.
(WebKit::toNormalizedRect):
(WebKit::findInPageRectFromAbsoluteRect):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (125426 => 125427)


--- trunk/Source/WebCore/ChangeLog	2012-08-13 16:49:49 UTC (rev 125426)
+++ trunk/Source/WebCore/ChangeLog	2012-08-13 17:42:55 UTC (rev 125427)
@@ -1,3 +1,17 @@
+2012-08-13  Leandro Gracia Gil  <[email protected]>
+
+        [Chromium] Fix nits in the find-in-page match rects API
+        https://bugs.webkit.org/show_bug.cgi?id=93817
+
+        Reviewed by Adam Barth.
+
+        This patch fixes a few pending nits from 93111.
+
+        Tests: existing WebKit unit test WebFrameTest.FindInPageMatchRects
+
+        * dom/Range.cpp:
+        (WebCore::Range::transformFriendlyBoundingBox): add call to updateLayoutIgnorePendingStylesheets.
+
 2012-08-13  Pavel Feldman  <[email protected]>
 
         Web Inspector: get rid of beforeTextChanged

Modified: trunk/Source/WebCore/dom/Range.cpp (125426 => 125427)


--- trunk/Source/WebCore/dom/Range.cpp	2012-08-13 16:49:49 UTC (rev 125426)
+++ trunk/Source/WebCore/dom/Range.cpp	2012-08-13 17:42:55 UTC (rev 125427)
@@ -1963,12 +1963,16 @@
 
 FloatRect Range::transformFriendlyBoundingBox() const
 {
-    FloatRect result;
+    if (!m_start.container())
+        return FloatRect();
+
+    m_ownerDocument->updateLayoutIgnorePendingStylesheets();
+
     Vector<FloatQuad> quads;
     textQuads(quads);
 
-    const size_t n = quads.size();
-    for (size_t i = 0; i < n; ++i)
+    FloatRect result;
+    for (size_t i = 0; i < quads.size(); ++i)
         result.unite(quads[i].boundingBox());
 
     return result;

Modified: trunk/Source/WebKit/chromium/ChangeLog (125426 => 125427)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-08-13 16:49:49 UTC (rev 125426)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-08-13 17:42:55 UTC (rev 125427)
@@ -1,3 +1,16 @@
+2012-08-13  Leandro Gracia Gil  <[email protected]>
+
+        [Chromium] Fix nits in the find-in-page match rects API
+        https://bugs.webkit.org/show_bug.cgi?id=93817
+
+        Reviewed by Adam Barth.
+
+        This patch fixes a few pending nits from 93111.
+
+        * src/FindInPageCoordinates.cpp: replace a pointer by a reference in an output argument.
+        (WebKit::toNormalizedRect):
+        (WebKit::findInPageRectFromAbsoluteRect):
+
 2012-08-13  Peter Beverloo  <[email protected]>
 
         [Chromium] Fix apk generation for the Android platform

Modified: trunk/Source/WebKit/chromium/src/FindInPageCoordinates.cpp (125426 => 125427)


--- trunk/Source/WebKit/chromium/src/FindInPageCoordinates.cpp	2012-08-13 16:49:49 UTC (rev 125426)
+++ trunk/Source/WebKit/chromium/src/FindInPageCoordinates.cpp	2012-08-13 17:42:55 UTC (rev 125427)
@@ -48,21 +48,19 @@
 
 namespace WebKit {
 
-static FloatRect toNormalizedRect(const FloatRect& absoluteRect, const RenderObject* renderer, FloatRect* containerBoundingBox = 0)
+static FloatRect toNormalizedRect(const FloatRect& absoluteRect, const RenderObject* renderer, FloatRect& containerBoundingBox)
 {
     ASSERT(renderer);
 
     const RenderObject* container = renderer->container();
     if (!container) {
-        if (containerBoundingBox)
-            *containerBoundingBox = FloatRect();
+        containerBoundingBox = FloatRect();
         return FloatRect();
     }
 
     FloatRect normalizedRect = absoluteRect;
     FloatRect containerRect = container->absoluteBoundingBoxRect();
-    if (containerBoundingBox)
-        *containerBoundingBox = containerRect;
+    containerBoundingBox = containerRect;
 
     // For RenderBoxes we want to normalize by the max layout overflow size instead of only the visible bounding box.
     // Quads and their enclosing bounding boxes need to be used in order to keep results transform-friendly.
@@ -102,7 +100,7 @@
 
     // Normalize the input rect to its container, saving the container bounding box for the incoming loop.
     FloatRect rendererBoundingBox;
-    FloatRect normalizedRect = toNormalizedRect(inputRect, renderer, &rendererBoundingBox);
+    FloatRect normalizedRect = toNormalizedRect(inputRect, renderer, rendererBoundingBox);
     renderer = renderer->container();
 
     // Go up across frames.
@@ -113,7 +111,7 @@
 
             // Compose the normalized rects. The absolute bounding box of the container is calculated in toNormalizedRect
             // and can be reused for the next iteration of the loop.
-            FloatRect normalizedBoxRect = toNormalizedRect(rendererBoundingBox, renderer, &rendererBoundingBox);
+            FloatRect normalizedBoxRect = toNormalizedRect(rendererBoundingBox, renderer, rendererBoundingBox);
             normalizedRect.scale(normalizedBoxRect.width(), normalizedBoxRect.height());
             normalizedRect.moveBy(normalizedBoxRect.location());
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to