mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 12:22:44 +00:00 
			
		
		
		
	 d4932196cc
			
		
	
	
		d4932196cc
		
	
	
	
	
		
			
			With this change, instead of applying only the border-radius clipping from the closest containing block with hidden overflow, we now collect all boxes within the containing block chain and apply the clipping from all of them.
		
			
				
	
	
		
			40 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <LibWeb/Painting/BorderRadiiData.h>
 | |
| #include <LibWeb/PixelUnits.h>
 | |
| 
 | |
| namespace Web::Painting {
 | |
| 
 | |
| struct BorderRadiiClip {
 | |
|     CSSPixelRect rect;
 | |
|     BorderRadiiData radii;
 | |
| };
 | |
| 
 | |
| struct ClipFrame : public RefCounted<ClipFrame> {
 | |
|     Vector<BorderRadiiClip> const& border_radii_clips() const { return m_border_radii_clips; }
 | |
|     void add_border_radii_clip(BorderRadiiClip border_radii_clip)
 | |
|     {
 | |
|         for (auto& existing_clip : m_border_radii_clips) {
 | |
|             if (border_radii_clip.rect == existing_clip.rect) {
 | |
|                 existing_clip.radii.union_max_radii(border_radii_clip.radii);
 | |
|                 return;
 | |
|             }
 | |
|         }
 | |
|         m_border_radii_clips.append(border_radii_clip);
 | |
|     }
 | |
| 
 | |
|     CSSPixelRect rect() const { return m_rect; }
 | |
|     void set_rect(CSSPixelRect rect) { m_rect = rect; }
 | |
| 
 | |
| private:
 | |
|     CSSPixelRect m_rect;
 | |
|     Vector<BorderRadiiClip> m_border_radii_clips;
 | |
| };
 | |
| 
 | |
| }
 |