Bug 34777 - [Qt] Make possible Qt DRT get a page number for element by ID
: [Qt] Make possible Qt DRT get a page number for element by ID
Status: RESOLVED FIXED
: WebKit
Tools / Tests
: 528+ (Nightly build)
: PC Linux
: P2 Normal
Assigned To:
:
: Qt
:
:
  Show dependency treegraph
 
Reported: 2010-02-09 15:04 PST by
Modified: 2010-02-10 19:01 PST (History)


Attachments
Proposed patch (7.96 KB, patch)
2010-02-09 15:18 PST, Diego Gonzalez
no flags Review Patch | Details | Formatted Diff | Diff
Proposed patch (7.96 KB, patch)
2010-02-10 04:52 PST, Diego Gonzalez
no flags Review Patch | Details | Formatted Diff | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2010-02-09 15:04:42 PST
Implement pageNumberForElementById() method in Qt DRT LayoutTestController,
to make Qt DRT able to get page number.

LayoutTests:
    printing/page-break-always.html
    printing/pageNumerForElementById.html
    printing/css2.1/page-break-before-000.html
    printing/css2.1/page-break-after-000.html
    printing/css2.1/page-break-after-004.html
    printing/css2.1/page-break-before-001.html
    printing/css2.1/page-break-after-001.html
    printing/css2.1/page-break-after-002.html
    printing/css2.1/page-break-before-002.html
    printing/css2.1/page-break-inside-000.html
------- Comment #1 From 2010-02-09 15:18:52 PST -------
Created an attachment (id=48445) [details]
Proposed patch
------- Comment #2 From 2010-02-09 15:21:04 PST -------
Attachment 48445 [details] did not pass style-queue:

Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1
WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h:151:  Missing spaces around =  [whitespace/operators] [4]
WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp:462:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
Ignoring "WebKit/qt/Api/qwebframe.cpp": this file is exempt from the style guide.
Total errors found: 2


If any of these errors are false positives, please file a bug against check-webkit-style.
------- Comment #3 From 2010-02-09 20:18:29 PST -------
great catch !


(In reply to comment #2)
> Attachment 48445 [details] [details] did not pass style-queue:
> 
> Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1
> WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h:151:  Missing spaces
> around =  [whitespace/operators] [4]

pls fix this.

> WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp:462:  Tests for
> true/false, null/non-null, and zero/non-zero should all be done without
> equality comparisons.  [readability/comparison_to_zero] [5]

well, generally the bot is right, but in this specific case we are comparing |width| and |height| with '0', which makes the code easier to read for me than using "!width", so i would not bother much , unless someone (reviewer) thinks different.

otherwise, lgtm.
------- Comment #4 From 2010-02-10 04:52:12 PST -------
Created an attachment (id=48487) [details]
Proposed patch

Checked style
------- Comment #5 From 2010-02-10 04:55:31 PST -------
(From update of attachment 48487 [details])

>  
> +int QWEBKIT_EXPORT qt_drt_pageNumberForElementById(QWebFrame* qFrame, const QString& id, float width, float height)
> +{
> +    Frame* frame = QWebFramePrivate::core(qFrame);
> +    if (!frame)

I would have used frame and coreFrame :-)
> +int LayoutTestController::pageNumberForElementById(const QString& id, float width, float height)
> +{
> +    // If no size specified, webpage viewport size is used
> +    if (!width && !height) {
> +        width = m_drt->webPage()->viewportSize().width();
> +        height = m_drt->webPage()->viewportSize().height();
> +    }

What is with is 0, but height is not?
------- Comment #6 From 2010-02-10 05:09:00 PST -------
(In reply to comment #5)
> (From update of attachment 48487 [details] [details])
> 
> >  
> > +int QWEBKIT_EXPORT qt_drt_pageNumberForElementById(QWebFrame* qFrame, const QString& id, float width, float height)
> > +{
> > +    Frame* frame = QWebFramePrivate::core(qFrame);
> > +    if (!frame)
> 
> I would have used frame and coreFrame :-)

humm I just followed the pattern of the others qt_drt*

> > +int LayoutTestController::pageNumberForElementById(const QString& id, float width, float height)
> > +{
> > +    // If no size specified, webpage viewport size is used
> > +    if (!width && !height) {
> > +        width = m_drt->webPage()->viewportSize().width();
> > +        height = m_drt->webPage()->viewportSize().height();
> > +    }
> 
> What is with is 0, but height is not?

I assumed the method will calculate using 0 for width and a given value for height, and it will possibly return a invalid value for that.
------- Comment #7 From 2010-02-10 11:26:55 PST -------
(From update of attachment 48487 [details])
Clearing flags on attachment: 48487

Committed r54612: <http://trac.webkit.org/changeset/54612>
------- Comment #8 From 2010-02-10 11:27:04 PST -------
All reviewed patches have been landed.  Closing bug.
------- Comment #9 From 2010-02-10 19:01:50 PST -------
*** Bug 34573 has been marked as a duplicate of this bug. ***