Lots of crashes in WebKit1 after r172013.
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Aug 2014 01:39:24 +0000 (01:39 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Aug 2014 01:39:24 +0000 (01:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=135582
<rdar://problem/17837636>

Reviewed by Enrica Casucci.

* editing/SelectionRectGatherer.cpp:
(WebCore::SelectionRectGatherer::addRect):
(WebCore::SelectionRectGatherer::addGapRects):
Don't try to do local-to-absolute coordinate conversion if we don't have
a repaint container, which happens a lot in WebKit1.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@172018 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/editing/SelectionRectGatherer.cpp

index ba9762264bafe9fb08859f766ccf9b0a90cb34aa..18f3b6d401b2f5084c51fbd492fa04f687637f60 100644 (file)
@@ -1,3 +1,17 @@
+2014-08-04  Tim Horton  <timothy_horton@apple.com>
+
+        Lots of crashes in WebKit1 after r172013.
+        https://bugs.webkit.org/show_bug.cgi?id=135582
+        <rdar://problem/17837636>
+
+        Reviewed by Enrica Casucci.
+
+        * editing/SelectionRectGatherer.cpp:
+        (WebCore::SelectionRectGatherer::addRect):
+        (WebCore::SelectionRectGatherer::addGapRects):
+        Don't try to do local-to-absolute coordinate conversion if we don't have
+        a repaint container, which happens a lot in WebKit1.
+
 2014-08-04  Alex Christensen  <achristensen@webkit.org>
 
         Progress towards CMake on Mac.
index 1e77809e65cfca12c21e7aafa391ec811f87c882..4920b34fd528192bf52a54ec8bdc7a27546f5f54 100644 (file)
@@ -43,18 +43,23 @@ SelectionRectGatherer::SelectionRectGatherer(RenderView& renderView)
 void SelectionRectGatherer::addRect(RenderLayerModelObject *repaintContainer, const LayoutRect& rect)
 {
     if (!rect.isEmpty()) {
-        LayoutRect absoluteRect(repaintContainer->localToAbsoluteQuad(FloatQuad(rect)).boundingBox());
-        m_rects.append(absoluteRect);
+        if (repaintContainer)
+            m_rects.append(LayoutRect(repaintContainer->localToAbsoluteQuad(FloatQuad(rect)).boundingBox()));
+        else
+            m_rects.append(rect);
     }
 }
 
 void SelectionRectGatherer::addGapRects(RenderLayerModelObject *repaintContainer, const GapRects& rects)
 {
-    GapRects absoluteGapRects;
-    absoluteGapRects.uniteLeft(LayoutRect(repaintContainer->localToAbsoluteQuad(FloatQuad(rects.left())).boundingBox()));
-    absoluteGapRects.uniteCenter(LayoutRect(repaintContainer->localToAbsoluteQuad(FloatQuad(rects.center())).boundingBox()));
-    absoluteGapRects.uniteRight(LayoutRect(repaintContainer->localToAbsoluteQuad(FloatQuad(rects.right())).boundingBox()));
-    m_gapRects.append(absoluteGapRects);
+    if (repaintContainer) {
+        GapRects absoluteGapRects;
+        absoluteGapRects.uniteLeft(LayoutRect(repaintContainer->localToAbsoluteQuad(FloatQuad(rects.left())).boundingBox()));
+        absoluteGapRects.uniteCenter(LayoutRect(repaintContainer->localToAbsoluteQuad(FloatQuad(rects.center())).boundingBox()));
+        absoluteGapRects.uniteRight(LayoutRect(repaintContainer->localToAbsoluteQuad(FloatQuad(rects.right())).boundingBox()));
+        m_gapRects.append(absoluteGapRects);
+    } else
+        m_gapRects.append(rects);
 }
 
 SelectionRectGatherer::Notifier::Notifier(SelectionRectGatherer& gatherer)