author | Cameron McCormack <cam@mcc.id.au> |
Thu, 16 Mar 2017 17:43:44 +0800 | |
changeset 348335 | f85eb6b4979496229915f467c31bc5773259741a |
parent 348334 | 127cb15515fbacba487e89da0b8e7abb2a49159c |
child 348336 | f5a5a605ae823a1cce72fecf4b4da4e8380f66b5 |
push id | 88187 |
push user | archaeopteryx@coole-files.de |
push date | Sat, 18 Mar 2017 15:27:00 +0000 |
treeherder | mozilla-inbound@0b1d3324cffe [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bholley |
bugs | 1346623 |
milestone | 55.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -4238,23 +4238,38 @@ nsCSSFrameConstructor::GetAnonymousConte uint32_t count = aContent.Length(); for (uint32_t i=0; i < count; i++) { // get our child's content and set its parent to our content nsIContent* content = aContent[i].mContent; NS_ASSERTION(content, "null anonymous content?"); ConnectAnonymousTreeDescendants(content, aContent[i].mChildren); - // least-surprise CSS binding until we do the SVG specified - // cascading rules for <svg:use> - bug 265894 - if (aParentFrame->GetType() == nsGkAtoms::svgUseFrame) { + nsIAtom* parentFrameType = aParentFrame->GetType(); + if (parentFrameType == nsGkAtoms::svgUseFrame) { + // least-surprise CSS binding until we do the SVG specified + // cascading rules for <svg:use> - bug 265894 content->SetFlags(NODE_IS_ANONYMOUS_ROOT); } else { content->SetIsNativeAnonymousRoot(); - SetNativeAnonymousBitOnDescendants(content); + // Don't mark descendants of the custom content container + // as native anonymous. When canvas custom content is initially + // created and appended to the custom content container, in + // nsIDocument::InsertAnonymousContent, it is not considered native + // anonymous content. But if we end up reframing the root element, + // we will re-create the nsCanvasFrame, and we would end up in here, + // marking it as NAC. Existing uses of canvas custom content would + // break if it becomes NAC (since each element starts inheriting + // styles from its closest non-NAC ancestor, rather than from its + // parent). + if (!(parentFrameType == nsGkAtoms::canvasFrame && + content == static_cast<nsCanvasFrame*>(aParentFrame) + ->GetCustomContentContainer())) { + SetNativeAnonymousBitOnDescendants(content); + } } bool anonContentIsEditable = content->HasFlag(NODE_IS_EDITABLE); // If the parent is in a shadow tree, make sure we don't // bind with a document because shadow roots and its descendants // are not in document. nsIDocument* bindDocument =