summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb/Layout/LayoutPosition.cpp
diff options
context:
space:
mode:
authorasynts <asynts@gmail.com>2020-12-01 23:35:47 +0100
committerAndreas Kling <kling@serenityos.org>2020-12-09 21:05:06 +0100
commitbbcc5a93321fa34b537e5b635040357c4d49f5d6 (patch)
treee8644730e5ebfaba52196008883addc372d31598 /Libraries/LibWeb/Layout/LayoutPosition.cpp
parent82aac98bea5bf69897e63df4f883470ed7cb3012 (diff)
downloadserenity-bbcc5a93321fa34b537e5b635040357c4d49f5d6.zip
LibWeb: Move editing stuff into EditEventHandler.
Diffstat (limited to 'Libraries/LibWeb/Layout/LayoutPosition.cpp')
-rw-r--r--Libraries/LibWeb/Layout/LayoutPosition.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/Libraries/LibWeb/Layout/LayoutPosition.cpp b/Libraries/LibWeb/Layout/LayoutPosition.cpp
index db0f8f2de1..b2b46b7343 100644
--- a/Libraries/LibWeb/Layout/LayoutPosition.cpp
+++ b/Libraries/LibWeb/Layout/LayoutPosition.cpp
@@ -24,11 +24,21 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <LibWeb/DOM/Position.h>
#include <LibWeb/Layout/LayoutPosition.h>
#include <LibWeb/Layout/Node.h>
namespace Web::Layout {
+DOM::Position LayoutPosition::to_dom_position() const
+{
+ if (!layout_node)
+ return {};
+
+ // FIXME: Verify that there are no shenanigans going on.
+ return { const_cast<DOM::Node&>(*layout_node->dom_node()), (unsigned)index_in_node };
+}
+
LayoutRange LayoutRange::normalized() const
{
if (!is_valid())