1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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 nsIPresShellInlines_h
8 #define nsIPresShellInlines_h
9 
10 #include "nsIDocument.h"
11 
SetNeedLayoutFlush()12 void nsIPresShell::SetNeedLayoutFlush() {
13   mNeedLayoutFlush = true;
14   if (nsIDocument* doc = mDocument->GetDisplayDocument()) {
15     if (nsIPresShell* shell = doc->GetShell()) {
16       shell->mNeedLayoutFlush = true;
17     }
18   }
19 
20 #ifdef MOZ_GECKO_PROFILER
21   if (!mReflowCause) {
22     mReflowCause = profiler_get_backtrace();
23   }
24 #endif
25 }
26 
SetNeedStyleFlush()27 void nsIPresShell::SetNeedStyleFlush() {
28   mNeedStyleFlush = true;
29   if (nsIDocument* doc = mDocument->GetDisplayDocument()) {
30     if (nsIPresShell* shell = doc->GetShell()) {
31       shell->mNeedStyleFlush = true;
32     }
33   }
34 
35 #ifdef MOZ_GECKO_PROFILER
36   if (!mStyleCause) {
37     mStyleCause = profiler_get_backtrace();
38   }
39 #endif
40 }
41 
EnsureStyleFlush()42 void nsIPresShell::EnsureStyleFlush() {
43   SetNeedStyleFlush();
44   ObserveStyleFlushes();
45 }
46 
SetNeedThrottledAnimationFlush()47 void nsIPresShell::SetNeedThrottledAnimationFlush() {
48   mNeedThrottledAnimationFlush = true;
49   if (nsIDocument* doc = mDocument->GetDisplayDocument()) {
50     if (nsIPresShell* shell = doc->GetShell()) {
51       shell->mNeedThrottledAnimationFlush = true;
52     }
53   }
54 }
55 
56 #endif  // nsIPresShellInlines_h
57