mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 02:02:45 +00:00 
			
		
		
		
	 c37820b898
			
		
	
	
		c37820b898
		
	
	
	
	
		
			
			https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules "The compiler is more likely to get the default semantics right and you cannot implement these functions better than the compiler."
		
			
				
	
	
		
			33 lines
		
	
	
	
		
			657 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
	
		
			657 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <LibWeb/DOM/Document.h>
 | |
| #include <LibWeb/HTML/EventLoop/Task.h>
 | |
| 
 | |
| namespace Web::HTML {
 | |
| 
 | |
| Task::Task(Source source, DOM::Document* document, Function<void()> steps)
 | |
|     : m_source(source)
 | |
|     , m_steps(move(steps))
 | |
|     , m_document(document)
 | |
| {
 | |
| }
 | |
| 
 | |
| Task::~Task() = default;
 | |
| 
 | |
| void Task::execute()
 | |
| {
 | |
|     m_steps();
 | |
| }
 | |
| 
 | |
| // https://html.spec.whatwg.org/#concept-task-runnable
 | |
| bool Task::is_runnable() const
 | |
| {
 | |
|     // A task is runnable if its document is either null or fully active.
 | |
|     return !m_document || m_document->is_fully_active();
 | |
| }
 | |
| 
 | |
| }
 |