OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. |
3 * Copyright (C) 2005 Alexey Proskuryakov. | 3 * Copyright (C) 2005 Alexey Proskuryakov. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 30 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
31 #include "core/HTMLNames.h" | 31 #include "core/HTMLNames.h" |
32 #include "core/dom/Document.h" | 32 #include "core/dom/Document.h" |
33 #include "core/dom/NodeTraversal.h" | 33 #include "core/dom/NodeTraversal.h" |
34 #include "core/dom/shadow/ShadowRoot.h" | 34 #include "core/dom/shadow/ShadowRoot.h" |
35 #include "core/editing/VisiblePosition.h" | 35 #include "core/editing/VisiblePosition.h" |
36 #include "core/editing/VisibleUnits.h" | 36 #include "core/editing/VisibleUnits.h" |
37 #include "core/editing/htmlediting.h" | 37 #include "core/editing/htmlediting.h" |
38 #include "core/frame/FrameView.h" | 38 #include "core/frame/FrameView.h" |
39 #include "core/html/HTMLElement.h" | 39 #include "core/html/HTMLElement.h" |
| 40 #include "core/html/HTMLImageElement.h" |
| 41 #include "core/html/HTMLInputElement.h" |
40 #include "core/html/HTMLTextFormControlElement.h" | 42 #include "core/html/HTMLTextFormControlElement.h" |
41 #include "core/rendering/InlineTextBox.h" | 43 #include "core/rendering/InlineTextBox.h" |
42 #include "core/rendering/RenderImage.h" | 44 #include "core/rendering/RenderImage.h" |
43 #include "core/rendering/RenderTableCell.h" | 45 #include "core/rendering/RenderTableCell.h" |
44 #include "core/rendering/RenderTableRow.h" | 46 #include "core/rendering/RenderTableRow.h" |
45 #include "core/rendering/RenderTextControl.h" | 47 #include "core/rendering/RenderTextControl.h" |
46 #include "core/rendering/RenderTextFragment.h" | 48 #include "core/rendering/RenderTextFragment.h" |
47 #include "platform/fonts/Character.h" | 49 #include "platform/fonts/Character.h" |
48 #include "platform/fonts/Font.h" | 50 #include "platform/fonts/Font.h" |
49 #include "platform/text/TextBoundaries.h" | 51 #include "platform/text/TextBoundaries.h" |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 | 462 |
461 // Handle the current node according to its type. | 463 // Handle the current node according to its type. |
462 if (m_iterationProgress < HandledNode) { | 464 if (m_iterationProgress < HandledNode) { |
463 bool handledNode = false; | 465 bool handledNode = false; |
464 if (renderer->isText() && m_node->nodeType() == Node::TEXT_NODE)
{ // FIXME: What about CDATA_SECTION_NODE? | 466 if (renderer->isText() && m_node->nodeType() == Node::TEXT_NODE)
{ // FIXME: What about CDATA_SECTION_NODE? |
465 handledNode = handleTextNode(); | 467 handledNode = handleTextNode(); |
466 } else if (renderer && (renderer->isImage() || renderer->isWidge
t() | 468 } else if (renderer && (renderer->isImage() || renderer->isWidge
t() |
467 || (m_node && m_node->isHTMLElement() | 469 || (m_node && m_node->isHTMLElement() |
468 && (isHTMLFormControlElement(toHTMLElement(*m_node)) | 470 && (isHTMLFormControlElement(toHTMLElement(*m_node)) |
469 || isHTMLLegendElement(toHTMLElement(*m_node)) | 471 || isHTMLLegendElement(toHTMLElement(*m_node)) |
| 472 || isHTMLImageElement(toElement(*m_node)) |
470 || isHTMLMeterElement(toHTMLElement(*m_node)) | 473 || isHTMLMeterElement(toHTMLElement(*m_node)) |
471 || isHTMLProgressElement(toHTMLElement(*m_node)))))) { | 474 || isHTMLProgressElement(toHTMLElement(*m_node)))))) { |
472 handledNode = handleReplacedElement(); | 475 handledNode = handleReplacedElement(); |
473 } else { | 476 } else { |
474 handledNode = handleNonTextNode(); | 477 handledNode = handleNonTextNode(); |
475 } | 478 } |
476 if (handledNode) | 479 if (handledNode) |
477 m_iterationProgress = HandledNode; | 480 m_iterationProgress = HandledNode; |
478 if (m_positionNode) | 481 if (m_positionNode) |
479 return; | 482 return; |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 emitCharacter(',', m_node->parentNode(), m_node, 0, 1); | 825 emitCharacter(',', m_node->parentNode(), m_node, 0, 1); |
823 return true; | 826 return true; |
824 } | 827 } |
825 | 828 |
826 m_positionNode = m_node->parentNode(); | 829 m_positionNode = m_node->parentNode(); |
827 m_positionOffsetBaseNode = m_node; | 830 m_positionOffsetBaseNode = m_node; |
828 m_positionStartOffset = 0; | 831 m_positionStartOffset = 0; |
829 m_positionEndOffset = 1; | 832 m_positionEndOffset = 1; |
830 m_singleCharacterBuffer = 0; | 833 m_singleCharacterBuffer = 0; |
831 | 834 |
832 if (m_emitsImageAltText && renderer->isImage() && renderer->isRenderImage())
{ | 835 if (m_emitsImageAltText) { |
833 m_text = toRenderImage(renderer)->altText(); | 836 m_text = toHTMLElement(m_node)->altText(); |
834 if (!m_text.isEmpty()) { | 837 if (!m_text.isEmpty()) { |
835 m_textLength = m_text.length(); | 838 m_textLength = m_text.length(); |
836 m_lastCharacter = m_text[m_textLength - 1]; | 839 m_lastCharacter = m_text[m_textLength - 1]; |
837 return true; | 840 return true; |
838 } | 841 } |
839 } | 842 } |
840 | 843 |
841 m_textLength = 0; | 844 m_textLength = 0; |
842 m_lastCharacter = 0; | 845 m_lastCharacter = 0; |
843 | 846 |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 m_textLength = 0; | 1309 m_textLength = 0; |
1307 | 1310 |
1308 while (m_node && !m_havePassedStartNode) { | 1311 while (m_node && !m_havePassedStartNode) { |
1309 // Don't handle node if we start iterating at [node, 0]. | 1312 // Don't handle node if we start iterating at [node, 0]. |
1310 if (!m_handledNode && !(m_node == m_endNode && !m_endOffset)) { | 1313 if (!m_handledNode && !(m_node == m_endNode && !m_endOffset)) { |
1311 RenderObject* renderer = m_node->renderer(); | 1314 RenderObject* renderer = m_node->renderer(); |
1312 if (renderer && renderer->isText() && m_node->nodeType() == Node::TE
XT_NODE) { | 1315 if (renderer && renderer->isText() && m_node->nodeType() == Node::TE
XT_NODE) { |
1313 // FIXME: What about CDATA_SECTION_NODE? | 1316 // FIXME: What about CDATA_SECTION_NODE? |
1314 if (renderer->style()->visibility() == VISIBLE && m_offset > 0) | 1317 if (renderer->style()->visibility() == VISIBLE && m_offset > 0) |
1315 m_handledNode = handleTextNode(); | 1318 m_handledNode = handleTextNode(); |
1316 } else if (renderer && (renderer->isImage() || renderer->isWidget())
) { | 1319 } else if (renderer && (isHTMLImageElement(toElement(*m_node)) || is
HTMLInputElement(toElement(*m_node)) || renderer->isWidget())) { |
1317 if (renderer->style()->visibility() == VISIBLE && m_offset > 0) | 1320 if (renderer->style()->visibility() == VISIBLE && m_offset > 0) |
1318 m_handledNode = handleReplacedElement(); | 1321 m_handledNode = handleReplacedElement(); |
1319 } else { | 1322 } else { |
1320 m_handledNode = handleNonTextNode(); | 1323 m_handledNode = handleNonTextNode(); |
1321 } | 1324 } |
1322 if (m_positionNode) | 1325 if (m_positionNode) |
1323 return; | 1326 return; |
1324 } | 1327 } |
1325 | 1328 |
1326 if (!m_handledChildren && m_node->hasChildren()) { | 1329 if (!m_handledChildren && m_node->hasChildren()) { |
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2215 resultEnd = collapseTo; | 2218 resultEnd = collapseTo; |
2216 return; | 2219 return; |
2217 } | 2220 } |
2218 } | 2221 } |
2219 | 2222 |
2220 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo
rFindPlainText); | 2223 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo
rFindPlainText); |
2221 calculateCharacterSubrange(computeRangeIterator, matchStart, matchLength, re
sultStart, resultEnd); | 2224 calculateCharacterSubrange(computeRangeIterator, matchStart, matchLength, re
sultStart, resultEnd); |
2222 } | 2225 } |
2223 | 2226 |
2224 } | 2227 } |
OLD | NEW |