mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 17:12:43 +00:00 
			
		
		
		
	 5ff7448fee
			
		
	
	
		5ff7448fee
		
	
	
	
	
		
			
			With this change, elements that want to receive viewport rect updates will need to register on document instead of the browsing context. This change solves the problem where a browsing context for a document is guaranteed to exist only while the document is active so browsing context might not exit by the time DOM node that want to register is constructed. This is a part of preparation work before switching to navigables where this issue becomes more visible.
		
			
				
	
	
		
			36 lines
		
	
	
	
		
			793 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
	
		
			793 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <LibWeb/Layout/ImageBox.h>
 | |
| #include <LibWeb/Painting/PaintableBox.h>
 | |
| 
 | |
| namespace Web::Painting {
 | |
| 
 | |
| class ImagePaintable final
 | |
|     : public PaintableBox
 | |
|     , public DOM::Document::ViewportClient {
 | |
|     JS_CELL(ImagePaintable, PaintableBox);
 | |
| 
 | |
| public:
 | |
|     static JS::NonnullGCPtr<ImagePaintable> create(Layout::ImageBox const&);
 | |
| 
 | |
|     virtual void paint(PaintContext&, PaintPhase) const override;
 | |
| 
 | |
|     Layout::ImageBox const& layout_box() const;
 | |
| 
 | |
| private:
 | |
|     // ^JS::Cell
 | |
|     virtual void finalize() override;
 | |
| 
 | |
|     // ^Document::ViewportClient
 | |
|     virtual void did_set_viewport_rect(CSSPixelRect const&) final;
 | |
| 
 | |
|     ImagePaintable(Layout::ImageBox const&);
 | |
| };
 | |
| 
 | |
| }
 |