Giter VIP home page Giter VIP logo

cocoacefview's People

Contributors

tishion avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cocoacefview's Issues

集成遇到的问题

请问作者,集成cocoaCefView到项目必须用xib形式添加吗?我用代码集成项目一直无法成功(我是将cocoaCefView添加再viewController上面)。还有个疑问就是,必须要修改main函数入口的CocoaCefApplication吗?如果看到信息麻烦及时回复([Nib Loading] Failed to connect (window) outlet from (CocoaCefApp) to (NSWindow): missing setter or instance variable)
ok,目前通过这个已经解决了(https://developer.apple.com/forums/thread/74868)

[问题] 询问关于原版CEF调整大小的问题。

你好 tishion ,我想询问一个关于原版CEF调整大小的问题(非CocoaCefView)
以下是原版CEF的 cefclient 例子root_window_mac.mm 文件中 创建浏览器窗口方法

if (!is_popup_) {
    // Create the browser window.
    browser_window_->CreateBrowser(
        CAST_NSVIEW_TO_CEF_WINDOW_HANDLE(viewForCEF),
        CefRect(0, 0, width, height), settings, nullptr,
        root_window_.delegate_->GetRequestContext(&root_window_));
  }

其中 CAST_NSVIEW_TO_CEF_WINDOW_HANDLE(viewForCEF) ,这里的view本来是contentView , 我把它改成自己创建的一个NSView ,我想让网页随viewForCEF大小变化

viewForCEF = [[NSView alloc]initWithFrame:NSMakeRect(0, 0, width, height)];
[contentView addSubview:viewForCEF];

然后我实验创建了一个NSButton ,按这个按钮,运行:

-(void)buttonPressed {
    NSLog(@"Button pressed!");
    CGFloat w = window_.contentView.frame.size.width - 100;
    CGFloat h = window_.contentView.frame.size.height;
    [viewForCEF setFrame:NSMakeRect(0, 0,w,h)];
}

我发现这个方法是可行的,是我想要的效果,网页大小刚好比窗口大小100,完美
但是如果把调整viewForCEF大小的代码放进 NSWindowDelegate windowDidResize 里,就出问题了,网页大小不对,而且被clip掉了:

 - (void)windowDidResize:(NSNotification *)notification{
    
    CGFloat w = window_.contentView.frame.size.width - 100;
    CGFloat h = window_.contentView.frame.size.height;
    [viewForCEF setFrame:NSMakeRect(0, 0,w,h)];
 
}

我发现,如果上面的代码放在NSTimer里或用dispatch_after 或 performSelector 方法延迟0.5秒左右也可以完美调整网页大小(即网页大小为viewForCEF的大小),另外使用手动按钮运行调整大小代码也是一样的道理

- (void)windowDidResize:(NSNotification *)notification{
    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(buttonPressed) object:nil];
    [self performSelector:@selector(buttonPressed) withObject:nil afterDelay:0.5];
}

所以我想请问,有什么方法可以立即调整viewForCEF的大小,且能够使网页大小和viewForCEF大小一致呢?
这是一个线程的问题,还是什么问题?
这问题我搜索了整个网络都没有答案,资料太少,我又菜
谢谢🙏

项目可以运行 但是会打印一些错误,会影响吗?

这个error会打印一遍
2021-12-14 14:26:16.383360+0800 CefViewWing (GPU)[52431:20128290] [1214/142616.383192:ERROR:vt_video_encode_accelerator_mac.cc(537)] VTCompressionSessionCreate failed: -12903
[1214/142616.383192:ERROR:vt_video_encode_accelerator_mac.cc(537)] VTCompressionSessionCreate failed: -12903

下边的打印信息会不停的打印,请问是什么原因呢?
2021-12-14 14:27:24.400414+0800 CefViewWing (GPU)[52431:20128338] [User Defaults] Couldn't read values in CFPrefsPlistSource<0x60000097c500> (Domain: kCFPreferencesAnyApplication, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): accessing preferences outside an application's container requires user-preference-read or file-read-data sandbox access

有没有可能新增自定义的 RenderDelegate ?

RT

如果想给 renderer 进程 js 环境注册 native 代码的话(比如 NSPasteboard 相关),需要自定义 RenderDelegate。

现在 CefView 中的 messge_router 和 invokeMethod 机制都只能是异步的。

我可以写在 CefViewCore 里面,但是感觉太侵入了。

网页打开方式如何判断?

对于网页端开发网页的方式有两种,
1:window.open(“”)
2:window.location.href =“”
对于wkwebView可以通过两个代理方法来处理两种不同的方式。请问cefView如何区分这两种打开方式呢?

页面一直闪烁

macOS 11.5.2
xcode 12.5.1
这个库还在维护么?刚才下载试了下,不能正常加载网页,一直在闪。

生成的app文件巨大,1G

生成的app文件巨大,debug 999M , release 729M
app里有3份Chromium Embedded Framework.framework
分别位于:
/CocoaCefViewDemo.app/Contents/Frameworks/CocoaCefView.framework/Resources/
/CocoaCefViewDemo.app/Contents/Frameworks/CocoaCefView.framework/Versions/A/
/CocoaCefViewDemo.app/Contents/Frameworks/CocoaCefView.framework/Versions/Current/Resources/
请问这要怎么解决?谢谢。

CefViewWing 进程数目问题

在 demo 中 CefViewWing 进程(非 renderer 进程)有一个,将 CocoaCefView.framework 集成到项目中后,运行有 3 个 CefViewWing 进程。

测试了下和 CefView 实例数也没有直接关系,会是因为什么导致 CefViewWing 进程数增加呢?

image

使用cocoacefView有异常

运行起来的cefView,每次加载url前总是会出现红色的背景。然后才会加载页面?这样的问题有遇到吗?如何解决?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.