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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 #include "core/editing/VisibleUnits.h" | 46 #include "core/editing/VisibleUnits.h" |
47 #include "core/editing/htmlediting.h" | 47 #include "core/editing/htmlediting.h" |
48 #include "core/editing/markup.h" | 48 #include "core/editing/markup.h" |
49 #include "core/events/BeforeTextInsertedEvent.h" | 49 #include "core/events/BeforeTextInsertedEvent.h" |
50 #include "core/frame/LocalFrame.h" | 50 #include "core/frame/LocalFrame.h" |
51 #include "core/frame/UseCounter.h" | 51 #include "core/frame/UseCounter.h" |
52 #include "core/html/HTMLBRElement.h" | 52 #include "core/html/HTMLBRElement.h" |
53 #include "core/html/HTMLElement.h" | 53 #include "core/html/HTMLElement.h" |
54 #include "core/html/HTMLInputElement.h" | 54 #include "core/html/HTMLInputElement.h" |
55 #include "core/html/HTMLLIElement.h" | 55 #include "core/html/HTMLLIElement.h" |
| 56 #include "core/html/HTMLSpanElement.h" |
56 #include "core/rendering/RenderObject.h" | 57 #include "core/rendering/RenderObject.h" |
57 #include "core/rendering/RenderText.h" | 58 #include "core/rendering/RenderText.h" |
58 #include "wtf/StdLibExtras.h" | 59 #include "wtf/StdLibExtras.h" |
59 #include "wtf/Vector.h" | 60 #include "wtf/Vector.h" |
60 | 61 |
61 namespace blink { | 62 namespace blink { |
62 | 63 |
63 using namespace HTMLNames; | 64 using namespace HTMLNames; |
64 | 65 |
65 enum EFragmentType { EmptyFragment, SingleTextNodeFragment, TreeFragment }; | 66 enum EFragmentType { EmptyFragment, SingleTextNodeFragment, TreeFragment }; |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 const StylePropertySet* inlineStyle = element->inlineStyle(); | 492 const StylePropertySet* inlineStyle = element->inlineStyle(); |
492 RefPtrWillBeRawPtr<EditingStyle> newInlineStyle = EditingStyle::create(i
nlineStyle); | 493 RefPtrWillBeRawPtr<EditingStyle> newInlineStyle = EditingStyle::create(i
nlineStyle); |
493 if (inlineStyle) { | 494 if (inlineStyle) { |
494 if (element->isHTMLElement()) { | 495 if (element->isHTMLElement()) { |
495 Vector<QualifiedName> attributes; | 496 Vector<QualifiedName> attributes; |
496 HTMLElement* htmlElement = toHTMLElement(element); | 497 HTMLElement* htmlElement = toHTMLElement(element); |
497 ASSERT(htmlElement); | 498 ASSERT(htmlElement); |
498 | 499 |
499 if (newInlineStyle->conflictsWithImplicitStyleOfElement(htmlElem
ent)) { | 500 if (newInlineStyle->conflictsWithImplicitStyleOfElement(htmlElem
ent)) { |
500 // e.g. <b style="font-weight: normal;"> is converted to <sp
an style="font-weight: normal;"> | 501 // e.g. <b style="font-weight: normal;"> is converted to <sp
an style="font-weight: normal;"> |
501 node = replaceElementWithSpanPreservingChildrenAndAttributes
(htmlElement); | 502 element = replaceElementWithSpanPreservingChildrenAndAttribu
tes(htmlElement); |
502 element = toElement(node); | |
503 inlineStyle = element->inlineStyle(); | 503 inlineStyle = element->inlineStyle(); |
504 insertedNodes.didReplaceNode(*htmlElement, *node); | 504 insertedNodes.didReplaceNode(*htmlElement, *element); |
505 } else if (newInlineStyle->extractConflictingImplicitStyleOfAttr
ibutes(htmlElement, EditingStyle::PreserveWritingDirection, 0, attributes, | 505 } else if (newInlineStyle->extractConflictingImplicitStyleOfAttr
ibutes(htmlElement, EditingStyle::PreserveWritingDirection, 0, attributes, |
506 EditingStyle::DoNotExtractMatchingStyle)) { | 506 EditingStyle::DoNotExtractMatchingStyle)) { |
507 // e.g. <font size="3" style="font-size: 20px;"> is converte
d to <font style="font-size: 20px;"> | 507 // e.g. <font size="3" style="font-size: 20px;"> is converte
d to <font style="font-size: 20px;"> |
508 for (size_t i = 0; i < attributes.size(); i++) | 508 for (size_t i = 0; i < attributes.size(); i++) |
509 removeNodeAttribute(element, attributes[i]); | 509 removeNodeAttribute(element, attributes[i]); |
510 } | 510 } |
511 } | 511 } |
512 | 512 |
513 ContainerNode* context = element->parentNode(); | 513 ContainerNode* context = element->parentNode(); |
514 | 514 |
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1529 void ReplaceSelectionCommand::trace(Visitor* visitor) | 1529 void ReplaceSelectionCommand::trace(Visitor* visitor) |
1530 { | 1530 { |
1531 visitor->trace(m_startOfInsertedContent); | 1531 visitor->trace(m_startOfInsertedContent); |
1532 visitor->trace(m_endOfInsertedContent); | 1532 visitor->trace(m_endOfInsertedContent); |
1533 visitor->trace(m_insertionStyle); | 1533 visitor->trace(m_insertionStyle); |
1534 visitor->trace(m_documentFragment); | 1534 visitor->trace(m_documentFragment); |
1535 CompositeEditCommand::trace(visitor); | 1535 CompositeEditCommand::trace(visitor); |
1536 } | 1536 } |
1537 | 1537 |
1538 } // namespace blink | 1538 } // namespace blink |
OLD | NEW |