Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Side by Side Diff: Source/core/rendering/HitTestResult.cpp

Issue 16081007: Introduce toHTMLInputElement(Node*), and use it. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/page/EventHandler.cpp ('k') | Source/core/rendering/RenderButton.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 { 238 {
239 if (!m_innerNonSharedNode) 239 if (!m_innerNonSharedNode)
240 return String(); 240 return String();
241 241
242 if (m_innerNonSharedNode->hasTagName(imgTag)) { 242 if (m_innerNonSharedNode->hasTagName(imgTag)) {
243 HTMLImageElement* image = static_cast<HTMLImageElement*>(m_innerNonShare dNode.get()); 243 HTMLImageElement* image = static_cast<HTMLImageElement*>(m_innerNonShare dNode.get());
244 return displayString(image->getAttribute(altAttr), m_innerNonSharedNode. get()); 244 return displayString(image->getAttribute(altAttr), m_innerNonSharedNode. get());
245 } 245 }
246 246
247 if (m_innerNonSharedNode->hasTagName(inputTag)) { 247 if (m_innerNonSharedNode->hasTagName(inputTag)) {
248 HTMLInputElement* input = static_cast<HTMLInputElement*>(m_innerNonShare dNode.get()); 248 HTMLInputElement* input = toHTMLInputElement(m_innerNonSharedNode.get()) ;
249 return displayString(input->alt(), m_innerNonSharedNode.get()); 249 return displayString(input->alt(), m_innerNonSharedNode.get());
250 } 250 }
251 251
252 return String(); 252 return String();
253 } 253 }
254 254
255 Image* HitTestResult::image() const 255 Image* HitTestResult::image() const
256 { 256 {
257 if (!m_innerNonSharedNode) 257 if (!m_innerNonSharedNode)
258 return 0; 258 return 0;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 // hooks into it. Anyway, we should architect this better. 368 // hooks into it. Anyway, we should architect this better.
369 bool HitTestResult::isContentEditable() const 369 bool HitTestResult::isContentEditable() const
370 { 370 {
371 if (!m_innerNonSharedNode) 371 if (!m_innerNonSharedNode)
372 return false; 372 return false;
373 373
374 if (m_innerNonSharedNode->hasTagName(textareaTag)) 374 if (m_innerNonSharedNode->hasTagName(textareaTag))
375 return true; 375 return true;
376 376
377 if (m_innerNonSharedNode->hasTagName(inputTag)) 377 if (m_innerNonSharedNode->hasTagName(inputTag))
378 return static_cast<HTMLInputElement*>(m_innerNonSharedNode.get())->isTex tField(); 378 return toHTMLInputElement(m_innerNonSharedNode.get())->isTextField();
379 379
380 return m_innerNonSharedNode->rendererIsEditable(); 380 return m_innerNonSharedNode->rendererIsEditable();
381 } 381 }
382 382
383 bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const HitTestReques t& request, const HitTestLocation& locationInContainer, const LayoutRect& rect) 383 bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const HitTestReques t& request, const HitTestLocation& locationInContainer, const LayoutRect& rect)
384 { 384 {
385 // If it is not a rect-based hit test, this method has to be no-op. 385 // If it is not a rect-based hit test, this method has to be no-op.
386 // Return false, so the hit test stops. 386 // Return false, so the hit test stops.
387 if (!isRectBasedTest()) 387 if (!isRectBasedTest())
388 return false; 388 return false;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 { 474 {
475 for (Node* node = m_innerNode.get(); node; node = node->parentNode()) { 475 for (Node* node = m_innerNode.get(); node; node = node->parentNode()) {
476 if (node->isElementNode()) 476 if (node->isElementNode())
477 return toElement(node); 477 return toElement(node);
478 } 478 }
479 479
480 return 0; 480 return 0;
481 } 481 }
482 482
483 } // namespace WebCore 483 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/EventHandler.cpp ('k') | Source/core/rendering/RenderButton.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698