<?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>94982</bug_id>
          
          <creation_ts>2012-08-24 17:02:15 -0700</creation_ts>
          <short_desc>Make const versions of computeLogical{Height,Width}</short_desc>
          <delta_ts>2012-09-07 14:27:16 -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>Layout and Rendering</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</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>
          <dependson>94984</dependson>
    
    <dependson>95255</dependson>
    
    <dependson>95595</dependson>
    
    <dependson>95787</dependson>
    
    <dependson>95907</dependson>
    
    <dependson>96129</dependson>
          <blocked>94855</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Tony Chang">tony</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>hyatt</cc>
    
    <cc>ojan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>704528</commentid>
    <comment_count>0</comment_count>
    <who name="Tony Chang">tony</who>
    <bug_when>2012-08-24 17:02:15 -0700</bug_when>
    <thetext>tl;dr version: computeLogical{Height,Width} actually compute values then set the height/width and margin values for a box.  This leads to awkwardness if you need the value, but don&apos;t want to set it.  Instead, we want const versions of these functions that return the height/width and margin values.

IRC discussion with Hyatt below:

12:18 &lt; tony^work&gt; dhyatt: while you&apos;re here, what do you think about making a 
                   helper function like computeLogicalHeight that returns the 
                   height and top rather than setting the values.
12:18 &lt; tony^work&gt; computeLogicalHeight would just call this function
12:20 &lt; dhyatt&gt; tony^work: oh i absolutely want to do that
12:20 &lt; dhyatt&gt; tony^work: for width and height
12:20 &lt; dhyatt&gt; tony^work: you can see FIXMES in the code where i say just that
12:20 &lt; tony^work&gt; dhyatt: ok, I can make the changes for height
12:20 &lt; tony^work&gt; we need it for column flexboxes
12:20 &lt; dhyatt&gt; tony^work: regions have this hack where they pull out all old 
                values
12:20 &lt; tony^work&gt; probably for grid too
12:20 &lt; dhyatt&gt; tony^work: and cache them
12:20 &lt; dhyatt&gt; and then call the function
12:20 &lt; dhyatt&gt; and restore the values
12:21 &lt; dhyatt&gt; tony^work: i would do it for both width and height. seems silly 
                to have one do it and the other not.
12:21 &lt; tony^work&gt; dhyatt: ok, I&apos;ll look into doing it for both
12:21 &lt; dhyatt&gt; tony^work: you would be doing me a great service if you did it 
                for both :)
12:21 &lt; ojan&gt; surely it can be done in two separate patches though
12:21 &lt; dhyatt&gt; tony^work: but yeah absolutely want things changed to work that 
                way
12:22 &lt; dhyatt&gt; ojan: oh of course
12:22 &lt; dhyatt&gt; ojan: just saying i don&apos;t want to see height changed and then 
                width not changed for months
12:22 &lt; ojan&gt; yeah, makes sense
12:22 &lt; dhyatt&gt; ideally someone does both as two tasks that happen close 
                together :)
12:22 &lt; tony^work&gt; ok, I&apos;ll do both
12:23 &lt; dhyatt&gt; tony^work: in particular admire the disgusting casting away of 
                the const in renderBoxRegionInfo
(snip example in RenderBox.cpp)
12:24 &lt; dhyatt&gt; i would suggest making little structs to hold the margins and 
                the width/height
12:25 &lt; dhyatt&gt; can still keep the version of the function that fills in the 
                members for you of course, but it would become nonvirtual
12:25 &lt; dhyatt&gt; and just call the virtual one to get the struct
12:25 &lt; dhyatt&gt; and fill the members in from that
12:25 &lt; dhyatt&gt; and then patch a bunch of call sites to use the struct-based 
                one when you don&apos;t want to mutate your renderobject
12:25 &lt; dhyatt&gt; and make the method const so we catch the baddies who try!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>704529</commentid>
    <comment_count>1</comment_count>
    <who name="Tony Chang">tony</who>
    <bug_when>2012-08-24 17:02:37 -0700</bug_when>
    <thetext>I&apos;m going to split the work into multiple smaller patches, although I hope to get it all landed in about a weeks time.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>714983</commentid>
    <comment_count>2</comment_count>
    <who name="Tony Chang">tony</who>
    <bug_when>2012-09-07 14:27:16 -0700</bug_when>
    <thetext>I&apos;m going to declare this done. I have some related cleanup (cleaning up some hacks that save the old value, call computeLogical*, then restore the value), but we don&apos;t need this meta bug anymore.


14:13 &lt; tony^work&gt; dhyatt: I&apos;m mostly done with adding const versions of 
                   computeLogical{Width,Height} (see 
                   http://trac.webkit.org/changeset/127914).  Do you think it&apos;s 
                   worthwhile to rename those functions to 
                   computeAndSetLogical{Width,Height}?
14:22 &lt; dhyatt&gt; tony^work: nah
14:22 &lt; dhyatt&gt; tony^work: i don&apos;t think you need to rename</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>