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

Side by Side Diff: Source/core/editing/TextIterator.cpp

Issue 757583002: Revert of Use Shadow DOM to display fallback content for images (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years 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
OLDNEW
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 20 matching lines...) Expand all
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/FirstLetterPseudoElement.h" 33 #include "core/dom/FirstLetterPseudoElement.h"
34 #include "core/dom/NodeTraversal.h" 34 #include "core/dom/NodeTraversal.h"
35 #include "core/dom/shadow/ShadowRoot.h" 35 #include "core/dom/shadow/ShadowRoot.h"
36 #include "core/editing/VisiblePosition.h" 36 #include "core/editing/VisiblePosition.h"
37 #include "core/editing/VisibleUnits.h" 37 #include "core/editing/VisibleUnits.h"
38 #include "core/editing/htmlediting.h" 38 #include "core/editing/htmlediting.h"
39 #include "core/frame/FrameView.h" 39 #include "core/frame/FrameView.h"
40 #include "core/html/HTMLElement.h" 40 #include "core/html/HTMLElement.h"
41 #include "core/html/HTMLImageElement.h"
42 #include "core/html/HTMLInputElement.h"
43 #include "core/html/HTMLTextFormControlElement.h" 41 #include "core/html/HTMLTextFormControlElement.h"
44 #include "core/rendering/InlineTextBox.h" 42 #include "core/rendering/InlineTextBox.h"
45 #include "core/rendering/RenderImage.h" 43 #include "core/rendering/RenderImage.h"
46 #include "core/rendering/RenderTableCell.h" 44 #include "core/rendering/RenderTableCell.h"
47 #include "core/rendering/RenderTableRow.h" 45 #include "core/rendering/RenderTableRow.h"
48 #include "core/rendering/RenderTextControl.h" 46 #include "core/rendering/RenderTextControl.h"
49 #include "core/rendering/RenderTextFragment.h" 47 #include "core/rendering/RenderTextFragment.h"
50 #include "platform/fonts/Character.h" 48 #include "platform/fonts/Character.h"
51 #include "platform/fonts/Font.h" 49 #include "platform/fonts/Font.h"
52 #include "platform/text/TextBoundaries.h" 50 #include "platform/text/TextBoundaries.h"
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 463
466 // Handle the current node according to its type. 464 // Handle the current node according to its type.
467 if (m_iterationProgress < HandledNode) { 465 if (m_iterationProgress < HandledNode) {
468 bool handledNode = false; 466 bool handledNode = false;
469 if (renderer->isText() && m_node->nodeType() == Node::TEXT_NODE) { // FIXME: What about CDATA_SECTION_NODE? 467 if (renderer->isText() && m_node->nodeType() == Node::TEXT_NODE) { // FIXME: What about CDATA_SECTION_NODE?
470 handledNode = handleTextNode(); 468 handledNode = handleTextNode();
471 } else if (renderer && (renderer->isImage() || renderer->isRende rPart() 469 } else if (renderer && (renderer->isImage() || renderer->isRende rPart()
472 || (m_node && m_node->isHTMLElement() 470 || (m_node && m_node->isHTMLElement()
473 && (isHTMLFormControlElement(toHTMLElement(*m_node)) 471 && (isHTMLFormControlElement(toHTMLElement(*m_node))
474 || isHTMLLegendElement(toHTMLElement(*m_node)) 472 || isHTMLLegendElement(toHTMLElement(*m_node))
475 || isHTMLImageElement(toElement(*m_node))
476 || isHTMLMeterElement(toHTMLElement(*m_node)) 473 || isHTMLMeterElement(toHTMLElement(*m_node))
477 || isHTMLProgressElement(toHTMLElement(*m_node)))))) { 474 || isHTMLProgressElement(toHTMLElement(*m_node)))))) {
478 handledNode = handleReplacedElement(); 475 handledNode = handleReplacedElement();
479 } else { 476 } else {
480 handledNode = handleNonTextNode(); 477 handledNode = handleNonTextNode();
481 } 478 }
482 if (handledNode) 479 if (handledNode)
483 m_iterationProgress = HandledNode; 480 m_iterationProgress = HandledNode;
484 if (m_positionNode) 481 if (m_positionNode)
485 return; 482 return;
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 emitCharacter(',', m_node->parentNode(), m_node, 0, 1); 822 emitCharacter(',', m_node->parentNode(), m_node, 0, 1);
826 return true; 823 return true;
827 } 824 }
828 825
829 m_positionNode = m_node->parentNode(); 826 m_positionNode = m_node->parentNode();
830 m_positionOffsetBaseNode = m_node; 827 m_positionOffsetBaseNode = m_node;
831 m_positionStartOffset = 0; 828 m_positionStartOffset = 0;
832 m_positionEndOffset = 1; 829 m_positionEndOffset = 1;
833 m_singleCharacterBuffer = 0; 830 m_singleCharacterBuffer = 0;
834 831
835 if (m_emitsImageAltText) { 832 if (m_emitsImageAltText && renderer->isImage() && renderer->isRenderImage()) {
836 m_text = toHTMLElement(m_node)->altText(); 833 m_text = toRenderImage(renderer)->altText();
837 if (!m_text.isEmpty()) { 834 if (!m_text.isEmpty()) {
838 m_textLength = m_text.length(); 835 m_textLength = m_text.length();
839 m_lastCharacter = m_text[m_textLength - 1]; 836 m_lastCharacter = m_text[m_textLength - 1];
840 return true; 837 return true;
841 } 838 }
842 } 839 }
843 840
844 m_textLength = 0; 841 m_textLength = 0;
845 m_lastCharacter = 0; 842 m_lastCharacter = 0;
846 843
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 m_textLength = 0; 1404 m_textLength = 0;
1408 1405
1409 while (m_node && !m_havePassedStartNode) { 1406 while (m_node && !m_havePassedStartNode) {
1410 // Don't handle node if we start iterating at [node, 0]. 1407 // Don't handle node if we start iterating at [node, 0].
1411 if (!m_handledNode && !(m_node == m_endNode && !m_endOffset)) { 1408 if (!m_handledNode && !(m_node == m_endNode && !m_endOffset)) {
1412 RenderObject* renderer = m_node->renderer(); 1409 RenderObject* renderer = m_node->renderer();
1413 if (renderer && renderer->isText() && m_node->nodeType() == Node::TE XT_NODE) { 1410 if (renderer && renderer->isText() && m_node->nodeType() == Node::TE XT_NODE) {
1414 // FIXME: What about CDATA_SECTION_NODE? 1411 // FIXME: What about CDATA_SECTION_NODE?
1415 if (renderer->style()->visibility() == VISIBLE && m_offset > 0) 1412 if (renderer->style()->visibility() == VISIBLE && m_offset > 0)
1416 m_handledNode = handleTextNode(); 1413 m_handledNode = handleTextNode();
1417 } else if (renderer && (isHTMLImageElement(toElement(*m_node)) || is HTMLInputElement(toElement(*m_node)) || renderer->isRenderPart())) { 1414 } else if (renderer && (renderer->isImage() || renderer->isRenderPar t())) {
1418 if (renderer->style()->visibility() == VISIBLE && m_offset > 0) 1415 if (renderer->style()->visibility() == VISIBLE && m_offset > 0)
1419 m_handledNode = handleReplacedElement(); 1416 m_handledNode = handleReplacedElement();
1420 } else { 1417 } else {
1421 m_handledNode = handleNonTextNode(); 1418 m_handledNode = handleNonTextNode();
1422 } 1419 }
1423 if (m_positionNode) 1420 if (m_positionNode)
1424 return; 1421 return;
1425 } 1422 }
1426 1423
1427 if (!m_handledChildren && m_node->hasChildren()) { 1424 if (!m_handledChildren && m_node->hasChildren()) {
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
2433 resultEnd = collapseTo; 2430 resultEnd = collapseTo;
2434 return; 2431 return;
2435 } 2432 }
2436 } 2433 }
2437 2434
2438 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo rFindPlainText); 2435 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo rFindPlainText);
2439 calculateCharacterSubrange(computeRangeIterator, matchStart, matchLength, re sultStart, resultEnd); 2436 calculateCharacterSubrange(computeRangeIterator, matchStart, matchLength, re sultStart, resultEnd);
2440 } 2437 }
2441 2438
2442 } 2439 }
OLDNEW
« no previous file with comments | « Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp ('k') | Source/core/html/HTMLElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698