mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 10:09:20 +02:00
fcl-css: clearstyles
This commit is contained in:
parent
be401422fd
commit
6685e22ead
@ -417,6 +417,7 @@ type
|
|||||||
function IndexOfStyle(aStyle: TCSSElement): integer; virtual;
|
function IndexOfStyle(aStyle: TCSSElement): integer; virtual;
|
||||||
procedure RemoveStyle(aStyle: TCSSElement); virtual;
|
procedure RemoveStyle(aStyle: TCSSElement); virtual;
|
||||||
procedure DeleteStyle(aIndex: integer); virtual;
|
procedure DeleteStyle(aIndex: integer); virtual;
|
||||||
|
procedure ClearStyles; virtual;
|
||||||
property StyleCount: integer read GetStyleCount;
|
property StyleCount: integer read GetStyleCount;
|
||||||
property Styles[Index: integer]: TCSSElement read GetStyles write SetStyles;
|
property Styles[Index: integer]: TCSSElement read GetStyles write SetStyles;
|
||||||
property OwnsStyle: boolean read FOwnsStyle write FOwnsStyle default false;
|
property OwnsStyle: boolean read FOwnsStyle write FOwnsStyle default false;
|
||||||
@ -568,6 +569,7 @@ begin
|
|||||||
if C=TCSSCompoundElement then
|
if C=TCSSCompoundElement then
|
||||||
begin
|
begin
|
||||||
Compound:=TCSSCompoundElement(El);
|
Compound:=TCSSCompoundElement(El);
|
||||||
|
//writeln('TCSSResolver.ComputeElement Compound.ChildCount=',Compound.ChildCount);
|
||||||
for i:=0 to Compound.ChildCount-1 do
|
for i:=0 to Compound.ChildCount-1 do
|
||||||
ComputeElement(Compound.Children[i]);
|
ComputeElement(Compound.Children[i]);
|
||||||
end else if C=TCSSRuleElement then
|
end else if C=TCSSRuleElement then
|
||||||
@ -635,6 +637,7 @@ var
|
|||||||
C: TClass;
|
C: TClass;
|
||||||
begin
|
begin
|
||||||
Result:=CSSSpecifityInvalid;
|
Result:=CSSSpecifityInvalid;
|
||||||
|
//writeln('TCSSResolver.SelectorMatches ',aSelector.ClassName,' ',TestNode.GetCSSTypeName);
|
||||||
C:=aSelector.ClassType;
|
C:=aSelector.ClassType;
|
||||||
if C=TCSSIdentifierElement then
|
if C=TCSSIdentifierElement then
|
||||||
Result:=SelectorIdentifierMatches(TCSSIdentifierElement(aSelector),TestNode,OnlySpecifity)
|
Result:=SelectorIdentifierMatches(TCSSIdentifierElement(aSelector),TestNode,OnlySpecifity)
|
||||||
@ -1769,6 +1772,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// resolve user defined names
|
// resolve user defined names
|
||||||
|
//writeln('TCSSResolver.ResolveIdentifier ',Kind,' "',aName,'"');
|
||||||
if Result=CSSIDNone then
|
if Result=CSSIDNone then
|
||||||
Result:=FNumericalIDs[Kind][aName];
|
Result:=FNumericalIDs[Kind][aName];
|
||||||
|
|
||||||
@ -1929,22 +1933,17 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TCSSResolver.Destroy;
|
destructor TCSSResolver.Destroy;
|
||||||
var
|
|
||||||
i: Integer;
|
|
||||||
begin
|
begin
|
||||||
|
Clear;
|
||||||
FreeAndNil(FLogEntries);
|
FreeAndNil(FLogEntries);
|
||||||
if FOwnsStyle then
|
|
||||||
begin
|
|
||||||
for i:=0 to high(FStyles) do
|
|
||||||
FStyles[i].Free;
|
|
||||||
end;
|
|
||||||
FStyles:=nil;
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCSSResolver.Clear;
|
procedure TCSSResolver.Clear;
|
||||||
begin
|
begin
|
||||||
|
FLogEntries.Clear;
|
||||||
ClearStyleCustomData;
|
ClearStyleCustomData;
|
||||||
|
ClearStyles;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCSSResolver.ClearStyleCustomData;
|
procedure TCSSResolver.ClearStyleCustomData;
|
||||||
@ -1988,6 +1987,7 @@ procedure TCSSResolver.Commit;
|
|||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
|
//writeln('TCSSResolver.Commit FAttributeCount=',FAttributeCount);
|
||||||
for i:=0 to FAttributeCount-1 do
|
for i:=0 to FAttributeCount-1 do
|
||||||
with FAttributes[i] do
|
with FAttributes[i] do
|
||||||
FNode.SetCSSValue(AttrID,Value);
|
FNode.SetCSSValue(AttrID,Value);
|
||||||
@ -2023,5 +2023,15 @@ begin
|
|||||||
Delete(FStyles,aIndex,1);
|
Delete(FStyles,aIndex,1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCSSResolver.ClearStyles;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
if OwnsStyle then
|
||||||
|
for i:=0 to high(FStyles) do
|
||||||
|
FStyles[i].Free;
|
||||||
|
FStyles:=nil;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user