<?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>168491</bug_id>
          
          <creation_ts>2017-02-16 19:16:30 -0800</creation_ts>
          <short_desc>AX: &quot;(inverted-colors)&quot; match sometimes fails on change</short_desc>
          <delta_ts>2017-04-10 01:08:57 -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>CSS</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</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>
          <dependson>163564</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="James Craig">jcraig</reporter>
          <assigned_to name="Dean Jackson">dino</assigned_to>
          <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1278073</commentid>
    <comment_count>0</comment_count>
    <who name="James Craig">jcraig</who>
    <bug_when>2017-02-16 19:16:30 -0800</bug_when>
    <thetext>The (inverted-colors) media feature from bug 163564 appears to match most of the time, for example, when toggling the setting on macOS or iOS if Safari is in the foreground. Or when using the Accessibility Inspector to change the setting.

Some times when it does not match:
- if you exit Safari on iOS and change via the settings app, the match does not fire when the app is returned to the foreground.
- if you lock the device or otherwise background Safari, the match does not fire again in Safari until you either 1) reload the page, or 2) rotate the device to trigger another orientation match change.

Once you reload the page, the subsequent changes fire appropriate matches. It seems like WebKit is trying to be efficient and not listen for match notifications if it thinks nothing should have changed. If you change the device orientation while it&apos;s in this state it seems to work as expected until the app is backgrounded again.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1278074</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2017-02-16 19:16:43 -0800</bug_when>
    <thetext>&lt;rdar://problem/30570942&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1278075</commentid>
    <comment_count>2</comment_count>
    <who name="James Craig">jcraig</who>
    <bug_when>2017-02-16 19:17:07 -0800</bug_when>
    <thetext>Same test case from bug 163564:
https://bugs.webkit.org/attachment.cgi?id=291870</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1295764</commentid>
    <comment_count>3</comment_count>
    <who name="James Craig">jcraig</who>
    <bug_when>2017-04-09 01:28:03 -0700</bug_when>
    <thetext>Also reproducible in desktop contexts. The change event won&apos;t fire initially, but does when another queryable layout change happens (e.g. resizing the window).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1295765</commentid>
    <comment_count>4</comment_count>
      <attachid>306608</attachid>
    <who name="James Craig">jcraig</who>
    <bug_when>2017-04-09 01:34:38 -0700</bug_when>
    <thetext>Created attachment 306608
test case

1. Load attached test case on Mac.
2. Toggle &quot;Reduce Motion&quot; setting in SysPrefs &gt; Accessibility &gt; Display.
3. Notice the on/off indicator does not change immediately.
4. Resize the window a bit.
5. Notice &quot;prefers reduced motion&quot; value is updated then.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1295924</commentid>
    <comment_count>5</comment_count>
    <who name="James Craig">jcraig</who>
    <bug_when>2017-04-10 01:08:22 -0700</bug_when>
    <thetext>Workaround identified. If you put an empty CSS @media block in, the JavaScript works as expected.

@media (prefers-reduced-motion) { /* Empty block workaround */ }

Including both test cases with and without the workaround.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1295925</commentid>
    <comment_count>6</comment_count>
      <attachid>306669</attachid>
    <who name="James Craig">jcraig</who>
    <bug_when>2017-04-10 01:08:57 -0700</bug_when>
    <thetext>Created attachment 306669
test case with workaround</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>306608</attachid>
            <date>2017-04-09 01:34:38 -0700</date>
            <delta_ts>2017-04-09 01:34:38 -0700</delta_ts>
            <desc>test case</desc>
            <filename>prm.htm</filename>
            <type>text/html</type>
            <size>826</size>
            <attacher name="James Craig">jcraig</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8aGVhZD4KPHRpdGxlPkRlbW86IHByZWZlcnMtcmVkdWNl
