Title: [127385] trunk/Source/WebKit/efl
Revision
127385
Author
[email protected]
Date
2012-09-01 21:31:52 -0700 (Sat, 01 Sep 2012)

Log Message

[EFL] Refactoring the DumpRenderTreeSupportEfl
https://bugs.webkit.org/show_bug.cgi?id=95544

Patch by Jinwoo Song <[email protected]> on 2012-09-01
Reviewed by Gyuyoung Kim.

There are lots of repeated codes for getting the WebCore::Frame
and WebCore::Page. To reduce these duplications, simple macros
are added.

No new tests, just refactoring.

* WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
(DumpRenderTreeSupportEfl::activeAnimationsCount):
(DumpRenderTreeSupportEfl::callShouldCloseOnWebView):
(DumpRenderTreeSupportEfl::clearFrameName):
(DumpRenderTreeSupportEfl::clearOpener):
(DumpRenderTreeSupportEfl::elementDoesAutoCompleteForElementWithId):
(DumpRenderTreeSupportEfl::frameChildren):
(DumpRenderTreeSupportEfl::frameParent):
(DumpRenderTreeSupportEfl::layoutFrame):
(DumpRenderTreeSupportEfl::numberOfPages):
(DumpRenderTreeSupportEfl::pageSizeAndMarginsInPixels):
(DumpRenderTreeSupportEfl::pageProperty):
(DumpRenderTreeSupportEfl::pauseAnimation):
(DumpRenderTreeSupportEfl::pauseTransition):
(DumpRenderTreeSupportEfl::pendingUnloadEventCount):
(DumpRenderTreeSupportEfl::renderTreeDump):
(DumpRenderTreeSupportEfl::responseMimeType):
(DumpRenderTreeSupportEfl::selectionRectangle):
(DumpRenderTreeSupportEfl::suitableDRTFrameName):
(DumpRenderTreeSupportEfl::setDefersLoading):
(DumpRenderTreeSupportEfl::setLoadsSiteIconsIgnoringImageLoadingSetting):
(DumpRenderTreeSupportEfl::addUserScript):
(DumpRenderTreeSupportEfl::clearUserScripts):
(DumpRenderTreeSupportEfl::addUserStyleSheet):
(DumpRenderTreeSupportEfl::clearUserStyleSheets):
(DumpRenderTreeSupportEfl::executeCoreCommandByName):
(DumpRenderTreeSupportEfl::findString):
(DumpRenderTreeSupportEfl::setCSSGridLayoutEnabled):
(DumpRenderTreeSupportEfl::isCommandEnabled):
(DumpRenderTreeSupportEfl::setSmartInsertDeleteEnabled):
(DumpRenderTreeSupportEfl::setSelectTrailingWhitespaceEnabled):
(DumpRenderTreeSupportEfl::evaluateInWebInspector):
(DumpRenderTreeSupportEfl::evaluateScriptInIsolatedWorld):
(DumpRenderTreeSupportEfl::globalContextRefForFrame):
(DumpRenderTreeSupportEfl::setInteractiveFormValidationEnabled):
(DumpRenderTreeSupportEfl::setValidationMessageTimerMagnification):
(DumpRenderTreeSupportEfl::setAuthorAndUserStylesEnabled):
(DumpRenderTreeSupportEfl::setComposition):
(DumpRenderTreeSupportEfl::hasComposition):
(DumpRenderTreeSupportEfl::compositionRange):
(DumpRenderTreeSupportEfl::confirmComposition):
(DumpRenderTreeSupportEfl::firstRectForCharacterRange):
(DumpRenderTreeSupportEfl::selectedRange):

Modified Paths

Diff

Modified: trunk/Source/WebKit/efl/ChangeLog (127384 => 127385)


