81 if ( e->hasLocalName(linkTag) ) { |
81 if ( e->hasLocalName(linkTag) ) { |
82 elType = TBrCtlDefs::EElementAnchor; |
82 elType = TBrCtlDefs::EElementAnchor; |
83 } |
83 } |
84 else if ( e->hasLocalName(aTag) ) { |
84 else if ( e->hasLocalName(aTag) ) { |
85 elType = TBrCtlDefs::EElementAnchor; |
85 elType = TBrCtlDefs::EElementAnchor; |
86 |
86 |
87 String href = e->getAttribute( hrefAttr ); |
87 String href = e->getAttribute( hrefAttr ); |
88 if (!href.isNull()) { |
88 if (!href.isNull()) { |
89 |
89 |
90 if( href.startsWith( KTel ) ) { |
90 if( href.startsWith( KTel ) ) { |
91 elType = TBrCtlDefs::EElementTelAnchor; |
91 elType = TBrCtlDefs::EElementTelAnchor; |
92 } |
92 } |
93 else if( href.startsWith( KWtai ) ) { |
93 else if( href.startsWith( KWtai ) ) { |
94 |
94 |
95 if( href.startsWith( KWtaiMC ) || href.startsWith(KWtaiAP) || href.startsWith(KWtaiSD) ) { |
95 if( href.startsWith( KWtaiMC ) || href.startsWith(KWtaiAP) || href.startsWith(KWtaiSD) ) { |
96 elType = TBrCtlDefs::EElementTelAnchor; |
96 elType = TBrCtlDefs::EElementTelAnchor; |
97 } |
97 } |
98 |
98 |
99 } |
99 } |
100 else if( href.startsWith( KMailto ) ) { |
100 else if( href.startsWith( KMailto ) ) { |
101 elType = TBrCtlDefs::EElementMailtoAnchor; |
101 elType = TBrCtlDefs::EElementMailtoAnchor; |
102 } |
102 } |
103 |
103 |
104 |
104 |
105 } |
105 } |
106 else if (!e->getAttribute( ctiAttr ).isNull()) { |
106 else if (!e->getAttribute( ctiAttr ).isNull()) { |
107 elType = TBrCtlDefs::EElementTelAnchor; |
107 elType = TBrCtlDefs::EElementTelAnchor; |
108 } |
108 } |
109 else if( e->hasLocalName(areaTag) ) { |
109 else if( e->hasLocalName(areaTag) ) { |
110 |
110 |
111 elType = TBrCtlDefs::EElementInputBox; |
111 elType = TBrCtlDefs::EElementInputBox; |
112 } |
112 } |
113 } |
113 } |
114 else if (e->isControl()) { |
114 else if (e->isControl()) { |
115 HTMLGenericFormElement* ie = static_cast<HTMLGenericFormElement*>( e ); |
115 HTMLGenericFormElement* ie = static_cast<HTMLGenericFormElement*>( e ); |
116 // default for form element |
116 // default for form element |
158 return elType; |
158 return elType; |
159 } |
159 } |
160 |
160 |
161 |
161 |
162 WebFrame* frameAndPointUnderCursor(IntPoint& p_, WebView& v_) |
162 WebFrame* frameAndPointUnderCursor(IntPoint& p_, WebView& v_) |
163 { |
163 { |
164 WebFrameView* mfv = v_.mainFrame()->frameView(); |
164 WebFrameView* mfv = v_.mainFrame()->frameView(); |
165 p_ = StaticObjectsContainer::instance()->webCursor()->position(); |
165 p_ = StaticObjectsContainer::instance()->webCursor()->position(); |
166 WebFrame* frame = v_.mainFrame()->frameAtPoint(p_); |
166 WebFrame* frame = v_.mainFrame()->frameAtPoint(p_); |
167 if (!frame) |
167 if (!frame) |
168 frame = v_.mainFrame(); |
168 frame = v_.mainFrame(); |
169 IntPoint rc = frame->frameView()->rectInGlobalCoords().iTl; |
169 IntPoint rc = frame->frameView()->rectInGlobalCoords().iTl; |
170 p_ = frame->frameView()->viewCoordsInFrameCoords(p_); |
170 p_ = frame->frameView()->viewCoordsInFrameCoords(p_); |
171 return frame; |
171 return frame; |
172 } |
172 } |
173 |
173 |
174 String getNodeUrlAtPointInFrame(WebFrame& f_, IntPoint& p_) |
174 String getNodeUrlAtPointInFrame(WebFrame& f_, IntPoint& p_) |
175 { |
175 { |
176 Document* doc = core(&f_)->document(); |
176 Document* doc = core(&f_)->document(); |
177 if (doc) { |
177 if (doc) { |
178 Node* node = doc->elementFromPoint(p_.x(), p_.y()); |
178 Node* node = doc->elementFromPoint(p_.x(), p_.y()); |
179 |
179 |
180 if (node) { |
180 if (node) { |
181 if (node->hasTagName(areaTag)) { |
181 if (node->hasTagName(areaTag)) { |
182 HTMLElement* e = static_cast<HTMLElement*>(node); |
182 HTMLElement* e = static_cast<HTMLElement*>(node); |
183 if(!e->getAttribute(hrefAttr).isNull()) { |
183 if(!e->getAttribute(hrefAttr).isNull()) { |
184 return e->getAttribute(hrefAttr); |
184 return e->getAttribute(hrefAttr); |
187 // get the navigable node at this point |
187 // get the navigable node at this point |
188 Node* n = node; |
188 Node* n = node; |
189 for (; n; n = n->parentNode()) |
189 for (; n; n = n->parentNode()) |
190 if (n->isFocusable() && n->isElementNode()) |
190 if (n->isFocusable() && n->isElementNode()) |
191 break; |
191 break; |
192 |
192 |
193 if (n && n->isFocusable() && n->isElementNode()) { |
193 if (n && n->isFocusable() && n->isElementNode()) { |
194 HTMLElement* e = static_cast<HTMLElement*>(n); |
194 HTMLElement* e = static_cast<HTMLElement*>(n); |
195 if (!e->getAttribute(hrefAttr).isNull()) { |
195 if (!e->getAttribute(hrefAttr).isNull()) { |
196 return e->getAttribute(hrefAttr); |
196 return e->getAttribute(hrefAttr); |
197 } |
197 } |
198 } |
198 } |
199 } |
199 } |
200 } |
200 } |
201 return String(); |
201 return String(); |
202 } |
202 } |
203 |
203 |
204 |
204 |
205 int imageCountInFrame(WebFrame& wf_, bool visibleOnly_) |
205 int imageCountInFrame(WebFrame& wf_, bool visibleOnly_) |
206 { |
206 { |
207 int count = 0; |
207 int count = 0; |
208 Frame* f = core(&wf_); |
208 Frame* f = core(&wf_); |
209 |
209 |
210 if (!f || !f->document() || !f->document()->renderer()) |
210 if (!f || !f->document() || !f->document()->renderer()) |
211 return count; |
211 return count; |
212 |
212 |
213 Document* doc = f->document(); |
213 Document* doc = f->document(); |
214 RefPtr<WebCore::HTMLCollection> collection = doc->images(); |
214 RefPtr<WebCore::HTMLCollection> collection = doc->images(); |
215 |
215 |
216 FrameView* v = doc->view(); |
216 FrameView* v = doc->view(); |
217 IntRect r1 = wf_.frameView()->topView()->mainFrame()->frameView()->rect(); |
217 IntRect r1 = wf_.frameView()->topView()->mainFrame()->frameView()->rect(); |
218 |
218 |
219 for (Node *n = collection->firstItem(); n; n = collection->nextItem()) { |
219 for (Node *n = collection->firstItem(); n; n = collection->nextItem()) { |
220 |
220 |
221 RenderImage* render = static_cast<RenderImage*>(n->renderer()); |
221 RenderImage* render = static_cast<RenderImage*>(n->renderer()); |
222 if (render) { |
222 if (render) { |
223 |
223 |
224 Image* img = render->image(); |
224 Image* img = render->image(); |
225 if (!img->isNull() && img->data()) { |
225 if (!img->isNull() && img->data()) { |
226 //if visible only is true, check for intersection |
226 //if visible only is true, check for intersection |
227 bool processing = true; |
227 bool processing = true; |
228 if (visibleOnly_) { |
228 if (visibleOnly_) { |
229 IntRect imageRect; |
229 IntRect imageRect; |
230 IntPoint tl = wf_.frameView()->frameCoordsInViewCoords(n->getRect().topLeft()); |
230 IntPoint tl = wf_.frameView()->frameCoordsInViewCoords(n->getRect().topLeft()); |
231 IntPoint br = wf_.frameView()->frameCoordsInViewCoords(n->getRect().bottomRight()); |
231 IntPoint br = wf_.frameView()->frameCoordsInViewCoords(n->getRect().bottomRight()); |
232 imageRect.setLocation(tl); |
232 imageRect.setLocation(tl); |
233 imageRect.setSize(br-tl); |
233 imageRect.setSize(br-tl); |
234 |
234 |
235 processing = r1.intersects(imageRect); |
235 processing = r1.intersects(imageRect); |
236 } |
236 } |
237 if (processing) { |
237 if (processing) { |
238 String alttext = static_cast<HTMLImageElement*>(render->element())->altText(); |
238 String alttext = static_cast<HTMLImageElement*>(render->element())->altText(); |
239 // Check if alttext is "Nokia" or "No_save". |
239 // Check if alttext is "Nokia" or "No_save". |
240 // Then do not count |
240 // Then do not count |
241 if (!(equalIgnoringCase(alttext, "nokia") || equalIgnoringCase(alttext, "no_save"))) |
241 if (!(equalIgnoringCase(alttext, "nokia") || equalIgnoringCase(alttext, "no_save"))) |
242 ++count; |
242 ++count; |
247 } |
247 } |
248 return count; |
248 return count; |
249 } |
249 } |
250 |
250 |
251 CArrayFixFlat<TBrCtlImageCarrier>* imagesInFrame(WebFrame& wf_, bool visibleOnly_) |
251 CArrayFixFlat<TBrCtlImageCarrier>* imagesInFrame(WebFrame& wf_, bool visibleOnly_) |
252 { |
252 { |
253 CArrayFixFlat<TBrCtlImageCarrier>* imglist = new CArrayFixFlat<TBrCtlImageCarrier>(10); |
253 CArrayFixFlat<TBrCtlImageCarrier>* imglist = new CArrayFixFlat<TBrCtlImageCarrier>(10); |
254 Frame* f = core(&wf_); |
254 Frame* f = core(&wf_); |
255 |
255 |
256 if (!f || !f->document() || !f->document()->renderer()) |
256 if (!f || !f->document() || !f->document()->renderer()) |
257 return imglist; |
257 return imglist; |
258 |
258 |
259 CleanupStack::PushL(imglist); |
259 CleanupStack::PushL(imglist); |
260 |
260 |
261 Document* doc = f->document(); |
261 Document* doc = f->document(); |
262 FrameView* v = doc->view(); |
262 FrameView* v = doc->view(); |
263 IntRect r1 = wf_.frameView()->topView()->mainFrame()->frameView()->rect(); |
263 IntRect r1 = wf_.frameView()->topView()->mainFrame()->frameView()->rect(); |
264 |
264 |
265 |
265 |
266 RefPtr<WebCore::HTMLCollection> collection = doc->images(); |
266 RefPtr<WebCore::HTMLCollection> collection = doc->images(); |
267 for (Node* n = collection->firstItem(); n; n = collection->nextItem()) { |
267 for (Node* n = collection->firstItem(); n; n = collection->nextItem()) { |
268 |
268 |
269 RenderImage* render = static_cast<RenderImage*>(n->renderer()); |
269 RenderImage* render = static_cast<RenderImage*>(n->renderer()); |
270 if (render) { |
270 if (render) { |
271 Image* img = render->image(); |
271 Image* img = render->image(); |
272 if (!img->isNull() && img->data()) { |
272 if (!img->isNull() && img->data()) { |
273 //if visible only is true, check for intersection |
273 //if visible only is true, check for intersection |
274 TBool processing = ETrue; |
274 TBool processing = ETrue; |
275 if (visibleOnly_) { |
275 if (visibleOnly_) { |
276 IntRect imageRect; |
276 IntRect imageRect; |
277 IntPoint tl = wf_.frameView()->frameCoordsInViewCoords(n->getRect().topLeft()); |
277 IntPoint tl = wf_.frameView()->frameCoordsInViewCoords(n->getRect().topLeft()); |
278 IntPoint br = wf_.frameView()->frameCoordsInViewCoords(n->getRect().bottomRight()); |
278 IntPoint br = wf_.frameView()->frameCoordsInViewCoords(n->getRect().bottomRight()); |
279 imageRect.setLocation(tl); |
279 imageRect.setLocation(tl); |
280 imageRect.setSize(br-tl); |
280 imageRect.setSize(br-tl); |
281 |
281 |
282 processing = r1.intersects(imageRect); |
282 processing = r1.intersects(imageRect); |
283 } |
283 } |
284 if (processing) { |
284 if (processing) { |
285 String alttext = static_cast<HTMLImageElement*>(render->element())->altText(); |
285 String alttext = static_cast<HTMLImageElement*>(render->element())->altText(); |
286 TBrCtlImageType type = EImageTypeAny; |
286 TBrCtlImageType type = EImageTypeAny; |
287 if (img->getMimeType().find("image/vnd.wap.wbmp") == 0) |
287 if (img->getMimeType().find("image/vnd.wap.wbmp") == 0) |
288 type = EImageTypeWbmp; |
288 type = EImageTypeWbmp; |
289 else if (img->getMimeType().find("image/vnd.nokia.ota-bitmap") == 0) |
289 else if (img->getMimeType().find("image/vnd.nokia.ota-bitmap") == 0) |
290 type = EImageTypeOta; |
290 type = EImageTypeOta; |
291 // |
291 // |
292 TBrCtlImageCarrier tImg(TPtrC8((const TUint8*)img->data()->data(),img->data()->size()), |
292 TBrCtlImageCarrier tImg(TPtrC8((const TUint8*)img->data()->data(),img->data()->size()), |
293 static_cast<HTMLImageElement*>(render->element())->getAttribute(srcAttr), |
293 static_cast<HTMLImageElement*>(render->element())->getAttribute(srcAttr), |
294 alttext, type, img->getMimeType()); |
294 alttext, type, img->getMimeType()); |
295 |
295 |
296 // Check if alttext is "Nokia" or "No_save". |
296 // Check if alttext is "Nokia" or "No_save". |
297 // Then do not add the image to the list |
297 // Then do not add the image to the list |
298 if (!(equalIgnoringCase(alttext, "nokia") || equalIgnoringCase(alttext, "no_save"))) { |
298 if (!(equalIgnoringCase(alttext, "nokia") || equalIgnoringCase(alttext, "no_save"))) { |
299 // Check if this image has been retrieved before. |
299 // Check if this image has been retrieved before. |
300 // Image pointer should be the same for similar images |
300 // Image pointer should be the same for similar images |
301 TBool imgexists = false; |
301 TBool imgexists = false; |
302 for (int i=0; i<imglist->Count();i++) { |
302 for (int i=0; i<imglist->Count();i++) { |
308 |
308 |
309 } |
309 } |
310 if (!imgexists) |
310 if (!imgexists) |
311 imglist->AppendL(tImg); |
311 imglist->AppendL(tImg); |
312 } |
312 } |
313 } |
313 } |
314 } |
314 } |
315 } |
315 } |
316 } |
316 } |
317 CleanupStack::Pop(imglist); |
317 CleanupStack::Pop(imglist); |
318 return imglist; |
318 return imglist; |
319 } |
319 } |
320 |
320 |
321 CArrayFixFlat<TBrCtlSubscribeTo>* findSubscribeToInFrame(WebFrame& wf_) |
321 CArrayFixFlat<TBrCtlSubscribeTo>* findSubscribeToInFrame(WebFrame& wf_) |
322 { |
322 { |
323 CArrayFixFlat<TBrCtlSubscribeTo>* linkList = new CArrayFixFlat<TBrCtlSubscribeTo>(10); |
323 CArrayFixFlat<TBrCtlSubscribeTo>* linkList = new CArrayFixFlat<TBrCtlSubscribeTo>(10); |
324 Frame* f = core(&wf_); |
324 Frame* f = core(&wf_); |
325 |
325 |
326 if (!f || !f->document()) |
326 if (!f || !f->document()) |
327 return linkList; |
327 return linkList; |
328 |
328 |
329 CleanupStack::PushL(linkList); |
329 CleanupStack::PushL(linkList); |
330 for (Node *n = f->document(); n; n = n->traverseNextNode()) { |
330 for (Node *n = f->document(); n; n = n->traverseNextNode()) { |
331 if (n->isElementNode() && n->hasTagName(linkTag)) { |
331 if (n->isElementNode() && n->hasTagName(linkTag)) { |
332 |
332 |
333 HTMLElement* e = static_cast<HTMLElement*>(n); |
333 HTMLElement* e = static_cast<HTMLElement*>(n); |
334 String type = e->getAttribute(typeAttr); |
334 String type = e->getAttribute(typeAttr); |
335 |
335 |
336 if (type == "application/rss+xml" || type == "application/atom+xml" || |
336 if (type == "application/rss+xml" || type == "application/atom+xml" || |
337 type == "text/xml" || type == "application/xml") { |
337 type == "text/xml" || type == "application/xml") { |
338 String href = e->getAttribute(hrefAttr); |
338 String href = e->getAttribute(hrefAttr); |
339 String title = e->getAttribute(titleAttr); |
339 String title = e->getAttribute(titleAttr); |
340 |
340 |
341 TBrCtlSubscribeTo item(title.des(), href.des(), 0); |
341 TBrCtlSubscribeTo item(title.des(), href.des(), 0); |
342 linkList->AppendL(item); |
342 linkList->AppendL(item); |
343 } |
343 } |
344 } |
344 } |
345 } |
345 } |
346 CleanupStack::Pop(linkList); |
346 CleanupStack::Pop(linkList); |
347 return linkList; |
347 return linkList; |
372 brCtlTtype = EImageTypeWbmp; |
372 brCtlTtype = EImageTypeWbmp; |
373 } |
373 } |
374 else if ( img->getMimeType().des().Find(KMimeOTA) != KErrNotFound ) { |
374 else if ( img->getMimeType().des().Find(KMimeOTA) != KErrNotFound ) { |
375 brCtlTtype = EImageTypeOta; |
375 brCtlTtype = EImageTypeOta; |
376 } |
376 } |
377 t = new TBrCtlImageCarrier(TPtrC8((const TUint8*)img->data()->data(),img->data()->size()), |
377 t = new TBrCtlImageCarrier(TPtrC8((const TUint8*)img->data()->data(),img->data()->size()), |
378 static_cast<HTMLImageElement*>(r->element())->getAttribute(srcAttr), |
378 static_cast<HTMLImageElement*>(r->element())->getAttribute(srcAttr), |
379 alttext, brCtlTtype, img->getMimeType()); |
379 alttext, brCtlTtype, img->getMimeType()); |
380 if (!t) { |
380 if (!t) { |
381 ret = KErrNoMemory; |
381 ret = KErrNoMemory; |
382 } |
382 } |
426 WebFrame* frame = frameAndPointUnderCursor(p, *webView); |
426 WebFrame* frame = frameAndPointUnderCursor(p, *webView); |
427 Frame* f = core(frame); |
427 Frame* f = core(frame); |
428 RenderImage* render = NULL; |
428 RenderImage* render = NULL; |
429 if (!f || !f->document() || !f->document()->renderer()) |
429 if (!f || !f->document() || !f->document()->renderer()) |
430 return NULL; |
430 return NULL; |
431 Document* doc = f->document(); |
431 Document* doc = f->document(); |
432 FrameView* v = doc->view(); |
432 FrameView* v = doc->view(); |
433 RefPtr<WebCore::HTMLCollection> collection = doc->images(); |
433 RefPtr<WebCore::HTMLCollection> collection = doc->images(); |
434 for (Node* n = collection->firstItem(); n; n = collection->nextItem()) { |
434 for (Node* n = collection->firstItem(); n; n = collection->nextItem()) { |
435 render = static_cast<RenderImage*>(n->renderer()); |
435 render = static_cast<RenderImage*>(n->renderer()); |
436 if (render) { |
436 if (render) { |
437 Image* img = render->image(); |
437 Image* img = render->image(); |
438 if (!img->isNull()) { |
438 if (!img->isNull()) { |
439 //if visible only is true, check for intersection |
439 //if visible only is true, check for intersection |
440 if (n->getRect().contains(p)) { |
440 if (n->getRect().contains(p)) { |
441 return render; |
441 return render; |
442 } |
442 } |
443 } |
443 } |
444 } |
444 } |
445 } |
445 } |
446 return NULL; |
446 return NULL; |
447 } |
447 } |
448 |
448 |
449 HBufC* generateFrameName() |
449 HBufC* generateFrameName() |
585 if (!attr.isNull() && !attr.isEmpty() ) |
585 if (!attr.isNull() && !attr.isEmpty() ) |
586 email = attr; |
586 email = attr; |
587 // telbook |
587 // telbook |
588 attr = e->getAttribute(telbookAttr); |
588 attr = e->getAttribute(telbookAttr); |
589 if (!attr.isNull() && !attr.isEmpty() ) |
589 if (!attr.isNull() && !attr.isEmpty() ) |
590 telbook = attr; |
590 telbook = attr; |
591 // Save to phone book |
591 // Save to phone book |
592 String url; |
592 String url; |
593 String makeCallUrlPrefix("wtai://wp/ap;"); |
593 String makeCallUrlPrefix("wtai://wp/ap;"); |
594 char numberNameSeparator = ';'; |
594 char numberNameSeparator = ';'; |
595 int len = makeCallUrlPrefix.length() + 3; // NULL terminator and ';' separators |
595 int len = makeCallUrlPrefix.length() + 3; // NULL terminator and ';' separators |
596 len += tel.length() + telbook.length() + email.length(); |
596 len += tel.length() + telbook.length() + email.length(); |
597 //url.reserve(len); |
597 //url.reserve(len); |
598 url = makeCallUrlPrefix; |
598 url = makeCallUrlPrefix; |
599 url.append(tel); |
599 url.append(tel); |
600 url.append(numberNameSeparator); |
600 url.append(numberNameSeparator); |
601 url.append(telbook); |
601 url.append(telbook); |
602 url.append(numberNameSeparator); |
602 url.append(numberNameSeparator); |
621 // All SSL errors are mapped into this one, which gets displayed to the user |
621 // All SSL errors are mapped into this one, which gets displayed to the user |
622 if (err <= SSL_ERROR_BASE && err > SSL_ERROR_BASE - 200 || |
622 if (err <= SSL_ERROR_BASE && err > SSL_ERROR_BASE - 200 || |
623 err == KErrHttpCannotEstablishTunnel) { |
623 err == KErrHttpCannotEstablishTunnel) { |
624 return KErrSSLAlertHandshakeFailure; |
624 return KErrSSLAlertHandshakeFailure; |
625 } |
625 } |
626 |
626 |
627 // Deal with DNS lookup errors |
627 // Deal with DNS lookup errors |
628 if ((err <= KErrInet6NoDestination) && (err > (KErrInet6NoDestination - 200))) { |
628 if ((err <= KErrInet6NoDestination) && (err > (KErrInet6NoDestination - 200))) { |
629 return KBrowserHTTP502; |
629 return KBrowserHTTP502; |
630 } |
630 } |
631 |
631 |
632 // Deal with HTTP errors |
632 // Deal with HTTP errors |
633 if (err <= KHttpErrorBase && err > KHttpErrorBase - 200) { |
633 if (err <= KHttpErrorBase && err > KHttpErrorBase - 200) { |
634 // Encode errors |
634 // Encode errors |
635 if (err <= KErrHttpEncodeDefault && err >= KErrHttpEncodeCookie2) { |
635 if (err <= KErrHttpEncodeDefault && err >= KErrHttpEncodeCookie2) { |
636 return KBrowserFailure; |
636 return KBrowserFailure; |
720 |
720 |
721 |
721 |
722 bool handleSelectElementScrolling(WebView* webView, int tb) |
722 bool handleSelectElementScrolling(WebView* webView, int tb) |
723 { |
723 { |
724 bool ret = false; |
724 bool ret = false; |
|
725 bool isScrollList = false; |
725 if (webView->focusedElementType() == TBrCtlDefs::EElementSelectMultiBox && tb != 0) { |
726 if (webView->focusedElementType() == TBrCtlDefs::EElementSelectMultiBox && tb != 0) { |
726 IntPoint point; |
727 IntPoint point; |
727 WebFrame* frame = frameAndPointUnderCursor(point, *webView); |
728 WebFrame* frame = frameAndPointUnderCursor(point, *webView); |
728 Element* e = core(frame)->document()->elementFromPoint(point.x(), point.y()); |
729 Element* e = core(frame)->document()->elementFromPoint(point.x(), point.y()); |
729 if (e && e->isControl()) { |
730 if (e && e->isControl()) { |
730 HTMLGenericFormElement* ie = static_cast<HTMLGenericFormElement*>( e ); |
731 HTMLGenericFormElement* ie = static_cast<HTMLGenericFormElement*>( e ); |
731 if (ie->type() == "select-multiple") { |
732 if (ie->type() == "select-multiple") { |
|
733 isScrollList = true; |
|
734 } |
|
735 else if (ie->type() == "select-one") { |
|
736 HTMLSelectElement* theSecletedElement = static_cast<HTMLSelectElement*>( e ); |
|
737 //check if the size is > 1 |
|
738 if (theSecletedElement->size() > 1) { |
|
739 isScrollList = true; |
|
740 } //select-one |
|
741 } |
|
742 |
|
743 //scroll only for the list which is either multiple or single but with more than one lines |
|
744 if (isScrollList) { |
732 RenderListBox* render = static_cast<RenderListBox*>(e->renderer()); |
745 RenderListBox* render = static_cast<RenderListBox*>(e->renderer()); |
733 if (render->isScrollable()) { |
746 if (render->isScrollable()) { |
734 HTMLSelectElement* selectElement = static_cast<HTMLSelectElement*>( e ); |
747 HTMLSelectElement* selectElement = static_cast<HTMLSelectElement*>( e ); |
735 IntRect r = e->getRect(); |
748 IntRect r = e->getRect(); |
736 int curIndex = render->listIndexAtOffset(point.x() - r.x(), point.y() - r.y()); |
749 int curIndex = render->listIndexAtOffset(point.x() - r.x(), point.y() - r.y()); |