mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-25 01:19:45 +00:00 
			
		
		
		
	Resulting in a massive rename across almost everywhere! Alongside the namespace change, we now have the following names: * JS::NonnullGCPtr -> GC::Ref * JS::GCPtr -> GC::Ptr * JS::HeapFunction -> GC::Function * JS::CellImpl -> GC::Cell * JS::Handle -> GC::Root
		
			
				
	
	
		
			35 lines
		
	
	
	
		
			777 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
	
		
			777 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.org>
 | |
|  * Copyright (c) 2021, Max Wipfli <mail@maxwipfli.ch>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <LibWeb/DOM/Node.h>
 | |
| #include <LibWeb/DOM/Position.h>
 | |
| #include <LibWeb/DOM/Text.h>
 | |
| 
 | |
| namespace Web::DOM {
 | |
| 
 | |
| GC_DEFINE_ALLOCATOR(Position);
 | |
| 
 | |
| Position::Position(GC::Ptr<Node> node, unsigned offset)
 | |
|     : m_node(node)
 | |
|     , m_offset(offset)
 | |
| {
 | |
| }
 | |
| 
 | |
| void Position::visit_edges(Visitor& visitor)
 | |
| {
 | |
|     Base::visit_edges(visitor);
 | |
|     visitor.visit(m_node);
 | |
| }
 | |
| 
 | |
| ErrorOr<String> Position::to_string() const
 | |
| {
 | |
|     if (!node())
 | |
|         return String::formatted("DOM::Position(nullptr, {})", offset());
 | |
|     return String::formatted("DOM::Position({} ({})), {})", node()->node_name(), node().ptr(), offset());
 | |
| }
 | |
| 
 | |
| }
 |