--- trunk/Source/WebKit/efl/ChangeLog	2012-09-02 03:08:00 UTC (rev 127384)
+++ trunk/Source/WebKit/efl/ChangeLog	2012-09-02 04:31:52 UTC (rev 127385)
@@ -1,3 +1,60 @@
+2012-09-01  Jinwoo Song  <[email protected]>
+
+        [EFL] Refactoring the DumpRenderTreeSupportEfl
+        https://bugs.webkit.org/show_bug.cgi?id=95544
+
+        Reviewed by Gyuyoung Kim.
+
+        There are lots of repeated codes for getting the WebCore::Frame 
+        and WebCore::Page. To reduce these duplications, simple macros
+        are added.
+
+        No new tests, just refactoring.
+
+        * WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
+        (DumpRenderTreeSupportEfl::activeAnimationsCount):
+        (DumpRenderTreeSupportEfl::callShouldCloseOnWebView):
+        (DumpRenderTreeSupportEfl::clearFrameName):
+        (DumpRenderTreeSupportEfl::clearOpener):
+        (DumpRenderTreeSupportEfl::elementDoesAutoCompleteForElementWithId):
+        (DumpRenderTreeSupportEfl::frameChildren):
+        (DumpRenderTreeSupportEfl::frameParent):
+        (DumpRenderTreeSupportEfl::layoutFrame):
+        (DumpRenderTreeSupportEfl::numberOfPages):
+        (DumpRenderTreeSupportEfl::pageSizeAndMarginsInPixels):
+        (DumpRenderTreeSupportEfl::pageProperty):
+        (DumpRenderTreeSupportEfl::pauseAnimation):
+        (DumpRenderTreeSupportEfl::pauseTransition):
+        (DumpRenderTreeSupportEfl::pendingUnloadEventCount):
+        (DumpRenderTreeSupportEfl::renderTreeDump):
+        (DumpRenderTreeSupportEfl::responseMimeType):
+        (DumpRenderTreeSupportEfl::selectionRectangle):
+        (DumpRenderTreeSupportEfl::suitableDRTFrameName):
+        (DumpRenderTreeSupportEfl::setDefersLoading):
+        (DumpRenderTreeSupportEfl::setLoadsSiteIconsIgnoringImageLoadingSetting):
+        (DumpRenderTreeSupportEfl::addUserScript):
+        (DumpRenderTreeSupportEfl::clearUserScripts):
+        (DumpRenderTreeSupportEfl::addUserStyleSheet):
+        (DumpRenderTreeSupportEfl::clearUserStyleSheets):
+        (DumpRenderTreeSupportEfl::executeCoreCommandByName):
+        (DumpRenderTreeSupportEfl::findString):
+        (DumpRenderTreeSupportEfl::setCSSGridLayoutEnabled):
+        (DumpRenderTreeSupportEfl::isCommandEnabled):
+        (DumpRenderTreeSupportEfl::setSmartInsertDeleteEnabled):
+        (DumpRenderTreeSupportEfl::setSelectTrailingWhitespaceEnabled):
+        (DumpRenderTreeSupportEfl::evaluateInWebInspector):
+        (DumpRenderTreeSupportEfl::evaluateScriptInIsolatedWorld):
+        (DumpRenderTreeSupportEfl::globalContextRefForFrame):
+        (DumpRenderTreeSupportEfl::setInteractiveFormValidationEnabled):
+        (DumpRenderTreeSupportEfl::setValidationMessageTimerMagnification):
+        (DumpRenderTreeSupportEfl::setAuthorAndUserStylesEnabled):
+        (DumpRenderTreeSupportEfl::setComposition):
+        (DumpRenderTreeSupportEfl::hasComposition):
+        (DumpRenderTreeSupportEfl::compositionRange):
+        (DumpRenderTreeSupportEfl::confirmComposition):
+        (DumpRenderTreeSupportEfl::firstRectForCharacterRange):
+        (DumpRenderTreeSupportEfl::selectedRange):
+
 2012-08-31  Christophe Dumez  <[email protected]>
 
         [EFL] Add proper support for navigator.onLine and associated events

Modified: trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp (127384 => 127385)


--- trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp	2012-09-02 03:08:00 UTC (rev 127384)
+++ trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp	2012-09-02 04:31:52 UTC (rev 127385)
@@ -61,13 +61,20 @@
 #include <workers/WorkerThread.h>
 #include <wtf/HashMap.h>
 
+#define DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, ...) \
+    WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame);  \
+    if (!frame)                                               \
+        return __VA_ARGS__;
+
+#define DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, ...) \
+    WebCore::Page* page = EWKPrivate::corePage(ewkView);  \
+    if (!page)                                            \
+        return __VA_ARGS__;
+    
 unsigned DumpRenderTreeSupportEfl::activeAnimationsCount(const Evas_Object* ewkFrame)
 {
-    WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame);
+    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, 0);
 
