<?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>67238</bug_id>
          
          <creation_ts>2011-08-30 14:49:58 -0700</creation_ts>
          <short_desc>Add helper methods to find and compute scale factor for zoom into an element</short_desc>
          <delta_ts>2012-03-26 11:01:58 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</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>
          
          <blocked>68075</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Fady Samuel">fsamuel</reporter>
          <assigned_to name="Fady Samuel">fsamuel</assigned_to>
          <cc>abarth</cc>
    
    <cc>ddkilzer</cc>
    
    <cc>fishd</cc>
    
    <cc>fsamuel</cc>
    
    <cc>rjkroege</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>tonikitoo</cc>
    
    <cc>varunjain</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>459232</commentid>
    <comment_count>0</comment_count>
    <who name="Fady Samuel">fsamuel</who>
    <bug_when>2011-08-30 14:49:58 -0700</bug_when>
    <thetext>Helper methods necessary to find and compute scale factor to zoom to an inner element</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>459236</commentid>
    <comment_count>1</comment_count>
      <attachid>105704</attachid>
    <who name="Fady Samuel">fsamuel</who>
    <bug_when>2011-08-30 14:54:06 -0700</bug_when>
    <thetext>Created attachment 105704
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>459245</commentid>
    <comment_count>2</comment_count>
      <attachid>105704</attachid>
    <who name="Adam Barth">abarth</who>
    <bug_when>2011-08-30 15:02:14 -0700</bug_when>
    <thetext>Comment on attachment 105704
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=105704&amp;action=review

&gt; Source/WebCore/ChangeLog:8
&gt; +        No new tests. (OOPS!)

This line will prevent this patch from being landed.  We either need to add tests or explain why we&apos;re not adding tests.

