mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2024-11-16 00:05:55 +01:00
Fixed black screen issue in OSR mode thanks to "Student"
- Fixed issues adding or replacing command line switches with hyphenated and non-hyphenated keys in TCEFApplicationCore. - Remove the values from the "enable-features" and "enable-blink-features" when that value is in the "disable-features" or "disable-blink-features" in the command line switches.
This commit is contained in:
parent
151b6fe3da
commit
47fb09e887
@ -343,6 +343,7 @@ type
|
|||||||
procedure AddCustomCommandLineSwitches(var aKeys, aValues : TStringList); virtual;
|
procedure AddCustomCommandLineSwitches(var aKeys, aValues : TStringList); virtual;
|
||||||
procedure AppendSwitch(var aKeys, aValues : TStringList; const aNewKey : ustring; const aNewValue : ustring = '');
|
procedure AppendSwitch(var aKeys, aValues : TStringList; const aNewKey : ustring; const aNewValue : ustring = '');
|
||||||
procedure ReplaceSwitch(var aKeys, aValues : TStringList; const aNewKey : ustring; const aNewValue : ustring = '');
|
procedure ReplaceSwitch(var aKeys, aValues : TStringList; const aNewKey : ustring; const aNewValue : ustring = '');
|
||||||
|
procedure CleanupFeatures(var aKeys, aValues : TStringList; const aEnableKey, aDisableKey : string);
|
||||||
|
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
@ -1744,22 +1745,34 @@ end;
|
|||||||
|
|
||||||
procedure TCefApplicationCore.AppendSwitch(var aKeys, aValues : TStringList; const aNewKey, aNewValue : ustring);
|
procedure TCefApplicationCore.AppendSwitch(var aKeys, aValues : TStringList; const aNewKey, aNewValue : ustring);
|
||||||
var
|
var
|
||||||
TempKey : ustring;
|
TempKey, TempHyphenatedKey : ustring;
|
||||||
i : integer;
|
i : integer;
|
||||||
begin
|
begin
|
||||||
if (copy(aNewKey, 1, 2) = '--') then
|
if (copy(aNewKey, 1, 2) = '--') then
|
||||||
TempKey := copy(aNewKey, 3, length(aNewKey))
|
begin
|
||||||
|
TempHyphenatedKey := aNewKey;
|
||||||
|
TempKey := copy(aNewKey, 3, length(aNewKey));
|
||||||
|
end
|
||||||
else
|
else
|
||||||
|
begin
|
||||||
|
TempHyphenatedKey := '--' + aNewKey;
|
||||||
TempKey := aNewKey;
|
TempKey := aNewKey;
|
||||||
|
end;
|
||||||
|
|
||||||
i := aKeys.IndexOf(TempKey);
|
i := aKeys.IndexOf(TempKey);
|
||||||
|
|
||||||
|
if (i < 0) then
|
||||||
|
begin
|
||||||
|
i := aKeys.IndexOf(TempHyphenatedKey);
|
||||||
|
|
||||||
if (i < 0) then
|
if (i < 0) then
|
||||||
begin
|
begin
|
||||||
aKeys.Add(aNewKey);
|
aKeys.Add(aNewKey);
|
||||||
aValues.Add(aNewValue);
|
aValues.Add(aNewValue);
|
||||||
end
|
exit;
|
||||||
else
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
if (length(aNewValue) > 0) then
|
if (length(aNewValue) > 0) then
|
||||||
begin
|
begin
|
||||||
if (length(aValues[i]) > 0) then
|
if (length(aValues[i]) > 0) then
|
||||||
@ -1769,18 +1782,93 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCefApplicationCore.CleanupFeatures(var aKeys, aValues : TStringList; const aEnableKey, aDisableKey : string);
|
||||||
|
var
|
||||||
|
i, j, k, n : integer;
|
||||||
|
TempEnabledValues, TempDisabledValues : TStringList;
|
||||||
|
TempEnableKey, TempHyphenatedEnableKey, TempDisableKey, TempHyphenatedDisableKey : ustring;
|
||||||
|
begin
|
||||||
|
if (copy(aEnableKey, 1, 2) = '--') then
|
||||||
|
begin
|
||||||
|
TempHyphenatedEnableKey := aEnableKey;
|
||||||
|
TempEnableKey := copy(aEnableKey, 3, length(aEnableKey));
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
TempHyphenatedEnableKey := '--' + aEnableKey;
|
||||||
|
TempEnableKey := aEnableKey;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if (copy(aDisableKey, 1, 2) = '--') then
|
||||||
|
begin
|
||||||
|
TempHyphenatedDisableKey := aDisableKey;
|
||||||
|
TempDisableKey := copy(aDisableKey, 3, length(aDisableKey));
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
TempHyphenatedDisableKey := '--' + aDisableKey;
|
||||||
|
TempDisableKey := aDisableKey;
|
||||||
|
end;
|
||||||
|
|
||||||
|
i := aKeys.IndexOf(TempEnableKey);
|
||||||
|
if (i < 0) then i := aKeys.IndexOf(TempHyphenatedEnableKey);
|
||||||
|
|
||||||
|
j := aKeys.IndexOf(TempDisableKey);
|
||||||
|
if (j < 0) then j := aKeys.IndexOf(TempHyphenatedDisableKey);
|
||||||
|
|
||||||
|
if (i < 0) or (j < 0) then exit;
|
||||||
|
|
||||||
|
TempEnabledValues := TStringList.Create;
|
||||||
|
TempDisabledValues := TStringList.Create;
|
||||||
|
TempEnabledValues.CommaText := aValues[i];
|
||||||
|
TempDisabledValues.CommaText := aValues[j];
|
||||||
|
|
||||||
|
k := 0;
|
||||||
|
while (k < TempDisabledValues.Count) do
|
||||||
|
begin
|
||||||
|
if (length(TempDisabledValues[k]) > 0) then
|
||||||
|
begin
|
||||||
|
n := TempEnabledValues.IndexOf(TempDisabledValues[k]);
|
||||||
|
if (n >= 0) then TempEnabledValues.Delete(n);
|
||||||
|
end;
|
||||||
|
|
||||||
|
inc(k);
|
||||||
|
end;
|
||||||
|
|
||||||
|
if (TempEnabledValues.Count > 0) then
|
||||||
|
aValues[i] := TempEnabledValues.CommaText
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
aKeys.Delete(i);
|
||||||
|
aValues.Delete(i);
|
||||||
|
end;
|
||||||
|
|
||||||
|
FreeAndNil(TempEnabledValues);
|
||||||
|
FreeAndNil(TempDisabledValues);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCefApplicationCore.ReplaceSwitch(var aKeys, aValues : TStringList; const aNewKey, aNewValue : ustring);
|
procedure TCefApplicationCore.ReplaceSwitch(var aKeys, aValues : TStringList; const aNewKey, aNewValue : ustring);
|
||||||
var
|
var
|
||||||
TempKey : ustring;
|
TempKey, TempHyphenatedKey : ustring;
|
||||||
i : integer;
|
i : integer;
|
||||||
begin
|
begin
|
||||||
if (copy(aNewKey, 1, 2) = '--') then
|
if (copy(aNewKey, 1, 2) = '--') then
|
||||||
TempKey := copy(aNewKey, 3, length(aNewKey))
|
begin
|
||||||
|
TempHyphenatedKey := aNewKey;
|
||||||
|
TempKey := copy(aNewKey, 3, length(aNewKey));
|
||||||
|
end
|
||||||
else
|
else
|
||||||
|
begin
|
||||||
|
TempHyphenatedKey := '--' + aNewKey;
|
||||||
TempKey := aNewKey;
|
TempKey := aNewKey;
|
||||||
|
end;
|
||||||
|
|
||||||
i := aKeys.IndexOf(TempKey);
|
i := aKeys.IndexOf(TempKey);
|
||||||
|
|
||||||
|
if (i < 0) then
|
||||||
|
begin
|
||||||
|
i := aKeys.IndexOf(TempHyphenatedKey);
|
||||||
|
|
||||||
if (i < 0) then
|
if (i < 0) then
|
||||||
begin
|
begin
|
||||||
aKeys.Add(aNewKey);
|
aKeys.Add(aNewKey);
|
||||||
@ -1788,6 +1876,9 @@ begin
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
aValues[i] := aNewValue;
|
aValues[i] := aNewValue;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
aValues[i] := aNewValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefApplicationCore.AddCustomCommandLineSwitches(var aKeys, aValues : TStringList);
|
procedure TCefApplicationCore.AddCustomCommandLineSwitches(var aKeys, aValues : TStringList);
|
||||||
@ -1975,6 +2066,8 @@ begin
|
|||||||
if (length(FDisableFeatures) > 0) then
|
if (length(FDisableFeatures) > 0) then
|
||||||
AppendSwitch(aKeys, aValues, '--disable-features', FDisableFeatures);
|
AppendSwitch(aKeys, aValues, '--disable-features', FDisableFeatures);
|
||||||
|
|
||||||
|
CleanupFeatures(aKeys, aValues, '--enable-features', '--disable-features');
|
||||||
|
|
||||||
// The list of Blink features you can enable is here :
|
// The list of Blink features you can enable is here :
|
||||||
// https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5
|
// https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5
|
||||||
if (length(FEnableBlinkFeatures) > 0) then
|
if (length(FEnableBlinkFeatures) > 0) then
|
||||||
@ -1985,6 +2078,8 @@ begin
|
|||||||
if (length(FDisableBlinkFeatures) > 0) then
|
if (length(FDisableBlinkFeatures) > 0) then
|
||||||
AppendSwitch(aKeys, aValues, '--disable-blink-features', FDisableBlinkFeatures);
|
AppendSwitch(aKeys, aValues, '--disable-blink-features', FDisableBlinkFeatures);
|
||||||
|
|
||||||
|
CleanupFeatures(aKeys, aValues, '--enable-blink-features', '--disable-blink-features');
|
||||||
|
|
||||||
// The list of Blink settings you can modify is here :
|
// The list of Blink settings you can modify is here :
|
||||||
// https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/frame/settings.json5
|
// https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/frame/settings.json5
|
||||||
if (length(FBlinkSettings) > 0) then
|
if (length(FBlinkSettings) > 0) then
|
||||||
|
@ -996,7 +996,14 @@ end;
|
|||||||
|
|
||||||
procedure TBufferPanel.BufferDraw(const aBitmap : TBitmap; const aSrcRect, aDstRect : TRect);
|
procedure TBufferPanel.BufferDraw(const aBitmap : TBitmap; const aSrcRect, aDstRect : TRect);
|
||||||
begin
|
begin
|
||||||
if (FBuffer <> nil) then FBuffer.Canvas.CopyRect(aDstRect, aBitmap.Canvas, aSrcRect);
|
if (FBuffer <> nil) and (aBitmap <> nil) then
|
||||||
|
begin
|
||||||
|
FBuffer.Canvas.Lock;
|
||||||
|
aBitmap.Canvas.Lock;
|
||||||
|
FBuffer.Canvas.CopyRect(aDstRect, aBitmap.Canvas, aSrcRect);
|
||||||
|
aBitmap.Canvas.UnLock;
|
||||||
|
FBuffer.Canvas.UnLock;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TBufferPanel.UpdateBufferDimensions(aWidth, aHeight : integer) : boolean;
|
function TBufferPanel.UpdateBufferDimensions(aWidth, aHeight : integer) : boolean;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"UpdateLazPackages" : [
|
"UpdateLazPackages" : [
|
||||||
{
|
{
|
||||||
"ForceNotify" : true,
|
"ForceNotify" : true,
|
||||||
"InternalVersion" : 237,
|
"InternalVersion" : 238,
|
||||||
"Name" : "cef4delphi_lazarus.lpk",
|
"Name" : "cef4delphi_lazarus.lpk",
|
||||||
"Version" : "88.1.4.0"
|
"Version" : "88.1.4.0"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user