Merge revision 739 changes:

- Add the ability to customize the animation frame rate (issue #697).

git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1025@740 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2012-08-14 23:34:56 +00:00
parent f0e11cc5df
commit 4a9c00b2e7
16 changed files with 128 additions and 113 deletions

View File

@@ -297,6 +297,10 @@ void AppGetBrowserSettings(CefBrowserSettings& settings) {
g_command_line->HasSwitch(cefclient::kLoadDropsDisabled);
settings.history_disabled =
g_command_line->HasSwitch(cefclient::kHistoryDisabled);
settings.animation_frame_rate = GetIntValue(
g_command_line->GetSwitchValue(cefclient::kAnimationFrameRate));
settings.remote_fonts_disabled =
g_command_line->HasSwitch(cefclient::kRemoteFontsDisabled);

View File

@@ -38,6 +38,7 @@ const char kPackLoadingDisabled[] = "pack-loading-disabled";
const char kDragDropDisabled[] = "drag-drop-disabled";
const char kLoadDropsDisabled[] = "load-drops-disabled";
const char kHistoryDisabled[] = "history-disabled";
const char kAnimationFrameRate[] = "animation-frame-rate";
const char kRemoteFontsDisabled[] = "remote-fonts-disabled";
const char kDefaultEncoding[] = "default-encoding";
const char kEncodingDetectorEnabled[] = "encoding-detector-enabled";

View File

@@ -40,6 +40,7 @@ extern const char kPackLoadingDisabled[];
extern const char kDragDropDisabled[];
extern const char kLoadDropsDisabled[];
extern const char kHistoryDisabled[];
extern const char kAnimationFrameRate[];
extern const char kRemoteFontsDisabled[];
extern const char kDefaultEncoding[];
extern const char kEncodingDetectorEnabled[];

View File

@@ -64,6 +64,11 @@ class ClientOSRHandler : public CefClient,
~ClientOSRHandler() {
}
// Called immediately before the plugin is destroyed.
void Detach() {
plugin_ = NULL;
}
// CefClient methods
virtual CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() OVERRIDE {
return this;
@@ -202,6 +207,9 @@ class ClientOSRHandler : public CefClient,
CefRect& rect) OVERRIDE {
REQUIRE_UI_THREAD();
if (!plugin_)
return false;
// The simulated screen and view rectangle are the same. This is necessary
// for popup menus to be located and sized inside the view.
RECT clientRect;
@@ -225,6 +233,9 @@ class ClientOSRHandler : public CefClient,
int& screenY) OVERRIDE {
REQUIRE_UI_THREAD();
if (!plugin_)
return false;
// Convert the point from view coordinates to actual screen coordinates.
POINT screen_pt = {viewX, viewY};
MapWindowPoints(plugin_->hWnd, HWND_DESKTOP, &screen_pt, 1);
@@ -236,12 +247,20 @@ class ClientOSRHandler : public CefClient,
virtual void OnPopupShow(CefRefPtr<CefBrowser> browser,
bool show) OVERRIDE {
REQUIRE_UI_THREAD();
if (!plugin_)
return;
plugin_->renderer.OnPopupShow(browser, show);
}
virtual void OnPopupSize(CefRefPtr<CefBrowser> browser,
const CefRect& rect) OVERRIDE {
REQUIRE_UI_THREAD();
if (!plugin_)
return;
plugin_->renderer.OnPopupSize(browser, rect);
}
@@ -251,6 +270,9 @@ class ClientOSRHandler : public CefClient,
const void* buffer) OVERRIDE {
REQUIRE_UI_THREAD();
if (!plugin_)
return;
wglMakeCurrent(plugin_->hDC, plugin_->hRC);
plugin_->renderer.OnPaint(browser, type, dirtyRects, buffer);
}
@@ -259,6 +281,9 @@ class ClientOSRHandler : public CefClient,
CefCursorHandle cursor) OVERRIDE {
REQUIRE_UI_THREAD();
if (!plugin_)
return;
// Change the plugin window's cursor.
SetClassLong(plugin_->hWnd, GCL_HCURSOR,
static_cast<LONG>(reinterpret_cast<LONG_PTR>(cursor)));
@@ -357,6 +382,11 @@ NPError NPP_DestroyImpl(NPP instance, NPSavedData** save) {
ClientPlugin* plugin = reinterpret_cast<ClientPlugin*>(instance->pdata);
if (plugin) {
if (g_offscreenBrowser.get()) {
CefRefPtr<ClientOSRHandler> handler =
static_cast<ClientOSRHandler*>(g_offscreenBrowser->GetClient().get());
handler->Detach();
}
if (plugin->hWnd) {
DestroyWindow(plugin->hWnd);
DisableGL(plugin);