-    if (!frame)
-        return 0;
-
     WebCore::AnimationController* animationController = frame->animation();
 
     if (!animationController)
@@ -78,33 +85,29 @@
 
 bool DumpRenderTreeSupportEfl::callShouldCloseOnWebView(Evas_Object* ewkFrame)
 {
-    WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame);
+    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, false);
 
-    if (!frame)
-        return false;
-
     return frame->loader()->shouldClose();
 }
 
 void DumpRenderTreeSupportEfl::clearFrameName(Evas_Object* ewkFrame)
 {
-    if (WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame))
-        frame->tree()->clearName();
+    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame);
+
+    frame->tree()->clearName();
 }
 
 void DumpRenderTreeSupportEfl::clearOpener(Evas_Object* ewkFrame)
 {
-    if (WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame))
-        frame->loader()->setOpener(0);
+    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame);
+
+    frame->loader()->setOpener(0);
 }
 
 bool DumpRenderTreeSupportEfl::elementDoesAutoCompleteForElementWithId(const Evas_Object* ewkFrame, const String& elementId)
 {
-    WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame);
+    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, false);
 
-    if (!frame)
-        return false;
-
     WebCore::Document* document = frame->document();
     ASSERT(document);
 
@@ -118,11 +121,8 @@
 
 Eina_List* DumpRenderTreeSupportEfl::frameChildren(const Evas_Object* ewkFrame)
 {
-    WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame);
+    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, 0);
 
-    if (!frame)
-        return 0;
-
     Eina_List* childFrames = 0;
 
     for (unsigned index = 0; index < frame->tree()->childCount(); index++) {
@@ -140,65 +140,46 @@
 
 WebCore::Frame* DumpRenderTreeSupportEfl::frameParent(const Evas_Object* ewkFrame)
 {
-    WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame);
+    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, 0);
 
-    if (!frame)
-        return 0;
-
     return frame->tree()->parent();
 }
 
 void DumpRenderTreeSupportEfl::layoutFrame(Evas_Object* ewkFrame)
 {
-    WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame);
+    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame);
 
-    if (!frame)
+    if (!frame->view())
         return;
 
-    WebCore::FrameView* frameView = frame->view();
-
-    if (!frameView)
-        return;
-
-    frameView->layout();
+    frame->view()->layout();
 }
 
 int DumpRenderTreeSupportEfl::numberOfPages(const Evas_Object* ewkFrame, float pageWidth, float pageHeight)
 {
-    WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame);
+    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, 0);
 
-    if (!frame)
-        return 0;
-
     return WebCore::PrintContext::numberOfPages(frame, WebCore::FloatSize(pageWidth, pageHeight));
 }
 
 String DumpRenderTreeSupportEfl::pageSizeAndMarginsInPixels(const Evas_Object* ewkFrame, int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft)
 {
-    WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame);
+    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, String());
 
-    if (!frame)
-        return String();
-
     return WebCore::PrintContext::pageSizeAndMarginsInPixels(frame, pageNumber, width, height, marginTop, marginRight, marginBottom, marginLeft);
 }
 
 String DumpRenderTreeSupportEfl::pageProperty(const Evas_Object* ewkFrame, const char* propertyName, int pageNumber)
 {
-    WebCore::Frame* coreFrame = EWKPrivate::coreFrame(ewkFrame);
-    if (!coreFrame)
-        return String();
+    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, String());
 
-    return WebCore::PrintContext::pageProperty(coreFrame, propertyName, pageNumber);
+    return WebCore::PrintContext::pageProperty(frame, propertyName, pageNumber);
 }
 
 bool DumpRenderTreeSupportEfl::pauseAnimation(Evas_Object* ewkFrame, const char* name, const char* elementId, double time)
 {
-    WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame);
+    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, false);
 
-    if (!frame)
-        return false;
-
     WebCore::Element* element = frame->document()->getElementById(elementId);
 
     if (!element || !element->renderer())
@@ -209,11 +190,8 @@
 
 bool DumpRenderTreeSupportEfl::pauseTransition(Evas_Object* ewkFrame, const char* name, const char* elementId, double time)
 {
-    WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame);
+    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, false);
 
-    if (!frame)
-        return false;
-
     WebCore::Element* element = frame->document()->getElementById(elementId);
 
     if (!element || !element->renderer())
