RESOLVED FIXED Bug 42694
WebKitTestRunner needs layoutTestController.numberOfPages
https://bugs.webkit.org/show_bug.cgi?id=42694
Summary WebKitTestRunner needs layoutTestController.numberOfPages
Sam Weinig
Reported 2010-07-20 15:16:24 PDT
WebKitTestRunner needs layoutTestController.numberOfPages
Attachments
fix patch (20.24 KB, patch)
2011-04-05 08:27 PDT, Chang Shu
darin: review-
fix patch 2 (10.11 KB, patch)
2011-04-05 11:38 PDT, Chang Shu
no flags
Sam Weinig
Comment 1 2010-07-20 15:31:22 PDT
Chang Shu
Comment 2 2011-04-05 08:27:06 PDT
Created attachment 88239 [details] fix patch
Darin Adler
Comment 3 2011-04-05 09:28:10 PDT
Comment on attachment 88239 [details] fix patch View in context: https://bugs.webkit.org/attachment.cgi?id=88239&action=review Good change, but I am not happy with how the WebKit2 changes are structured. > Source/WebKit2/WebProcess/WebCoreSupport/WebKitTestRunnerSupport.cpp:44 > +int WebKitTestRunnerSupport::numberOfPages(WebCore::Frame* frame, float width, float height) > +{ > + if (!frame) > + return -1; > + if (!width) > + width = frame->view()->width(); > + if (!height) > + height = frame->view()->height(); > + > + return PrintContext::numberOfPages(frame, FloatSize(width, height)); > +} I don’t think this function needs its own file. This code can just go inside InjectedBundle::numberOfPages. While I understand that we might want to put testing functions somewhere different than functions for other purposes, I would not call that file WebKitTestRunnerSupport, nor would I make a new class. I could imagine making a new source file InjectedBundleTestFunctions.cpp or InjectedBundleTesting.cpp and put some of the InjectedBundle function definitions in there to segregate them from the rest of the class. But this factoring seems to go too far in creating a new class just to hold some functions. > Source/WebKit2/WebProcess/WebCoreSupport/WebKitTestRunnerSupport.h:40 > +class WebKitTestRunnerSupport { > + > +public: > + > + WebKitTestRunnerSupport(); > + ~WebKitTestRunnerSupport(); > + > + static int numberOfPages(WebCore::Frame*, float width, float height); > +}; To me it does not make sense to have this be a class. You don’t need a class just to hold some functions.
Chang Shu
Comment 4 2011-04-05 10:48:31 PDT
> I don’t think this function needs its own file. This code can just go inside InjectedBundle::numberOfPages. While I understand that we might want to put testing functions somewhere different than functions for other purposes, I would not call that file WebKitTestRunnerSupport, nor would I make a new class. > > I could imagine making a new source file InjectedBundleTestFunctions.cpp or InjectedBundleTesting.cpp and put some of the InjectedBundle function definitions in there to segregate them from the rest of the class. But this factoring seems to go too far in creating a new class just to hold some functions. > > > Source/WebKit2/WebProcess/WebCoreSupport/WebKitTestRunnerSupport.h:40 > > +class WebKitTestRunnerSupport { > > + > > +public: > > + > > + WebKitTestRunnerSupport(); > > + ~WebKitTestRunnerSupport(); > > + > > + static int numberOfPages(WebCore::Frame*, float width, float height); > > +}; > > To me it does not make sense to have this be a class. You don’t need a class just to hold some functions. I was mimicking the DumpRenderTreeSupport of WebKit 1. But you are right, as we have InjectedBundle.cpp, we don't need a new file/class. New patch is coming.
Chang Shu
Comment 5 2011-04-05 11:38:26 PDT
Created attachment 88288 [details] fix patch 2
WebKit Commit Bot
Comment 6 2011-04-05 20:05:20 PDT
Comment on attachment 88288 [details] fix patch 2 Clearing flags on attachment: 88288 Committed r83010: <http://trac.webkit.org/changeset/83010>
WebKit Commit Bot
Comment 7 2011-04-05 20:05:26 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.