Index: third_party/WebKit/Source/core/frame/LocalFrame.cpp |
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.cpp b/third_party/WebKit/Source/core/frame/LocalFrame.cpp |
index 3eefa4fb1b4e989b32a932a7221951863416ce44..af2d790a62a58feef4a6202c0b3a1b1600da890e 100644 |
--- a/third_party/WebKit/Source/core/frame/LocalFrame.cpp |
+++ b/third_party/WebKit/Source/core/frame/LocalFrame.cpp |
@@ -572,6 +572,27 @@ void LocalFrame::DidChangeVisibilityState() { |
Frame::DidChangeVisibilityState(); |
} |
+void LocalFrame::SetIsInert(bool inert) { |
+ is_inert_ = inert; |
+ PropagateInertToChildFrames(); |
+} |
+ |
+void LocalFrame::PropagateInertToChildFrames() { |
+ for (Frame* child = Tree().FirstChild(); child; |
+ child = child->Tree().NextSibling()) { |
+ if (child->Owner()) { |
+ DCHECK(child->Owner()->IsLocal()); |
+ // Only propagate if there is a change to the child's inert bit. This |
+ // prevents redundant recursions through the Frame tree during style |
+ // calculation. |
+ bool new_value = |
+ is_inert_ || ToHTMLFrameOwnerElement(child->Owner())->IsInert(); |
+ if (new_value != child->IsInert()) |
+ child->SetIsInert(new_value); |
+ } |
+ } |
+} |
+ |
LocalFrame& LocalFrame::LocalFrameRoot() const { |
const LocalFrame* cur_frame = this; |
while (cur_frame && cur_frame->Tree().Parent() && |
@@ -899,6 +920,7 @@ inline LocalFrame::LocalFrame(LocalFrameClient* client, |
page_zoom_factor_(ParentPageZoomFactor(this)), |
text_zoom_factor_(ParentTextZoomFactor(this)), |
in_view_source_mode_(false), |
+ is_inert_(false), |
interface_provider_(interface_provider), |
interface_registry_(interface_registry) { |
if (IsLocalRoot()) { |