Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: Source/core/inspector/DOMPatchSupport.h

Issue 23453033: Have DOMPatchSupport and DocumentFragment deal with Document references (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/inspector/DOMEditor.cpp ('k') | Source/core/inspector/DOMPatchSupport.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 30 matching lines...) Expand all
41 41
42 class ContainerNode; 42 class ContainerNode;
43 class DOMEditor; 43 class DOMEditor;
44 class Document; 44 class Document;
45 class ExceptionState; 45 class ExceptionState;
46 class Node; 46 class Node;
47 47
48 class DOMPatchSupport { 48 class DOMPatchSupport {
49 WTF_MAKE_NONCOPYABLE(DOMPatchSupport); 49 WTF_MAKE_NONCOPYABLE(DOMPatchSupport);
50 public: 50 public:
51 static void patchDocument(Document*, const String& markup); 51 static void patchDocument(Document&, const String& markup);
52 52
53 DOMPatchSupport(DOMEditor*, Document*); 53 DOMPatchSupport(DOMEditor*, Document&);
54 virtual ~DOMPatchSupport(); 54 virtual ~DOMPatchSupport();
55 55
56 void patchDocument(const String& markup); 56 void patchDocument(const String& markup);
57 Node* patchNode(Node*, const String& markup, ExceptionState&); 57 Node* patchNode(Node*, const String& markup, ExceptionState&);
58 58
59 private: 59 private:
60 struct Digest; 60 struct Digest;
61 typedef Vector<pair<Digest*, size_t> > ResultMap; 61 typedef Vector<pair<Digest*, size_t> > ResultMap;
62 typedef HashMap<String, Digest*> UnusedNodesMap; 62 typedef HashMap<String, Digest*> UnusedNodesMap;
63 63
64 bool innerPatchNode(Digest* oldNode, Digest* newNode, ExceptionState&); 64 bool innerPatchNode(Digest* oldNode, Digest* newNode, ExceptionState&);
65 std::pair<ResultMap, ResultMap> diff(const Vector<OwnPtr<Digest> >& oldChild ren, const Vector<OwnPtr<Digest> >& newChildren); 65 std::pair<ResultMap, ResultMap> diff(const Vector<OwnPtr<Digest> >& oldChild ren, const Vector<OwnPtr<Digest> >& newChildren);
66 bool innerPatchChildren(ContainerNode*, const Vector<OwnPtr<Digest> >& oldCh ildren, const Vector<OwnPtr<Digest> >& newChildren, ExceptionState&); 66 bool innerPatchChildren(ContainerNode*, const Vector<OwnPtr<Digest> >& oldCh ildren, const Vector<OwnPtr<Digest> >& newChildren, ExceptionState&);
67 PassOwnPtr<Digest> createDigest(Node*, UnusedNodesMap*); 67 PassOwnPtr<Digest> createDigest(Node*, UnusedNodesMap*);
68 bool insertBeforeAndMarkAsUsed(ContainerNode*, Digest*, Node* anchor, Except ionState&); 68 bool insertBeforeAndMarkAsUsed(ContainerNode*, Digest*, Node* anchor, Except ionState&);
69 bool removeChildAndMoveToNew(Digest*, ExceptionState&); 69 bool removeChildAndMoveToNew(Digest*, ExceptionState&);
70 void markNodeAsUsed(Digest*); 70 void markNodeAsUsed(Digest*);
71 #ifdef DEBUG_DOM_PATCH_SUPPORT 71 #ifdef DEBUG_DOM_PATCH_SUPPORT
72 void dumpMap(const ResultMap&, const String& name); 72 void dumpMap(const ResultMap&, const String& name);
73 #endif 73 #endif
74 74
75 DOMEditor* m_domEditor; 75 DOMEditor* m_domEditor;
76 Document* m_document; 76 Document& m_document;
77 77
78 UnusedNodesMap m_unusedNodesMap; 78 UnusedNodesMap m_unusedNodesMap;
79 }; 79 };
80 80
81 81
82 } // namespace WebCore 82 } // namespace WebCore
83 83
84 #endif // !defined(DOMPatchSupport_h) 84 #endif // !defined(DOMPatchSupport_h)
OLDNEW
« no previous file with comments | « Source/core/inspector/DOMEditor.cpp ('k') | Source/core/inspector/DOMPatchSupport.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698