Alexandre Julliard pushed to branch master at wine / wine
Commits:
-
72651751
by Gabriel Ivăncescu at 2024-07-23T21:29:24+02:00
-
63de479c
by Gabriel Ivăncescu at 2024-07-23T21:29:24+02:00
-
fa668a15
by Gabriel Ivăncescu at 2024-07-23T21:29:29+02:00
-
285e8f0d
by Gabriel Ivăncescu at 2024-07-23T21:29:33+02:00
-
483412bf
by Gabriel Ivăncescu at 2024-07-23T21:29:34+02:00
-
03547558
by Gabriel Ivăncescu at 2024-07-23T21:29:36+02:00
-
226217c5
by Gabriel Ivăncescu at 2024-07-23T21:29:40+02:00
-
4eddb711
by Gabriel Ivăncescu at 2024-07-23T21:29:44+02:00
-
91317cae
by Gabriel Ivăncescu at 2024-07-23T21:29:44+02:00
7 changed files:
- dlls/mshtml/htmlevent.c
- dlls/mshtml/htmlevent.h
- dlls/mshtml/htmlstyle.c
- dlls/mshtml/htmlstyle.h
- dlls/mshtml/tests/documentmode.js
- dlls/mshtml/tests/dom.js
- dlls/mshtml/tests/events.js
Changes:
... | ... | @@ -504,7 +504,7 @@ static HRESULT WINAPI HTMLEventObj_put_cancelBubble(IHTMLEventObj *iface, VARIAN |
504 | 504 | TRACE("(%p)->(%x)\n", This, v);
|
505 | 505 | |
506 | 506 | if(This->event)
|
507 | - IDOMEvent_stopPropagation(&This->event->IDOMEvent_iface);
|
|
507 | + IDOMEvent_put_cancelBubble(&This->event->IDOMEvent_iface, v);
|
|
508 | 508 | return S_OK;
|
509 | 509 | }
|
510 | 510 | |
... | ... | @@ -514,8 +514,7 @@ static HRESULT WINAPI HTMLEventObj_get_cancelBubble(IHTMLEventObj *iface, VARIAN |
514 | 514 | |
515 | 515 | TRACE("(%p)->(%p)\n", This, p);
|
516 | 516 | |
517 | - *p = variant_bool(This->event && This->event->stop_propagation);
|
|
518 | - return S_OK;
|
|
517 | + return IDOMEvent_get_cancelBubble(&This->event->IDOMEvent_iface, p);
|
|
519 | 518 | }
|
520 | 519 | |
521 | 520 | static HRESULT WINAPI HTMLEventObj_get_fromElement(IHTMLEventObj *iface, IHTMLElement **p)
|
... | ... | @@ -2013,7 +2012,6 @@ static HRESULT WINAPI DOMEvent_stopPropagation(IDOMEvent *iface) |
2013 | 2012 | TRACE("(%p)\n", This);
|
2014 | 2013 | |
2015 | 2014 | This->stop_propagation = TRUE;
|
2016 | - nsIDOMEvent_StopPropagation(This->nsevent);
|
|
2017 | 2015 | return S_OK;
|
2018 | 2016 | }
|
2019 | 2017 | |
... | ... | @@ -2041,15 +2039,25 @@ static HRESULT WINAPI DOMEvent_get_isTrusted(IDOMEvent *iface, VARIANT_BOOL *p) |
2041 | 2039 | static HRESULT WINAPI DOMEvent_put_cancelBubble(IDOMEvent *iface, VARIANT_BOOL v)
|
2042 | 2040 | {
|
2043 | 2041 | DOMEvent *This = impl_from_IDOMEvent(iface);
|
2044 | - FIXME("(%p)->(%x)\n", This, v);
|
|
2045 | - return E_NOTIMPL;
|
|
2042 | + |
|
2043 | + TRACE("(%p)->(%x)\n", This, v);
|
|
2044 | + |
|
2045 | + if(This->phase < 2)
|
|
2046 | + return S_OK;
|
|
2047 | + |
|
2048 | + /* stop_immediate_propagation is not able to be interrupted, but native has a weird behavior. */
|
|
2049 | + This->stop_propagation = (v != VARIANT_FALSE);
|
|
2050 | + return S_OK;
|
|
2046 | 2051 | }
|
2047 | 2052 | |
2048 | 2053 | static HRESULT WINAPI DOMEvent_get_cancelBubble(IDOMEvent *iface, VARIANT_BOOL *p)
|
2049 | 2054 | {
|
2050 | 2055 | DOMEvent *This = impl_from_IDOMEvent(iface);
|
2051 | - FIXME("(%p)->(%p)\n", This, p);
|
|
2052 | - return E_NOTIMPL;
|
|
2056 | + |
|
2057 | + TRACE("(%p)->(%p)\n", This, p);
|
|
2058 | + |
|
2059 | + *p = variant_bool(This->stop_propagation);
|
|
2060 | + return S_OK;
|
|
2053 | 2061 | }
|
2054 | 2062 | |
2055 | 2063 | static HRESULT WINAPI DOMEvent_get_srcElement(IDOMEvent *iface, IHTMLElement **p)
|
... | ... | @@ -4257,8 +4265,7 @@ static void call_event_handlers(EventTarget *event_target, DOMEvent *event, disp |
4257 | 4265 | }
|
4258 | 4266 | }
|
4259 | 4267 | |
4260 | - for(listener = listeners; !event->stop_immediate_propagation
|
|
4261 | - && listener < listeners + listeners_cnt; listener++) {
|
|
4268 | + for(listener = listeners; listener < listeners + listeners_cnt; listener++) {
|
|
4262 | 4269 | if(listener->type != LISTENER_TYPE_ATTACHED) {
|
4263 | 4270 | DISPID named_arg = DISPID_THIS;
|
4264 | 4271 | VARIANTARG args[2];
|
... | ... | @@ -4321,6 +4328,9 @@ static void call_event_handlers(EventTarget *event_target, DOMEvent *event, disp |
4321 | 4328 | WARN("%p %s attached <<< %08lx\n", event_target, debugstr_w(event->type), hres);
|
4322 | 4329 | }
|
4323 | 4330 | }
|
4331 | + |
|
4332 | + if(event->stop_immediate_propagation)
|
|
4333 | + break;
|
|
4324 | 4334 | }
|
4325 | 4335 | |
4326 | 4336 | for(listener = listeners; listener < listeners + listeners_cnt; listener++)
|
... | ... | @@ -4469,6 +4479,9 @@ static HRESULT dispatch_event_object(EventTarget *event_target, DOMEvent *event, |
4469 | 4479 | call_event_handlers(target_chain[i], event, dispatch_mode);
|
4470 | 4480 | }
|
4471 | 4481 | |
4482 | + if(event->stop_propagation)
|
|
4483 | + nsIDOMEvent_StopPropagation(event->nsevent);
|
|
4484 | + |
|
4472 | 4485 | if(r)
|
4473 | 4486 | *r = variant_bool(!event->prevent_default);
|
4474 | 4487 |
... | ... | @@ -83,16 +83,16 @@ typedef struct DOMEvent { |
83 | 83 | EventTarget *target;
|
84 | 84 | EventTarget *current_target;
|
85 | 85 | ULONGLONG time_stamp;
|
86 | - BOOL bubbles;
|
|
87 | - BOOL cancelable;
|
|
88 | - BOOL prevent_default;
|
|
89 | - BOOL stop_propagation;
|
|
90 | - BOOL stop_immediate_propagation;
|
|
91 | - BOOL trusted;
|
|
86 | + unsigned bubbles : 1;
|
|
87 | + unsigned cancelable : 1;
|
|
88 | + unsigned prevent_default : 1;
|
|
89 | + unsigned stop_propagation : 1;
|
|
90 | + unsigned stop_immediate_propagation : 1;
|
|
91 | + unsigned trusted : 1;
|
|
92 | + unsigned no_event_obj : 1;
|
|
92 | 93 | DOM_EVENT_PHASE phase;
|
93 | 94 | |
94 | 95 | IHTMLEventObj *event_obj;
|
95 | - BOOL no_event_obj;
|
|
96 | 96 | } DOMEvent;
|
97 | 97 | |
98 | 98 | const WCHAR *get_event_name(eventid_t);
|
... | ... | @@ -119,6 +119,17 @@ typedef struct { |
119 | 119 | } style_tbl_entry_t;
|
120 | 120 | |
121 | 121 | static const style_tbl_entry_t style_tbl[] = {
|
122 | + {
|
|
123 | + L"-ms-transform",
|
|
124 | + DISPID_IHTMLCSSSTYLEDECLARATION_MSTRANSFORM,
|
|
125 | + DISPID_UNKNOWN
|
|
126 | + },
|
|
127 | + {
|
|
128 | + L"-ms-transition",
|
|
129 | + DISPID_IHTMLCSSSTYLEDECLARATION2_MSTRANSITION,
|
|
130 | + DISPID_UNKNOWN,
|
|
131 | + ATTR_COMPAT_IE10
|
|
132 | + },
|
|
122 | 133 | {
|
123 | 134 | L"animation",
|
124 | 135 | DISPID_IHTMLCSSSTYLEDECLARATION2_ANIMATION,
|
... | ... | @@ -318,7 +329,7 @@ static const style_tbl_entry_t style_tbl[] = { |
318 | 329 | ATTR_FIX_PX
|
319 | 330 | },
|
320 | 331 | {
|
321 | - L"-moz-box-sizing",
|
|
332 | + L"box-sizing",
|
|
322 | 333 | DISPID_IHTMLCSSSTYLEDECLARATION_BOXSIZING,
|
323 | 334 | DISPID_A_BOXSIZING
|
324 | 335 | },
|
... | ... | @@ -702,6 +713,18 @@ static const style_tbl_entry_t style_tbl[] = { |
702 | 713 | |
703 | 714 | C_ASSERT(ARRAY_SIZE(style_tbl) == STYLEID_MAX_VALUE);
|
704 | 715 | |
716 | +static const WCHAR *get_style_nsname(const style_tbl_entry_t *style_entry)
|
|
717 | +{
|
|
718 | + if(style_entry->name[0] == '-')
|
|
719 | + return style_entry->name + sizeof("-ms-")-1;
|
|
720 | + return style_entry->name;
|
|
721 | +}
|
|
722 | + |
|
723 | +static const WCHAR *get_style_prop_nsname(const style_tbl_entry_t *style_entry, const WCHAR *orig_name)
|
|
724 | +{
|
|
725 | + return style_entry ? get_style_nsname(style_entry) : orig_name;
|
|
726 | +}
|
|
727 | + |
|
705 | 728 | static const style_tbl_entry_t *lookup_style_tbl(CSSStyle *style, const WCHAR *name)
|
706 | 729 | {
|
707 | 730 | int c, i, min = 0, max = ARRAY_SIZE(style_tbl)-1;
|
... | ... | @@ -788,7 +811,7 @@ static HRESULT set_nsstyle_property(nsIDOMCSSStyleDeclaration *nsstyle, styleid_ |
788 | 811 | nsAString str_name, str_empty;
|
789 | 812 | nsresult nsres;
|
790 | 813 | |
791 | - nsAString_InitDepend(&str_name, style_tbl[sid].name);
|
|
814 | + nsAString_InitDepend(&str_name, get_style_nsname(&style_tbl[sid]));
|
|
792 | 815 | nsAString_InitDepend(&str_empty, L"");
|
793 | 816 | nsres = nsIDOMCSSStyleDeclaration_SetProperty(nsstyle, &str_name, value, &str_empty);
|
794 | 817 | nsAString_Finish(&str_name);
|
... | ... | @@ -867,7 +890,7 @@ static HRESULT get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration *nsstyle, stylei |
867 | 890 | nsAString str_name;
|
868 | 891 | nsresult nsres;
|
869 | 892 | |
870 | - nsAString_InitDepend(&str_name, style_tbl[sid].name);
|
|
893 | + nsAString_InitDepend(&str_name, get_style_nsname(&style_tbl[sid]));
|
|
871 | 894 | nsres = nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle, &str_name, value);
|
872 | 895 | nsAString_Finish(&str_name);
|
873 | 896 | if(NS_FAILED(nsres))
|
... | ... | @@ -2946,7 +2969,7 @@ static HRESULT WINAPI HTMLStyle_removeAttribute(IHTMLStyle *iface, BSTR strAttri |
2946 | 2969 | return S_OK;
|
2947 | 2970 | }
|
2948 | 2971 | |
2949 | - nsAString_InitDepend(&name_str, style_entry->name);
|
|
2972 | + nsAString_InitDepend(&name_str, get_style_nsname(style_entry));
|
|
2950 | 2973 | nsAString_Init(&ret_str, NULL);
|
2951 | 2974 | nsres = nsIDOMCSSStyleDeclaration_RemoveProperty(This->css_style.nsstyle, &name_str, &ret_str);
|
2952 | 2975 | if(NS_SUCCEEDED(nsres)) {
|
... | ... | @@ -4443,7 +4466,7 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_getPropertyValue(IHTMLCSSStyleDecl |
4443 | 4466 | TRACE("(%p)->(%s %p)\n", This, debugstr_w(name), value);
|
4444 | 4467 | |
4445 | 4468 | style_entry = lookup_style_tbl(This, name);
|
4446 | - nsAString_InitDepend(&name_str, style_entry ? style_entry->name : name);
|
|
4469 | + nsAString_InitDepend(&name_str, get_style_prop_nsname(style_entry, name));
|
|
4447 | 4470 | nsAString_InitDepend(&value_str, NULL);
|
4448 | 4471 | nsres = nsIDOMCSSStyleDeclaration_GetPropertyValue(This->nsstyle, &name_str, &value_str);
|
4449 | 4472 | nsAString_Finish(&name_str);
|
... | ... | @@ -4467,7 +4490,7 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_removeProperty(IHTMLCSSStyleDeclar |
4467 | 4490 | TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrPropertyName), pbstrPropertyValue);
|
4468 | 4491 | |
4469 | 4492 | style_entry = lookup_style_tbl(This, bstrPropertyName);
|
4470 | - nsAString_InitDepend(&name_str, style_entry ? style_entry->name : bstrPropertyName);
|
|
4493 | + nsAString_InitDepend(&name_str, get_style_prop_nsname(style_entry, bstrPropertyName));
|
|
4471 | 4494 | nsAString_Init(&ret_str, NULL);
|
4472 | 4495 | nsres = nsIDOMCSSStyleDeclaration_RemoveProperty(This->nsstyle, &name_str, &ret_str);
|
4473 | 4496 | nsAString_Finish(&name_str);
|
... | ... | @@ -4500,7 +4523,7 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_setProperty(IHTMLCSSStyleDeclarati |
4500 | 4523 | nsAString_InitDepend(&priority_str, NULL);
|
4501 | 4524 | }
|
4502 | 4525 | |
4503 | - nsAString_InitDepend(&name_str, style_entry ? style_entry->name : name);
|
|
4526 | + nsAString_InitDepend(&name_str, get_style_prop_nsname(style_entry, name));
|
|
4504 | 4527 | nsres = nsIDOMCSSStyleDeclaration_SetProperty(This->nsstyle, &name_str, &value_str, &priority_str);
|
4505 | 4528 | nsAString_Finish(&name_str);
|
4506 | 4529 | nsAString_Finish(&value_str);
|
... | ... | @@ -7262,15 +7285,19 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_get_boxShadow(IHTMLCSSStyleDeclara |
7262 | 7285 | static HRESULT WINAPI HTMLCSSStyleDeclaration_put_msTransform(IHTMLCSSStyleDeclaration *iface, BSTR v)
|
7263 | 7286 | {
|
7264 | 7287 | CSSStyle *This = impl_from_IHTMLCSSStyleDeclaration(iface);
|
7265 | - FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
|
7266 | - return E_NOTIMPL;
|
|
7288 | + |
|
7289 | + TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
7290 | + |
|
7291 | + return set_style_property(This, STYLEID_MSTRANSFORM, v);
|
|
7267 | 7292 | }
|
7268 | 7293 | |
7269 | 7294 | static HRESULT WINAPI HTMLCSSStyleDeclaration_get_msTransform(IHTMLCSSStyleDeclaration *iface, BSTR *p)
|
7270 | 7295 | {
|
7271 | 7296 | CSSStyle *This = impl_from_IHTMLCSSStyleDeclaration(iface);
|
7272 | - FIXME("(%p)->(%p)\n", This, p);
|
|
7273 | - return E_NOTIMPL;
|
|
7297 | + |
|
7298 | + TRACE("(%p)->(%p)\n", This, p);
|
|
7299 | + |
|
7300 | + return get_style_property(This, STYLEID_MSTRANSFORM, p);
|
|
7274 | 7301 | }
|
7275 | 7302 | |
7276 | 7303 | static HRESULT WINAPI HTMLCSSStyleDeclaration_put_msTransformOrigin(IHTMLCSSStyleDeclaration *iface, BSTR v)
|
... | ... | @@ -8760,15 +8787,19 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration2_get_msTransitionDelay(IHTMLCSSSty |
8760 | 8787 | static HRESULT WINAPI HTMLCSSStyleDeclaration2_put_msTransition(IHTMLCSSStyleDeclaration2 *iface, BSTR v)
|
8761 | 8788 | {
|
8762 | 8789 | CSSStyle *This = impl_from_IHTMLCSSStyleDeclaration2(iface);
|
8763 | - FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
|
8764 | - return E_NOTIMPL;
|
|
8790 | + |
|
8791 | + TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
8792 | + |
|
8793 | + return set_style_property(This, STYLEID_MSTRANSITION, v);
|
|
8765 | 8794 | }
|
8766 | 8795 | |
8767 | 8796 | static HRESULT WINAPI HTMLCSSStyleDeclaration2_get_msTransition(IHTMLCSSStyleDeclaration2 *iface, BSTR *p)
|
8768 | 8797 | {
|
8769 | 8798 | CSSStyle *This = impl_from_IHTMLCSSStyleDeclaration2(iface);
|
8770 | - FIXME("(%p)->(%p)\n", This, p);
|
|
8771 | - return E_NOTIMPL;
|
|
8799 | + |
|
8800 | + TRACE("(%p)->(%p)\n", This, p);
|
|
8801 | + |
|
8802 | + return get_style_property(This, STYLEID_MSTRANSITION, p);
|
|
8772 | 8803 | }
|
8773 | 8804 | |
8774 | 8805 | static HRESULT WINAPI HTMLCSSStyleDeclaration2_put_msTouchAction(IHTMLCSSStyleDeclaration2 *iface, BSTR v)
|
... | ... | @@ -40,6 +40,8 @@ struct HTMLStyle { |
40 | 40 | |
41 | 41 | /* NOTE: Make sure to keep in sync with style_tbl in htmlstyle.c */
|
42 | 42 | typedef enum {
|
43 | + STYLEID_MSTRANSFORM,
|
|
44 | + STYLEID_MSTRANSITION,
|
|
43 | 45 | STYLEID_ANIMATION,
|
44 | 46 | STYLEID_ANIMATION_NAME,
|
45 | 47 | STYLEID_BACKGROUND,
|
... | ... | @@ -660,60 +660,42 @@ sync_test("xhr open", function() { |
660 | 660 | });
|
661 | 661 | |
662 | 662 | sync_test("style_props", function() {
|
663 | - var style = document.body.style;
|
|
663 | + var style = document.body.style, currentStyle = document.body.currentStyle, computedStyle = window.getComputedStyle ? window.getComputedStyle(document.body) : undefined;
|
|
664 | 664 | |
665 | - function test_exposed(prop, expect) {
|
|
666 | - if(expect)
|
|
665 | + function test_exposed(prop, expect_style, expect_currentStyle, expect_computedStyle) {
|
|
666 | + if(expect_style)
|
|
667 | 667 | ok(prop in style, prop + " not found in style object.");
|
668 | 668 | else
|
669 | 669 | ok(!(prop in style), prop + " found in style object.");
|
670 | + if(expect_currentStyle)
|
|
671 | + ok(prop in currentStyle, prop + " not found in currentStyle object.");
|
|
672 | + else
|
|
673 | + ok(!(prop in currentStyle), prop + " found in currentStyle object.");
|
|
674 | + if(computedStyle) {
|
|
675 | + if(expect_computedStyle)
|
|
676 | + ok(prop in computedStyle, prop + " not found in computedStyle object.");
|
|
677 | + else
|
|
678 | + ok(!(prop in computedStyle), prop + " found in computedStyle object.");
|
|
679 | + }
|
|
670 | 680 | }
|
671 | 681 | |
672 | 682 | var v = document.documentMode;
|
673 | 683 | |
674 | - test_exposed("removeAttribute", true);
|
|
675 | - test_exposed("zIndex", true);
|
|
676 | - test_exposed("z-index", true);
|
|
677 | - test_exposed("filter", true);
|
|
678 | - test_exposed("pixelTop", true);
|
|
679 | - test_exposed("float", true);
|
|
680 | - test_exposed("css-float", false);
|
|
681 | - test_exposed("style-float", false);
|
|
682 | - test_exposed("setProperty", v >= 9);
|
|
683 | - test_exposed("removeProperty", v >= 9);
|
|
684 | - test_exposed("background-clip", v >= 9);
|
|
685 | - test_exposed("msTransform", v >= 9);
|
|
686 | - test_exposed("transform", v >= 10);
|
|
687 | - |
|
688 | - style = document.body.currentStyle;
|
|
689 | - |
|
690 | - test_exposed("zIndex", true);
|
|
691 | - test_exposed("z-index", true);
|
|
692 | - test_exposed("filter", true);
|
|
693 | - test_exposed("pixelTop", false);
|
|
694 | - test_exposed("float", true);
|
|
695 | - test_exposed("css-float", false);
|
|
696 | - test_exposed("style-float", false);
|
|
697 | - test_exposed("setProperty", v >= 9);
|
|
698 | - test_exposed("removeProperty", v >= 9);
|
|
699 | - test_exposed("background-clip", v >= 9);
|
|
700 | - test_exposed("transform", v >= 10);
|
|
701 | - |
|
702 | - if(window.getComputedStyle) {
|
|
703 | - style = window.getComputedStyle(document.body);
|
|
704 | - |
|
705 | - test_exposed("removeAttribute", false);
|
|
706 | - test_exposed("zIndex", true);
|
|
707 | - test_exposed("z-index", true);
|
|
708 | - test_exposed("pixelTop", false);
|
|
709 | - test_exposed("float", true);
|
|
710 | - test_exposed("css-float", false);
|
|
711 | - test_exposed("style-float", false);
|
|
712 | - test_exposed("setProperty", v >= 9);
|
|
713 | - test_exposed("removeProperty", v >= 9);
|
|
714 | - test_exposed("background-clip", v >= 9);
|
|
715 | - test_exposed("transform", v >= 10);
|
|
716 | - }
|
|
684 | + test_exposed("removeAttribute", true, broken(true) ? v >= 9 : false /* todo_wine */, false);
|
|
685 | + test_exposed("zIndex", true, true, true);
|
|
686 | + test_exposed("z-index", true, true, true);
|
|
687 | + test_exposed("filter", true, true, broken(true) ? v >= 10 : v >= 9 /* todo_wine */);
|
|
688 | + test_exposed("pixelTop", true, false, false);
|
|
689 | + test_exposed("float", true, true, true);
|
|
690 | + test_exposed("css-float", false, false, false);
|
|
691 | + test_exposed("style-float", false, false, false);
|
|
692 | + test_exposed("setProperty", v >= 9, v >= 9, v >= 9);
|
|
693 | + test_exposed("removeProperty", v >= 9, v >= 9, v >= 9);
|
|
694 | + test_exposed("background-clip", v >= 9, v >= 9, v >= 9);
|
|
695 | + test_exposed("msTransform", v >= 9, v >= 9, v >= 9);
|
|
696 | + test_exposed("msTransition", v >= 10, v >= 10, v >= 10);
|
|
697 | + test_exposed("transform", v >= 10, v >= 10, v >= 10);
|
|
698 | + test_exposed("transition", v >= 10, v >= 10, v >= 10);
|
|
717 | 699 | });
|
718 | 700 | |
719 | 701 | sync_test("createElement_inline_attr", function() {
|
... | ... | @@ -399,6 +399,20 @@ sync_test("style_properties", function() { |
399 | 399 | ok(val === "", "removeProperty() returned " + val);
|
400 | 400 | ok(style.testVal === "test", "testVal = " + style.testVal);
|
401 | 401 | |
402 | + val = style.getPropertyValue("testVal");
|
|
403 | + ok(val === "", 'style.getPropertyValue("testVal") = ' + val);
|
|
404 | + ok(style.testVal === "test", "testVal = " + style.testVal);
|
|
405 | + |
|
406 | + style.setProperty("testVal", "1px");
|
|
407 | + val = style.getPropertyValue("testVal");
|
|
408 | + ok(val === "", 'style.getPropertyValue("testVal") = ' + val);
|
|
409 | + ok(style.testVal === "test", "testVal = " + style.testVal);
|
|
410 | + |
|
411 | + style.setProperty("test", "1px");
|
|
412 | + val = style.getPropertyValue("test");
|
|
413 | + ok(val === "", 'style.getPropertyValue("test") = ' + val);
|
|
414 | + ok(!("test" in style), "test in style");
|
|
415 | + |
|
402 | 416 | style["z-index"] = 1;
|
403 | 417 | ok(style.zIndex === 1, "zIndex = " + style.zIndex);
|
404 | 418 | ok(style["z-index"] === 1, "z-index = " + style["z-index"]);
|
... | ... | @@ -458,6 +472,21 @@ sync_test("style_properties", function() { |
458 | 472 | ok(computed_style.zIndex === 4, "computed_style.zIndex = " + computed_style.zIndex);
|
459 | 473 | |
460 | 474 | window.getComputedStyle(elem, null);
|
475 | + |
|
476 | + /* ms* prefixed styles alias */
|
|
477 | + var list = [
|
|
478 | + [ "transform", "translate(5px, 5px)" ],
|
|
479 | + [ "transition", "background-color 0.5s linear 0.1s" ]
|
|
480 | + ];
|
|
481 | + for(var i = 0; i < list.length; i++) {
|
|
482 | + var s = list[i][0], v = list[i][1], ms = "ms" + s[0].toUpperCase() + s.substring(1);
|
|
483 | + style[s] = v;
|
|
484 | + ok(style[s] === v, "style." + s + " = " + style[s] + ", expected " + v);
|
|
485 | + ok(style[ms] === v, "style." + ms + " = " + style[ms] + ", expected " + v);
|
|
486 | + elem.style[ms] = v;
|
|
487 | + ok(elem.style[s] === v, "elem.style." + s + " = " + elem.style[s] + ", expected " + v);
|
|
488 | + ok(elem.style[ms] === v, "elem.style." + ms + " = " + elem.style[ms] + ", expected " + v);
|
|
489 | + }
|
|
461 | 490 | });
|
462 | 491 | |
463 | 492 | sync_test("stylesheets", function() {
|
... | ... | @@ -255,63 +255,150 @@ sync_test("stop_propagation", function() { |
255 | 255 | |
256 | 256 | function stop_propagation(e) {
|
257 | 257 | calls += "stop,";
|
258 | + ok(e.cancelBubble === (e.cancelBubble_winetest ? true : false), "cancelBubble before stopPropagation = " + e.cancelBubble);
|
|
258 | 259 | e.stopPropagation();
|
260 | + e.cancelBubble_winetest = true;
|
|
261 | + ok(e.cancelBubble === true, "cancelBubble after stopPropagation = " + e.cancelBubble);
|
|
259 | 262 | ok(e.bubbles === true, "bubbles = " + e.bubbles);
|
260 | 263 | ok(e.defaultPrevented === false, "defaultPrevented = " + e.defaultPrevented);
|
261 | 264 | }
|
262 | 265 | |
263 | 266 | function stop_immediate_propagation(e) {
|
264 | 267 | calls += "immediateStop,";
|
268 | + ok(e.cancelBubble === (e.cancelBubble_winetest ? true : false), "cancelBubble before stopImmediatePropagation = " + e.cancelBubble);
|
|
265 | 269 | e.stopImmediatePropagation();
|
270 | + e.cancelBubble_winetest = true;
|
|
271 | + ok(e.cancelBubble === true, "cancelBubble after stopImmediatePropagation = " + e.cancelBubble);
|
|
266 | 272 | ok(e.bubbles === true, "bubbles = " + e.bubbles);
|
267 | 273 | ok(e.cancelable === true, "cancelable = " + e.cancelable);
|
268 | 274 | ok(e.defaultPrevented === false, "defaultPrevented = " + e.defaultPrevented);
|
269 | 275 | }
|
270 | 276 | |
271 | - div1.addEventListener("click", stop_immediate_propagation, true);
|
|
277 | + function stop_immediate_propagation_cancel_bubble_false(e) {
|
|
278 | + calls += "immediateStop and cancelBubble(false),";
|
|
279 | + ok(e.cancelBubble === (e.cancelBubble_winetest ? true : false), "cancelBubble before stopImmediatePropagation = " + e.cancelBubble);
|
|
280 | + e.stopImmediatePropagation();
|
|
281 | + e.cancelBubble = false;
|
|
282 | + e.cancelBubble_winetest = e.eventPhase < 2 ? true : false;
|
|
283 | + ok(e.cancelBubble === (e.cancelBubble_winetest ? true : false), "cancelBubble after stopImmediatePropagation and setting cancelBubble to false = " + e.cancelBubble);
|
|
284 | + ok(e.bubbles === true, "bubbles = " + e.bubbles);
|
|
285 | + ok(e.cancelable === true, "cancelable = " + e.cancelable);
|
|
286 | + ok(e.defaultPrevented === false, "defaultPrevented = " + e.defaultPrevented);
|
|
287 | + }
|
|
288 | + |
|
289 | + function cancel_bubble_impl(i) {
|
|
290 | + return function(e) {
|
|
291 | + calls += "cancelBubble["+i+"],";
|
|
292 | + ok(e.cancelBubble === (e.cancelBubble_winetest ? true : false), "cancelBubble before setting cancelBubble = " + e.cancelBubble);
|
|
293 | + e.cancelBubble = true;
|
|
294 | + if(e.eventPhase < 2)
|
|
295 | + ok(e.cancelBubble === (e.cancelBubble_winetest ? true : false), "cancelBubble after setting cancelBubble during capture phase = " + e.cancelBubble);
|
|
296 | + else
|
|
297 | + ok(e.cancelBubble === true, "cancelBubble after setting cancelBubble during bubble phase = " + e.cancelBubble);
|
|
298 | + e.cancelBubble_winetest = e.cancelBubble;
|
|
299 | + ok(e.bubbles === true, "bubbles = " + e.bubbles);
|
|
300 | + ok(e.cancelable === true, "cancelable = " + e.cancelable);
|
|
301 | + ok(e.defaultPrevented === false, "defaultPrevented = " + e.defaultPrevented);
|
|
302 | + }
|
|
303 | + }
|
|
304 | + |
|
305 | + var cancel_bubble = [];
|
|
306 | + for(var i = 0; i < 4; i++)
|
|
307 | + cancel_bubble.push(cancel_bubble_impl(i));
|
|
308 | + |
|
309 | + function cancel_bubble_false(e) {
|
|
310 | + calls += "cancelBubble(false),";
|
|
311 | + ok(e.cancelBubble === (e.cancelBubble_winetest ? true : false), "cancelBubble before setting cancelBubble to false = " + e.cancelBubble);
|
|
312 | + e.cancelBubble = false;
|
|
313 | + if(e.cancelBubble_winetest && e.eventPhase !== 1)
|
|
314 | + delete e.cancelBubble_winetest;
|
|
315 | + ok(e.cancelBubble === (e.cancelBubble_winetest ? true : false), "cancelBubble after setting cancelBubble to false = " + e.cancelBubble);
|
|
316 | + ok(e.bubbles === true, "bubbles = " + e.bubbles);
|
|
317 | + ok(e.cancelable === true, "cancelable = " + e.cancelable);
|
|
318 | + ok(e.defaultPrevented === false, "defaultPrevented = " + e.defaultPrevented);
|
|
319 | + }
|
|
320 | + |
|
321 | + div1.addEventListener("click", stop_immediate_propagation_cancel_bubble_false, true);
|
|
272 | 322 | div1.addEventListener("click", stop_propagation, true);
|
323 | + div1.addEventListener("click", cancel_bubble[0], true);
|
|
324 | + div1.addEventListener("click", cancel_bubble_false, true);
|
|
273 | 325 | div1.addEventListener("click", record_call("div1.click(capture)"), true);
|
274 | 326 | |
275 | 327 | div2.addEventListener("click", stop_immediate_propagation, true);
|
328 | + div2.addEventListener("click", cancel_bubble[1], true);
|
|
276 | 329 | div2.addEventListener("click", stop_propagation, true);
|
277 | 330 | div2.addEventListener("click", record_call("div2.click(capture)"), true);
|
278 | 331 | |
332 | + div1.addEventListener("click", cancel_bubble[2], false);
|
|
333 | + div1.addEventListener("click", cancel_bubble_false, false);
|
|
279 | 334 | div1.addEventListener("click", stop_propagation, false);
|
280 | 335 | div1.addEventListener("click", record_call("div1.click(bubble)"), false);
|
281 | 336 | |
337 | + div2.addEventListener("click", stop_immediate_propagation_cancel_bubble_false, false);
|
|
282 | 338 | div2.addEventListener("click", stop_propagation, false);
|
339 | + div2.addEventListener("click", cancel_bubble[3], false);
|
|
340 | + div2.addEventListener("click", cancel_bubble_false, false);
|
|
283 | 341 | div2.addEventListener("click", record_call("div2.click(bubble)"), false);
|
284 | 342 | |
285 | 343 | calls = "";
|
286 | 344 | div2.click();
|
287 | - ok(calls === "immediateStop,", "calls = " + calls);
|
|
345 | + ok(calls === "immediateStop and cancelBubble(false),", "calls = " + calls);
|
|
288 | 346 | |
289 | - div1.removeEventListener("click", stop_immediate_propagation, true);
|
|
347 | + div1.removeEventListener("click", stop_immediate_propagation_cancel_bubble_false, true);
|
|
290 | 348 | calls = "";
|
291 | 349 | div2.click();
|
292 | - ok(calls === "stop,div1.click(capture),", "calls = " + calls);
|
|
350 | + ok(calls === "stop,cancelBubble[0],cancelBubble(false),div1.click(capture),", "calls = " + calls);
|
|
293 | 351 | |
294 | 352 | div1.removeEventListener("click", stop_propagation, true);
|
295 | 353 | calls = "";
|
296 | 354 | div2.click();
|
297 | - ok(calls === "div1.click(capture),immediateStop,", "calls = " + calls);
|
|
355 | + ok(calls === "cancelBubble[0],cancelBubble(false),div1.click(capture),immediateStop,", "calls = " + calls);
|
|
356 | + |
|
357 | + div1.removeEventListener("click", cancel_bubble[0], true);
|
|
358 | + calls = "";
|
|
359 | + div2.click();
|
|
360 | + ok(calls === "cancelBubble(false),div1.click(capture),immediateStop,", "calls = " + calls);
|
|
298 | 361 | |
299 | 362 | div2.removeEventListener("click", stop_immediate_propagation, true);
|
300 | 363 | calls = "";
|
301 | 364 | div2.click();
|
302 | - ok(calls === "div1.click(capture),stop,div2.click(capture),stop,div2.click(bubble),",
|
|
365 | + ok(calls === "cancelBubble(false),div1.click(capture),cancelBubble[1],stop,div2.click(capture),immediateStop and cancelBubble(false),cancelBubble[2],", // weird native behavior
|
|
366 | + "calls = " + calls);
|
|
367 | + |
|
368 | + div2.removeEventListener("click", stop_immediate_propagation_cancel_bubble_false, false);
|
|
369 | + calls = "";
|
|
370 | + div2.click();
|
|
371 | + ok(calls === "cancelBubble(false),div1.click(capture),cancelBubble[1],stop,div2.click(capture),stop,cancelBubble[3],cancelBubble(false),div2.click(bubble),cancelBubble[2],cancelBubble(false),stop,div1.click(bubble),",
|
|
372 | + "calls = " + calls);
|
|
373 | + |
|
374 | + div2.removeEventListener("click", cancel_bubble_false, false);
|
|
375 | + calls = "";
|
|
376 | + div2.click();
|
|
377 | + ok(calls === "cancelBubble(false),div1.click(capture),cancelBubble[1],stop,div2.click(capture),stop,cancelBubble[3],div2.click(bubble),",
|
|
378 | + "calls = " + calls);
|
|
379 | + |
|
380 | + div2.removeEventListener("click", cancel_bubble[1], true);
|
|
381 | + calls = "";
|
|
382 | + div2.click();
|
|
383 | + ok(calls === "cancelBubble(false),div1.click(capture),stop,div2.click(capture),stop,cancelBubble[3],div2.click(bubble),",
|
|
303 | 384 | "calls = " + calls);
|
304 | 385 | |
305 | 386 | div2.removeEventListener("click", stop_propagation, true);
|
306 | 387 | calls = "";
|
307 | 388 | div2.click();
|
308 | - ok(calls === "div1.click(capture),div2.click(capture),stop,div2.click(bubble),",
|
|
389 | + ok(calls === "cancelBubble(false),div1.click(capture),div2.click(capture),stop,cancelBubble[3],div2.click(bubble),",
|
|
309 | 390 | "calls = " + calls);
|
310 | 391 | |
311 | 392 | div2.removeEventListener("click", stop_propagation, false);
|
312 | 393 | calls = "";
|
313 | 394 | div2.click();
|
314 | - ok(calls === "div1.click(capture),div2.click(capture),div2.click(bubble),stop,div1.click(bubble),",
|
|
395 | + ok(calls === "cancelBubble(false),div1.click(capture),div2.click(capture),cancelBubble[3],div2.click(bubble),",
|
|
396 | + "calls = " + calls);
|
|
397 | + |
|
398 | + div2.removeEventListener("click", cancel_bubble[3], false);
|
|
399 | + calls = "";
|
|
400 | + div2.click();
|
|
401 | + ok(calls === "cancelBubble(false),div1.click(capture),div2.click(capture),div2.click(bubble),cancelBubble[2],cancelBubble(false),stop,div1.click(bubble),",
|
|
315 | 402 | "calls = " + calls);
|
316 | 403 | });
|
317 | 404 |