Changeset 132647 in webkit
- Timestamp:
- Oct 26, 2012, 6:43:35 AM (12 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r132643 r132647 1 2012-10-26 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> 2 3 [EFL][WK2] Clean up construction/destruction code in Ewk_view 4 https://bugs.webkit.org/show_bug.cgi?id=100232 5 6 Reviewed by Kenneth Rohde Christiansen. 7 8 Simplified a lot of initialization and destruction code of Ewk_view and EwkViewImpl 9 put all the impl stuff to its constructor and destructor, also made EwkViewImpl member 10 variables private. 11 12 * UIProcess/API/efl/EwkViewImpl.cpp: 13 (pageViewMap): 14 (EwkViewImpl::addToPageViewMap): 15 (EwkViewImpl::removeFromPageViewMap): 16 (EwkViewImpl::viewFromPageViewMap): 17 (EwkViewImpl::EwkViewImpl): 18 (EwkViewImpl::~EwkViewImpl): 19 (EwkViewImpl::wkPage): 20 (EwkViewImpl::title): 21 (EwkViewImpl::setThemePath): 22 (EwkViewImpl::customTextEncodingName): 23 (EwkViewImpl::setCustomTextEncodingName): 24 (EwkViewImpl::informIconChange): 25 (EwkViewImpl::informWebProcessCrashed): 26 (EwkViewImpl::updateTextInputState): 27 (EwkViewImpl::informURLChange): 28 (EwkViewImpl::onFaviconChanged): 29 * UIProcess/API/efl/EwkViewImpl.h: 30 (WebKit): 31 (EwkViewImpl): 32 (EwkViewImpl::view): 33 (EwkViewImpl::page): 34 (EwkViewImpl::ewkContext): 35 (EwkViewImpl::backForwardList): 36 * UIProcess/API/efl/ewk_settings.cpp: 37 (Ewk_Settings::preferences): 38 * UIProcess/API/efl/ewk_view.cpp: 39 (_ewk_view_smart_focus_in): 40 (_ewk_view_smart_focus_out): 41 (_ewk_view_smart_mouse_wheel): 42 (_ewk_view_smart_mouse_down): 43 (_ewk_view_smart_mouse_up): 44 (_ewk_view_smart_mouse_move): 45 (_ewk_view_smart_key_down): 46 (_ewk_view_smart_key_up): 47 (_ewk_view_on_show): 48 (_ewk_view_on_hide): 49 (_ewk_view_smart_add): 50 (_ewk_view_smart_del): 51 (_ewk_view_smart_calculate): 52 (_ewk_view_smart_color_set): 53 (createEwkViewSmartClass): 54 (createEwkView): 55 (ewk_view_base_add): 56 (ewk_view_smart_add): 57 (ewk_view_add_with_context): 58 (ewk_view_url_set): 59 (ewk_view_reload): 60 (ewk_view_reload_bypass_cache): 61 (ewk_view_stop): 62 (ewk_view_load_progress_get): 63 (ewk_view_scale_set): 64 (ewk_view_scale_get): 65 (ewk_view_device_pixel_ratio_set): 66 (ewk_view_device_pixel_ratio_get): 67 (ewk_view_back): 68 (ewk_view_forward): 69 (ewk_view_intent_deliver): 70 (ewk_view_back_possible): 71 (ewk_view_forward_possible): 72 (ewk_view_back_forward_list_get): 73 (ewk_view_html_string_load): 74 (ewk_view_text_find): 75 (ewk_view_text_find_highlight_clear): 76 (ewk_view_text_matches_count): 77 (ewk_view_feed_touch_event): 78 (ewk_view_inspector_show): 79 (ewk_view_inspector_close): 80 (ewk_view_pagination_mode_set): 81 (ewk_view_pagination_mode_get): 82 1 83 2012-10-26 Christophe Dumez <christophe.dumez@intel.com> 2 84 -
trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp
r132617 r132647 34 34 #include "ResourceLoadClientEfl.h" 35 35 #include "WKString.h" 36 #include "WebContext.h" 37 #include "WebPageGroup.h" 36 38 #include "WebPageProxy.h" 37 39 #include "WebPopupMenuProxyEfl.h" 40 #include "WebPreferences.h" 38 41 #include "ewk_back_forward_list_private.h" 39 42 #include "ewk_color_picker_private.h" … … 50 53 #include <WebCore/Cursor.h> 51 54 55 56 #if ENABLE(FULLSCREEN_API) 57 #include "WebFullScreenManagerProxy.h" 58 #endif 59 52 60 using namespace WebCore; 53 61 using namespace WebKit; … … 55 63 static const int defaultCursorSize = 16; 56 64 57 EwkViewImpl::PageViewMap EwkViewImpl::pageViewMap; 58 59 void EwkViewImpl::addToPageViewMap(const Evas_Object* ewkView) 60 { 61 EwkViewImpl* viewImpl = EwkViewImpl::fromEvasObject(ewkView); 62 63 PageViewMap::AddResult result = pageViewMap.add(viewImpl->wkPage(), ewkView); 65 typedef HashMap<WKPageRef, Evas_Object*> PageViewMap; 66 67 static inline PageViewMap& pageViewMap() 68 { 69 DEFINE_STATIC_LOCAL(PageViewMap, map, ()); 70 return map; 71 } 72 73 void EwkViewImpl::addToPageViewMap(EwkViewImpl* viewImpl) 74 { 75 PageViewMap::AddResult result = pageViewMap().add(viewImpl->wkPage(), viewImpl->view()); 64 76 ASSERT_UNUSED(result, result.isNewEntry); 65 77 } 66 78 67 void EwkViewImpl::removeFromPageViewMap(const Evas_Object* ewkView) 68 { 69 EwkViewImpl* viewImpl = EwkViewImpl::fromEvasObject(ewkView); 70 71 ASSERT(pageViewMap.contains(viewImpl->wkPage())); 72 pageViewMap.remove(viewImpl->wkPage()); 79 void EwkViewImpl::removeFromPageViewMap(EwkViewImpl* viewImpl) 80 { 81 ASSERT(pageViewMap().contains(viewImpl->wkPage())); 82 pageViewMap().remove(viewImpl->wkPage()); 73 83 } 74 84 … … 77 87 ASSERT(page); 78 88 79 return pageViewMap.get(page); 80 } 81 82 EwkViewImpl::EwkViewImpl(Evas_Object* view) 89 return pageViewMap().get(page); 90 } 91 92 EwkViewImpl::EwkViewImpl(Evas_Object* view, PassRefPtr<Ewk_Context> context, PassRefPtr<WebPageGroup> pageGroup) 93 : m_view(view) 94 , m_context(context) 95 , m_pageClient(PageClientImpl::create(this)) 96 , m_pageProxy(toImpl(m_context->wkContext())->createWebPage(m_pageClient.get(), pageGroup.get())) 97 , m_pageLoadClient(PageLoadClientEfl::create(this)) 98 , m_pagePolicyClient(PagePolicyClientEfl::create(this)) 99 , m_pageUIClient(PageUIClientEfl::create(this)) 100 , m_resourceLoadClient(ResourceLoadClientEfl::create(this)) 101 , m_findClient(FindClientEfl::create(this)) 102 , m_formClient(FormClientEfl::create(this)) 103 , m_backForwardList(Ewk_Back_Forward_List::create(toAPI(m_pageProxy->backForwardList()))) 104 #if USE(TILED_BACKING_STORE) 105 , m_pageViewportControllerClient(PageViewportControllerClientEfl::create(this)) 106 , m_pageViewportController(adoptPtr(new PageViewportController(m_pageProxy.get(), m_pageViewportControllerClient.get()))) 107 #endif 83 108 #if USE(ACCELERATED_COMPOSITING) 84 : evasGl(0) 85 , evasGlContext(0) 86 , evasGlSurface(0) 87 , m_view(view) 88 #else 89 : m_view(view) 109 , m_evasGl(0) 110 , m_evasGlContext(0) 111 , m_evasGlSurface(0) 90 112 #endif 91 113 , m_settings(Ewk_Settings::create(this)) … … 97 119 , m_inputMethodContext(InputMethodContextEfl::create(this, smartData()->base.evas)) 98 120 { 99 ASSERT(view); 121 ASSERT(m_view); 122 ASSERT(m_context); 123 ASSERT(m_pageProxy); 124 125 #if USE(COORDINATED_GRAPHICS) 126 m_pageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(true); 127 m_pageProxy->pageGroup()->preferences()->setForceCompositingMode(true); 128 m_pageProxy->setUseFixedLayout(true); 129 #endif 130 131 m_pageProxy->initializeWebPage(); 132 133 #if USE(TILED_BACKING_STORE) 134 pageClient->setPageViewportController(pageViewportController.get()); 135 #endif 136 137 #if ENABLE(FULLSCREEN_API) 138 m_pageProxy->fullScreenManager()->setWebView(m_view); 139 m_pageProxy->pageGroup()->preferences()->setFullScreenEnabled(true); 140 #endif 100 141 101 142 // Enable mouse events by default 102 143 setMouseEventsEnabled(true); 144 145 // Listen for favicon changes. 146 Ewk_Favicon_Database* iconDatabase = m_context->faviconDatabase(); 147 ASSERT(iconDatabase); 148 149 iconDatabase->watchChanges(IconChangeCallbackData(EwkViewImpl::onFaviconChanged, this)); 150 151 EwkViewImpl::addToPageViewMap(this); 103 152 } 104 153 105 154 EwkViewImpl::~EwkViewImpl() 106 155 { 156 // Unregister icon change callback. 157 Ewk_Favicon_Database* iconDatabase = m_context->faviconDatabase(); 158 ASSERT(iconDatabase); 159 160 iconDatabase->unwatchChanges(EwkViewImpl::onFaviconChanged); 161 162 EwkViewImpl::removeFromPageViewMap(this); 107 163 } 108 164 … … 127 183 WKPageRef EwkViewImpl::wkPage() 128 184 { 129 return toAPI( pageProxy.get());185 return toAPI(m_pageProxy.get()); 130 186 } 131 187 … … 523 579 const char* EwkViewImpl::title() const 524 580 { 525 m_title = pageProxy->pageTitle().utf8().data();581 m_title = m_pageProxy->pageTitle().utf8().data(); 526 582 527 583 return m_title; … … 546 602 if (m_theme != theme) { 547 603 m_theme = theme; 548 pageProxy->setThemePath(theme);604 m_pageProxy->setThemePath(theme); 549 605 } 550 606 } … … 552 608 const char* EwkViewImpl::customTextEncodingName() const 553 609 { 554 String customEncoding = pageProxy->customTextEncodingName();610 String customEncoding = m_pageProxy->customTextEncodingName(); 555 611 if (customEncoding.isEmpty()) 556 612 return 0; … … 564 620 { 565 621 m_customEncoding = encoding; 566 pageProxy->setCustomTextEncodingName(encoding ? encoding : String());622 m_pageProxy->setCustomTextEncodingName(encoding ? encoding : String()); 567 623 } 568 624 … … 627 683 void EwkViewImpl::informIconChange() 628 684 { 629 Ewk_Favicon_Database* iconDatabase = context->faviconDatabase();685 Ewk_Favicon_Database* iconDatabase = m_context->faviconDatabase(); 630 686 ASSERT(iconDatabase); 631 687 … … 801 857 802 858 if (!handled) { 803 CString url = pageProxy->urlAtProcessExit().utf8();859 CString url = m_pageProxy->urlAtProcessExit().utf8(); 804 860 WARN("WARNING: The web process experienced a crash on '%s'.\n", url.data()); 805 861 … … 924 980 void EwkViewImpl::informURLChange() 925 981 { 926 String activeURL = pageProxy->activeURL();982 String activeURL = m_pageProxy->activeURL(); 927 983 if (activeURL.isEmpty()) 928 984 return; … … 1029 1085 } 1030 1086 #endif 1087 1088 void EwkViewImpl::onFaviconChanged(const char* pageURL, void* eventInfo) 1089 { 1090 EwkViewImpl* viewImpl = static_cast<EwkViewImpl*>(eventInfo); 1091 1092 if (!viewImpl->url() || strcasecmp(viewImpl->url(), pageURL)) 1093 return; 1094 1095 viewImpl->informIconChange(); 1096 } -
trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h
r132617 r132647 70 70 class PageViewportController; 71 71 class ResourceLoadClientEfl; 72 class WebPageGroup; 72 73 class WebPageProxy; 73 74 class WebPopupItem; … … 101 102 class EwkViewImpl { 102 103 public: 103 explicit EwkViewImpl(Evas_Object* view);104 EwkViewImpl(Evas_Object* view, PassRefPtr<Ewk_Context> context, PassRefPtr<WebKit::WebPageGroup> pageGroup); 104 105 ~EwkViewImpl(); 105 106 106 107 static EwkViewImpl* fromEvasObject(const Evas_Object* view); 107 108 108 inlineEvas_Object* view() { return m_view; }109 Evas_Object* view() { return m_view; } 109 110 WKPageRef wkPage(); 110 inline WebKit::WebPageProxy* page() { returnpageProxy.get(); }111 Ewk_Context* ewkContext() { return context.get(); }111 WebKit::WebPageProxy* page() { return m_pageProxy.get(); } 112 Ewk_Context* ewkContext() { return m_context.get(); } 112 113 Ewk_Settings* settings() { return m_settings.get(); } 114 Ewk_Back_Forward_List* backForwardList() { return m_backForwardList.get(); } 113 115 114 116 WebCore::IntSize size() const; … … 137 139 void setImageData(void* imageData, const WebCore::IntSize& size); 138 140 139 static void addToPageViewMap( const Evas_Object* ewkView);140 static void removeFromPageViewMap( const Evas_Object* ewkView);141 static void addToPageViewMap(EwkViewImpl* viewImpl); 142 static void removeFromPageViewMap(EwkViewImpl* viewImpl); 141 143 static const Evas_Object* viewFromPageViewMap(const WKPageRef); 142 144 … … 211 213 #endif 212 214 213 // FIXME: Make members private for encapsulation.214 OwnPtr<WebKit::PageClientImpl> pageClient;215 #if USE(TILED_BACKING_STORE)216 OwnPtr<WebKit::PageViewportControllerClientEfl> pageViewportControllerClient;217 OwnPtr<WebKit::PageViewportController> pageViewportController;218 #endif219 RefPtr<WebKit::WebPageProxy> pageProxy;220 OwnPtr<WebKit::PageLoadClientEfl> pageLoadClient;221 OwnPtr<WebKit::PagePolicyClientEfl> pagePolicyClient;222 OwnPtr<WebKit::PageUIClientEfl> pageUIClient;223 OwnPtr<WebKit::ResourceLoadClientEfl> resourceLoadClient;224 OwnPtr<WebKit::FindClientEfl> findClient;225 OwnPtr<WebKit::FormClientEfl> formClient;226 227 OwnPtr<Ewk_Back_Forward_List> backForwardList;228 RefPtr<Ewk_Context> context;229 230 #if USE(ACCELERATED_COMPOSITING)231 Evas_GL* evasGl;232 Evas_GL_Context* evasGlContext;233 Evas_GL_Surface* evasGlSurface;234 #endif235 236 215 private: 237 216 inline Ewk_View_Smart_Data* smartData(); … … 247 226 static void onTouchMove(void* /* data */, Evas* /* canvas */, Evas_Object* ewkView, void* /* eventInfo */); 248 227 #endif 249 228 static void onFaviconChanged(const char* pageURL, void* eventInfo); 229 230 // Note, initialization matters. 250 231 Evas_Object* m_view; 232 RefPtr<Ewk_Context> m_context; 233 OwnPtr<WebKit::PageClientImpl> m_pageClient; 234 RefPtr<WebKit::WebPageProxy> m_pageProxy; 235 OwnPtr<WebKit::PageLoadClientEfl> m_pageLoadClient; 236 OwnPtr<WebKit::PagePolicyClientEfl> m_pagePolicyClient; 237 OwnPtr<WebKit::PageUIClientEfl> m_pageUIClient; 238 OwnPtr<WebKit::ResourceLoadClientEfl> m_resourceLoadClient; 239 OwnPtr<WebKit::FindClientEfl> m_findClient; 240 OwnPtr<WebKit::FormClientEfl> m_formClient; 241 OwnPtr<Ewk_Back_Forward_List> m_backForwardList; 242 #if USE(TILED_BACKING_STORE) 243 OwnPtr<WebKit::PageViewportControllerClientEfl> m_pageViewportControllerClient; 244 OwnPtr<WebKit::PageViewportController> m_pageViewportController; 245 #endif 246 #if USE(ACCELERATED_COMPOSITING) 247 Evas_GL* m_evasGl; 248 Evas_GL_Context* m_evasGlContext; 249 Evas_GL_Surface* m_evasGlSurface; 250 #endif 251 251 OwnPtr<Ewk_Settings> m_settings; 252 252 RefPtr<Evas_Object> m_cursorObject; … … 266 266 OwnPtr<WebKit::InputMethodContextEfl> m_inputMethodContext; 267 267 OwnPtr<Ewk_Color_Picker> m_colorPicker; 268 269 typedef HashMap<WKPageRef, const Evas_Object*> PageViewMap;270 static PageViewMap pageViewMap;271 268 }; 272 269 -
trunk/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp
r132354 r132647 46 46 const WebKit::WebPreferences* Ewk_Settings::preferences() const 47 47 { 48 return m_viewImpl->page Proxy->pageGroup()->preferences();48 return m_viewImpl->page()->pageGroup()->preferences(); 49 49 } 50 50 51 51 WebKit::WebPreferences* Ewk_Settings::preferences() 52 52 { 53 return m_viewImpl->page Proxy->pageGroup()->preferences();53 return m_viewImpl->page()->pageGroup()->preferences(); 54 54 } 55 55 -
trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
r132627 r132647 53 53 #include <WebKit2/WKPageGroup.h> 54 54 #include <wtf/text/CString.h> 55 56 #if ENABLE(FULLSCREEN_API)57 #include "WebFullScreenManagerProxy.h"58 #endif59 55 60 56 #if ENABLE(INSPECTOR) … … 130 126 } 131 127 132 static void _ewk_view_on_favicon_changed(const char* pageURL, void* eventInfo)133 {134 Evas_Object* ewkView = static_cast<Evas_Object*>(eventInfo);135 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);136 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);137 138 const char* viewURL = ewk_view_url_get(ewkView);139 if (!viewURL || strcasecmp(viewURL, pageURL))140 return;141 142 impl->informIconChange();143 }144 145 128 // Default Event Handling. 146 129 static Eina_Bool _ewk_view_smart_focus_in(Ewk_View_Smart_Data* smartData) … … 148 131 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); 149 132 150 impl->page Proxy->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive);133 impl->page()->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive); 151 134 return true; 152 135 } … … 156 139 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); 157 140 158 impl->page Proxy->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive);141 impl->page()->viewStateDidChange(WebPageProxy::ViewIsFocused | WebPageProxy::ViewWindowIsActive); 159 142 return true; 160 143 } … … 180 163 Evas_Event_Mouse_Wheel event(*wheelEvent); 181 164 event.canvas = mapToWebContent(smartData, event.canvas); 182 impl->page Proxy->handleWheelEvent(NativeWebWheelEvent(&event, &position));165 impl->page()->handleWheelEvent(NativeWebWheelEvent(&event, &position)); 183 166 #else 184 impl->page Proxy->handleWheelEvent(NativeWebWheelEvent(wheelEvent, &position));167 impl->page()->handleWheelEvent(NativeWebWheelEvent(wheelEvent, &position)); 185 168 #endif 186 169 return true; … … 195 178 Evas_Event_Mouse_Down event(*downEvent); 196 179 event.canvas = mapToWebContent(smartData, event.canvas); 197 impl->page Proxy->handleMouseEvent(NativeWebMouseEvent(&event, &position));180 impl->page()->handleMouseEvent(NativeWebMouseEvent(&event, &position)); 198 181 #else 199 impl->page Proxy->handleMouseEvent(NativeWebMouseEvent(downEvent, &position));182 impl->page()->handleMouseEvent(NativeWebMouseEvent(downEvent, &position)); 200 183 #endif 201 184 return true; … … 210 193 Evas_Event_Mouse_Up event(*upEvent); 211 194 event.canvas = mapToWebContent(smartData, event.canvas); 212 impl->page Proxy->handleMouseEvent(NativeWebMouseEvent(&event, &position));195 impl->page()->handleMouseEvent(NativeWebMouseEvent(&event, &position)); 213 196 #else 214 impl->page Proxy->handleMouseEvent(NativeWebMouseEvent(upEvent, &position));197 impl->page()->handleMouseEvent(NativeWebMouseEvent(upEvent, &position)); 215 198 #endif 216 199 … … 230 213 Evas_Event_Mouse_Move event(*moveEvent); 231 214 event.cur.canvas = mapToWebContent(smartData, event.cur.canvas); 232 impl->page Proxy->handleMouseEvent(NativeWebMouseEvent(&event, &position));215 impl->page()->handleMouseEvent(NativeWebMouseEvent(&event, &position)); 233 216 #else 234 impl->page Proxy->handleMouseEvent(NativeWebMouseEvent(moveEvent, &position));217 impl->page()->handleMouseEvent(NativeWebMouseEvent(moveEvent, &position)); 235 218 #endif 236 219 return true; … … 246 229 inputMethodContext->handleKeyDownEvent(downEvent, &isFiltered); 247 230 248 impl->page Proxy->handleKeyboardEvent(NativeWebKeyboardEvent(downEvent, isFiltered));231 impl->page()->handleKeyboardEvent(NativeWebKeyboardEvent(downEvent, isFiltered)); 249 232 return true; 250 233 } … … 254 237 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); 255 238 256 impl->page Proxy->handleKeyboardEvent(NativeWebKeyboardEvent(upEvent));239 impl->page()->handleKeyboardEvent(NativeWebKeyboardEvent(upEvent)); 257 240 return true; 258 241 } … … 306 289 Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data); 307 290 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); 308 impl->page Proxy->viewStateDidChange(WebPageProxy::ViewIsVisible);291 impl->page()->viewStateDidChange(WebPageProxy::ViewIsVisible); 309 292 } 310 293 … … 317 300 // viewStateDidChange() itself is responsible for actually setting the visibility to Visible or Hidden 318 301 // depending on what WebPageProxy::isViewVisible() returns, this simply triggers the process. 319 impl->page Proxy->viewStateDidChange(WebPageProxy::ViewIsVisible);302 impl->page()->viewStateDidChange(WebPageProxy::ViewIsVisible); 320 303 } 321 304 322 305 static Evas_Smart_Class g_parentSmartClass = EVAS_SMART_CLASS_INIT_NULL; 323 324 static void _ewk_view_impl_del(EwkViewImpl* impl)325 {326 /* Unregister icon change callback */327 Ewk_Favicon_Database* iconDatabase = impl->context->faviconDatabase();328 iconDatabase->unwatchChanges(_ewk_view_on_favicon_changed);329 330 delete impl;331 }332 306 333 307 static void _ewk_view_smart_add(Evas_Object* ewkView) … … 352 326 g_parentSmartClass.add(ewkView); 353 327 354 smartData->priv = new EwkViewImpl(ewkView); 355 if (!smartData->priv) { 356 EINA_LOG_CRIT("could not allocate EwkViewImpl"); 357 evas_object_smart_data_set(ewkView, 0); 358 free(smartData); 359 return; 360 } 328 smartData->priv = 0; 361 329 362 330 // Create evas_object_image to draw web contents. … … 380 348 static void _ewk_view_smart_del(Evas_Object* ewkView) 381 349 { 382 EwkViewImpl::removeFromPageViewMap(ewkView);383 350 EWK_VIEW_SD_GET(ewkView, smartData); 384 if (smartData && smartData->priv)385 _ewk_view_impl_del(smartData->priv);351 if (smartData) 352 delete smartData->priv; 386 353 387 354 g_parentSmartClass.del(ewkView); … … 430 397 #endif 431 398 432 if (impl->page Proxy->drawingArea())433 impl->page Proxy->drawingArea()->setSize(IntSize(width, height), IntSize());399 if (impl->page()->drawingArea()) 400 impl->page()->drawingArea()->setSize(IntSize(width, height), IntSize()); 434 401 435 402 smartData->view.w = width; … … 493 460 494 461 evas_object_image_alpha_set(smartData->image, alpha < 255); 495 impl->page Proxy->setDrawsBackground(red || green || blue);496 impl->page Proxy->setDrawsTransparentBackground(alpha < 255);462 impl->page()->setDrawsBackground(red || green || blue); 463 impl->page()->setDrawsTransparentBackground(alpha < 255); 497 464 498 465 g_parentSmartClass.color_set(ewkView, red, green, blue, alpha); … … 538 505 } 539 506 540 static inline Evas_Smart* _ewk_view_smart_class_new(void)507 static inline Evas_Smart* createEwkViewSmartClass(void) 541 508 { 542 509 static Ewk_View_Smart_Class api = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION("Ewk_View"); … … 551 518 } 552 519 553 static void _ewk_view_initialize(Evas_Object* ewkView, PassRefPtr<Ewk_Context> context, WKPageGroupRef pageGroupRef) 554 { 555 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); 556 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl); 557 EINA_SAFETY_ON_NULL_RETURN(context); 558 559 if (impl->pageClient) 560 return; 561 562 impl->pageClient = PageClientImpl::create(impl); 563 564 if (pageGroupRef) 565 impl->pageProxy = toImpl(context->wkContext())->createWebPage(impl->pageClient.get(), toImpl(pageGroupRef)); 566 else 567 impl->pageProxy = toImpl(context->wkContext())->createWebPage(impl->pageClient.get(), WebPageGroup::create().get()); 568 569 EwkViewImpl::addToPageViewMap(ewkView); 570 571 #if USE(COORDINATED_GRAPHICS) 572 impl->pageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(true); 573 impl->pageProxy->pageGroup()->preferences()->setForceCompositingMode(true); 574 impl->pageProxy->setUseFixedLayout(true); 575 #if ENABLE(WEBGL) 576 impl->pageProxy->pageGroup()->preferences()->setWebGLEnabled(true); 577 #endif 578 #endif 579 impl->pageProxy->initializeWebPage(); 580 581 impl->backForwardList = Ewk_Back_Forward_List::create(toAPI(impl->pageProxy->backForwardList())); 582 583 impl->context = context; 584 585 #if USE(TILED_BACKING_STORE) 586 impl->pageViewportControllerClient = PageViewportControllerClientEfl::create(impl); 587 impl->pageViewportController = adoptPtr(new PageViewportController(impl->pageProxy.get(), impl->pageViewportControllerClient.get())); 588 impl->pageClient->setPageViewportController(impl->pageViewportController.get()); 589 #endif 590 591 #if ENABLE(FULLSCREEN_API) 592 impl->pageProxy->fullScreenManager()->setWebView(ewkView); 593 impl->pageProxy->pageGroup()->preferences()->setFullScreenEnabled(true); 594 #endif 595 596 // Initialize page clients. 597 impl->pageLoadClient = PageLoadClientEfl::create(impl); 598 impl->pagePolicyClient = PagePolicyClientEfl::create(impl); 599 impl->pageUIClient = PageUIClientEfl::create(impl); 600 impl->resourceLoadClient = ResourceLoadClientEfl::create(impl); 601 impl->findClient = FindClientEfl::create(impl); 602 impl->formClient = FormClientEfl::create(impl); 603 604 /* Listen for favicon changes */ 605 Ewk_Favicon_Database* iconDatabase = impl->context->faviconDatabase(); 606 iconDatabase->watchChanges(IconChangeCallbackData(_ewk_view_on_favicon_changed, ewkView)); 607 } 608 609 static Evas_Object* _ewk_view_add_with_smart(Evas* canvas, Evas_Smart* smart) 520 static inline Evas_Object* createEwkView(Evas* canvas, Evas_Smart* smart, PassRefPtr<Ewk_Context> context, WKPageGroupRef pageGroupRef = 0) 610 521 { 611 522 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0); 612 523 EINA_SAFETY_ON_NULL_RETURN_VAL(smart, 0); 524 EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0); 613 525 614 526 Evas_Object* ewkView = evas_object_smart_add(canvas, smart); 615 if (!ewkView) 616 return 0; 527 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkView, 0); 617 528 618 529 EWK_VIEW_SD_GET(ewkView, smartData); … … 622 533 } 623 534 624 EWK_VIEW_IMPL_GET(smartData, impl); 625 if (!impl) { 626 evas_object_del(ewkView); 627 return 0; 628 } 535 ASSERT(!smartData->priv); 536 RefPtr<WebPageGroup> pageGroup = pageGroupRef ? toImpl(pageGroupRef) : WebPageGroup::create(); 537 smartData->priv = new EwkViewImpl(ewkView, context, pageGroup); 629 538 630 539 return ewkView; … … 637 546 Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef contextRef, WKPageGroupRef pageGroupRef) 638 547 { 639 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0); 640 EINA_SAFETY_ON_NULL_RETURN_VAL(contextRef, 0); 641 Evas_Object* ewkView = _ewk_view_add_with_smart(canvas, _ewk_view_smart_class_new()); 642 if (!ewkView) 643 return 0; 644 645 _ewk_view_initialize(ewkView, Ewk_Context::create(contextRef), pageGroupRef); 646 647 return ewkView; 548 return createEwkView(canvas, createEwkViewSmartClass(), Ewk_Context::create(contextRef), pageGroupRef); 648 549 } 649 550 650 551 Evas_Object* ewk_view_smart_add(Evas* canvas, Evas_Smart* smart, Ewk_Context* context) 651 552 { 652 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0); 653 EINA_SAFETY_ON_NULL_RETURN_VAL(smart, 0); 654 EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0); 655 656 Evas_Object* ewkView = _ewk_view_add_with_smart(canvas, smart); 657 if (!ewkView) 658 return 0; 659 660 _ewk_view_initialize(ewkView, context, 0); 661 662 return ewkView; 553 return createEwkView(canvas, smart, context); 663 554 } 664 555 665 556 Evas_Object* ewk_view_add_with_context(Evas* canvas, Ewk_Context* context) 666 557 { 667 EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0); 668 return ewk_view_smart_add(canvas, _ewk_view_smart_class_new(), context); 558 return ewk_view_smart_add(canvas, createEwkViewSmartClass(), context); 669 559 } 670 560 … … 688 578 EINA_SAFETY_ON_NULL_RETURN_VAL(url, false); 689 579 690 impl->page Proxy->loadURL(url);580 impl->page()->loadURL(url); 691 581 impl->informURLChange(); 692 582 … … 715 605 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); 716 606 717 impl->page Proxy->reload(/*reloadFromOrigin*/ false);607 impl->page()->reload(/*reloadFromOrigin*/ false); 718 608 impl->informURLChange(); 719 609 … … 726 616 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); 727 617 728 impl->page Proxy->reload(/*reloadFromOrigin*/ true);618 impl->page()->reload(/*reloadFromOrigin*/ true); 729 619 impl->informURLChange(); 730 620 … … 737 627 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); 738 628 739 impl->page Proxy->stopLoading();629 impl->page()->stopLoading(); 740 630 741 631 return true; … … 774 664 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, -1.0); 775 665 776 return impl->page Proxy->estimatedProgress();666 return impl->page()->estimatedProgress(); 777 667 } 778 668 … … 782 672 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); 783 673 784 impl->page Proxy->scalePage(scaleFactor, IntPoint(x, y));674 impl->page()->scalePage(scaleFactor, IntPoint(x, y)); 785 675 return true; 786 676 } … … 791 681 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, -1); 792 682 793 return impl->page Proxy->pageScaleFactor();683 return impl->page()->pageScaleFactor(); 794 684 } 795 685 … … 799 689 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); 800 690 801 impl->page Proxy->setCustomDeviceScaleFactor(ratio);691 impl->page()->setCustomDeviceScaleFactor(ratio); 802 692 803 693 return true; … … 809 699 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, -1.0); 810 700 811 return impl->page Proxy->deviceScaleFactor();701 return impl->page()->deviceScaleFactor(); 812 702 } 813 703 … … 833 723 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); 834 724 835 WebPageProxy* page = impl->page Proxy.get();725 WebPageProxy* page = impl->page(); 836 726 if (page->canGoBack()) { 837 727 page->goBack(); … … 847 737 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); 848 738 849 WebPageProxy* page = impl->page Proxy.get();739 WebPageProxy* page = impl->page(); 850 740 if (page->canGoForward()) { 851 741 page->goForward(); … … 863 753 EINA_SAFETY_ON_NULL_RETURN_VAL(intent, false); 864 754 865 WebPageProxy* page = impl->page Proxy.get();755 WebPageProxy* page = impl->page(); 866 756 page->deliverIntentToFrame(page->mainFrame(), intent->webIntentData()); 867 757 … … 877 767 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); 878 768 879 return impl->page Proxy->canGoBack();769 return impl->page()->canGoBack(); 880 770 } 881 771 … … 885 775 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); 886 776 887 return impl->page Proxy->canGoForward();777 return impl->page()->canGoForward(); 888 778 } 889 779 … … 893 783 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0); 894 784 895 return impl->backForwardList .get();785 return impl->backForwardList(); 896 786 } 897 787 … … 903 793 904 794 if (unreachableUrl && *unreachableUrl) 905 impl->page Proxy->loadAlternateHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "", String::fromUTF8(unreachableUrl));795 impl->page()->loadAlternateHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "", String::fromUTF8(unreachableUrl)); 906 796 else 907 impl->page Proxy->loadHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : "");797 impl->page()->loadHTMLString(String::fromUTF8(html), baseUrl ? String::fromUTF8(baseUrl) : ""); 908 798 909 799 impl->informURLChange(); … … 946 836 EINA_SAFETY_ON_NULL_RETURN_VAL(text, false); 947 837 948 impl->page Proxy->findString(String::fromUTF8(text), static_cast<WebKit::FindOptions>(options), maxMatchCount);838 impl->page()->findString(String::fromUTF8(text), static_cast<WebKit::FindOptions>(options), maxMatchCount); 949 839 950 840 return true; … … 956 846 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); 957 847 958 impl->page Proxy->hideFindUI();848 impl->page()->hideFindUI(); 959 849 960 850 return true; … … 967 857 EINA_SAFETY_ON_NULL_RETURN_VAL(text, false); 968 858 969 impl->page Proxy->countStringMatches(String::fromUTF8(text), static_cast<WebKit::FindOptions>(options), maxMatchCount);859 impl->page()->countStringMatches(String::fromUTF8(text), static_cast<WebKit::FindOptions>(options), maxMatchCount); 970 860 971 861 return true; … … 1000 890 // FIXME: Touch points do not take scroll position and scale into account when 1001 891 // TILED_BACKING_STORE is enabled. 1002 impl->page Proxy->handleTouchEvent(NativeWebTouchEvent(type, points, modifiers, &position, ecore_time_get()));892 impl->page()->handleTouchEvent(NativeWebTouchEvent(type, points, modifiers, &position, ecore_time_get())); 1003 893 1004 894 return true; … … 1040 930 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); 1041 931 1042 WebInspectorProxy* inspector = impl->page Proxy->inspector();932 WebInspectorProxy* inspector = impl->page()->inspector(); 1043 933 if (inspector) 1044 934 inspector->show(); … … 1056 946 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); 1057 947 1058 WebInspectorProxy* inspector = impl->page Proxy->inspector();948 WebInspectorProxy* inspector = impl->page()->inspector(); 1059 949 if (inspector) 1060 950 inspector->close(); … … 1078 968 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false); 1079 969 1080 impl->page Proxy->setPaginationMode(static_cast<WebCore::Pagination::Mode>(mode));970 impl->page()->setPaginationMode(static_cast<WebCore::Pagination::Mode>(mode)); 1081 971 1082 972 return true; … … 1088 978 EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, EWK_PAGINATION_MODE_INVALID); 1089 979 1090 return static_cast<Ewk_Pagination_Mode>(impl->page Proxy->paginationMode());1091 } 980 return static_cast<Ewk_Pagination_Mode>(impl->page()->paginationMode()); 981 }
Note:
See TracChangeset
for help on using the changeset viewer.