Title: [126074] trunk/Source
Revision
126074
Author
[email protected]
Date
2012-08-20 14:41:02 -0700 (Mon, 20 Aug 2012)

Log Message

Move transformFriendlyBoundingBox out of Range
https://bugs.webkit.org/show_bug.cgi?id=94366

Source/WebCore: 

Patch by Leandro Gracia Gil <[email protected]> on 2012-08-20
Reviewed by Simon Fraser and Ryosuke Niwa.

Bug 93111 introduced a new method in Range called transformFriendlyBoundingBox.
However, this method should not have been added there in order to reduce the
dependencies between Range and the rendering code. This patch moves it to a
static method in RenderObject.

Tests: existing tests, no new feature added by this patch.

* dom/Range.cpp:
* dom/Range.h:
* rendering/RenderObject.cpp:
(WebCore::RenderObject::absoluteBoundingBoxRectForRange):
(WebCore):
* rendering/RenderObject.h:
(RenderObject):

Source/WebKit/chromium: 

Patch by Leandro Gracia Gil <[email protected]> on 2012-08-20
Reviewed by Ryosuke Niwa.

Update the WebKit code that makes use of transformFriendlyBoundingBox.

* src/FindInPageCoordinates.cpp:
(WebKit::findInPageRectFromRange):
* src/WebFrameImpl.cpp:
(WebKit::WebFrameImpl::find):
(WebKit::WebFrameImpl::selectFindMatch):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (126073 => 126074)


--- trunk/Source/WebCore/ChangeLog	2012-08-20 21:38:42 UTC (rev 126073)
+++ trunk/Source/WebCore/ChangeLog	2012-08-20 21:41:02 UTC (rev 126074)
@@ -1,3 +1,25 @@
+2012-08-20  Leandro Gracia Gil  <[email protected]>
+
+        Move transformFriendlyBoundingBox out of Range
+        https://bugs.webkit.org/show_bug.cgi?id=94366
+
+        Reviewed by Simon Fraser and Ryosuke Niwa.
+
+        Bug 93111 introduced a new method in Range called transformFriendlyBoundingBox.
+        However, this method should not have been added there in order to reduce the
+        dependencies between Range and the rendering code. This patch moves it to a
+        static method in RenderObject.
+
+        Tests: existing tests, no new feature added by this patch.
+
+        * dom/Range.cpp:
+        * dom/Range.h:
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::absoluteBoundingBoxRectForRange):
+        (WebCore):
+        * rendering/RenderObject.h:
+        (RenderObject):
+
 2012-08-20  Ryosuke Niwa  <[email protected]>
 
         Replace isolate || bidi-override by isolate-override

Modified: trunk/Source/WebCore/dom/Range.cpp (126073 => 126074)


--- trunk/Source/WebCore/dom/Range.cpp	2012-08-20 21:38:42 UTC (rev 126073)
+++ trunk/Source/WebCore/dom/Range.cpp	2012-08-20 21:41:02 UTC (rev 126074)
@@ -1961,23 +1961,6 @@
     return result;
 }
 
-FloatRect Range::transformFriendlyBoundingBox() const
-{
-    if (!m_start.container())
-        return FloatRect();
-
-    m_ownerDocument->updateLayoutIgnorePendingStylesheets();
-
-    Vector<FloatQuad> quads;
-    textQuads(quads);
-
-    FloatRect result;
-    for (size_t i = 0; i < quads.size(); ++i)
-        result.unite(quads[i].boundingBox());
-
-    return result;
-}
-
 } // namespace WebCore
 
 #ifndef NDEBUG

Modified: trunk/Source/WebCore/dom/Range.h (126073 => 126074)


--- trunk/Source/WebCore/dom/Range.h	2012-08-20 21:38:42 UTC (rev 126073)
+++ trunk/Source/WebCore/dom/Range.h	2012-08-20 21:41:02 UTC (rev 126074)
@@ -117,7 +117,7 @@
         PartiallyFixedPosition,
         EntirelyFixedPosition
     };
-    
+
     // Not transform-friendly
     void textRects(Vector<IntRect>&, bool useSelectionHeight = false, RangeInFixedPosition* = 0) const;
     IntRect boundingBox() const;
@@ -126,7 +126,6 @@
     void textQuads(Vector<FloatQuad>&, bool useSelectionHeight = false, RangeInFixedPosition* = 0) const;
     void getBorderAndTextQuads(Vector<FloatQuad>&) const;
     FloatRect boundingRect() const;
