OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 29 matching lines...) Expand all Loading... |
40 #include "core/editing/EditingStyle.h" | 40 #include "core/editing/EditingStyle.h" |
41 #include "core/editing/HTMLInterchange.h" | 41 #include "core/editing/HTMLInterchange.h" |
42 #include "core/editing/PlainTextRange.h" | 42 #include "core/editing/PlainTextRange.h" |
43 #include "core/editing/VisibleUnits.h" | 43 #include "core/editing/VisibleUnits.h" |
44 #include "core/editing/htmlediting.h" | 44 #include "core/editing/htmlediting.h" |
45 #include "core/editing/iterators/TextIterator.h" | 45 #include "core/editing/iterators/TextIterator.h" |
46 #include "core/frame/UseCounter.h" | 46 #include "core/frame/UseCounter.h" |
47 #include "core/html/HTMLFontElement.h" | 47 #include "core/html/HTMLFontElement.h" |
48 #include "core/html/HTMLSpanElement.h" | 48 #include "core/html/HTMLSpanElement.h" |
49 #include "core/layout/LayoutObject.h" | 49 #include "core/layout/LayoutObject.h" |
50 #include "core/rendering/RenderText.h" | 50 #include "core/layout/LayoutText.h" |
51 #include "platform/heap/Handle.h" | 51 #include "platform/heap/Handle.h" |
52 #include "wtf/StdLibExtras.h" | 52 #include "wtf/StdLibExtras.h" |
53 #include "wtf/text/StringBuilder.h" | 53 #include "wtf/text/StringBuilder.h" |
54 | 54 |
55 namespace blink { | 55 namespace blink { |
56 | 56 |
57 using namespace HTMLNames; | 57 using namespace HTMLNames; |
58 | 58 |
59 static String& styleSpanClassString() | 59 static String& styleSpanClassString() |
60 { | 60 { |
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 newInlineStyle->mergeInlineStyleOfElement(toHTMLElement(node), EditingSt
yle::OverrideValues); | 1033 newInlineStyle->mergeInlineStyleOfElement(toHTMLElement(node), EditingSt
yle::OverrideValues); |
1034 } | 1034 } |
1035 | 1035 |
1036 // Since addInlineStyleIfNeeded can't add styles to block-flow render object
s, add style attribute instead. | 1036 // Since addInlineStyleIfNeeded can't add styles to block-flow render object
s, add style attribute instead. |
1037 // FIXME: applyInlineStyleToRange should be used here instead. | 1037 // FIXME: applyInlineStyleToRange should be used here instead. |
1038 if ((node->renderer()->isLayoutBlockFlow() || node->hasChildren()) && node->
isHTMLElement()) { | 1038 if ((node->renderer()->isLayoutBlockFlow() || node->hasChildren()) && node->
isHTMLElement()) { |
1039 setNodeAttribute(toHTMLElement(node), styleAttr, AtomicString(newInlineS
tyle->style()->asText())); | 1039 setNodeAttribute(toHTMLElement(node), styleAttr, AtomicString(newInlineS
tyle->style()->asText())); |
1040 return; | 1040 return; |
1041 } | 1041 } |
1042 | 1042 |
1043 if (node->renderer()->isText() && toRenderText(node->renderer())->isAllColla
psibleWhitespace()) | 1043 if (node->renderer()->isText() && toLayoutText(node->renderer())->isAllColla
psibleWhitespace()) |
1044 return; | 1044 return; |
1045 | 1045 |
1046 // We can't wrap node with the styled element here because new styled elemen
t will never be removed if we did. | 1046 // We can't wrap node with the styled element here because new styled elemen
t will never be removed if we did. |
1047 // If we modified the child pointer in pushDownInlineStyleAroundNode to poin
t to new style element | 1047 // If we modified the child pointer in pushDownInlineStyleAroundNode to poin
t to new style element |
1048 // then we fall into an infinite loop where we keep removing and adding styl
ed element wrapping node. | 1048 // then we fall into an infinite loop where we keep removing and adding styl
ed element wrapping node. |
1049 addInlineStyleIfNeeded(newInlineStyle.get(), node, node, DoNotAddStyledEleme
nt); | 1049 addInlineStyleIfNeeded(newInlineStyle.get(), node, node, DoNotAddStyledEleme
nt); |
1050 } | 1050 } |
1051 | 1051 |
1052 void ApplyStyleCommand::pushDownInlineStyleAroundNode(EditingStyle* style, Node*
targetNode) | 1052 void ApplyStyleCommand::pushDownInlineStyleAroundNode(EditingStyle* style, Node*
targetNode) |
1053 { | 1053 { |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1586 DEFINE_TRACE(ApplyStyleCommand) | 1586 DEFINE_TRACE(ApplyStyleCommand) |
1587 { | 1587 { |
1588 visitor->trace(m_style); | 1588 visitor->trace(m_style); |
1589 visitor->trace(m_start); | 1589 visitor->trace(m_start); |
1590 visitor->trace(m_end); | 1590 visitor->trace(m_end); |
1591 visitor->trace(m_styledInlineElement); | 1591 visitor->trace(m_styledInlineElement); |
1592 CompositeEditCommand::trace(visitor); | 1592 CompositeEditCommand::trace(visitor); |
1593 } | 1593 } |
1594 | 1594 |
1595 } | 1595 } |
OLD | NEW |