Skip to content

Commit

Permalink
Fixed typos + whitespace cleanups.
Browse files Browse the repository at this point in the history
  • Loading branch information
perlun committed Nov 27, 2017
1 parent b77878e commit 8dd4637
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 41 deletions.
22 changes: 11 additions & 11 deletions CefSharp.Example/Resources/BindingTest.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<span id="asyncresult"></span>
<script type="text/javascript">
var asResult = document.getElementById('asyncresult');

function writeAsyncResult(call, end)
{
var p = document.createElement('p');
Expand All @@ -18,16 +18,16 @@
var title = document.createTextNode('Async Call: ');
var callText = document.createTextNode(call);
var endText = document.createTextNode(end);

p.appendChild(title);
p.appendChild(br);
p.appendChild(callText);
p.appendChild(br2);
p.appendChild(endText);

asResult.appendChild(p);
}

function asyncError()
{
var call = "Async call (Throw Exception): " + Date();
Expand All @@ -37,7 +37,7 @@
writeAsyncResult(call, end);
});
}

function asyncDivOk()
{
var call = "Async call (Divide 16 / 2): " + Date();
Expand All @@ -47,7 +47,7 @@
writeAsyncResult(call, end);
});
}

function asyncDivFail()
{
var call = "Async call (Divide 16 /0): " + Date();
Expand All @@ -62,7 +62,7 @@
writeAsyncResult(call, end);
});
}

function asyncHello()
{
var call = "Async call (Hello): " + Date();
Expand All @@ -72,7 +72,7 @@
writeAsyncResult(call, end);
});
}

function asyncDoSomething()
{
var call = "Async call (Long Running Task): " + Date();
Expand Down Expand Up @@ -102,7 +102,7 @@
writeAsyncResult(call, end);
});
}

asyncError();
asyncDivOk();
asyncDivFail();
Expand All @@ -113,7 +113,7 @@
</script>
</p>
<p>
Javscript Callback Test
Javascript Callback Test
<br />
<script type="text/javascript">
function callback(s)
Expand Down Expand Up @@ -164,7 +164,7 @@
</p>

<p>
Javscript Callback Test using object as parameter
Javascript Callback Test using object as parameter
<br />
<script type="text/javascript">
function objectCallback(s)
Expand Down
32 changes: 16 additions & 16 deletions CefSharp.Example/Resources/Home.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,22 +116,22 @@ <h2 id="the-basics">The Basics</h2>
</p>
<h3>Initialize/Shutdown Cef</h3>
<p>
It's important to note that it's nessicary to Initialize the underlying CEF library. This can be achieved in one of two ways, explicitly and implicitly.
It's important to note that it's neccesary to Initialize the underlying CEF library. This can be achieved in one of two ways, explicitly and implicitly.
When you create a new instance of ChromiumWebBrowser it will check if CEF has been initialized and if not, initialize it for you with the defaults.
For those wishing to specify some custom settings then you can explicitly initialize CEF yourself like below

<pre data-shbrush="csharp">
public static void Init()
{
var settings = new CefSettings();

// Increase the log severity so CEF outputs detailed information, useful for debugging
settings.LogSeverity = LogSeverity.Verbose;

Cef.Initialize(settings);
}
</pre>

CEF also requires that you call Shutdown when your finished with it. If you don't call Shutdown explicitly then it will be called for you on exit.
You can call Shutdown explicitly which will be required in some instances.

Expand All @@ -141,7 +141,7 @@ <h3>Initialize/Shutdown Cef</h3>
Cef.Shutdown();
}
</pre>

