Title: [122802] trunk
Revision
122802
Author
[email protected]
Date
2012-07-16 20:26:00 -0700 (Mon, 16 Jul 2012)

Log Message

REGRESSION: RenderInline::absoluteQuads produces incorrect results for fixed position.
https://bugs.webkit.org/show_bug.cgi?id=91451

Patch by Kiran Muppala <[email protected]> on 2012-07-16
Reviewed by Simon Fraser.

Source/WebCore:

RenderInline::absoluteQuads relies on copies of RenderGeometryMap,
created indirectly by passing AbsoluteQuadsGeneratorContext object by
value.  These copies are unsafe because the individual transform steps
within the geometry map include a owned poitner to their respective
transform.

Modify the callee methods to take context by reference and disable
copy constructor for RenderGeometryMap.

Test: fast/inline/inline-fixed-position-boundingbox.html

* rendering/RenderGeometryMap.h:
(WebCore::RenderGeometryMapStep::RenderGeometryMapStep): Add missing
m_offset to copy constructor initialization list.
(RenderGeometryMap): Disable copy constructor.
* rendering/RenderInline.cpp: Pass context object by reference.
(WebCore::RenderInline::generateLineBoxRects):
(WebCore::RenderInline::generateCulledLineBoxRects):
(WebCore::RenderInline::absoluteRects):
(WebCore::RenderInline::absoluteQuads):
(WebCore::RenderInline::linesBoundingBox):
(WebCore::RenderInline::culledInlineVisualOverflowBoundingBox):
(WebCore::RenderInline::addFocusRingRects):
* rendering/RenderInline.h:
(RenderInline::generateLineBoxRects): Update method declarations to
show pass by reference context parameter.
(RenderInline::generateCulledLineBoxRects): Ditto.

LayoutTests:

Add a regression test for boundingBox of an inline element with fixed position.

* fast/inline/inline-fixed-position-boundingbox-expected.txt: Added.
* fast/inline/inline-fixed-position-boundingbox.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (122801 => 122802)


--- trunk/LayoutTests/ChangeLog	2012-07-17 03:24:33 UTC (rev 122801)
+++ trunk/LayoutTests/ChangeLog	2012-07-17 03:26:00 UTC (rev 122802)
@@ -1,3 +1,15 @@
+2012-07-16  Kiran Muppala  <[email protected]>
+
+        REGRESSION: RenderInline::absoluteQuads produces incorrect results for fixed position.
+        https://bugs.webkit.org/show_bug.cgi?id=91451
+
+        Reviewed by Simon Fraser.
+
+        Add a regression test for boundingBox of an inline element with fixed position.
+
+        * fast/inline/inline-fixed-position-boundingbox-expected.txt: Added.
+        * fast/inline/inline-fixed-position-boundingbox.html: Added.
+
 2012-07-16  Hayato Ito  <[email protected]>
 
         Some events should be always stopped at shadow boundary.

Added: trunk/LayoutTests/fast/inline/inline-fixed-position-boundingbox-expected.txt (0 => 122802)


--- trunk/LayoutTests/fast/inline/inline-fixed-position-boundingbox-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/inline-fixed-position-boundingbox-expected.txt	2012-07-17 03:26:00 UTC (rev 122802)
@@ -0,0 +1,10 @@
+Bug 91451: REGRESSION: RenderInline::absoluteQuads produces incorrect results for fixed position.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS inlineRect.left is parentRect.left
+

Added: trunk/LayoutTests/fast/inline/inline-fixed-position-boundingbox.html (0 => 122802)