&gt; Source/WebCore/page/Page.cpp:268
&gt; +    if (node) {

Prefer early return.

&gt; Source/WebCore/page/Page.cpp:282
&gt; +        // TODO(fsamuel, varunjain): snap scale to thresholds

TODO =&gt; FIXME.

Also, WebKit doesn&apos;t include user names.

&gt; Source/WebCore/page/Page.cpp:283
&gt; +        scaleUnchanged = fabs(mainFrame()-&gt;pageScaleFactor() - scale) &lt; 0.1;

0.1 &lt;-- This magic constant is curious.

&gt; Source/WebCore/page/Page.h:145
&gt; +        IntRect getBlockBounds(const IntPoint&amp; inputPoint, int padding);
&gt; +        float getScaleFactorForRect(const IntRect&amp;);

Are there callers for these functions?

Generally whenever we add something to Page, we should ask ourselves whether that&apos;s the right place for the API.  Page is a &quot;god&quot; object that likes to collect infinite complexity.  These functions don&apos;t appear to use anything from the Page other than it&apos;s mainFrame(), and then, even, mostly just the mainFrame()-&gt;view().  Perhaps these methods should be on FrameView?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>459249</commentid>
    <comment_count>3</comment_count>
      <attachid>105704</attachid>
    <who name="Adam Barth">abarth</who>
    <bug_when>2011-08-30 15:02:56 -0700</bug_when>
    <thetext>Comment on attachment 105704
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=105704&amp;action=review

&gt; Source/WebCore/ChangeLog:4
&gt; +        Helper methods necessary to find and compute scale factor to zoom to an inner element
&gt; +        https://bugs.webkit.org/show_bug.cgi?id=67238

This ChangeLog also doesn&apos;t explain why we&apos;d like to make this change.  There&apos;s probably some larger context here that would be helpful to explain.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>459252</commentid>
    <comment_count>4</comment_count>
    <who name="Fady Samuel">fsamuel</who>
    <bug_when>2011-08-30 15:10:14 -0700</bug_when>
    <thetext>Padding and the 0.1 are magic numbers that are platform-dependent and may be determined empirically (whatever *feels* right). These helper methods will enable platforms to implement functionality to zoom to a particular div. Making this feel right will, most likely, require a number of iterations based on empirical testing. I suppose this can be moved to FrameView.

(In reply to comment #3)
&gt; (From update of attachment 105704 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=105704&amp;action=review
&gt; 
&gt; &gt; Source/WebCore/ChangeLog:4
&gt; &gt; +        Helper methods necessary to find and compute scale factor to zoom to an inner element
&gt; &gt; +        https://bugs.webkit.org/show_bug.cgi?id=67238
&gt; 
&gt; This ChangeLog also doesn&apos;t explain why we&apos;d like to make this change.  There&apos;s probably some larger context here that would be helpful to explain.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>459255</commentid>
    <comment_count>5</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2011-08-30 15:12:25 -0700</bug_when>
    <thetext>It might make sense to make those named constants and add a comment explaining that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>461559</commentid>
    <comment_count>6</comment_count>
      <attachid>105704</attachid>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2011-09-02 15:06:59 -0700</bug_when>
    <thetext>Comment on attachment 105704
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=105704&amp;action=review

&gt; Source/WebCore/page/Page.cpp:254
&gt; +IntRect Page::getBlockBounds(const IntPoint&amp; inputPoint, int padding)

The method name is very confusing. It also seems weird to do the hit testing and get the rect, but not return the element that was hit.

Agree that this should not be on Page. What&apos;s the expected behavior for iframes?

&gt; Source/WebCore/page/Page.cpp:276
&gt; +float Page::getScaleFactorForRect(const IntRect&amp; rect)

Again, this method name doesn&apos;t explain what it&apos;s trying to do. Should also not be on page. What&apos;s the expected behavior inside iframes?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>461580</commentid>
    <comment_count>7</comment_count>
      <attachid>105704</attachid>
    <who name="Fady Samuel">fsamuel</who>
    <bug_when>2011-09-02 15:29:03 -0700</bug_when>
    <thetext>Comment on attachment 105704
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=105704&amp;action=review

&gt;&gt; Source/WebCore/page/Page.cpp:254

&gt; 
&gt; The method name is very confusing. It also seems weird to do the hit testing and get the rect, but not return the element that was hit.
&gt; 
&gt; Agree that this should not be on Page. What&apos;s the expected behavior for iframes?

So the purpose of this method is to take an input rect, and find the bounds of the deepest block node. We use a readonly hit test to find out which block encompasses that rect.

We&apos;d like to make this code available in WebCore because it&apos;s platform-independent. Where would you suggest we place this?

&gt;&gt; Source/WebCore/page/Page.cpp:276
&gt;&gt; +float Page::getScaleFactorForRect(const IntRect&amp; rect)
&gt; 
&gt; Again, this method name doesn&apos;t explain what it&apos;s trying to do. Should also not be on page. What&apos;s the expected behavior inside iframes?

The first method is an input to this method, typically. Once we have a box bounds, we compute the appropriate scale factor to fill the frameView&apos;s content area with the particular box we&apos;d like to zoom to...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>461591</commentid>
    <comment_count>8</comment_count>
    <who name="Fady Samuel">fsamuel</who>
    <bug_when>2011-09-02 15:43:49 -0700</bug_when>
    <thetext>I should add the search for the deepest box stops at the iframe boundary.  

(In reply to comment #7)
&gt; (From update of attachment 105704 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=105704&amp;action=review
&gt; 
&gt; &gt;&gt; Source/WebCore/page/Page.cpp:254
&gt; 
&gt; &gt; 
&gt; &gt; The method name is very confusing. It also seems weird to do the hit testing and get the rect, but not return the element that was hit.
&gt; &gt; 
&gt; &gt; Agree that this should not be on Page. What&apos;s the expected behavior for iframes?
&gt; 
&gt; So the purpose of this method is to take an input rect, and find the bounds of the deepest block node. We use a readonly hit test to find out which block encompasses that rect.
&gt; 
&gt; We&apos;d like to make this code available in WebCore because it&apos;s platform-independent. Where would you suggest we place this?
&gt; 
&gt; &gt;&gt; Source/WebCore/page/Page.cpp:276
&gt; &gt;&gt; +float Page::getScaleFactorForRect(const IntRect&amp; rect)
&gt; &gt; 
&gt; &gt; Again, this method name doesn&apos;t explain what it&apos;s trying to do. Should also not be on page. What&apos;s the expected behavior inside iframes?
&gt; 
&gt; The first method is an input to this method, typically. Once we have a box bounds, we compute the appropriate scale factor to fill the frameView&apos;s content area with the particular box we&apos;d like to zoom to...</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>105704</attachid>
            <date>2011-08-30 14:54:06 -0700</date>
            <delta_ts>2011-09-02 15:29:03 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-67238-20110830175404.patch</filename>
            <type>text/plain</type>
            <size>3933</size>
            <attacher name="Fady Samuel">fsamuel</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogOTM5ODAKZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJDb3JlL0No
YW5nZUxvZyBiL1NvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwppbmRleCA4MDE1MjYyZDgwYWRjN2Rl
Y2U5MTUyMzM0M2QyZDYxNDNkZGM4ZTZlLi45ZGU2MDBhNjkyNjg0ODllOTQ2ZGYyMmMwZjA3Mzgz
OGNlY2Y3MzU0IDEwMDY0NAotLS0gYS9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKKysrIGIvU291
cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCkBAIC0xLDMgKzEsMjEgQEAKKzIwMTEtMDgtMzAgIEZhZHkg
U2FtdWVsICA8ZnNhbXVlbEBjaHJvbWl1bS5vcmc+CisKKyAgICAgICAgSGVscGVyIG1ldGhvZHMg
bmVjZXNzYXJ5IH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7CiAgICAgY2xhc3MgTWVkaWFTdHJlYW1Db250cm9sbGVyOwpAQCAtMTM5LDYg
KzE0MSw5IEBAIG5hbWVzcGFjZSBXZWJDb3JlIHsKICAgICAgICAgdm9pZCBzZXRNYWluRnJhbWUo
UGFzc1JlZlB0cjxGcmFtZT4pOwogICAgICAgICBGcmFtZSogbWFpbkZyYW1lKCkgY29uc3QgeyBy
ZXR1cm4gbV9tYWluRnJhbWUuZ2V0KCk7IH0KIAorICAgICAgICBJbnRSZWN0IGdldEJsb2NrQm91
bmRzKGNvbnN0IEludFBvaW50JiBpbnB1dFBvaW50LCBpbnQgcGFkZGluZyk7CisgICAgICAgIGZs
b2F0IGdldFNjYWxlRmFjdG9yRm9yUmVjdChjb25zdCBJbnRSZWN0Jik7CisKICAgICAgICAgYm9v
bCBvcGVuZWRCeURPTSgpIGNvbnN0OwogICAgICAgICB2b2lkIHNldE9wZW5lZEJ5RE9NKCk7CiAK
</data>
<flag name="review"
          id="101938"
          type_id="1"
          status="-"
          setter="abarth"
    />
          </attachment>
      

    </bug>

</bugzilla>