nsHtml5AutoPauseUpdate.h (887B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=2 sw=2 et tw=78: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef nsHtml5AutoPauseUpdate_h 8 #define nsHtml5AutoPauseUpdate_h 9 10 #include "nsHtml5DocumentBuilder.h" 11 12 class MOZ_RAII nsHtml5AutoPauseUpdate final { 13 private: 14 RefPtr<nsHtml5DocumentBuilder> mBuilder; 15 16 public: 17 explicit nsHtml5AutoPauseUpdate(nsHtml5DocumentBuilder* aBuilder) 18 : mBuilder(aBuilder) { 19 mBuilder->EndDocUpdate(); 20 } 21 ~nsHtml5AutoPauseUpdate() { 22 // Something may have terminated the parser during the update pause. 23 if (!mBuilder->IsComplete()) { 24 mBuilder->BeginDocUpdate(); 25 } 26 } 27 }; 28 29 #endif // nsHtml5AutoPauseUpdate_h