--- trunk/LayoutTests/fast/inline/inline-fixed-position-boundingbox.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/inline-fixed-position-boundingbox.html	2012-07-17 03:26:00 UTC (rev 122802)
@@ -0,0 +1,25 @@
+<html>
+<head>
+    <script src=""
+    <script>
+        description('<a href="" 91451</a>: REGRESSION: RenderInline::absoluteQuads produces incorrect results for fixed position.');
+
+        function runTest()
+        {
+            inline = document.getElementById("inlineElement");
+            inlineRect = inline.getBoundingClientRect();
+            parent = inline.parentNode;
+            parentRect = parent.getBoundingClientRect();
+            shouldBe("inlineRect.left", "parentRect.left");
+        }
+
+        window._onload_ = runTest;
+    </script>
+</head>
+<body>
+    <div style="position:fixed">
+        <span id="inlineElement"></span>
+    </div>
+    <script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (122801 => 122802)


--- trunk/Source/WebCore/ChangeLog	2012-07-17 03:24:33 UTC (rev 122801)
+++ trunk/Source/WebCore/ChangeLog	2012-07-17 03:26:00 UTC (rev 122802)
@@ -1,3 +1,38 @@
+2012-07-16  Kiran Muppala  <[email protected]>
+
+        REGRESSION: RenderInline::absoluteQuads produces incorrect results for fixed position.
+        https://bugs.webkit.org/show_bug.cgi?id=91451
+
+        Reviewed by Simon Fraser.
+
+        RenderInline::absoluteQuads relies on copies of RenderGeometryMap,
+        created indirectly by passing AbsoluteQuadsGeneratorContext object by
+        value.  These copies are unsafe because the individual transform steps
+        within the geometry map include a owned poitner to their respective
+        transform.
+
+        Modify the callee methods to take context by reference and disable
+        copy constructor for RenderGeometryMap.
+
+        Test: fast/inline/inline-fixed-position-boundingbox.html
+
+        * rendering/RenderGeometryMap.h:
+        (WebCore::RenderGeometryMapStep::RenderGeometryMapStep): Add missing
+        m_offset to copy constructor initialization list.
+        (RenderGeometryMap): Disable copy constructor.
+        * rendering/RenderInline.cpp: Pass context object by reference.
+        (WebCore::RenderInline::generateLineBoxRects): 
+        (WebCore::RenderInline::generateCulledLineBoxRects):
+        (WebCore::RenderInline::absoluteRects):
+        (WebCore::RenderInline::absoluteQuads):
+        (WebCore::RenderInline::linesBoundingBox):
+        (WebCore::RenderInline::culledInlineVisualOverflowBoundingBox):
+        (WebCore::RenderInline::addFocusRingRects):
+        * rendering/RenderInline.h:
+        (RenderInline::generateLineBoxRects): Update method declarations to
+        show pass by reference context parameter.
+        (RenderInline::generateCulledLineBoxRects): Ditto.
+
 2012-07-16  Hayato Ito  <[email protected]>
 
         Some events should be always stopped at shadow boundary.

Modified: trunk/Source/WebCore/rendering/RenderGeometryMap.h (122801 => 122802)


