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

Side by Side Diff: Source/core/html/shadow/HTMLShadowElement.cpp

Issue 22852020: Only allow reprojecting shadows between ShadowRoots of the same type (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Delete another test Created 7 years, 4 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/html/shadow/HTMLShadowElement.h ('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) 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 document()->updateDistributionForNodeIfNeeded(this); 63 document()->updateDistributionForNodeIfNeeded(this);
64 64
65 ShadowRoot* older = containingRoot->olderShadowRoot(); 65 ShadowRoot* older = containingRoot->olderShadowRoot();
66 if (!older || !older->shouldExposeToBindings() || older->insertionPoint() != this) 66 if (!older || !older->shouldExposeToBindings() || older->insertionPoint() != this)
67 return 0; 67 return 0;
68 68
69 ASSERT(older->shouldExposeToBindings()); 69 ASSERT(older->shouldExposeToBindings());
70 return older; 70 return older;
71 } 71 }
72 72
73 static inline Element* hostForOldestAuthorShadowRoot(ShadowRoot* root)
74 {
75 return root && root->isOldestAuthorShadowRoot() ? root->host() : 0;
76 }
77
78 bool HTMLShadowElement::shouldSelect() const
79 {
80 Element* host = hostForOldestAuthorShadowRoot(containingShadowRoot());
81 return !host || host->supportsShadowElementForUserAgentShadow();
82 }
83
84 Node::InsertionNotificationRequest HTMLShadowElement::insertedInto(ContainerNode * insertionPoint) 73 Node::InsertionNotificationRequest HTMLShadowElement::insertedInto(ContainerNode * insertionPoint)
85 { 74 {
86 if (insertionPoint->inDocument() && !shouldSelect()) { 75 if (insertionPoint->inDocument()) {
87 String message = String::format("<shadow> doesn't work for %s element ho st.", containingShadowRoot()->host()->nodeName().utf8().data()); 76 // Warn if trying to reproject between user agent and author shadows.
88 document()->addConsoleMessage(RenderingMessageSource, WarningMessageLeve l, message); 77 ShadowRoot* root = containingShadowRoot();
78 if (root && root->olderShadowRoot() && root->type() != root->olderShadow Root()->type()) {
79 String message = String::format("<shadow> doesn't work for %s elemen t host.", root->host()->tagName().utf8().data());
80 document()->addConsoleMessage(RenderingMessageSource, WarningMessage Level, message);
81 }
89 } 82 }
90 return InsertionPoint::insertedInto(insertionPoint); 83 return InsertionPoint::insertedInto(insertionPoint);
91 } 84 }
92 85
93 } // namespace WebCore 86 } // namespace WebCore
94 87
OLDNEW
« no previous file with comments | « Source/core/html/shadow/HTMLShadowElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698