浏览代码

LibWeb: Set direction to forwards in addRange

Gingeh 9 月之前
父节点
当前提交
93927d8243
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      Userland/Libraries/LibWeb/Selection/Selection.cpp

+ 3 - 0
Userland/Libraries/LibWeb/Selection/Selection.cpp

@@ -152,6 +152,9 @@ void Selection::add_range(JS::NonnullGCPtr<DOM::Range> range)
 
 
     // 3. Set this's range to range by a strong reference (not by making a copy).
     // 3. Set this's range to range by a strong reference (not by making a copy).
     set_range(range);
     set_range(range);
+
+    // AD-HOC: WPT selection/removeAllRanges.html and selection/addRange.htm expect this
+    m_direction = Direction::Forwards;
 }
 }
 
 
 // https://w3c.github.io/selection-api/#dom-selection-removerange
 // https://w3c.github.io/selection-api/#dom-selection-removerange