@@ -224,19 +202,15 @@
 
 unsigned DumpRenderTreeSupportEfl::pendingUnloadEventCount(const Evas_Object* ewkFrame)
 {
-    if (WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame))
-        return frame->document()->domWindow()->pendingUnloadEventListeners();
+    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, 0);
 
-    return 0;
+    return frame->document()->domWindow()->pendingUnloadEventListeners();
 }
 
 String DumpRenderTreeSupportEfl::renderTreeDump(Evas_Object* ewkFrame)
 {
-    WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame);
+    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, String());
 
-    if (!frame)
-        return String();
-
     WebCore::FrameView *frameView = frame->view();
 
     if (frameView && frameView->layoutPending())
@@ -247,11 +221,8 @@
 
 String DumpRenderTreeSupportEfl::responseMimeType(const Evas_Object* ewkFrame)
 {
-    WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame);
+    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, String());
 
-    if (!frame)
-        return String();
-
     WebCore::DocumentLoader *documentLoader = frame->loader()->documentLoader();
 
     if (!documentLoader)
@@ -262,22 +233,16 @@
 
 WebCore::IntRect DumpRenderTreeSupportEfl::selectionRectangle(const Evas_Object* ewkFrame)
 {
-    WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame);
+    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, WebCore::IntRect());
 
-    if (!frame)
-        return WebCore::IntRect();
-
     return enclosingIntRect(frame->selection()->bounds());
 }
 
 // Compare with "WebKit/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm
 String DumpRenderTreeSupportEfl::suitableDRTFrameName(const Evas_Object* ewkFrame)
 {
-    WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame);
+    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, String());
 
-    if (!frame)
-        return String();
-
     const String frameName(ewk_frame_name_get(ewkFrame));
 
     if (ewkFrame == ewk_view_frame_main_get(ewk_frame_view_get(ewkFrame))) {
@@ -321,28 +286,21 @@
 
 void DumpRenderTreeSupportEfl::setDefersLoading(Evas_Object* ewkView, bool defers)
 {
-    WebCore::Page* page = EWKPrivate::corePage(ewkView);
+    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);
 
-    if (!page)
-        return;
-
     page->setDefersLoading(defers);
 }
 
 void DumpRenderTreeSupportEfl::setLoadsSiteIconsIgnoringImageLoadingSetting(Evas_Object* ewkView, bool loadsSiteIconsIgnoringImageLoadingPreferences)
 {
-    WebCore::Page* page = EWKPrivate::corePage(ewkView);
-    if (!page)
-        return;
+    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);
 
     page->settings()->setLoadsSiteIconsIgnoringImageLoadingSetting(loadsSiteIconsIgnoringImageLoadingPreferences);
 }
 
 void DumpRenderTreeSupportEfl::addUserScript(const Evas_Object* ewkView, const String& sourceCode, bool runAtStart, bool allFrames)
 {
-    WebCore::Page* page = EWKPrivate::corePage(ewkView);
-    if (!page)
-        return;
+    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);
 
     page->group().addUserScriptToWorld(WebCore::mainThreadNormalWorld(), sourceCode, WebCore::KURL(),
                                        nullptr, nullptr, runAtStart ? WebCore::InjectAtDocumentStart : WebCore::InjectAtDocumentEnd,
@@ -351,71 +309,56 @@
 
 void DumpRenderTreeSupportEfl::clearUserScripts(const Evas_Object* ewkView)
 {
-    WebCore::Page* page = EWKPrivate::corePage(ewkView);
-    if (!page)
-        return;
+    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);
 
     page->group().removeUserScriptsFromWorld(WebCore::mainThreadNormalWorld());
 }
 
 void DumpRenderTreeSupportEfl::addUserStyleSheet(const Evas_Object* ewkView, const String& sourceCode, bool allFrames)
 {
-    WebCore::Page* page = EWKPrivate::corePage(ewkView);
-    if (!page)
-        return;
+    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);
 
     page->group().addUserStyleSheetToWorld(WebCore::mainThreadNormalWorld(), sourceCode, WebCore::KURL(), nullptr, nullptr, allFrames ? WebCore::InjectInAllFrames : WebCore::InjectInTopFrameOnly);
 }
 
 void DumpRenderTreeSupportEfl::clearUserStyleSheets(const Evas_Object* ewkView)
 {
-    WebCore::Page* page = EWKPrivate::corePage(ewkView);
-    if (!page)
-        return;
+    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);
 
     page->group().removeUserStyleSheetsFromWorld(WebCore::mainThreadNormalWorld());
 }
 
 void DumpRenderTreeSupportEfl::executeCoreCommandByName(const Evas_Object* ewkView, const char* name, const char* value)
 {
-    WebCore::Page* page = EWKPrivate::corePage(ewkView);
-    if (!page)
-        return;
+    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);
 
     page->focusController()->focusedOrMainFrame()->editor()->command(name).execute(value);
 }
 
 bool DumpRenderTreeSupportEfl::findString(const Evas_Object* ewkView, const String& text, WebCore::FindOptions options)
 {
-    WebCore::Page* page = EWKPrivate::corePage(ewkView);
+    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, false);
 
