REGRESSION(r169105): fast/regions/cssom/region-range-for-box-crash.html is more crash...
authormihnea@adobe.com <mihnea@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 May 2014 19:01:27 +0000 (19:01 +0000)
committermihnea@adobe.com <mihnea@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 May 2014 19:01:27 +0000 (19:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=133124

Reviewed by David Hyatt.

Source/WebCore:
When adjusting the end points of a subtree selection in the case of a document
with named flows, we have to make sure that we pass the computed end
points to the visible selection algorithm only if the end points are
part of the same subtree, otherwise assume a selection clear behavior.

The test fast/regions/cssom/region-range-for-box-crash.html is used to
test this behavior.

* rendering/SelectionSubtreeRoot.cpp:
(WebCore::SelectionSubtreeRoot::adjustForVisibleSelection):
(WebCore::SelectionSubtreeRoot::selectionStartEndPositions): Moved to header file.
* rendering/SelectionSubtreeRoot.h:
(WebCore::SelectionSubtreeRoot::selectionStartEndPositions):

LayoutTests:
Unskip the test file that used to crash.

* TestExpectations:

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

LayoutTests/ChangeLog
LayoutTests/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/rendering/SelectionSubtreeRoot.cpp
Source/WebCore/rendering/SelectionSubtreeRoot.h

index 8da1ee2..cb94420 100644 (file)
@@ -1,3 +1,14 @@
+2014-05-23  Mihnea Ovidenie  <mihnea@adobe.com>
+
+        REGRESSION(r169105): fast/regions/cssom/region-range-for-box-crash.html is more crashy than before
+        https://bugs.webkit.org/show_bug.cgi?id=133124
+
+        Reviewed by David Hyatt.
+
+        Unskip the test file that used to crash.
+
+        * TestExpectations:
+
 2014-05-23  Mark Hahnenberg  <mhahnenberg@apple.com>
 
         Rebaseline some tests after r169260
index 6ad3b95..c04a3d0 100644 (file)
@@ -122,4 +122,3 @@ webkit.org/b/132791 svg/as-object/sizing/svg-in-object-placeholder-height-fixed.
 webkit.org/b/132791 svg/as-object/sizing/svg-in-object-placeholder-height-percentage.html [ Skip ]
 webkit.org/b/132791 svg/as-object/sizing/svg-in-object-placeholder-height-auto.html [ Skip ]
 
-webkit.org/b/133124 fast/regions/cssom/region-range-for-box-crash.html [ Skip ]
index f41ce2d..f04f822 100644 (file)
@@ -1,3 +1,24 @@
+2014-05-23  Mihnea Ovidenie  <mihnea@adobe.com>
+
+        REGRESSION(r169105): fast/regions/cssom/region-range-for-box-crash.html is more crashy than before
+        https://bugs.webkit.org/show_bug.cgi?id=133124
+
+        Reviewed by David Hyatt.
+
+        When adjusting the end points of a subtree selection in the case of a document
+        with named flows, we have to make sure that we pass the computed end
+        points to the visible selection algorithm only if the end points are
+        part of the same subtree, otherwise assume a selection clear behavior.
+
+        The test fast/regions/cssom/region-range-for-box-crash.html is used to
+        test this behavior.
+
+        * rendering/SelectionSubtreeRoot.cpp:
+        (WebCore::SelectionSubtreeRoot::adjustForVisibleSelection):
+        (WebCore::SelectionSubtreeRoot::selectionStartEndPositions): Moved to header file.
+        * rendering/SelectionSubtreeRoot.h:
+        (WebCore::SelectionSubtreeRoot::selectionStartEndPositions):
+
 2014-05-23  Jeremy Jones  <jeremyj@apple.com>
 
         reset m_havePreparedToPlay when changing media engines.
index 3688108..5cfd3fc 100644 (file)
@@ -45,12 +45,6 @@ SelectionSubtreeRoot::SelectionSubtreeRoot()
 {
 }
 
-void SelectionSubtreeRoot::selectionStartEndPositions(int& startPos, int& endPos) const
-{
-    startPos = m_selectionStartPos;
-    endPos = m_selectionEndPos;
-}
-
 void SelectionSubtreeRoot::adjustForVisibleSelection(Document& document)
 {
     if (selectionClear())
@@ -77,7 +71,10 @@ void SelectionSubtreeRoot::adjustForVisibleSelection(Document& document)
     m_selectionEnd = nullptr;
     m_selectionEndPos = -1;
 
-    if (startPos.isNotNull() && endPos.isNotNull() && selection.visibleStart() != selection.visibleEnd()) {
+    if (startPos.isNotNull()
+        && endPos.isNotNull()
+        && selection.visibleStart() != selection.visibleEnd()
+        && startPos.deprecatedNode()->renderer()->flowThreadContainingBlock() == endPos.deprecatedNode()->renderer()->flowThreadContainingBlock()) {
         m_selectionStart = startPos.deprecatedNode()->renderer();
         m_selectionStartPos = startPos.deprecatedEditingOffset();
         m_selectionEnd = endPos.deprecatedNode()->renderer();
index aa4cd0c..35cef11 100644 (file)
@@ -45,7 +45,12 @@ public:
     int selectionStartPos() const { return m_selectionStartPos; }
     RenderObject* selectionEnd() const { return m_selectionEnd; }
     int selectionEndPos() const { return m_selectionEndPos; }
-    void selectionStartEndPositions(int& startPos, int& endPos) const;
+    void selectionStartEndPositions(int& startPos, int& endPos) const
+    {
+        startPos = m_selectionStartPos;
+        endPos = m_selectionEndPos;
+    }
+
     bool selectionClear() const
     {
         return !m_selectionStart