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

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

Issue 19028005: Introduce isHTMLTitleElement and toHTMLTitleElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 5 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved.
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "core/editing/FrameSelection.h" 44 #include "core/editing/FrameSelection.h"
45 #include "core/editing/HTMLInterchange.h" 45 #include "core/editing/HTMLInterchange.h"
46 #include "core/editing/SimplifyMarkupCommand.h" 46 #include "core/editing/SimplifyMarkupCommand.h"
47 #include "core/editing/SmartReplace.h" 47 #include "core/editing/SmartReplace.h"
48 #include "core/editing/TextIterator.h" 48 #include "core/editing/TextIterator.h"
49 #include "core/editing/VisibleUnits.h" 49 #include "core/editing/VisibleUnits.h"
50 #include "core/editing/htmlediting.h" 50 #include "core/editing/htmlediting.h"
51 #include "core/editing/markup.h" 51 #include "core/editing/markup.h"
52 #include "core/html/HTMLElement.h" 52 #include "core/html/HTMLElement.h"
53 #include "core/html/HTMLInputElement.h" 53 #include "core/html/HTMLInputElement.h"
54 #include "core/html/HTMLTitleElement.h"
54 #include "core/page/Frame.h" 55 #include "core/page/Frame.h"
55 #include "core/rendering/RenderObject.h" 56 #include "core/rendering/RenderObject.h"
56 #include "core/rendering/RenderText.h" 57 #include "core/rendering/RenderText.h"
57 #include <wtf/StdLibExtras.h> 58 #include <wtf/StdLibExtras.h>
58 #include <wtf/Vector.h> 59 #include <wtf/Vector.h>
59 60
60 namespace WebCore { 61 namespace WebCore {
61 62
62 using namespace HTMLNames; 63 using namespace HTMLNames;
63 64
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 } 697 }
697 698
698 static void removeHeadContents(ReplacementFragment& fragment) 699 static void removeHeadContents(ReplacementFragment& fragment)
699 { 700 {
700 Node* next = 0; 701 Node* next = 0;
701 for (Node* node = fragment.firstChild(); node; node = next) { 702 for (Node* node = fragment.firstChild(); node; node = next) {
702 if (node->hasTagName(baseTag) 703 if (node->hasTagName(baseTag)
703 || node->hasTagName(linkTag) 704 || node->hasTagName(linkTag)
704 || node->hasTagName(metaTag) 705 || node->hasTagName(metaTag)
705 || node->hasTagName(styleTag) 706 || node->hasTagName(styleTag)
706 || node->hasTagName(titleTag)) { 707 || isHTMLTitleElement(node)) {
707 next = NodeTraversal::nextSkippingChildren(node); 708 next = NodeTraversal::nextSkippingChildren(node);
708 fragment.removeNode(node); 709 fragment.removeNode(node);
709 } else 710 } else
710 next = NodeTraversal::next(node); 711 next = NodeTraversal::next(node);
711 } 712 }
712 } 713 }
713 714
714 // Remove style spans before insertion if they are unnecessary. It's faster bec ause we'll 715 // Remove style spans before insertion if they are unnecessary. It's faster bec ause we'll
715 // avoid doing a layout. 716 // avoid doing a layout.
716 static bool handleStyleSpansBeforeInsertion(ReplacementFragment& fragment, const Position& insertionPos) 717 static bool handleStyleSpansBeforeInsertion(ReplacementFragment& fragment, const Position& insertionPos)
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
1486 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get()); 1487 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get());
1487 1488
1488 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en d); 1489 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en d);
1489 1490
1490 setEndingSelection(selectionAfterReplace); 1491 setEndingSelection(selectionAfterReplace);
1491 1492
1492 return true; 1493 return true;
1493 } 1494 }
1494 1495
1495 } // namespace WebCore 1496 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698