View Javadoc
1   /*
2    * Copyright 2010 Daniel Kurka
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5    * use this file except in compliance with the License. You may obtain a copy of
6    * the License at
7    * 
8    * http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations under
14   * the License.
15   */
16  package com.google.gwt.user.client.impl;
17  
18  import com.google.gwt.user.client.Element;
19  
20  /**
21   * <p>DOMImplSafariWithTransistion class.</p>
22   *
23   * @author Daniel Kurka
24   * @version $Id: $
25   */
26  public class DOMImplSafariWithTransistion extends DOMImplWebkit {
27  
28  	/**
29  	 * <p>Constructor for DOMImplSafariWithTransistion.</p>
30  	 */
31  	public DOMImplSafariWithTransistion() {
32  
33  	}
34  
35  	
36  	protected native int eventGetTypeInt0(String eventType)/*-{
37  		switch (eventType) {
38      	//added dom transistionend event
39  		case "webkitTransitionEnd": return 0x8000000;
40  		//added dom transistionend event
41  		case "webkitAnimationEnd": return 0x10000000;
42      	default: return -1;
43  		}
44  	}-*/;
45  	
46  	/** {@inheritDoc} */
47  	@Override
48  	public  int eventGetTypeInt(String eventType){
49  		int type = super.eventGetTypeInt(eventType);
50  		if(type != -1)
51  			return type;
52  		return eventGetTypeInt0(eventType);
53  			
54  	}
55  
56  	/** {@inheritDoc} */
57  	protected   void sinkEventsImpl(Element elem, int bits){
58  		sinkEventsImpl0(elem, bits);
59  	}
60  	
61  	protected  native void sinkEventsImpl0(Element elem, int bits) /*-{
62  	var chMask = (elem.__eventBits || 0) ^ bits;
63      elem.__eventBits = bits;
64      if (!chMask) return;
65     
66      if (chMask & 0x00001) elem.onclick       = (bits & 0x00001) ?
67          @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
68      if (chMask & 0x00002) elem.ondblclick    = (bits & 0x00002) ?
69          @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
70      if (chMask & 0x00004) elem.onmousedown   = (bits & 0x00004) ?
71          @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
72      if (chMask & 0x00008) elem.onmouseup     = (bits & 0x00008) ?
73          @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
74      if (chMask & 0x00010) elem.onmouseover   = (bits & 0x00010) ?
75          @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
76      if (chMask & 0x00020) elem.onmouseout    = (bits & 0x00020) ?
77          @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
78      if (chMask & 0x00040) elem.onmousemove   = (bits & 0x00040) ?
79          @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
80      if (chMask & 0x00080) elem.onkeydown     = (bits & 0x00080) ?
81          @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
82      if (chMask & 0x00100) elem.onkeypress    = (bits & 0x00100) ?
83          @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
84      if (chMask & 0x00200) elem.onkeyup       = (bits & 0x00200) ?
85          @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
86      if (chMask & 0x00400) elem.onchange      = (bits & 0x00400) ?
87          @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
88      if (chMask & 0x00800) elem.onfocus       = (bits & 0x00800) ?
89          @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
90      if (chMask & 0x01000) elem.onblur        = (bits & 0x01000) ?
91          @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
92      if (chMask & 0x02000) elem.onlosecapture = (bits & 0x02000) ?
93          @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
94      if (chMask & 0x04000) elem.onscroll      = (bits & 0x04000) ?
95          @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
96      if (chMask & 0x08000) elem.onload        = (bits & 0x08000) ?
97          @com.google.gwt.user.client.impl.DOMImplStandard::dispatchUnhandledEvent : null;
98      if (chMask & 0x10000) elem.onerror       = (bits & 0x10000) ?
99          @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
100     if (chMask & 0x20000) elem.onmousewheel  = (bits & 0x20000) ? 
101         @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
102     if (chMask & 0x40000) elem.oncontextmenu = (bits & 0x40000) ? 
103         @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
104     if (chMask & 0x80000) elem.onpaste       = (bits & 0x80000) ? 
105         @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
106     if (chMask & 0x100000) elem.ontouchstart = (bits & 0x100000) ? 
107         @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
108     if (chMask & 0x200000) elem.ontouchmove  = (bits & 0x200000) ? 
109         @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
110     if (chMask & 0x400000) elem.ontouchend   = (bits & 0x400000) ? 
111         @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
112     if (chMask & 0x800000) elem.ontouchcancel= (bits & 0x800000) ? 
113         @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
114     if (chMask & 0x1000000) elem.ongesturestart  =(bits & 0x1000000) ? 
115         @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
116     if (chMask & 0x2000000) elem.ongesturechange =(bits & 0x2000000) ? 
117         @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
118     if (chMask & 0x4000000) elem.ongestureend    = (bits & 0x4000000) ? 
119         @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null;
120     
121 	//transistion end
122 	if (chMask & 0x8000000) {
123 	if(bits & 0x8000000){
124 	elem.addEventListener('webkitTransitionEnd', @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent, false);
125 	}
126 	}
127 
128 
129 	//animation end
130 	if (chMask & 0x10000000) {
131 	if(bits & 0x10000000){
132 	elem.addEventListener('webkitAnimationEnd', @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent, false);
133 	}
134 	}
135 }-*/;
136 
137 }