| OLD | NEW |
| 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 26 matching lines...) Expand all Loading... |
| 37 #include "sky/engine/core/dom/Element.h" | 37 #include "sky/engine/core/dom/Element.h" |
| 38 #include "sky/engine/core/dom/Text.h" | 38 #include "sky/engine/core/dom/Text.h" |
| 39 #include "sky/engine/core/editing/FrameSelection.h" | 39 #include "sky/engine/core/editing/FrameSelection.h" |
| 40 #include "sky/engine/core/editing/HTMLInterchange.h" | 40 #include "sky/engine/core/editing/HTMLInterchange.h" |
| 41 #include "sky/engine/core/editing/SmartReplace.h" | 41 #include "sky/engine/core/editing/SmartReplace.h" |
| 42 #include "sky/engine/core/editing/TextIterator.h" | 42 #include "sky/engine/core/editing/TextIterator.h" |
| 43 #include "sky/engine/core/editing/VisibleUnits.h" | 43 #include "sky/engine/core/editing/VisibleUnits.h" |
| 44 #include "sky/engine/core/editing/htmlediting.h" | 44 #include "sky/engine/core/editing/htmlediting.h" |
| 45 #include "sky/engine/core/events/BeforeTextInsertedEvent.h" | 45 #include "sky/engine/core/events/BeforeTextInsertedEvent.h" |
| 46 #include "sky/engine/core/frame/LocalFrame.h" | 46 #include "sky/engine/core/frame/LocalFrame.h" |
| 47 #include "sky/engine/core/frame/UseCounter.h" | |
| 48 #include "sky/engine/core/html/HTMLElement.h" | 47 #include "sky/engine/core/html/HTMLElement.h" |
| 49 #include "sky/engine/core/rendering/RenderObject.h" | 48 #include "sky/engine/core/rendering/RenderObject.h" |
| 50 #include "sky/engine/core/rendering/RenderText.h" | 49 #include "sky/engine/core/rendering/RenderText.h" |
| 51 #include "sky/engine/wtf/StdLibExtras.h" | 50 #include "sky/engine/wtf/StdLibExtras.h" |
| 52 #include "sky/engine/wtf/Vector.h" | 51 #include "sky/engine/wtf/Vector.h" |
| 53 | 52 |
| 54 namespace blink { | 53 namespace blink { |
| 55 | 54 |
| 56 enum EFragmentType { EmptyFragment, SingleTextNodeFragment, TreeFragment }; | 55 enum EFragmentType { EmptyFragment, SingleTextNodeFragment, TreeFragment }; |
| 57 | 56 |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 if (isBlock(node)) | 489 if (isBlock(node)) |
| 491 return false; | 490 return false; |
| 492 | 491 |
| 493 if (!node->isHTMLElement()) | 492 if (!node->isHTMLElement()) |
| 494 return false; | 493 return false; |
| 495 | 494 |
| 496 // We can skip over elements whose class attribute is | 495 // We can skip over elements whose class attribute is |
| 497 // one of our internal classes. | 496 // one of our internal classes. |
| 498 const HTMLElement* element = toHTMLElement(node); | 497 const HTMLElement* element = toHTMLElement(node); |
| 499 const AtomicString& classAttributeValue = element->getAttribute(HTMLNames::c
lassAttr); | 498 const AtomicString& classAttributeValue = element->getAttribute(HTMLNames::c
lassAttr); |
| 500 if (classAttributeValue == AppleTabSpanClass) { | 499 if (classAttributeValue == AppleTabSpanClass) |
| 501 UseCounter::count(element->document(), UseCounter::EditingAppleTabSpanCl
ass); | |
| 502 return true; | 500 return true; |
| 503 } | 501 if (classAttributeValue == AppleConvertedSpace) |
| 504 if (classAttributeValue == AppleConvertedSpace) { | |
| 505 UseCounter::count(element->document(), UseCounter::EditingAppleConverted
Space); | |
| 506 return true; | 502 return true; |
| 507 } | 503 if (classAttributeValue == ApplePasteAsQuotation) |
| 508 if (classAttributeValue == ApplePasteAsQuotation) { | |
| 509 UseCounter::count(element->document(), UseCounter::EditingApplePasteAsQu
otation); | |
| 510 return true; | 504 return true; |
| 511 } | |
| 512 | 505 |
| 513 return EditingStyle::elementIsStyledSpanOrHTMLEquivalent(element); | 506 return EditingStyle::elementIsStyledSpanOrHTMLEquivalent(element); |
| 514 } | 507 } |
| 515 | 508 |
| 516 static inline HTMLElement* elementToSplitToAvoidPastingIntoInlineElementsWithSty
le(const Position& insertionPos) | 509 static inline HTMLElement* elementToSplitToAvoidPastingIntoInlineElementsWithSty
le(const Position& insertionPos) |
| 517 { | 510 { |
| 518 Element* containingBlock = enclosingBlock(insertionPos.containerNode()); | 511 Element* containingBlock = enclosingBlock(insertionPos.containerNode()); |
| 519 return toHTMLElement(highestEnclosingNodeOfType(insertionPos, isInlineHTMLEl
ementWithStyle, CannotCrossEditingBoundary, containingBlock)); | 512 return toHTMLElement(highestEnclosingNodeOfType(insertionPos, isInlineHTMLEl
ementWithStyle, CannotCrossEditingBoundary, containingBlock)); |
| 520 } | 513 } |
| 521 | 514 |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 return false; | 998 return false; |
| 1006 | 999 |
| 1007 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en
d); | 1000 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en
d); |
| 1008 | 1001 |
| 1009 setEndingSelection(selectionAfterReplace); | 1002 setEndingSelection(selectionAfterReplace); |
| 1010 | 1003 |
| 1011 return true; | 1004 return true; |
| 1012 } | 1005 } |
| 1013 | 1006 |
| 1014 } // namespace blink | 1007 } // namespace blink |
| OLD | NEW |