| 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 #include "core/dom/NodeTraversal.h" | 32 #include "core/dom/NodeTraversal.h" |
| 33 #include "core/dom/Position.h" | 33 #include "core/dom/Position.h" |
| 34 #include "core/editing/EditingStrategy.h" | 34 #include "core/editing/EditingStrategy.h" |
| 35 #include "core/editing/EditingStyle.h" | 35 #include "core/editing/EditingStyle.h" |
| 36 #include "core/editing/StyledMarkupAccumulator.h" | 36 #include "core/editing/StyledMarkupAccumulator.h" |
| 37 #include "wtf/Forward.h" | 37 #include "wtf/Forward.h" |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 enum class ConvertBlocksToInlines; | |
| 42 | |
| 43 template<typename Strategy> | 41 template<typename Strategy> |
| 44 class StyledMarkupSerializer final { | 42 class StyledMarkupSerializer final { |
| 45 STACK_ALLOCATED(); | 43 STACK_ALLOCATED(); |
| 46 using PositionType = typename Strategy::PositionType; | 44 using PositionType = typename Strategy::PositionType; |
| 47 public: | 45 public: |
| 48 StyledMarkupSerializer(EAbsoluteURLs, EAnnotateForInterchange, const Positio
nType& start, const PositionType& end, Node* highestNodeToBeSerialized, ConvertB
locksToInlines); | 46 StyledMarkupSerializer(EAbsoluteURLs, EAnnotateForInterchange, const Positio
nType& start, const PositionType& end, Node* highestNodeToBeSerialized, ConvertB
locksToInlines); |
| 49 | 47 |
| 50 String createMarkup(); | 48 String createMarkup(); |
| 51 | 49 |
| 52 private: | 50 private: |
| 53 bool convertBlocksToInlines() const { return m_convertBlocksToInlines == Con
vertBlocksToInlines::Convert; } | |
| 54 bool shouldAnnotate() const { return m_shouldAnnotate == AnnotateForIntercha
nge; } | 51 bool shouldAnnotate() const { return m_shouldAnnotate == AnnotateForIntercha
nge; } |
| 55 Node* serializeNodes(Node* startNode, Node* pastEnd, StyledMarkupAccumulator
*); | |
| 56 Node* traverseNodesForSerialization(Node* startNode, Node* pastEnd, StyledMa
rkupAccumulator*); | |
| 57 void wrapWithNode(StyledMarkupAccumulator&, ContainerNode&, PassRefPtrWillBe
RawPtr<EditingStyle>); | |
| 58 RefPtrWillBeRawPtr<EditingStyle> createInlineStyle(Element&); | |
| 59 RefPtrWillBeRawPtr<EditingStyle> createInlineStyleIfNeeded(Node&); | |
| 60 bool needsInlineStyle(const Element&); | |
| 61 void appendStartMarkup(StyledMarkupAccumulator&, Node&); | |
| 62 bool shouldApplyWrappingStyle(const Node&) const; | |
| 63 | 52 |
| 64 const PositionType m_start; | 53 const PositionType m_start; |
| 65 const PositionType m_end; | 54 const PositionType m_end; |
| 66 const EAbsoluteURLs m_shouldResolveURLs; | 55 const EAbsoluteURLs m_shouldResolveURLs; |
| 67 const EAnnotateForInterchange m_shouldAnnotate; | 56 const EAnnotateForInterchange m_shouldAnnotate; |
| 68 const RefPtrWillBeMember<Node> m_highestNodeToBeSerialized; | 57 const RefPtrWillBeMember<Node> m_highestNodeToBeSerialized; |
| 69 const ConvertBlocksToInlines m_convertBlocksToInlines; | 58 const ConvertBlocksToInlines m_convertBlocksToInlines; |
| 70 RawPtrWillBeMember<Node> m_lastClosed; | 59 RawPtrWillBeMember<Node> m_lastClosed; |
| 71 RefPtrWillBeMember<EditingStyle> m_wrappingStyle; | 60 RefPtrWillBeMember<EditingStyle> m_wrappingStyle; |
| 72 }; | 61 }; |
| 73 | 62 |
| 74 extern template class StyledMarkupSerializer<EditingStrategy>; | 63 extern template class StyledMarkupSerializer<EditingStrategy>; |
| 75 | 64 |
| 76 } // namespace blink | 65 } // namespace blink |
| 77 | 66 |
| 78 #endif // StyledMarkupSerializer_h | 67 #endif // StyledMarkupSerializer_h |
| OLD | NEW |