--- trunk/Source/WebCore/rendering/RenderGeometryMap.h	2012-07-17 03:24:33 UTC (rev 122801)
+++ trunk/Source/WebCore/rendering/RenderGeometryMap.h	2012-07-17 03:26:00 UTC (rev 122802)
@@ -41,6 +41,7 @@
 struct RenderGeometryMapStep {
     RenderGeometryMapStep(const RenderGeometryMapStep& o)
         : m_renderer(o.m_renderer)
+        , m_offset(o.m_offset)
         , m_accumulatingTransform(o.m_accumulatingTransform)
         , m_isNonUniform(o.m_isNonUniform)
         , m_isFixedPosition(o.m_isFixedPosition)
@@ -67,6 +68,7 @@
 
 // Can be used while walking the Renderer tree to cache data about offsets and transforms.
 class RenderGeometryMap {
+    WTF_MAKE_NONCOPYABLE(RenderGeometryMap);
 public:
     RenderGeometryMap();
     ~RenderGeometryMap();

Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (122801 => 122802)


--- trunk/Source/WebCore/rendering/RenderInline.cpp	2012-07-17 03:24:33 UTC (rev 122801)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp	2012-07-17 03:26:00 UTC (rev 122802)
@@ -533,7 +533,7 @@
 }
 
 template<typename GeneratorContext>
-void RenderInline::generateLineBoxRects(GeneratorContext yield) const
+void RenderInline::generateLineBoxRects(GeneratorContext& yield) const
 {
     if (!alwaysCreateLineBoxes())
         generateCulledLineBoxRects(yield, this);
@@ -545,7 +545,7 @@
 }
 
 template<typename GeneratorContext>
-void RenderInline::generateCulledLineBoxRects(GeneratorContext yield, const RenderInline* container) const
+void RenderInline::generateCulledLineBoxRects(GeneratorContext& yield, const RenderInline* container) const
 {
     if (!culledInlineFirstLineBox()) {
         yield(FloatRect());
@@ -631,7 +631,8 @@
 
 void RenderInline::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumulatedOffset) const
 {
-    generateLineBoxRects(AbsoluteRectsGeneratorContext(rects, accumulatedOffset));
+    AbsoluteRectsGeneratorContext context(rects, accumulatedOffset);
+    generateLineBoxRects(context);
 
     if (continuation()) {
         if (continuation()->isBox()) {
@@ -669,7 +670,8 @@
 
 void RenderInline::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const
 {
-    generateLineBoxRects(AbsoluteQuadsGeneratorContext(this, quads, wasFixed));
+    AbsoluteQuadsGeneratorContext context(this, quads, wasFixed);
+    generateLineBoxRects(context);
 
     if (continuation())
         continuation()->absoluteQuads(quads, wasFixed);
@@ -804,7 +806,8 @@
     if (!alwaysCreateLineBoxes()) {
         ASSERT(!firstLineBox());
         FloatRect floatResult;
-        generateCulledLineBoxRects(LinesBoundingBoxGeneratorContext(floatResult), this);
+        LinesBoundingBoxGeneratorContext context(floatResult);
+        generateCulledLineBoxRects(context, this);
         return enclosingIntRect(floatResult);
     }
 
@@ -888,7 +891,8 @@
 LayoutRect RenderInline::culledInlineVisualOverflowBoundingBox() const
 {
     FloatRect floatResult;
-    generateCulledLineBoxRects(LinesBoundingBoxGeneratorContext(floatResult), this);
+    LinesBoundingBoxGeneratorContext context(floatResult);
+    generateCulledLineBoxRects(context, this);
     LayoutRect result(enclosingLayoutRect(floatResult));
     bool isHorizontal = style()->isHorizontalWritingMode();
     for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) {
@@ -1354,7 +1358,8 @@
 
 void RenderInline::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& additionalOffset)
 {
-    generateLineBoxRects(AbsoluteRectsGeneratorContext(rects, additionalOffset));
+    AbsoluteRectsGeneratorContext context(rects, additionalOffset);
+    generateLineBoxRects(context);
 
     for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) {
         if (!curr->isText() && !curr->isListMarker()) {

Modified: trunk/Source/WebCore/rendering/RenderInline.h (122801 => 122802)


--- trunk/Source/WebCore/rendering/RenderInline.h	2012-07-17 03:24:33 UTC (rev 122801)
+++ trunk/Source/WebCore/rendering/RenderInline.h	2012-07-17 03:26:00 UTC (rev 122802)
@@ -106,9 +106,9 @@
     InlineBox* culledInlineLastLineBox() const;
 
     template<typename GeneratorContext>
-    void generateLineBoxRects(GeneratorContext yield) const;
+    void generateLineBoxRects(GeneratorContext& yield) const;
     template<typename GeneratorContext>
-    void generateCulledLineBoxRects(GeneratorContext yield, const RenderInline* container) const;
+    void generateCulledLineBoxRects(GeneratorContext& yield, const RenderInline* container) const;
 
     void addChildToContinuation(RenderObject* newChild, RenderObject* beforeChild);
     virtual void addChildIgnoringContinuation(RenderObject* newChild, RenderObject* beforeChild = 0);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to