<?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>133271</bug_id>
          
          <creation_ts>2014-05-25 18:15:17 -0700</creation_ts>
          <short_desc>vw units not calculated properly when scrollbars are present and overflow is not auto</short_desc>
          <delta_ts>2020-07-27 20:17:48 -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>Scrolling</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Patrick Arlt">patrick.arlt</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bjonesbe</cc>
    
    <cc>karan</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>tamlyn</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1011609</commentid>
    <comment_count>0</comment_count>
    <who name="Patrick Arlt">patrick.arlt</who>
    <bug_when>2014-05-25 18:15:17 -0700</bug_when>
    <thetext>In Safari 7+ if you Mac is set to always show scroll bars vw units are calculated againt the area of the screen that includes scrollbars.

The CSS spec http://dev.w3.org/csswg/css-values/#viewport-relative-lengths says that &quot;when the value of overflow on the root element is auto, any scroll bars are assumed not to exist.&quot; and &quot;Note that the initial containing block’s size is affected by the presence of scrollbars on the viewport.&quot;

So if I set the overflow property on the &lt;html&gt; element to something like overflow:scroll it should exclude the width of the scrollbar for the vw unit.

In my attached reproduction case with scrollbars always enabled (http://osxdaily.com/2011/08/03/show-scroll-bars-mac-os-x-lion/) the 2 divs should have equal widths but do not.

This also appears to be a bug in chromium/blink which I filed here https://code.google.com/p/chromium/issues/detail?id=377331.

Firefox implements the spec correctly.

IE 11 also has this bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1011612</commentid>
    <comment_count>1</comment_count>
      <attachid>232047</attachid>
    <who name="Patrick Arlt">patrick.arlt</who>
    <bug_when>2014-05-25 18:17:10 -0700</bug_when>
    <thetext>Created attachment 232047
Reproduction case</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1014768</commentid>
    <comment_count>2</comment_count>
    <who name="Bem Jones-Bey">bjonesbe</who>
    <bug_when>2014-06-11 09:17:10 -0700</bug_when>
    <thetext>Looking at the spec, I don&apos;t come to the same conclusion that you do. The spec says that scrollbars are assumed not to exist if overflow is set to &quot;auto&quot;. However, in your example, you have set overflow to &quot;scroll&quot;. So I don&apos;t understand why you would expect the scrollbars to be ignored in your example.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1044187</commentid>
    <comment_count>3</comment_count>
    <who name="Karan Lyons">karan</who>
    <bug_when>2014-10-26 12:49:41 -0700</bug_when>
    <thetext>Scrollbars are supposed to *not* be ignored when overflow is set to scroll. Currently, they&apos;re ignored no matter what overflow&apos;s set to, which is in defiance of the viewport units&apos; spec.

By way of example, assume a viewport 200px wide by 100px tall. If the root element is set to &quot;overflow: auto;&quot;, 100vw should be 200px, and 100vh 100px. This is because the scrollbars should be ignored, regardless of whether they&apos;re present. For this case all browsers are doing the right thing. Here&apos;s what that looks like, in crude ascii form:

+------------------+
|                  |
|     viewport     |
|     200x100      |
|                  |
|                  |
+------------------+


Now set &quot;overflow: scroll;&quot;. Let&apos;s say our scrollbars are 20px wide. So if scrollbars are visible, the browser&apos;s viewport is now 20px less in whichever dimension has a scrollbar. If its in both dimensions, our layout is now as such:

+----------------+-+
|    viewport    | |
|     180x80     | |
|                | |
+----------------+ |
|   scrollbars     |
+------------------+

Currently, Webkit reports the viewport as *still* being 200x100. Which makes viewport units close to useless when scrollbars are present: 100 units no longer equals 100% of the viewport, but some amount more.

The spec is very clear about this being incorrect behavior. It states, &quot;The viewport-percentage lengths are relative to the size of the initial containing block.&quot;[1] and only a couple sentences later says, &quot;Note that the initial containing block’s size is affected by the presence of scrollbars on the viewport.&quot;

Right now the initial containing block&apos;s (the document&apos;s root element in this case) size is *not* being affected by the presence of scrollbars on the viewport, like the spec states it should be.

[1] http://dev.w3.org/csswg/css-values/#viewport-relative-lengths</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1069399</commentid>
    <comment_count>4</comment_count>
    <who name="Tamlyn">tamlyn</who>
    <bug_when>2015-02-16 02:58:53 -0800</bug_when>
    <thetext>(In reply to comment #2)
&gt; Looking at the spec, I don&apos;t come to the same conclusion that you do. 

See this discussion from the CSS Working Group for clarification: http://lists.w3.org/Archives/Public/www-style/2013Jan/0616.html

&gt; viewport units in case of &apos;overflow:auto&apos; are sized as if scrollbar is *not* present (even if they are)
&gt; In case of &apos;overflow: scroll&apos;, scrollbars are accounted for in calculating viewport units</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1675504</commentid>
    <comment_count>5</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2020-07-27 20:17:48 -0700</bug_when>
    <thetext>&lt;rdar://problem/66196708&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>232047</attachid>
            <date>2014-05-25 18:17:10 -0700</date>
            <delta_ts>2014-05-25 18:17:10 -0700</delta_ts>
            <desc>Reproduction case</desc>
            <filename>vw-reproduction.html</filename>
            <type>text/html</type>
            <size>494</size>
            <attacher name="Patrick Arlt">patrick.arlt</attacher>
            
              <data encoding="base64">PCFkb2N0eXBlIGh0bWw+CjxodG1sPgogIDxoZWFkPgogICAgPHRpdGxlPlRlc3Q8L3RpdGxlPgog
ICAgPHN0eWxlPgogICAgICBodG1sIHsKICAgICAgICBvdmVyZmxvdy14OiBoaWRkZW47CiAgICAg
ICAgb3ZlcmZsb3cteTogc2Nyb2xsOwogICAgICB9CgogICAgICBib2R5IHsKICAgICAgICBtYXJn
aW46IDA7CiAgICAgIH0KCiAgICAgICN3aWR0aDEwMCwgI3Z3MTAwIHsKICAgICAgICBiYWNrZ3Jv
dW5kOiBncmF5OwogICAgICAgIG1hcmdpbi10b3A6IDFlbTsKICAgICAgICBoZWlnaHQ6IDIwcHg7
CiAgICAgIH0KCiAgICAgICN3aWR0aDEwMCB7CiAgICAgICAgd2lkdGg6IDEwMCU7CiAgICAgIH0K
CiAgICAgICN2dzEwMCB7CiAgICAgICAgd2lkdGg6IDEwMHZ3OwogICAgICB9CiAgICA8L3N0eWxl
PgogIDwvaGVhZD4KICA8Ym9keT4KICAgIDxkaXYgaWQ9IndpZHRoMTAwIj48L2Rpdj4KICAgIDxk
aXYgaWQ9InZ3MTAwIj48L2Rpdj4KICA8L2JvZHk+CjwvaHRtbD4=
</data>

          </attachment>
      

    </bug>

</bugzilla>