-    if (!page)
-        return false;
-
     return page->findString(text, options);
 }
 
 void DumpRenderTreeSupportEfl::setCSSGridLayoutEnabled(const Evas_Object* ewkView, bool enabled)
 {
-    WebCore::Page* corePage = EWKPrivate::corePage(ewkView);
-    if (corePage)
-        corePage->settings()->setCSSGridLayoutEnabled(enabled);
+    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);
+
+    page->settings()->setCSSGridLayoutEnabled(enabled);
 }
 
 bool DumpRenderTreeSupportEfl::isCommandEnabled(const Evas_Object* ewkView, const char* name)
 {
-    WebCore::Page* page = EWKPrivate::corePage(ewkView);
-    if (!page)
-        return false;
+    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, false);
 
     return page->focusController()->focusedOrMainFrame()->editor()->command(name).isEnabled();
 }
 
 void DumpRenderTreeSupportEfl::setSmartInsertDeleteEnabled(Evas_Object* ewkView, bool enabled)
 {
-    WebCore::Page* page = EWKPrivate::corePage(ewkView);
-    if (!page)
-        return;
+    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);
 
     WebCore::EditorClientEfl* editorClient = static_cast<WebCore::EditorClientEfl*>(page->editorClient());
     if (!editorClient)
@@ -426,9 +369,7 @@
 
 void DumpRenderTreeSupportEfl::setSelectTrailingWhitespaceEnabled(Evas_Object* ewkView, bool enabled)
 {
-    WebCore::Page* page = EWKPrivate::corePage(ewkView);
-    if (!page)
-        return;
+    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);
 
     WebCore::EditorClientEfl* editorClient = static_cast<WebCore::EditorClientEfl*>(page->editorClient());
     if (!editorClient)
@@ -508,9 +449,7 @@
 void DumpRenderTreeSupportEfl::evaluateInWebInspector(const Evas_Object* ewkView, long callId, const String& script)
 {
 #if ENABLE(INSPECTOR)
-    WebCore::Page* page = EWKPrivate::corePage(ewkView);
-    if (!page)
-        return;
+    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);
 
     if (page->inspectorController())
         page->inspectorController()->evaluateForTestInFrontend(callId, script);
@@ -519,12 +458,10 @@
 
 void DumpRenderTreeSupportEfl::evaluateScriptInIsolatedWorld(const Evas_Object* ewkFrame, int worldID, JSObjectRef globalObject, const String& script)
 {
-    WebCore::Frame* coreFrame = EWKPrivate::coreFrame(ewkFrame);
-    if (!coreFrame)
-        return;
+    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame);
 
     // Comment from mac: Start off with some guess at a frame and a global object, we'll try to do better...!
-    WebCore::JSDOMWindow* anyWorldGlobalObject = coreFrame->script()->globalObject(WebCore::mainThreadNormalWorld());
+    WebCore::JSDOMWindow* anyWorldGlobalObject = frame->script()->globalObject(WebCore::mainThreadNormalWorld());
 
     // Comment from mac: The global object is probably a shell object? - if so, we know how to use this!
     JSC::JSObject* globalObjectObj = toJS(globalObject);
@@ -562,11 +499,9 @@
 
 JSGlobalContextRef DumpRenderTreeSupportEfl::globalContextRefForFrame(const Evas_Object* ewkFrame)
 {
-    WebCore::Frame* coreFrame = EWKPrivate::coreFrame(ewkFrame);
-    if (!coreFrame)
-        return 0;
+    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, 0);
 
