| 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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1400 m_textLength = 0; | 1403 m_textLength = 0; |
| 1401 | 1404 |
| 1402 while (m_node && !m_havePassedStartNode) { | 1405 while (m_node && !m_havePassedStartNode) { |
| 1403 // Don't handle node if we start iterating at [node, 0]. | 1406 // Don't handle node if we start iterating at [node, 0]. |
| 1404 if (!m_handledNode && !(m_node == m_endNode && !m_endOffset)) { | 1407 if (!m_handledNode && !(m_node == m_endNode && !m_endOffset)) { |
| 1405 RenderObject* renderer = m_node->renderer(); | 1408 RenderObject* renderer = m_node->renderer(); |
| 1406 if (renderer && renderer->isText() && m_node->nodeType() == Node::TE
XT_NODE) { | 1409 if (renderer && renderer->isText() && m_node->nodeType() == Node::TE
XT_NODE) { |
| 1407 // FIXME: What about CDATA_SECTION_NODE? | 1410 // FIXME: What about CDATA_SECTION_NODE? |
| 1408 if (renderer->style()->visibility() == VISIBLE && m_offset > 0) | 1411 if (renderer->style()->visibility() == VISIBLE && m_offset > 0) |
| 1409 m_handledNode = handleTextNode(); | 1412 m_handledNode = handleTextNode(); |
| 1410 } else if (renderer && (renderer->isImage() || renderer->isWidget())
) { | 1413 } else if (renderer && (isHTMLImageElement(toElement(*m_node)) || is
HTMLInputElement(toElement(*m_node)) || renderer->isWidget())) { |
| 1411 if (renderer->style()->visibility() == VISIBLE && m_offset > 0) | 1414 if (renderer->style()->visibility() == VISIBLE && m_offset > 0) |
| 1412 m_handledNode = handleReplacedElement(); | 1415 m_handledNode = handleReplacedElement(); |
| 1413 } else { | 1416 } else { |
| 1414 m_handledNode = handleNonTextNode(); | 1417 m_handledNode = handleNonTextNode(); |
| 1415 } | 1418 } |
| 1416 if (m_positionNode) | 1419 if (m_positionNode) |
| 1417 return; | 1420 return; |
| 1418 } | 1421 } |
| 1419 | 1422 |
| 1420 if (!m_handledChildren && m_node->hasChildren()) { | 1423 if (!m_handledChildren && m_node->hasChildren()) { |
| (...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2419 resultEnd = collapseTo; | 2422 resultEnd = collapseTo; |
| 2420 return; | 2423 return; |
| 2421 } | 2424 } |
| 2422 } | 2425 } |
| 2423 | 2426 |
| 2424 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo
rFindPlainText); | 2427 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo
rFindPlainText); |
| 2425 calculateCharacterSubrange(computeRangeIterator, matchStart, matchLength, re
sultStart, resultEnd); | 2428 calculateCharacterSubrange(computeRangeIterator, matchStart, matchLength, re
sultStart, resultEnd); |
| 2426 } | 2429 } |
| 2427 | 2430 |
| 2428 } | 2431 } |
| OLD | NEW |