ZC1tb3Rpb24gbWVkaWEgcXVlcnk8L3RpdGxlPgoKPC9oZWFkPgo8Ym9keT4KCjxkaXYgaWQ9Imlu
ZGljYXRvciI+Cgk8cD5QcmVmZXJzIFJlZHVjZWQgTW90aW9uOiA8c3BhbiBpZD0icHJtVmFsdWUi
PnVuc3VwcG9ydGVkPC9zcGFuPjwvcD4KPC9kaXY+Cgo8c2NyaXB0IHR5cGU9InRleHQvamF2YXNj
cmlwdCI+Cgp2YXIgbW90aW9uUXVlcnkgPSBtYXRjaE1lZGlhKCcocHJlZmVycy1yZWR1Y2VkLW1v
dGlvbiknKTsKZnVuY3Rpb24gaGFuZGxlUmVkdWNlTW90aW9uQ2hhbmdlZCgpIHsKICAgIGlmICht
b3Rpb25RdWVyeS5tYXRjaGVzKSB7CiAgICAgICAgLyogYWRqdXN0IG1vdGlvbiBvZiAndHJhbnNp
dGlvbicgb3IgJ2FuaW1hdGlvbicgcHJvcGVydGllcyAqLwoJCXVwZGF0ZVZhbHVlVGV4dCgnb24n
KTsKICAgIH0gZWxzZSB7IAogICAgICAgIC8qIHN0YW5kYXJkIG1vdGlvbiAqLwogICAgICAgIHVw
ZGF0ZVZhbHVlVGV4dCgnb2ZmJyk7CiAgICB9Cn0KbW90aW9uUXVlcnkuYWRkTGlzdGVuZXIoaGFu
ZGxlUmVkdWNlTW90aW9uQ2hhbmdlZCk7CmhhbmRsZVJlZHVjZU1vdGlvbkNoYW5nZWQoKTsgLy8g
dHJpZ2dlciB0aGlzIG9uY2Ugb24gbG9hZCB0byBzZXQgdXAgdGhlIGluaXRpYWwgdmFsdWUKCmZ1
bmN0aW9uIHVwZGF0ZVZhbHVlVGV4dChzdHIpIHsKCXZhciBlbCA9IGRvY3VtZW50LmdldEVsZW1l
bnRCeUlkKCdwcm1WYWx1ZScpOwoJaWYgKGVsKSB7CgkJZWwuaW5uZXJUZXh0ID0gc3RyOwoJfQp9
Cgo8L3NjcmlwdD4KCjwvYm9keT4KPC9odG1sPg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>306669</attachid>
            <date>2017-04-10 01:08:57 -0700</date>
            <delta_ts>2017-04-10 01:08:57 -0700</delta_ts>
            <desc>test case with workaround</desc>
            <filename>168491_with_workaround.htm</filename>
            <type>text/html</type>
            <size>949</size>
            <attacher name="James Craig">jcraig</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8aGVhZD4KPHRpdGxlPkRlbW86IHByZWZlcnMtcmVkdWNl
ZC1tb3Rpb24gbWVkaWEgcXVlcnk8L3RpdGxlPgo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoKQG1l
ZGlhIChwcmVmZXJzLXJlZHVjZWQtbW90aW9uKSB7IC8qIEVtcHR5IGJsb2NrIHdvcmthcm91bmQg
Zm9yIHdlYmtpdC5vcmcvYi8xNjg0OTEgKi8gfQoKPC9zdHlsZT4KPC9oZWFkPgo8Ym9keT4KCjxk
aXYgaWQ9ImluZGljYXRvciI+Cgk8cD5QcmVmZXJzIFJlZHVjZWQgTW90aW9uOiA8c3BhbiBpZD0i
cHJtVmFsdWUiPnVuc3VwcG9ydGVkPC9zcGFuPjwvcD4KPC9kaXY+Cgo8c2NyaXB0IHR5cGU9InRl
eHQvamF2YXNjcmlwdCI+Cgp2YXIgbW90aW9u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