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

Side by Side Diff: Source/core/html/HTMLFormElement.cpp

Issue 218753003: Fix crash when a demoted FORM element is moved into a ShadowRoot. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 | « LayoutTests/fast/dom/shadow/shadowdom-for-unknown-with-form-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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 { 85 {
86 document().formController().willDeleteForm(this); 86 document().formController().willDeleteForm(this);
87 } 87 }
88 88
89 bool HTMLFormElement::rendererIsNeeded(const RenderStyle& style) 89 bool HTMLFormElement::rendererIsNeeded(const RenderStyle& style)
90 { 90 {
91 if (!m_wasDemoted) 91 if (!m_wasDemoted)
92 return HTMLElement::rendererIsNeeded(style); 92 return HTMLElement::rendererIsNeeded(style);
93 93
94 ContainerNode* node = parentNode(); 94 ContainerNode* node = parentNode();
95 if (!node || !node->renderer())
96 return HTMLElement::rendererIsNeeded(style);
95 RenderObject* parentRenderer = node->renderer(); 97 RenderObject* parentRenderer = node->renderer();
96 // FIXME: Shouldn't we also check for table caption (see |formIsTablePart| b elow). 98 // FIXME: Shouldn't we also check for table caption (see |formIsTablePart| b elow).
97 // FIXME: This check is not correct for Shadow DOM. 99 // FIXME: This check is not correct for Shadow DOM.
98 bool parentIsTableElementPart = (parentRenderer->isTable() && isHTMLTableEle ment(*node)) 100 bool parentIsTableElementPart = (parentRenderer->isTable() && isHTMLTableEle ment(*node))
99 || (parentRenderer->isTableRow() && isHTMLTableRowElement(*node)) 101 || (parentRenderer->isTableRow() && isHTMLTableRowElement(*node))
100 || (parentRenderer->isTableSection() && node->hasTagName(tbodyTag)) 102 || (parentRenderer->isTableSection() && node->hasTagName(tbodyTag))
101 || (parentRenderer->isRenderTableCol() && node->hasTagName(colTag)) 103 || (parentRenderer->isRenderTableCol() && node->hasTagName(colTag))
102 || (parentRenderer->isTableCell() && isHTMLTableRowElement(*node)); 104 || (parentRenderer->isTableCell() && isHTMLTableRowElement(*node));
103 105
104 if (!parentIsTableElementPart) 106 if (!parentIsTableElementPart)
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 } 789 }
788 790
789 void HTMLFormElement::setDemoted(bool demoted) 791 void HTMLFormElement::setDemoted(bool demoted)
790 { 792 {
791 if (demoted) 793 if (demoted)
792 UseCounter::count(document(), UseCounter::DemotedFormElement); 794 UseCounter::count(document(), UseCounter::DemotedFormElement);
793 m_wasDemoted = demoted; 795 m_wasDemoted = demoted;
794 } 796 }
795 797
796 } // namespace 798 } // namespace
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/shadow/shadowdom-for-unknown-with-form-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698