OLD | NEW |
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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 if (!title.isEmpty()) { | 241 if (!title.isEmpty()) { |
242 if (RenderObject* renderer = titleNode->renderer()) | 242 if (RenderObject* renderer = titleNode->renderer()) |
243 dir = renderer->style()->direction(); | 243 dir = renderer->style()->direction(); |
244 return title; | 244 return title; |
245 } | 245 } |
246 } | 246 } |
247 } | 247 } |
248 return String(); | 248 return String(); |
249 } | 249 } |
250 | 250 |
251 String displayString(const String& string, const Node* node) | |
252 { | |
253 if (!node) | |
254 return string; | |
255 return node->document().displayStringModifiedByEncoding(string); | |
256 } | |
257 | |
258 String HitTestResult::altDisplayString() const | 251 String HitTestResult::altDisplayString() const |
259 { | 252 { |
260 if (!m_innerNonSharedNode) | 253 if (!m_innerNonSharedNode) |
261 return String(); | 254 return String(); |
262 | 255 |
263 if (m_innerNonSharedNode->hasTagName(imgTag)) { | 256 if (m_innerNonSharedNode->hasTagName(imgTag)) { |
264 HTMLImageElement* image = toHTMLImageElement(m_innerNonSharedNode.get())
; | 257 HTMLImageElement* image = toHTMLImageElement(m_innerNonSharedNode.get())
; |
265 return displayString(image->getAttribute(altAttr), m_innerNonSharedNode.
get()); | 258 return image->getAttribute(altAttr); |
266 } | 259 } |
267 | 260 |
268 if (m_innerNonSharedNode->hasTagName(inputTag)) { | 261 if (m_innerNonSharedNode->hasTagName(inputTag)) { |
269 HTMLInputElement* input = toHTMLInputElement(m_innerNonSharedNode.get())
; | 262 HTMLInputElement* input = toHTMLInputElement(m_innerNonSharedNode.get())
; |
270 return displayString(input->alt(), m_innerNonSharedNode.get()); | 263 return input->alt(); |
271 } | 264 } |
272 | 265 |
273 return String(); | 266 return String(); |
274 } | 267 } |
275 | 268 |
276 Image* HitTestResult::image() const | 269 Image* HitTestResult::image() const |
277 { | 270 { |
278 if (!m_innerNonSharedNode) | 271 if (!m_innerNonSharedNode) |
279 return 0; | 272 return 0; |
280 | 273 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 bool HitTestResult::isOverLink() const | 375 bool HitTestResult::isOverLink() const |
383 { | 376 { |
384 return m_innerURLElement && m_innerURLElement->isLink(); | 377 return m_innerURLElement && m_innerURLElement->isLink(); |
385 } | 378 } |
386 | 379 |
387 String HitTestResult::titleDisplayString() const | 380 String HitTestResult::titleDisplayString() const |
388 { | 381 { |
389 if (!m_innerURLElement) | 382 if (!m_innerURLElement) |
390 return String(); | 383 return String(); |
391 | 384 |
392 return displayString(m_innerURLElement->title(), m_innerURLElement.get()); | 385 return m_innerURLElement->title(); |
393 } | 386 } |
394 | 387 |
395 String HitTestResult::textContent() const | 388 String HitTestResult::textContent() const |
396 { | 389 { |
397 if (!m_innerURLElement) | 390 if (!m_innerURLElement) |
398 return String(); | 391 return String(); |
399 return m_innerURLElement->textContent(); | 392 return m_innerURLElement->textContent(); |
400 } | 393 } |
401 | 394 |
402 // FIXME: This function needs a better name and may belong in a different class.
It's not | 395 // FIXME: This function needs a better name and may belong in a different class.
It's not |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 Element* HitTestResult::innerElement() const | 513 Element* HitTestResult::innerElement() const |
521 { | 514 { |
522 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa
rent(node)) | 515 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa
rent(node)) |
523 if (node->isElementNode()) | 516 if (node->isElementNode()) |
524 return toElement(node); | 517 return toElement(node); |
525 | 518 |
526 return 0; | 519 return 0; |
527 } | 520 } |
528 | 521 |
529 } // namespace WebCore | 522 } // namespace WebCore |
OLD | NEW |