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

Side by Side Diff: Source/WebCore/html/parser/HTMLConstructionSite.cpp

Issue 7150019: Merge 88434 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/782/
Patch Set: Created 9 years, 6 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
« no previous file with comments | « LayoutTests/fast/parser/document-write-onload-clear-expected.txt ('k') | no next file » | 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) 2010 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved.
3 * Copyright (C) 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2011 Apple 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 return tagName == tableTag 75 return tagName == tableTag
76 || tagName == tbodyTag 76 || tagName == tbodyTag
77 || tagName == tfootTag 77 || tagName == tfootTag
78 || tagName == theadTag 78 || tagName == theadTag
79 || tagName == trTag; 79 || tagName == trTag;
80 } 80 }
81 81
82 } // namespace 82 } // namespace
83 83
84 template<typename ChildType> 84 template<typename ChildType>
85 PassRefPtr<ChildType> HTMLConstructionSite::attach(ContainerNode* parent, PassRe fPtr<ChildType> prpChild) 85 PassRefPtr<ChildType> HTMLConstructionSite::attach(ContainerNode* rawParent, Pas sRefPtr<ChildType> prpChild)
86 { 86 {
87 RefPtr<ChildType> child = prpChild; 87 RefPtr<ChildType> child = prpChild;
88 RefPtr<ContainerNode> parent = rawParent;
88 89
89 // FIXME: It's confusing that HTMLConstructionSite::attach does the magic 90 // FIXME: It's confusing that HTMLConstructionSite::attach does the magic
90 // redirection to the foster parent but HTMLConstructionSite::attachAtSite 91 // redirection to the foster parent but HTMLConstructionSite::attachAtSite
91 // doesn't. It feels like we're missing a concept somehow. 92 // doesn't. It feels like we're missing a concept somehow.
92 if (shouldFosterParent()) { 93 if (shouldFosterParent()) {
93 fosterParent(child.get()); 94 fosterParent(child.get());
94 ASSERT(child->attached() || !child->parentNode() || !child->parentNode() ->attached()); 95 ASSERT(child->attached() || !child->parentNode() || !child->parentNode() ->attached());
95 return child.release(); 96 return child.release();
96 } 97 }
97 98
98 parent->parserAddChild(child); 99 parent->parserAddChild(child);
99 100
100 // An event handler (DOM Mutation, beforeload, et al.) could have removed 101 // An event handler (DOM Mutation, beforeload, et al.) could have removed
101 // the child, in which case we shouldn't try attaching it. 102 // the child, in which case we shouldn't try attaching it.
102 if (!child->parentNode()) 103 if (!child->parentNode())
103 return child.release(); 104 return child.release();
104 105
105 // It's slightly unfortunate that we need to hold a reference to child
106 // here to call attach(). We should investigate whether we can rely on
107 // |parent| to hold a ref at this point. In the common case (at least
108 // for elements), however, we'll get to use this ref in the stack of
109 // open elements.
110 if (parent->attached() && !child->attached()) 106 if (parent->attached() && !child->attached())
111 child->attach(); 107 child->attach();
112 return child.release(); 108 return child.release();
113 } 109 }
114 110
115 void HTMLConstructionSite::attachAtSite(const AttachmentSite& site, PassRefPtr<N ode> prpChild) 111 void HTMLConstructionSite::attachAtSite(const AttachmentSite& site, PassRefPtr<N ode> prpChild)
116 { 112 {
117 // FIXME: It's unfortunate that we need to hold a reference to child 113 // FIXME: It's unfortunate that we need to hold a reference to child
118 // here to call attach(). We should investigate whether we can rely on 114 // here to call attach(). We should investigate whether we can rely on
119 // |site.parent| to hold a ref at this point. 115 // |site.parent| to hold a ref at this point.
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 } 491 }
496 492
497 void HTMLConstructionSite::fosterParent(Node* node) 493 void HTMLConstructionSite::fosterParent(Node* node)
498 { 494 {
499 AttachmentSite site; 495 AttachmentSite site;
500 findFosterSite(site); 496 findFosterSite(site);
501 attachAtSite(site, node); 497 attachAtSite(site, node);
502 } 498 }
503 499
504 } 500 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/parser/document-write-onload-clear-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698