Index: third_party/WebKit/Source/core/dom/PseudoElement.cpp |
diff --git a/third_party/WebKit/Source/core/dom/PseudoElement.cpp b/third_party/WebKit/Source/core/dom/PseudoElement.cpp |
index 1672b8600b09a7c432d66599f8dce9bbf0f2a27a..424e89ef1ae320566eedb4c4c705890a6fa2b75a 100644 |
--- a/third_party/WebKit/Source/core/dom/PseudoElement.cpp |
+++ b/third_party/WebKit/Source/core/dom/PseudoElement.cpp |
@@ -29,6 +29,7 @@ |
#include "core/dom/FirstLetterPseudoElement.h" |
#include "core/frame/UseCounter.h" |
#include "core/inspector/InspectorInstrumentation.h" |
+#include "core/layout/GeneratedChildren.h" |
#include "core/layout/LayoutObject.h" |
#include "core/layout/LayoutQuote.h" |
#include "core/style/ContentData.h" |
@@ -124,6 +125,13 @@ void PseudoElement::attach(const AttachContext& context) |
if (!layoutObject) |
return; |
+ // This is to ensure that bypassing the canHaveGeneratedChildren check in |
+ // StyleResolver::createPseudoElementIfNeeded does not result in the |
+ // backdrop pseudo element's layout object becoming the child of a layout |
+ // object that doesn't allow children. |
+ DCHECK(layoutObject->parent()); |
+ DCHECK(canHaveGeneratedChildren(*layoutObject->parent())); |
+ |
ComputedStyle& style = layoutObject->mutableStyleRef(); |
if (style.styleType() != PseudoIdBefore && style.styleType() != PseudoIdAfter) |
return; |