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>DOMImplMobileSafari class.</p> 22 * 23 * @author Daniel Kurka 24 * @version $Id: $ 25 */ 26 public class DOMImplMobileSafari extends DOMImplWebkit { 27 28 /** 29 * <p>Constructor for DOMImplMobileSafari.</p> 30 */ 31 public DOMImplMobileSafari() { 32 33 } 34 protected native int eventGetTypeInt0(String eventType)/*-{ 35 switch (eventType) { 36 //added dom transistionend event 37 case "webkitTransitionEnd": return 0x8000000; 38 //added dom transistionend event 39 case "webkitAnimationEnd": return 0x10000000; 40 default: return -1; 41 } 42 }-*/; 43 44 /** {@inheritDoc} */ 45 @Override 46 public int eventGetTypeInt(String eventType) { 47 int type = super.eventGetTypeInt(eventType); 48 if (type != -1) 49 return type; 50 return eventGetTypeInt0(eventType); 51 52 } 53 54 /** {@inheritDoc} */ 55 protected void sinkEventsImpl(Element elem, int bits) { 56 sinkEventsImpl0(elem, bits); 57 } 58 59 protected native void sinkEventsImpl0(Element elem, int bits) /*-{ 60 var chMask = (elem.__eventBits || 0) ^ bits; 61 elem.__eventBits = bits; 62 if (!chMask) return; 63 64 if (chMask & 0x00001) elem.onclick = (bits & 0x00001) ? 65 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 66 if (chMask & 0x00002) elem.ondblclick = (bits & 0x00002) ? 67 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 68 if (chMask & 0x00004) elem.onmousedown = (bits & 0x00004) ? 69 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 70 if (chMask & 0x00008) elem.onmouseup = (bits & 0x00008) ? 71 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 72 if (chMask & 0x00010) elem.onmouseover = (bits & 0x00010) ? 73 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 74 if (chMask & 0x00020) elem.onmouseout = (bits & 0x00020) ? 75 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 76 if (chMask & 0x00040) elem.onmousemove = (bits & 0x00040) ? 77 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 78 if (chMask & 0x00080) elem.onkeydown = (bits & 0x00080) ? 79 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 80 if (chMask & 0x00100) elem.onkeypress = (bits & 0x00100) ? 81 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 82 if (chMask & 0x00200) elem.onkeyup = (bits & 0x00200) ? 83 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 84 if (chMask & 0x00400) elem.onchange = (bits & 0x00400) ? 85 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 86 if (chMask & 0x00800) elem.onfocus = (bits & 0x00800) ? 87 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 88 if (chMask & 0x01000) elem.onblur = (bits & 0x01000) ? 89 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 90 if (chMask & 0x02000) elem.onlosecapture = (bits & 0x02000) ? 91 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 92 if (chMask & 0x04000) elem.onscroll = (bits & 0x04000) ? 93 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 94 if (chMask & 0x08000) elem.onload = (bits & 0x08000) ? 95 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchUnhandledEvent : null; 96 if (chMask & 0x10000) elem.onerror = (bits & 0x10000) ? 97 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 98 if (chMask & 0x20000) elem.onmousewheel = (bits & 0x20000) ? 99 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 100 if (chMask & 0x40000) elem.oncontextmenu = (bits & 0x40000) ? 101 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 102 if (chMask & 0x80000) elem.onpaste = (bits & 0x80000) ? 103 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 104 if (chMask & 0x100000) elem.ontouchstart = (bits & 0x100000) ? 105 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 106 if (chMask & 0x200000) elem.ontouchmove = (bits & 0x200000) ? 107 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 108 if (chMask & 0x400000) elem.ontouchend = (bits & 0x400000) ? 109 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 110 if (chMask & 0x800000) elem.ontouchcancel= (bits & 0x800000) ? 111 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 112 if (chMask & 0x1000000) elem.ongesturestart =(bits & 0x1000000) ? 113 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 114 if (chMask & 0x2000000) elem.ongesturechange =(bits & 0x2000000) ? 115 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 116 if (chMask & 0x4000000) elem.ongestureend = (bits & 0x4000000) ? 117 @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent : null; 118 119 //transistion end 120 if (chMask & 0x8000000) { 121 if(bits & 0x8000000){ 122 elem.addEventListener('webkitTransitionEnd', @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent, false); 123 } 124 } 125 126 127 //animation end 128 if (chMask & 0x10000000) { 129 if(bits & 0x10000000){ 130 elem.addEventListener('webkitAnimationEnd', @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent, false); 131 } 132 } 133 }-*/; 134 135 }