Title: [92059] trunk
Revision
92059
Author
[email protected]
Date
2011-07-30 16:51:31 -0700 (Sat, 30 Jul 2011)

Log Message

REGRESSION: culledInlineAbsoluteRects needs to translate a 0,0 point to absolute
coordinates so that the top left position is accurate.
https://bugs.webkit.org/show_bug.cgi?id=65419
<rdar://problem/9408862>

Source/WebCore: 

This patch fixes a regression introduced in r83075.
Make sure that culledInlineAbsoluteRects still does
a translation of a 0,0 point to absolute coordinates so that the top left position is
accurate.
This code path could not be tested via _javascript_. The patch
extends the Internals object to be able to test this case.

Reviewed by Dan Bernstein.

Test: fast/inline/skipped-whitespace-boundingBox.html

* WebCore.exp.in: Added some exports.
* rendering/RenderInline.cpp:
(WebCore::RenderInline::culledInlineAbsoluteRects):
* testing/Internals.cpp:
(WebCore::Internals::boundingBox):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests: 

Reviewed by Dan Bernstein.

* fast/inline/skipped-whitespace-boundingBox-expected.txt: Added.
* fast/inline/skipped-whitespace-boundingBox.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (92058 => 92059)


--- trunk/LayoutTests/ChangeLog	2011-07-30 23:10:19 UTC (rev 92058)
+++ trunk/LayoutTests/ChangeLog	2011-07-30 23:51:31 UTC (rev 92059)
@@ -1,3 +1,15 @@
+2011-07-30  Enrica Casucci  <[email protected]>
+
+        REGRESSION: culledInlineAbsoluteRects needs to translate a 0,0 point to absolute
+        coordinates so that the top left position is accurate.
+        https://bugs.webkit.org/show_bug.cgi?id=65419
+        <rdar://problem/9408862>
+
+        Reviewed by Dan Bernstein.
+
+        * fast/inline/skipped-whitespace-boundingBox-expected.txt: Added.
+        * fast/inline/skipped-whitespace-boundingBox.html: Added.
+
 2011-07-26  Pavel Podivilov  <[email protected]>
 
         Web Inspector: move location conversion functions to SourceFile.

Added: trunk/LayoutTests/fast/inline/skipped-whitespace-boundingBox-expected.txt (0 => 92059)


--- trunk/LayoutTests/fast/inline/skipped-whitespace-boundingBox-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/skipped-whitespace-boundingBox-expected.txt	2011-07-30 23:51:31 UTC (rev 92059)
@@ -0,0 +1 @@
+PASS

Added: trunk/LayoutTests/fast/inline/skipped-whitespace-boundingBox.html (0 => 92059)


--- trunk/LayoutTests/fast/inline/skipped-whitespace-boundingBox.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/skipped-whitespace-boundingBox.html	2011-07-30 23:51:31 UTC (rev 92059)
@@ -0,0 +1,24 @@
+<!doctype html>
+<html>
+<head>
+<script>
+if (window.layoutTestController)
+    window.layoutTestController.dumpAsText()
+
+function runTest()
+{
+    var elem = document.getElementById('test');
+    if (window.internals) {
+        var rect = internals.boundingBox(elem);
+        if (rect.top > 0 || rect.left > 0)
+            document.getElementById('console').innerHTML = 'PASS';
+    }
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<div>   <a id="test"></a>    </div>
+<div id="console">FAIL</div>
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (92058 => 92059)


--- trunk/Source/WebCore/ChangeLog	2011-07-30 23:10:19 UTC (rev 92058)
+++ trunk/Source/WebCore/ChangeLog	2011-07-30 23:51:31 UTC (rev 92059)
@@ -1,3 +1,29 @@
+2011-07-30  Enrica Casucci  <[email protected]>
+
+        REGRESSION: culledInlineAbsoluteRects needs to translate a 0,0 point to absolute
+        coordinates so that the top left position is accurate.
+        https://bugs.webkit.org/show_bug.cgi?id=65419
+        <rdar://problem/9408862>
+
+        This patch fixes a regression introduced in r83075.
+        Make sure that culledInlineAbsoluteRects still does
+        a translation of a 0,0 point to absolute coordinates so that the top left position is
+        accurate.
+        This code path could not be tested via _javascript_. The patch
+        extends the Internals object to be able to test this case.
+
+        Reviewed by Dan Bernstein.
+
+        Test: fast/inline/skipped-whitespace-boundingBox.html
+
+        * WebCore.exp.in: Added some exports.
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::culledInlineAbsoluteRects):
+        * testing/Internals.cpp:
+        (WebCore::Internals::boundingBox):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2011-07-26  Pavel Podivilov  <[email protected]>
 
         Web Inspector: move location conversion functions to SourceFile.

Modified: trunk/Source/WebCore/WebCore.exp.in (92058 => 92059)


