| 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" | |
| 42 #include "core/html/HTMLTextFormControlElement.h" | 40 #include "core/html/HTMLTextFormControlElement.h" |
| 43 #include "core/rendering/InlineTextBox.h" | 41 #include "core/rendering/InlineTextBox.h" |
| 44 #include "core/rendering/RenderImage.h" | 42 #include "core/rendering/RenderImage.h" |
| 45 #include "core/rendering/RenderTableCell.h" | 43 #include "core/rendering/RenderTableCell.h" |
| 46 #include "core/rendering/RenderTableRow.h" | 44 #include "core/rendering/RenderTableRow.h" |
| 47 #include "core/rendering/RenderTextControl.h" | 45 #include "core/rendering/RenderTextControl.h" |
| 48 #include "core/rendering/RenderTextFragment.h" | 46 #include "core/rendering/RenderTextFragment.h" |
| 49 #include "platform/fonts/Character.h" | 47 #include "platform/fonts/Character.h" |
| 50 #include "platform/fonts/Font.h" | 48 #include "platform/fonts/Font.h" |
| 51 #include "platform/text/TextBoundaries.h" | 49 #include "platform/text/TextBoundaries.h" |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 | 462 |
| 465 // Handle the current node according to its type. | 463 // Handle the current node according to its type. |
| 466 if (m_iterationProgress < HandledNode) { | 464 if (m_iterationProgress < HandledNode) { |
| 467 bool handledNode = false; | 465 bool handledNode = false; |
| 468 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? |
| 469 handledNode = handleTextNode(); | 467 handledNode = handleTextNode(); |
| 470 } else if (renderer && (renderer->isImage() || renderer->isRende
rPart() | 468 } else if (renderer && (renderer->isImage() || renderer->isRende
rPart() |
| 471 || (m_node && m_node->isHTMLElement() | 469 || (m_node && m_node->isHTMLElement() |
| 472 && (isHTMLFormControlElement(toHTMLElement(*m_node)) | 470 && (isHTMLFormControlElement(toHTMLElement(*m_node)) |
| 473 || isHTMLLegendElement(toHTMLElement(*m_node)) | 471 || isHTMLLegendElement(toHTMLElement(*m_node)) |
| 474 || isHTMLImageElement(toElement(*m_node)) | |
| 475 || isHTMLMeterElement(toHTMLElement(*m_node)) | 472 || isHTMLMeterElement(toHTMLElement(*m_node)) |
| 476 || isHTMLProgressElement(toHTMLElement(*m_node)))))) { | 473 || isHTMLProgressElement(toHTMLElement(*m_node)))))) { |
| 477 handledNode = handleReplacedElement(); | 474 handledNode = handleReplacedElement(); |
| 478 } else { | 475 } else { |
| 479 handledNode = handleNonTextNode(); | 476 handledNode = handleNonTextNode(); |
| 480 } | 477 } |
| 481 if (handledNode) | 478 if (handledNode) |
| 482 m_iterationProgress = HandledNode; | 479 m_iterationProgress = HandledNode; |
| 483 if (m_positionNode) | 480 if (m_positionNode) |
| 484 return; | 481 return; |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 emitCharacter(',', m_node->parentNode(), m_node, 0, 1); | 824 emitCharacter(',', m_node->parentNode(), m_node, 0, 1); |
| 828 return true; | 825 return true; |
| 829 } | 826 } |
| 830 | 827 |
| 831 m_positionNode = m_node->parentNode(); | 828 m_positionNode = m_node->parentNode(); |
| 832 m_positionOffsetBaseNode = m_node; | 829 m_positionOffsetBaseNode = m_node; |
| 833 m_positionStartOffset = 0; | 830 m_positionStartOffset = 0; |
| 834 m_positionEndOffset = 1; | 831 m_positionEndOffset = 1; |
| 835 m_singleCharacterBuffer = 0; | 832 m_singleCharacterBuffer = 0; |
| 836 | 833 |
| 837 if (m_emitsImageAltText) { | 834 if (m_emitsImageAltText && renderer->isImage() && renderer->isRenderImage())
{ |
| 838 m_text = toHTMLElement(m_node)->altText(); | 835 m_text = toRenderImage(renderer)->altText(); |
| 839 if (!m_text.isEmpty()) { | 836 if (!m_text.isEmpty()) { |
| 840 m_textLength = m_text.length(); | 837 m_textLength = m_text.length(); |
| 841 m_lastCharacter = m_text[m_textLength - 1]; | 838 m_lastCharacter = m_text[m_textLength - 1]; |
| 842 return true; | 839 return true; |
| 843 } | 840 } |
| 844 } | 841 } |
| 845 | 842 |
| 846 m_textLength = 0; | 843 m_textLength = 0; |
| 847 m_lastCharacter = 0; | 844 m_lastCharacter = 0; |
| 848 | 845 |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1405 m_textLength = 0; | 1402 m_textLength = 0; |
| 1406 | 1403 |
| 1407 while (m_node && !m_havePassedStartNode) { | 1404 while (m_node && !m_havePassedStartNode) { |
| 1408 // Don't handle node if we start iterating at [node, 0]. | 1405 // Don't handle node if we start iterating at [node, 0]. |
| 1409 if (!m_handledNode && !(m_node == m_endNode && !m_endOffset)) { | 1406 if (!m_handledNode && !(m_node == m_endNode && !m_endOffset)) { |
| 1410 RenderObject* renderer = m_node->renderer(); | 1407 RenderObject* renderer = m_node->renderer(); |
| 1411 if (renderer && renderer->isText() && m_node->nodeType() == Node::TE
XT_NODE) { | 1408 if (renderer && renderer->isText() && m_node->nodeType() == Node::TE
XT_NODE) { |
| 1412 // FIXME: What about CDATA_SECTION_NODE? | 1409 // FIXME: What about CDATA_SECTION_NODE? |
| 1413 if (renderer->style()->visibility() == VISIBLE && m_offset > 0) | 1410 if (renderer->style()->visibility() == VISIBLE && m_offset > 0) |
| 1414 m_handledNode = handleTextNode(); | 1411 m_handledNode = handleTextNode(); |
| 1415 } else if (renderer && (isHTMLImageElement(toElement(*m_node)) || is
HTMLInputElement(toElement(*m_node)) || renderer->isRenderPart())) { | 1412 } else if (renderer && (renderer->isImage() || renderer->isRenderPar
t())) { |
| 1416 if (renderer->style()->visibility() == VISIBLE && m_offset > 0) | 1413 if (renderer->style()->visibility() == VISIBLE && m_offset > 0) |
| 1417 m_handledNode = handleReplacedElement(); | 1414 m_handledNode = handleReplacedElement(); |
| 1418 } else { | 1415 } else { |
| 1419 m_handledNode = handleNonTextNode(); | 1416 m_handledNode = handleNonTextNode(); |
| 1420 } | 1417 } |
| 1421 if (m_positionNode) | 1418 if (m_positionNode) |
| 1422 return; | 1419 return; |
| 1423 } | 1420 } |
| 1424 | 1421 |
| 1425 if (!m_handledChildren && m_node->hasChildren()) { | 1422 if (!m_handledChildren && m_node->hasChildren()) { |
| (...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2424 resultEnd = collapseTo; | 2421 resultEnd = collapseTo; |
| 2425 return; | 2422 return; |
| 2426 } | 2423 } |
| 2427 } | 2424 } |
| 2428 | 2425 |
| 2429 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo
rFindPlainText); | 2426 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo
rFindPlainText); |
| 2430 calculateCharacterSubrange(computeRangeIterator, matchStart, matchLength, re
sultStart, resultEnd); | 2427 calculateCharacterSubrange(computeRangeIterator, matchStart, matchLength, re
sultStart, resultEnd); |
| 2431 } | 2428 } |
| 2432 | 2429 |
| 2433 } | 2430 } |
| OLD | NEW |