<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>34743</bug_id>
          
          <creation_ts>2010-02-09 02:42:56 -0800</creation_ts>
          <short_desc>[Chromium] Implement WebFrameImpl::numberOfPages</short_desc>
          <delta_ts>2010-02-16 01:01:40 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Tools / Tests</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Shinichiro Hamaji">hamaji</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>abarth</cc>
    
    <cc>fishd</cc>
    
    <cc>hayato</cc>
    
    <cc>yuzo</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>188942</commentid>
    <comment_count>0</comment_count>
    <who name="Shinichiro Hamaji">hamaji</who>
    <bug_when>2010-02-09 02:42:56 -0800</bug_when>
    <thetext>This is necessary to implement layoutTestController.numberOfPages in
test_shell. This API was added in http://trac.webkit.org/changeset/54533

Note that this is similar to Bug 34471, but a different API.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>188945</commentid>
    <comment_count>1</comment_count>
      <attachid>48398</attachid>
    <who name="Shinichiro Hamaji">hamaji</who>
    <bug_when>2010-02-09 02:49:06 -0800</bug_when>
    <thetext>Created attachment 48398
Patch v1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>189118</commentid>
    <comment_count>2</comment_count>
      <attachid>48398</attachid>
    <who name="Adam Barth">abarth</who>
    <bug_when>2010-02-09 12:16:05 -0800</bug_when>
    <thetext>Comment on attachment 48398
Patch v1

LGTM, but fishd should look at his change because it touches the WebKit API.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>189132</commentid>
    <comment_count>3</comment_count>
      <attachid>48398</attachid>
    <who name="Darin Fisher (:fishd, Google)">fishd</who>
    <bug_when>2010-02-09 12:46:14 -0800</bug_when>
    <thetext>Comment on attachment 48398
Patch v1

&gt; +++ b/WebKit/chromium/public/WebFrame.h
&gt; @@ -490,6 +490,11 @@ public:
&gt;                                           float pageWidthInPixels,
&gt;                                           float pageHeightInPixels) const = 0;
&gt;  
&gt; +    // Returns the number of pages to be printed.
&gt; +    // This method is used to support layout tests.
&gt; +    virtual int numberOfPages(float pageWidthInPixels,
&gt; +                              float pageHeightInPixels) const = 0;

Since this is about printing, should this be moved into the &quot;printing&quot;
section of WebFrame?  I realize that you probably stuck this nearby
pageNumberForElementById intentionally, and that was probably put next
to counterValueForElementById because they are only used by layout tests.

Is it necessary to call printBegin before using this function?  Would
it be advantageous to do so?

If we wanted to have a print preview system, perhaps we&apos;d want to know
how many pages will be generated, so this API might be nice outside the
context of layout tests.

At any rate, it seems like we should either make these features of the
printing API, or we should create a new section in WebFrame that is
dedicated to providing utilities for layout tests.

One more question:  is it necessary to be able to specify pageWidth
and pageHeight in fractions of a pixel?  Do these need to be floats,
or can they be integers?

-Darin</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>189343</commentid>
    <comment_count>4</comment_count>
    <who name="Shinichiro Hamaji">hamaji</who>
    <bug_when>2010-02-10 06:03:03 -0800</bug_when>
    <thetext>Thanks for your review! I checked printBegin and found printBegin and printEnd are doing the same stuff as PrintContext::numberOfPages (printBegin returns the number of pages). So, I think we don&apos;t need to add a new API. We can implement layoutTestController.numberOfPages only with printBegin and printEnd. I&apos;ll close this bug.

&gt; At any rate, it seems like we should either make these features of the
&gt; printing API, or we should create a new section in WebFrame that is
&gt; dedicated to providing utilities for layout tests.

It seems there are 3 functions for layout tests (renderTreeAsText, counterValueForElementById, and pageNumberForElementById). I&apos;ll open another bug (or re-title this bug) to create a section for them. By the way, both counterValueForElementById and pageNumberForElementById were putted by me and you are right, I put them here because I wanted to put them nearby renderTreeAsText.

