Ver Fonte

pseudo elements dont invalidate the dom

mattias há 5 meses atrás
pai
commit
173f000e87
2 ficheiros alterados com 18 adições e 13 exclusões
  1. 17 12
      src/base/fresnel.dom.pas
  2. 1 1
      src/base/fresnel.renderer.pas

+ 17 - 12
src/base/fresnel.dom.pas

@@ -1279,7 +1279,7 @@ type
   end;
 
   TPseudoElement = class;
-  TFresnelScrollBar = class;
+  TPseudoElScrollBar = class;
 
   { TFresnelElement }
 
@@ -1310,8 +1310,8 @@ type
     FRendered: boolean;
     FRenderedBorderBox: TFresnelRect;
     FRenderedContentBox: TFresnelRect;
-    FScrollBarHorizontal: TFresnelScrollBar;
-    FScrollBarVertical: TFresnelScrollBar;
+    FScrollBarHorizontal: TPseudoElScrollBar;
+    FScrollBarVertical: TPseudoElScrollBar;
     FScrollLeft: TFresnelLength;
     FScrollTop: TFresnelLength;
     FStates: TStates;
@@ -1515,8 +1515,8 @@ type
     property ScrollTop: TFresnelLength read FScrollTop write SetScrollTop;
     property ScrollWidth: TFresnelLength read GetScrollWidth;
     property ScrollHeight: TFresnelLength read GetScrollHeight;
-    property ScrollBarHorizontal: TFresnelScrollBar read FScrollBarHorizontal;
-    property ScrollBarVertical: TFresnelScrollBar read FScrollBarVertical;
+    property ScrollBarHorizontal: TPseudoElScrollBar read FScrollBarHorizontal;
+    property ScrollBarVertical: TPseudoElScrollBar read FScrollBarVertical;
     // Renderer
     function GetBorderBoxOnViewport: TFresnelRect; virtual;
     function GetRenderedPaddingBox: TFresnelRect;
@@ -1559,6 +1559,7 @@ type
   TPseudoElement = class(TFresnelElement)
   public
     constructor Create(AOwner: TComponent); override;
+    procedure DomChanged; override;
     class function CSSTypeID: TCSSNumericalID; override;
     class function CSSTypeName: TCSSString; override;
     { ICSSNode }
@@ -1585,9 +1586,9 @@ type
     function GetCSSPseudoElementName: TCSSString; override;
   end;
 
-  { TFresnelScrollBar }
+  { TPseudoElScrollBar }
 
-  TFresnelScrollBar = class(TPseudoElement)
+  TPseudoElScrollBar = class(TPseudoElement)
   private
     FHorizontal: boolean;
   protected
@@ -1611,7 +1612,6 @@ type
     property Horizontal: boolean read FHorizontal;
   end;
 
-
   { TReplacedElement - base class for elements with special content and no child elements, e.g. label, video }
 
   TReplacedElement = class(TFresnelElement)
@@ -6595,9 +6595,9 @@ begin
 end;
 {$ENDIF}
 
-{ TFresnelScrollBar }
+{ TPseudoElScrollBar }
 
-procedure TFresnelScrollBar.SetParent(const AValue: TFresnelElement);
+procedure TPseudoElScrollBar.SetParent(const AValue: TFresnelElement);
 begin
   if Parent<>nil then
   begin
@@ -6609,7 +6609,7 @@ begin
   inherited SetParent(AValue);
 end;
 
-constructor TFresnelScrollBar.Create(TheElement: TFresnelElement; aHorizontal: boolean);
+constructor TPseudoElScrollBar.Create(TheElement: TFresnelElement; aHorizontal: boolean);
 begin
   inherited Create(TheElement);
   FHorizontal:=aHorizontal;
@@ -7085,7 +7085,7 @@ procedure TFresnelViewport.GetElementsAt(const x, y: TFresnelLength; OnlyLast: b
     BorderBox, r: TFresnelRect;
     aContentOffset: TFresnelPoint;
     HitX, HitY: TFresnelLength;
-    aBar: TFresnelScrollBar;
+    aBar: TPseudoElScrollBar;
     ClipHorizontal, ClipVertical: Boolean;
   begin
     Result:=false;
@@ -10042,6 +10042,11 @@ begin
   inherited Create(AOwner);
 end;
 
+procedure TPseudoElement.DomChanged;
+begin
+  // by default a pseudo element does not change the DOM
+end;
+
 class function TPseudoElement.CSSTypeID: TCSSNumericalID;
 begin
   Result:=CSSIDNone;

+ 1 - 1
src/base/fresnel.renderer.pas

@@ -35,7 +35,7 @@ type
 
   { TRendererScrollBar - simple custom drawn scrollbar with a round thumb bar - no buttons }
 
-  TRendererScrollBar = class(TFresnelScrollBar)
+  TRendererScrollBar = class(TPseudoElScrollBar)
   public
     Border: TFresnelLength;
     procedure Draw(Renderer: TFresnelRenderer); virtual;