|
@@ -44,6 +44,9 @@ const
|
|
|
|
|
|
type
|
|
|
// CSS attributes of the TFresnelElement class
|
|
|
+ // Important:
|
|
|
+ // for Left,Top,Right,Border attributes use the order defined in TFresnelCSSSide
|
|
|
+ // for TopLeft,TopRight,BottomLeft,BottomRight attributes use the order defined in TFresnelCSSCorner
|
|
|
TFresnelCSSAttribute = (
|
|
|
fcaDisplay,
|
|
|
fcaDisplayBox,
|
|
@@ -533,10 +536,12 @@ type
|
|
|
// CSS classes and inline style
|
|
|
property StyleElements: TCSSElement read FStyleElements write SetStyleElements;
|
|
|
// CSS attributes
|
|
|
+ property CSSAttribute[Attr: TFresnelCSSAttribute]: string read GetCSSElAttribute write SetCSSElAttribute;
|
|
|
+ // CSS computed attributes (values used by layouter to compute the rendered attributes)
|
|
|
function GetComputedCSSLength(Attr: TFresnelCSSAttribute; UseInherited: boolean; UseNaNOnFail: boolean = false): TFresnelLength; virtual; // on fail returns NaN
|
|
|
- function GetComputedCSString(Attr: TFresnelCSSAttribute; UseInherited: boolean): string; virtual;
|
|
|
+ function GetComputedCSSString(Attr: TFresnelCSSAttribute; UseInherited: boolean): string; virtual;
|
|
|
+ function GetComputedCSSBorderWidth(Attr: TFresnelCSSAttribute): TFresnelLength; virtual;
|
|
|
procedure WriteComputedAttributes(Title: string);
|
|
|
- property CSSAttribute[Attr: TFresnelCSSAttribute]: string read GetCSSElAttribute write SetCSSElAttribute;
|
|
|
property CSSComputedAttribute[Attr: TFresnelCSSAttribute]: string read GetCSSElComputedAttribute write SetCSSElComputedAttribute;
|
|
|
class property FresnelElementBaseAttrID: TCSSNumericalID read FFresnelElementBaseAttrID;
|
|
|
// CSS pseudo classes
|
|
@@ -1269,7 +1274,10 @@ var
|
|
|
El.ComputeCSSInit;
|
|
|
end;
|
|
|
Layouter.ComputeCSS(El);
|
|
|
+ if El.GetComputedCSSString(fcaDisplayBox,false)='none' then
|
|
|
+ exit;
|
|
|
El.ComputeCSSAfterLayoutNode(Layouter);
|
|
|
+ El.WriteComputedAttributes('TFresnelViewport.ApplyCSS');
|
|
|
for i:=0 to El.NodeCount-1 do
|
|
|
Traverse(El.Nodes[i]);
|
|
|
Layouter.ComputedChildrenCSS(El);
|
|
@@ -3052,7 +3060,7 @@ begin
|
|
|
Result:=0;
|
|
|
end;
|
|
|
|
|
|
-function TFresnelElement.GetComputedCSString(Attr: TFresnelCSSAttribute;
|
|
|
+function TFresnelElement.GetComputedCSSString(Attr: TFresnelCSSAttribute;
|
|
|
UseInherited: boolean): string;
|
|
|
var
|
|
|
El: TFresnelElement;
|
|
@@ -3073,6 +3081,19 @@ begin
|
|
|
Result:=GetCSSInitialAttribute(ElementAttrToAttrId(Attr));
|
|
|
end;
|
|
|
|
|
|
+function TFresnelElement.GetComputedCSSBorderWidth(Attr: TFresnelCSSAttribute
|
|
|
+ ): TFresnelLength;
|
|
|
+var
|
|
|
+ StyleAttr: TFresnelCSSAttribute;
|
|
|
+ aStyle: String;
|
|
|
+begin
|
|
|
+ StyleAttr:=TFresnelCSSAttribute(ord(fcaBorderLeftStyle)+ord(Attr)-ord(fcaBorderLeftWidth));
|
|
|
+ aStyle:=GetComputedCSSString(StyleAttr,false);
|
|
|
+ if (aStyle='') or (aStyle='none') then
|
|
|
+ exit(0.0);
|
|
|
+ Result:=GetComputedCSSLength(Attr,false);
|
|
|
+end;
|
|
|
+
|
|
|
procedure TFresnelElement.WriteComputedAttributes(Title: string);
|
|
|
var
|
|
|
Attr: TFresnelCSSAttribute;
|
|
@@ -3351,11 +3372,11 @@ begin
|
|
|
if FFontDescValid then
|
|
|
exit(FFont);
|
|
|
FFontDescValid:=true;
|
|
|
- FFontDesc.Family:=GetComputedCSString(fcaFontFamily,true);
|
|
|
- FFontDesc.Style:=GetComputedCSString(fcaFontStyle,true);
|
|
|
- FFontDesc.Variant_:=GetComputedCSString(fcaFontVariant,true);
|
|
|
- FFontDesc.Weight:=GetComputedCSString(fcaFontWeight,true);
|
|
|
- s:=GetComputedCSString(fcaFontSize,true);
|
|
|
+ FFontDesc.Family:=GetComputedCSSString(fcaFontFamily,true);
|
|
|
+ FFontDesc.Style:=GetComputedCSSString(fcaFontStyle,true);
|
|
|
+ FFontDesc.Variant_:=GetComputedCSSString(fcaFontVariant,true);
|
|
|
+ FFontDesc.Weight:=GetComputedCSSString(fcaFontWeight,true);
|
|
|
+ s:=GetComputedCSSString(fcaFontSize,true);
|
|
|
case s of
|
|
|
'xx-small': FFontDesc.Size:=6;
|
|
|
'x-small': FFontDesc.Size:=7;
|
|
@@ -3370,7 +3391,7 @@ begin
|
|
|
if not CSSStrToFloat(s,FFontDesc.Size) then
|
|
|
FFontDesc.Size:=10;
|
|
|
end;
|
|
|
- FFontDesc.Kerning:=GetComputedCSString(fcaFontKerning,true);
|
|
|
+ FFontDesc.Kerning:=GetComputedCSSString(fcaFontKerning,true);
|
|
|
if FFont<>nil then
|
|
|
begin
|
|
|
if (FFont.GetFamily=FFontDesc.Family)
|