&gt; One more question:  is it necessary to be able to specify pageWidth
&gt; and pageHeight in fractions of a pixel?  Do these need to be floats,
&gt; or can they be integers?

I made them float just because PrintContext takes float parameters. As I don&apos;t think we&apos;ll want to use float sized pages from layout tests, printBegin, which takes WebSize (a struct which has two integers), is sufficient to implement layoutTestController.numberOfPages.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>48398</attachid>
            <date>2010-02-09 02:49:06 -0800</date>
            <delta_ts>2010-02-10 06:03:18 -0800</delta_ts>
            <desc>Patch v1</desc>
            <filename>bug-34743-20100209024904.patch</filename>
            <type>text/plain</type>
            <size>2709</size>
            <attacher name="Shinichiro Hamaji">hamaji</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1dlYktpdC9jaHJvbWl1bS9DaGFuZ2VMb2cgYi9XZWJLaXQvY2hyb21pdW0v
Q2hhbmdlTG9nCmluZGV4IDk3ZDE5MDIuLmJiNzQ5MDAgMTAwNjQ0Ci0tLSBhL1dlYktpdC9jaHJv
bWl1bS9DaGFuZ2VMb2cKKysrIGIvV2ViS2l0L2Nocm9taXVtL0NoYW5nZUxvZwpAQCAtMSwzICsx
LDE1IEBACisyMDEwLTAyLTA5ICBTaGluaWNoaXJvIEhhbWFqaSAgPGhhbWFqaUBjaHJvbWl1bS5v
cmc+CisKKyAgICAgICAgUmV2aWV3ZWQgYnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAgICAgW0No
cm9taXVtXSBJbXBsZW1lbn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1lSW1wbCBwdWJsaWMgLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCiAK
IFBhc3NSZWZQdHI8V2ViRnJhbWVJbXBsPiBXZWJGcmFtZUltcGw6OmNyZWF0ZShXZWJGcmFtZUNs
aWVudCogY2xpZW50KQpkaWZmIC0tZ2l0IGEvV2ViS2l0L2Nocm9taXVtL3NyYy9XZWJGcmFtZUlt
cGwuaCBiL1dlYktpdC9jaHJvbWl1bS9zcmMvV2ViRnJhbWVJbXBsLmgKaW5kZXggY2NiYTZkNC4u
NDU1NzNiNyAxMDA2NDQKLS0tIGEvV2ViS2l0L2Nocm9taXVtL3NyYy9XZWJGcmFtZUltcGwuaAor
KysgYi9XZWJLaXQvY2hyb21pdW0vc3JjL1dlYkZyYW1lSW1wbC5oCkBAIC0xNjcsNiArMTY3LDgg
QEAgcHVibGljOgogICAgIHZpcnR1YWwgaW50IHBhZ2VOdW1iZXJGb3JFbGVtZW50QnlJZChjb25z
dCBXZWJTdHJpbmcmIGlkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICBmbG9hdCBwYWdlV2lkdGhJblBpeGVscywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgZmxvYXQgcGFnZUhlaWdodEluUGl4ZWxzKSBjb25zdDsKKyAgICB2aXJ0dWFs
IGludCBudW1iZXJPZlBhZ2VzKGZsb2F0IHBhZ2VXaWR0aEluUGl4ZWxzLAorICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgZmxvYXQgcGFnZUhlaWdodEluUGl4ZWxzKSBjb25zdDsKIAogICAg
IHN0YXRpYyBQYXNzUmVmUHRyPFdlYkZyYW1lSW1wbD4gY3JlYXRlKFdlYkZyYW1lQ2xpZW50KiBj
bGllbnQpOwogICAgIH5XZWJGcmFtZUltcGwoKTsK
</data>

          </attachment>
      

    </bug>

</bugzilla>