-    return toGlobalRef(coreFrame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec());
+    return toGlobalRef(frame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec());
 }
 
 void DumpRenderTreeSupportEfl::setMockScrollbarsEnabled(bool enable)
@@ -593,16 +528,16 @@
 
 void DumpRenderTreeSupportEfl::setInteractiveFormValidationEnabled(Evas_Object* ewkView, bool enabled)
 {
-    WebCore::Page* corePage = EWKPrivate::corePage(ewkView);
-    if (corePage)
-        corePage->settings()->setInteractiveFormValidationEnabled(enabled);
+    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);
+
+    page->settings()->setInteractiveFormValidationEnabled(enabled);
 }
 
 void DumpRenderTreeSupportEfl::setValidationMessageTimerMagnification(Evas_Object* ewkView, int value)
 {
-    WebCore::Page* corePage = EWKPrivate::corePage(ewkView);
-    if (corePage)
-        corePage->settings()->setValidationMessageTimerMagnification(value);
+    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);
+
+    page->settings()->setValidationMessageTimerMagnification(value);
 }
 
 JSValueRef DumpRenderTreeSupportEfl::computedStyleIncludingVisitedInfo(JSContextRef context, JSValueRef value)
@@ -623,11 +558,9 @@
 
 void DumpRenderTreeSupportEfl::setAuthorAndUserStylesEnabled(Evas_Object* ewkView, bool enabled)
 {
-    WebCore::Page* corePage = EWKPrivate::corePage(ewkView);
-    if (!corePage)
-        return;
+    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);
 
-    corePage->settings()->setAuthorAndUserStylesEnabled(enabled);
+    page->settings()->setAuthorAndUserStylesEnabled(enabled);
 }
 
 void DumpRenderTreeSupportEfl::setSerializeHTTPLoads(bool enabled)
@@ -673,8 +606,9 @@
 
 void DumpRenderTreeSupportEfl::setComposition(Evas_Object* ewkView, const char* text, int start, int length)
 {
-    WebCore::Page* page = EWKPrivate::corePage(ewkView);
-    if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame())
+    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);
+
+    if (!page->focusController() || !page->focusController()->focusedOrMainFrame())
         return;
 
     WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor();
@@ -689,8 +623,9 @@
 
 bool DumpRenderTreeSupportEfl::hasComposition(const Evas_Object* ewkView)
 {
-    const WebCore::Page* page = EWKPrivate::corePage(ewkView);
-    if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame())
+    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, false);
+
+    if (!page->focusController() || !page->focusController()->focusedOrMainFrame())
         return false;
 
     const WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor();
@@ -704,8 +639,9 @@
 {
     *start = *length = 0;
 
-    WebCore::Page* page = EWKPrivate::corePage(ewkView);
-    if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame())
+    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, false);
+
+    if (!page->focusController() || !page->focusController()->focusedOrMainFrame())
         return false;
 
     WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor();
@@ -719,8 +655,9 @@
 
 void DumpRenderTreeSupportEfl::confirmComposition(Evas_Object* ewkView, const char* text)
 {
-    WebCore::Page* page = EWKPrivate::corePage(ewkView);
-    if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame())
+    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);
+
+    if (!page->focusController() || !page->focusController()->focusedOrMainFrame())
         return;
 
     WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor();
@@ -741,8 +678,9 @@
 
 WebCore::IntRect DumpRenderTreeSupportEfl::firstRectForCharacterRange(Evas_Object* ewkView, int location, int length)
 {
-    WebCore::Page* page = EWKPrivate::corePage(ewkView);
-    if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame() || !page->focusController()->focusedOrMainFrame()->editor())
+    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, WebCore::IntRect());
+
+    if (!page->focusController() || !page->focusController()->focusedOrMainFrame() || !page->focusController()->focusedOrMainFrame()->editor())
         return WebCore::IntRect();
 
     if ((location + length < location) && (location + length))
@@ -763,8 +701,9 @@
     if (!(start && length))
         return false;
 
-    WebCore::Page* page = EWKPrivate::corePage(ewkView);
-    if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame())
+    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, false);
+
+    if (!page->focusController() || !page->focusController()->focusedOrMainFrame())
         return false;
 
     WebCore::Frame* frame = page->focusController()->focusedOrMainFrame();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to