Note: first of all, compared with the code on the WebKit official website, the version on IOS uses wakview instead of nsview. For example, in Mac OS, platformwidget is defined as nsview *, while in IOS it is wakview *. For details, refer to hursing'sBlog.
Overview
Observe the view structure of a page containing videos:
Hierarchy of uiwebview
<Uiwebview: 0x8d8c160; frame = (0 78; 768 926 );
| <_ Uiwebviewscrollview: 0x8d95310; frame = (0 0; 768 926 );
| <Uiimageview: 0x8d96eb0; frame = (0 0; 10 10 );
|...
| <Uiwebbrowserview: 0xa2a3c00; frame = (0 0; 768 926 );
| <Tilehostlayer: 0x8d8d4a0> (layer)
| <Tilelayer: 0x8a81e20> (layer)
| <Calayer: 0x7579a70> (layer)
| <Weblayer: 0x71ab2b0> (layer)
| <Weblayer: 0x8ea80f0> (layer)
| <Weblayer: 0x71848c0> (layer)
| <Calayer: 0x88a0650> (layer)
| <Figpluginview: 0xb1d6670; frame = (0 0; 631 278 );
| <Uiimageview: 0x8c650d0; frame = (0 919; 768 7 );
| <Uiimageview: 0x8c7d760; frame = (761 0; 7 926 );
Hierarchy of webview
Uiwebbrowserview (uiview)
| _ Webview <webview: Wak: 0x7541e70 (WK: 0x7541ee0)>
| <Webframeview: Wak: 0x75428c0 (WK: 0x7542910)>
| <Wakscrollview: Wak: 0x7542c90 (WK: 0x7542cf0)>
| <Wakclipview: Wak: 0x7542e80 (WK: 0x7542ed0)>
| <Webhtmlview: Wak: 0x8e226e0 (WK: 0x8e2c5a0)>
| <Uiwebpluginview: Wak: 0x8e31a60 (WK: 0x8e31ad0)>
* This is not a direct subview relationship, but a wakview tree managed by the member Variable _ webview of uiwebbrowserview.
Expand down from uiwebview and display the playback view figpluginview at the view level. The following tree shows the uiwebpluginview from the webview layer (note that the second upper-case I is used ). Figpluginview is managed by uiwebpluginview (see the previous article ).
Uiwebpluginview only cares about the plugin view, layer, and interaction. Therefore, you can see that it provides four WebKit plugin interface functions and some painting operations interfaces (setframe, layout ....), The rest is basically related to the layer. M_widget In the widget points to a wakview. When webframeview is created, it is assigned to a widget. The widget is added to the frameview when the renderwidget loads the plugin.
For more information about widgets, see WebCore: widget.
Uipluginview-Initialize view (Video plug-in)
In this creation process, the relationship between figpluginview, uiwebpluginviiew, and webplugincontroller is established.
Uipluginview-add plug-in view to page view
When the uiwebpluginview receives the setframe setting, the plugin view figpluginview is added to the uibrowserview, and the layer of the video plug-in is associated.
Uipluginview-Attach/detach View
During the typographical process, the uiwebpluginview attach plug-in view is triggered through renderbox (step 1. When the view is removed (step 4), the layer of the plug-in is detached.
Reprinted please indicate the source: http://blog.csdn.net/horkychen