--- trunk/Source/WebCore/WebCore.exp.in	2011-07-30 23:10:19 UTC (rev 92058)
+++ trunk/Source/WebCore/WebCore.exp.in	2011-07-30 23:51:31 UTC (rev 92059)
@@ -152,6 +152,9 @@
 __ZN7WebCore10handCursorEv
 __ZN7WebCore10setCookiesEPNS_8DocumentERKNS_4KURLERKN3WTF6StringE
 __ZN7WebCore10toDocumentEN3JSC7JSValueE
+__ZN7WebCore10ClientRectC1Ev
+__ZN7WebCore10ClientRectC1ERKNS_7IntRectE
+__ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_10ClientRectE
 __ZN7WebCore11BitmapImageC1EP7CGImagePNS_13ImageObserverE
 __ZN7WebCore11CachedFrame23cachedFramePlatformDataEv
 __ZN7WebCore11CachedFrame26setCachedFramePlatformDataEN3WTF10PassOwnPtrINS_23CachedFramePlatformDataEEE
@@ -280,6 +283,7 @@
 __ZN7WebCore12PrintContextC1EPNS_5FrameE
 __ZN7WebCore12PrintContextD1Ev
 __ZN7WebCore12RenderObject16repaintRectangleERKNS_7IntRectEb
+__ZN7WebCore12RenderObject23absoluteBoundingBoxRectEb
 __ZN7WebCore12RenderWidget19showSubstituteImageEN3WTF10PassRefPtrINS_5ImageEEE
 __ZN7WebCore12RenderWidget28resumeWidgetHierarchyUpdatesEv
 __ZN7WebCore12RenderWidget29suspendWidgetHierarchyUpdatesEv

Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (92058 => 92059)


--- trunk/Source/WebCore/rendering/RenderInline.cpp	2011-07-30 23:10:19 UTC (rev 92058)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp	2011-07-30 23:51:31 UTC (rev 92059)
@@ -486,6 +486,11 @@
 
 void RenderInline::culledInlineAbsoluteRects(const RenderInline* container, Vector<IntRect>& rects, const IntSize& offset)
 {
+    if (!culledInlineFirstLineBox()) {
+        rects.append(IntRect(offset.width(), offset.height(), 0, 0));
+        return;
+    }
+
     bool isHorizontal = style()->isHorizontalWritingMode();
     for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) {
         if (curr->isFloatingOrPositioned())

Modified: trunk/Source/WebCore/testing/Internals.cpp (92058 => 92059)


--- trunk/Source/WebCore/testing/Internals.cpp	2011-07-30 23:10:19 UTC (rev 92058)
+++ trunk/Source/WebCore/testing/Internals.cpp	2011-07-30 23:51:31 UTC (rev 92059)
@@ -27,12 +27,14 @@
 #include "Internals.h"
 
 #include "CachedResourceLoader.h"
+#include "ClientRect.h"
 #include "Document.h"
 #include "Element.h"
 #include "ExceptionCode.h"
 #include "InspectorController.h"
 #include "NodeRenderingContext.h"
 #include "Page.h"
+#include "RenderObject.h"
 #include "RenderTreeAsText.h"
 #include "ShadowContentElement.h"
 #include "ShadowRoot.h"
@@ -147,4 +149,18 @@
 }
 #endif
 
+PassRefPtr<ClientRect> Internals::boundingBox(Element* element, ExceptionCode& ec)
+{
+    if (!element) {
+        ec = INVALID_ACCESS_ERR;
+        return ClientRect::create();
+    }
+
+    element->document()->updateLayoutIgnorePendingStylesheets();
+    RenderObject* renderer = element->renderer();
+    if (!renderer)
+        return ClientRect::create();
+    return ClientRect::create(renderer->absoluteBoundingBoxRect());
 }
+
+}

Modified: trunk/Source/WebCore/testing/Internals.h (92058 => 92059)


--- trunk/Source/WebCore/testing/Internals.h	2011-07-30 23:10:19 UTC (rev 92058)
+++ trunk/Source/WebCore/testing/Internals.h	2011-07-30 23:51:31 UTC (rev 92059)
@@ -34,6 +34,7 @@
 
 namespace WebCore {
 
+class ClientRect;
 class Document;
 class Element;
 class Node;
@@ -60,6 +61,8 @@
     void setInspectorResourcesDataSizeLimits(Document*, int maximumResourcesContentSize, int maximumSingleResourceContentSize, ExceptionCode&) { }
 #endif
 
+    PassRefPtr<ClientRect> boundingBox(Element*, ExceptionCode&);
+
 private:
     Internals();
 };

Modified: trunk/Source/WebCore/testing/Internals.idl (92058 => 92059)


--- trunk/Source/WebCore/testing/Internals.idl	2011-07-30 23:10:19 UTC (rev 92058)
+++ trunk/Source/WebCore/testing/Internals.idl	2011-07-30 23:51:31 UTC (rev 92059)
@@ -38,6 +38,8 @@
         Element createShadowContentElement(in Document document) raises(DOMException);
 
         void setInspectorResourcesDataSizeLimits(in Document document, in long maximumResourcesContentSize, in long maximumSingleResourceContentSize) raises(DOMException);
+
+        ClientRect boundingBox(in Element element) raises(DOMException);
     };
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to