OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. |
4 * Copyright (C) 2011 Igalia S.L. | 4 * Copyright (C) 2011 Igalia S.L. |
5 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 5 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
6 * | 6 * |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
9 * are met: | 9 * are met: |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 , m_shouldAnnotate(shouldAnnotate) | 130 , m_shouldAnnotate(shouldAnnotate) |
131 , m_highestNodeToBeSerialized(highestNodeToBeSerialized) | 131 , m_highestNodeToBeSerialized(highestNodeToBeSerialized) |
132 , m_convertBlocksToInlines(convertBlocksToInlines) | 132 , m_convertBlocksToInlines(convertBlocksToInlines) |
133 , m_lastClosed(highestNodeToBeSerialized) | 133 , m_lastClosed(highestNodeToBeSerialized) |
134 { | 134 { |
135 } | 135 } |
136 | 136 |
137 static bool needInterchangeNewlineAfter(const VisiblePosition& v) | 137 static bool needInterchangeNewlineAfter(const VisiblePosition& v) |
138 { | 138 { |
139 VisiblePosition next = v.next(); | 139 VisiblePosition next = v.next(); |
140 Node* upstreamNode = next.deepEquivalent().upstream().anchorNode(); | 140 Node* upstreamNode = mostBackwardCaretPosition(next.deepEquivalent()).anchor
Node(); |
141 Node* downstreamNode = v.deepEquivalent().downstream().anchorNode(); | 141 Node* downstreamNode = mostForwardCaretPosition(v.deepEquivalent()).anchorNo
de(); |
142 // Add an interchange newline if a paragraph break is selected and a br won'
t already be added to the markup to represent it. | 142 // Add an interchange newline if a paragraph break is selected and a br won'
t already be added to the markup to represent it. |
143 return isEndOfParagraph(v) && isStartOfParagraph(next) && !(isHTMLBRElement(
*upstreamNode) && upstreamNode == downstreamNode); | 143 return isEndOfParagraph(v) && isStartOfParagraph(next) && !(isHTMLBRElement(
*upstreamNode) && upstreamNode == downstreamNode); |
144 } | 144 } |
145 | 145 |
146 static bool needInterchangeNewlineAt(const VisiblePosition& v) | 146 static bool needInterchangeNewlineAt(const VisiblePosition& v) |
147 { | 147 { |
148 // FIXME: |v.previous()| works on a DOM tree. We need to fix this to work on | 148 // FIXME: |v.previous()| works on a DOM tree. We need to fix this to work on |
149 // a composed tree. | 149 // a composed tree. |
150 return needInterchangeNewlineAfter(v.previous()); | 150 return needInterchangeNewlineAfter(v.previous()); |
151 } | 151 } |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 if (element.isHTMLElement() && shouldAnnotate()) | 475 if (element.isHTMLElement() && shouldAnnotate()) |
476 inlineStyle->mergeStyleFromRulesForSerialization(&toHTMLElement(element)
); | 476 inlineStyle->mergeStyleFromRulesForSerialization(&toHTMLElement(element)
); |
477 | 477 |
478 return inlineStyle; | 478 return inlineStyle; |
479 } | 479 } |
480 | 480 |
481 template class StyledMarkupSerializer<EditingStrategy>; | 481 template class StyledMarkupSerializer<EditingStrategy>; |
482 template class StyledMarkupSerializer<EditingInComposedTreeStrategy>; | 482 template class StyledMarkupSerializer<EditingInComposedTreeStrategy>; |
483 | 483 |
484 } // namespace blink | 484 } // namespace blink |
OLD | NEW |