mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:12:45 +00:00 
			
		
		
		
	LibWeb: Make Document::run_the_document_write_steps take a StringView
Which flows on down into HTMLTokenizer::insert_input_at_insertion_point.
This commit is contained in:
		
							parent
							
								
									827170f6e6
								
							
						
					
					
						commit
						49eb3bfb1d
					
				
					 4 changed files with 6 additions and 6 deletions
				
			
		|  | @ -415,7 +415,7 @@ WebIDL::ExceptionOr<void> Document::write(Vector<DeprecatedString> const& string | ||||||
|     StringBuilder builder; |     StringBuilder builder; | ||||||
|     builder.join(""sv, strings); |     builder.join(""sv, strings); | ||||||
| 
 | 
 | ||||||
|     return run_the_document_write_steps(builder.to_deprecated_string()); |     return run_the_document_write_steps(builder.string_view()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-document-writeln
 | // https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-document-writeln
 | ||||||
|  | @ -425,11 +425,11 @@ WebIDL::ExceptionOr<void> Document::writeln(Vector<DeprecatedString> const& stri | ||||||
|     builder.join(""sv, strings); |     builder.join(""sv, strings); | ||||||
|     builder.append("\n"sv); |     builder.append("\n"sv); | ||||||
| 
 | 
 | ||||||
|     return run_the_document_write_steps(builder.to_deprecated_string()); |     return run_the_document_write_steps(builder.string_view()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#document-write-steps
 | // https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#document-write-steps
 | ||||||
| WebIDL::ExceptionOr<void> Document::run_the_document_write_steps(DeprecatedString input) | WebIDL::ExceptionOr<void> Document::run_the_document_write_steps(StringView input) | ||||||
| { | { | ||||||
|     // 1. If document is an XML document, then throw an "InvalidStateError" DOMException.
 |     // 1. If document is an XML document, then throw an "InvalidStateError" DOMException.
 | ||||||
|     if (m_type == Type::XML) |     if (m_type == Type::XML) | ||||||
|  |  | ||||||
|  | @ -546,7 +546,7 @@ private: | ||||||
| 
 | 
 | ||||||
|     void evaluate_media_rules(); |     void evaluate_media_rules(); | ||||||
| 
 | 
 | ||||||
|     WebIDL::ExceptionOr<void> run_the_document_write_steps(DeprecatedString); |     WebIDL::ExceptionOr<void> run_the_document_write_steps(StringView); | ||||||
| 
 | 
 | ||||||
|     void queue_intersection_observer_task(); |     void queue_intersection_observer_task(); | ||||||
|     void queue_an_intersection_observer_entry(IntersectionObserver::IntersectionObserver&, HighResolutionTime::DOMHighResTimeStamp time, JS::NonnullGCPtr<Geometry::DOMRectReadOnly> root_bounds, JS::NonnullGCPtr<Geometry::DOMRectReadOnly> bounding_client_rect, JS::NonnullGCPtr<Geometry::DOMRectReadOnly> intersection_rect, bool is_intersecting, double intersection_ratio, JS::NonnullGCPtr<Element> target); |     void queue_an_intersection_observer_entry(IntersectionObserver::IntersectionObserver&, HighResolutionTime::DOMHighResTimeStamp time, JS::NonnullGCPtr<Geometry::DOMRectReadOnly> root_bounds, JS::NonnullGCPtr<Geometry::DOMRectReadOnly> bounding_client_rect, JS::NonnullGCPtr<Geometry::DOMRectReadOnly> intersection_rect, bool is_intersecting, double intersection_ratio, JS::NonnullGCPtr<Element> target); | ||||||
|  |  | ||||||
|  | @ -2799,7 +2799,7 @@ HTMLTokenizer::HTMLTokenizer(StringView input, DeprecatedString const& encoding) | ||||||
|     m_source_positions.empend(0u, 0u); |     m_source_positions.empend(0u, 0u); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void HTMLTokenizer::insert_input_at_insertion_point(DeprecatedString const& input) | void HTMLTokenizer::insert_input_at_insertion_point(StringView input) | ||||||
| { | { | ||||||
|     auto utf8_iterator_byte_offset = m_utf8_view.byte_offset_of(m_utf8_iterator); |     auto utf8_iterator_byte_offset = m_utf8_view.byte_offset_of(m_utf8_iterator); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -126,7 +126,7 @@ public: | ||||||
| 
 | 
 | ||||||
|     DeprecatedString source() const { return m_decoded_input; } |     DeprecatedString source() const { return m_decoded_input; } | ||||||
| 
 | 
 | ||||||
|     void insert_input_at_insertion_point(DeprecatedString const& input); |     void insert_input_at_insertion_point(StringView input); | ||||||
|     void insert_eof(); |     void insert_eof(); | ||||||
|     bool is_eof_inserted(); |     bool is_eof_inserted(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Shannon Booth
						Shannon Booth