Fix display of fonts in SkyShell
Originally reviewed for the branch on: https://codereview.chromium.org/945083002 TBR=abarth@chromium.org Review URL: https://codereview.chromium.org/953933004
This commit is contained in:
parent
6fa805515e
commit
aa1d4db99c
@ -8,6 +8,7 @@
|
|||||||
#include "sky/engine/public/platform/WebInputEvent.h"
|
#include "sky/engine/public/platform/WebInputEvent.h"
|
||||||
#include "sky/engine/public/web/Sky.h"
|
#include "sky/engine/public/web/Sky.h"
|
||||||
#include "sky/engine/public/web/WebLocalFrame.h"
|
#include "sky/engine/public/web/WebLocalFrame.h"
|
||||||
|
#include "sky/engine/public/web/WebSettings.h"
|
||||||
#include "sky/engine/public/web/WebView.h"
|
#include "sky/engine/public/web/WebView.h"
|
||||||
#include "sky/shell/ui/animator.h"
|
#include "sky/shell/ui/animator.h"
|
||||||
#include "sky/shell/ui/input_event_converter.h"
|
#include "sky/shell/ui/input_event_converter.h"
|
||||||
@ -18,6 +19,16 @@
|
|||||||
namespace sky {
|
namespace sky {
|
||||||
namespace shell {
|
namespace shell {
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
void ConfigureSettings(blink::WebSettings* settings) {
|
||||||
|
settings->setDefaultFixedFontSize(13);
|
||||||
|
settings->setDefaultFontSize(16);
|
||||||
|
settings->setLoadsImagesAutomatically(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Engine::Engine(const Config& config)
|
Engine::Engine(const Config& config)
|
||||||
: animator_(new Animator(config, this)),
|
: animator_(new Animator(config, this)),
|
||||||
web_view_(nullptr),
|
web_view_(nullptr),
|
||||||
@ -85,6 +96,15 @@ void Engine::UpdateWebViewSize()
|
|||||||
web_view_->resize(blink::WebSize(size.width(), size.height()));
|
web_view_->resize(blink::WebSize(size.width(), size.height()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(eseidel): This is likely not needed anymore.
|
||||||
|
blink::WebScreenInfo Engine::screenInfo() {
|
||||||
|
blink::WebScreenInfo screen;
|
||||||
|
screen.rect = blink::WebRect(gfx::Rect(physical_size_));
|
||||||
|
screen.availableRect = screen.rect;
|
||||||
|
screen.deviceScaleFactor = device_pixel_ratio_;
|
||||||
|
return screen;
|
||||||
|
}
|
||||||
|
|
||||||
void Engine::OnInputEvent(InputEventPtr event) {
|
void Engine::OnInputEvent(InputEventPtr event) {
|
||||||
scoped_ptr<blink::WebInputEvent> web_event =
|
scoped_ptr<blink::WebInputEvent> web_event =
|
||||||
ConvertEvent(event, device_pixel_ratio_);
|
ConvertEvent(event, device_pixel_ratio_);
|
||||||
@ -95,6 +115,7 @@ void Engine::OnInputEvent(InputEventPtr event) {
|
|||||||
|
|
||||||
void Engine::LoadURL(const mojo::String& url) {
|
void Engine::LoadURL(const mojo::String& url) {
|
||||||
web_view_ = blink::WebView::create(this);
|
web_view_ = blink::WebView::create(this);
|
||||||
|
ConfigureSettings(web_view_->settings());
|
||||||
web_view_->setMainFrame(blink::WebLocalFrame::create(this));
|
web_view_->setMainFrame(blink::WebLocalFrame::create(this));
|
||||||
UpdateWebViewSize();
|
UpdateWebViewSize();
|
||||||
web_view_->mainFrame()->load(GURL(url));
|
web_view_->mainFrame()->load(GURL(url));
|
||||||
|
@ -58,6 +58,7 @@ class Engine : public UIDelegate,
|
|||||||
// WebViewClient methods:
|
// WebViewClient methods:
|
||||||
void initializeLayerTreeView() override;
|
void initializeLayerTreeView() override;
|
||||||
void scheduleVisualUpdate() override;
|
void scheduleVisualUpdate() override;
|
||||||
|
blink::WebScreenInfo screenInfo() override;
|
||||||
|
|
||||||
void UpdateWebViewSize();
|
void UpdateWebViewSize();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user