It's important to note CEF that Initialize/Shutdown <strong>MUST</strong> be called on your main applicaiton thread (Typically the UI thead). If you call them on different
threads, your application will hang.
</p>
Expand All @@ -155,21 +155,21 @@ <h3>Settings and Command Line Arguments</h3>
{
// Specify Global Settings and Command Line Arguments
var settings = new CefSettings();

// By default CEF uses an in memory cache, to save cached data e.g. passwords you need to specify a cache path
// NOTE: The executing user must have sufficent privileges to write to this folder.
settings.CachePath = "cache";

// There are many command line arguments that can either be turned on or off
// Enable WebRTC

// Enable WebRTC
settings.CefCommandLineArgs.Add("enable-media-stream", "1");

// Don't use a proxy server, always make direct connections. Overrides any other proxy server flags that are passed.
// Slightly improves Cef initialize time as it won't attempt to resolve a proxy
settings.CefCommandLineArgs.Add("no-proxy-server", "1");
settings.CefCommandLineArgs.Add("no-proxy-server", "1");



Cef.Initialize(settings);
}
</pre>
Expand Down Expand Up @@ -198,10 +198,10 @@ <h3>State-of-the-art HTML5 and Javascript support</h3>
Perhaps very obvious, but still worth mentioning. Since CefSharp is based on
<a href="https://bitbucket.org/chromiumembedded/cef">CEF</a>, which is in turn based on
<a href="http://www.chromium.org/Home">Chromium</a> (version 43 for the time being), CefSharp provides
one of the best HTML5 rendering experiences available -
one of the best HTML5 rendering experiences available -
<a href="http://html5test.com/compare/browser/mybrowser/chrome-41/chrome-43/ie-11.html">
470+ points out of 555
</a> on <a href="http://www.html5test.com">html5test.com</a>. Note:
</a> on <a href="http://www.html5test.com">html5test.com</a>. Note:
<a href="http://en.wiktionary.org/wiki/your_mileage_may_vary" title="Your mileage may vary">YMMV</a>
depending on .DLLs you add and features you enable.
</p>
Expand Down Expand Up @@ -252,13 +252,13 @@ <h3 id="features-custom-schemes">Custom Schemes</h3>
// even if there is an exception as they wrap an unmanaged response which will cause memory
// leaks if not freed
using (callback)
{
{
// Read the data in, set the mime type
var bytes = Encoding.UTF8.GetBytes(resource);
stream = new MemoryStream(bytes);
var fileExtension = Path.GetExtension(fileName);
mimeType = ResourceHandler.GetMimeType(fileExtension);

// When your finished processing execute the callback.
// Most callbacks have multiple methods, so checkout their interface for details
callback.Continue();
Expand Down Expand Up @@ -289,13 +289,13 @@ <h3 id="features-custom-schemes">Custom Schemes</h3>
{
// Pseudo code; you probably need more in your CefSettings also.
var settings = new CefSettings();

settings.RegisterScheme(new CefCustomScheme
{
SchemeName = CefSharpSchemeHandlerFactory.SchemeName,
SchemeHandlerFactory = new CefSharpSchemeHandlerFactory()
});

Cef.Initialize(settings);
}
</pre>
Expand Down
28 changes: 14 additions & 14 deletions CefSharp.Wpf/ChromiumWebBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ protected virtual void Dispose(bool isDisposing)
{
//If disposeCount is 0 then we'll update it to 1 and begin disposing
if (Interlocked.CompareExchange(ref disposeCount, 1, 0) == 0)
{
{
// No longer reference event listeners:
ConsoleMessage = null;
FrameLoadStart = null;
Expand Down Expand Up @@ -521,7 +521,7 @@ protected virtual void Dispose(bool isDisposing)
IsVisibleChanged -= OnIsVisibleChanged;

if(popup != null)
{
{
popup.Opened -= PopupOpened;
popup.Closed -= PopupClosed;
popup = null;
Expand Down Expand Up @@ -612,7 +612,7 @@ bool IRenderWebBrowser.GetScreenPoint(int viewX, int viewY, out int screenX, out
//We manually claculate the screen point as calling PointToScreen can only be called on the UI thread
// in a sync fashion and it's easy for users to get themselves into a deadlock.
if(DpiScaleFactor > 1)
{
{
screenX = (int)(browserScreenLocation.X + (viewX * DpiScaleFactor));
screenY = (int)(browserScreenLocation.Y + (viewY * DpiScaleFactor));
}
Expand Down Expand Up @@ -683,7 +683,7 @@ bool IRenderWebBrowser.StartDragging(IDragData dragData, DragOperationsMask mask
UiThreadRunAsync(delegate
{
if(browser != null)
{
{
var results = DragDrop.DoDragDrop(this, dataObject, GetDragEffects(mask));
browser.GetHost().DragSourceEndedAt(0, 0, GetDragOperationsMask(results));
browser.GetHost().DragSourceSystemDragEnded();
Expand Down Expand Up @@ -795,7 +795,7 @@ void IRenderWebBrowser.SetCursor(IntPtr handle, CursorType type)
{
Cursor = CursorInteropHelper.Create(new SafeFileHandle(handle, ownsHandle: false));
});
}
}
}

void IRenderWebBrowser.OnImeCompositionRangeChanged(Range selectedRange, Rect[] characterBounds)
Expand Down Expand Up @@ -1139,13 +1139,13 @@ private static void OnIsBrowserInitializedChanged(DependencyObject d, Dependency
protected virtual void OnIsBrowserInitializedChanged(bool oldValue, bool newValue)
{
if (newValue && !IsDisposed)
{
{
var task = this.GetZoomLevelAsync();
task.ContinueWith(previous =>
{
if (previous.Status == TaskStatus.RanToCompletion)
{
UiThreadRunAsync(() =>
UiThreadRunAsync(() =>
{
if (!IsDisposed)
{
Expand Down Expand Up @@ -1586,7 +1586,7 @@ private void WindowStateChanged(object sender, EventArgs e)
}
break;
}
}
}
}

private void updateBrowserScreenLocation()
Expand Down Expand Up @@ -1841,7 +1841,7 @@ protected virtual IntPtr SourceHook(IntPtr hWnd, int message, IntPtr wParam, Int
case WM.KEYUP:
case WM.CHAR:
case WM.IME_CHAR:
{
{
if (!IsKeyboardFocused)
{
break;
Expand All @@ -1857,7 +1857,7 @@ protected virtual IntPtr SourceHook(IntPtr hWnd, int message, IntPtr wParam, Int

if (browser != null)
{
browser.GetHost().SendKeyEvent(message, wParam.CastToInt32(), lParam.CastToInt32());
browser.GetHost().SendKeyEvent(message, wParam.CastToInt32(), lParam.CastToInt32());
handled = true;
}

Expand Down Expand Up @@ -2287,8 +2287,8 @@ public bool IsDisposed
{
get
{
//Use CompareExchange to read the current value - if disposeCount is 1, we set it to 1, effectively a no-op
//Volatile.Read would likely use a memory barrier which I beleive is unnessicary in this scenario
// Use CompareExchange to read the current value - if disposeCount is 1, we set it to 1, effectively a no-op
// Volatile.Read would likely use a memory barrier which I believe is unnecessary in this scenario
return Interlocked.CompareExchange(ref disposeCount, 1, 1) == 1;
}
}
Expand All @@ -2299,8 +2299,8 @@ public bool IsDisposed
/// <returns>true if browser is initialized</returns>
private bool InternalIsBrowserInitialized()
{
//Use CompareExchange to read the current value - if browserInitialized is 0, we set it to 0, effectively a no-op
//Volatile.Read would likely use a memory barrier which I beleive is unnessicary in this scenario
// Use CompareExchange to read the current value - if disposeCount is 1, we set it to 1, effectively a no-op
// Volatile.Read would likely use a memory barrier which I believe is unnecessary in this scenario
return Interlocked.CompareExchange(ref browserInitialized, 0, 0) == 1;
}

Expand Down

0 comments on commit 8dd4637

Please sign in to comment.