-    FloatRect transformFriendlyBoundingBox() const;
 
     void nodeChildrenChanged(ContainerNode*);
     void nodeChildrenWillBeRemoved(ContainerNode*);

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (126073 => 126074)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2012-08-20 21:38:42 UTC (rev 126073)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2012-08-20 21:41:02 UTC (rev 126074)
@@ -1204,6 +1204,24 @@
     }
 }
 
+FloatRect RenderObject::absoluteBoundingBoxRectForRange(const Range* range)
+{
+    if (!range || !range->startContainer())
+        return FloatRect();
+
+    if (range->ownerDocument())
+        range->ownerDocument()->updateLayout();
+
+    Vector<FloatQuad> quads;
+    range->textQuads(quads);
+
+    FloatRect result;
+    for (size_t i = 0; i < quads.size(); ++i)
+        result.unite(quads[i].boundingBox());
+
+    return result;
+}
+
 void RenderObject::addAbsoluteRectForLayer(LayoutRect& result)
 {
     if (hasLayer())

Modified: trunk/Source/WebCore/rendering/RenderObject.h (126073 => 126074)


--- trunk/Source/WebCore/rendering/RenderObject.h	2012-08-20 21:38:42 UTC (rev 126073)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2012-08-20 21:41:02 UTC (rev 126074)
@@ -711,6 +711,8 @@
 
     void absoluteFocusRingQuads(Vector<FloatQuad>&);
 
+    static FloatRect absoluteBoundingBoxRectForRange(const Range*);
+
     // the rect that will be painted if this object is passed as the paintingRoot
     LayoutRect paintingRootRect(LayoutRect& topLevelRect);
 

Modified: trunk/Source/WebKit/chromium/ChangeLog (126073 => 126074)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-08-20 21:38:42 UTC (rev 126073)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-08-20 21:41:02 UTC (rev 126074)
@@ -1,5 +1,20 @@
 2012-08-20  Leandro Gracia Gil  <[email protected]>
 
+        Move transformFriendlyBoundingBox out of Range
+        https://bugs.webkit.org/show_bug.cgi?id=94366
+
+        Reviewed by Ryosuke Niwa.
+
+        Update the WebKit code that makes use of transformFriendlyBoundingBox.
+
+        * src/FindInPageCoordinates.cpp:
+        (WebKit::findInPageRectFromRange):
+        * src/WebFrameImpl.cpp:
+        (WebKit::WebFrameImpl::find):
+        (WebKit::WebFrameImpl::selectFindMatch):
+
+2012-08-20  Leandro Gracia Gil  <[email protected]>
+
         [Chromium] detectContentIntentAround has a misleading name
         https://bugs.webkit.org/show_bug.cgi?id=94349
 

Modified: trunk/Source/WebKit/chromium/src/FindInPageCoordinates.cpp (126073 => 126074)


--- trunk/Source/WebKit/chromium/src/FindInPageCoordinates.cpp	2012-08-20 21:38:42 UTC (rev 126073)
+++ trunk/Source/WebKit/chromium/src/FindInPageCoordinates.cpp	2012-08-20 21:41:02 UTC (rev 126074)
@@ -136,7 +136,7 @@
     if (!range || !range->firstNode())
         return FloatRect();
 
-    return findInPageRectFromAbsoluteRect(range->transformFriendlyBoundingBox(), range->firstNode()->renderer());
+    return findInPageRectFromAbsoluteRect(RenderObject::absoluteBoundingBoxRectForRange(range), range->firstNode()->renderer());
 }
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp (126073 => 126074)


--- trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp	2012-08-20 21:38:42 UTC (rev 126073)
+++ trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp	2012-08-20 21:41:02 UTC (rev 126074)
@@ -1671,7 +1671,7 @@
     }
 
 #if OS(ANDROID)
-    viewImpl()->zoomToFindInPageRect(frameView()->contentsToWindow(enclosingIntRect(m_activeMatch->transformFriendlyBoundingBox())));
+    viewImpl()->zoomToFindInPageRect(frameView()->contentsToWindow(enclosingIntRect(RenderObject::absoluteBoundingBoxRectForRange(m_activeMatch.get()))));
 #endif
 
     setMarkerActive(m_activeMatch.get(), true);
@@ -2149,7 +2149,7 @@
     }
 
     IntRect activeMatchRect;
-    IntRect activeMatchBoundingBox = enclosingIntRect(m_activeMatch->transformFriendlyBoundingBox());
+    IntRect activeMatchBoundingBox = enclosingIntRect(RenderObject::absoluteBoundingBoxRectForRange(m_activeMatch.get()));
 
     if (!activeMatchBoundingBox.isEmpty()) {
         if (m_activeMatch->firstNode() && m_activeMatch->firstNode()->renderer())
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to