LCOV - app.info - objdir/dist/include/nsChangeHint.h

LCOV - code coverage report
| Current view: | directory - objdir/dist/include - nsChangeHint.h (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 5 | 0 | 0.0 %
| Date: | 2012-07-07 | Functions: | 1 | 0 | 0.0 %

           1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
           2                 : /* ***** BEGIN LICENSE BLOCK *****
           3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
           4                 :  *
           5                 :  * The contents of this file are subject to the Mozilla Public License Version
           6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
           7                 :  * the License. You may obtain a copy of the License at
           8                 :  * http://www.mozilla.org/MPL/
           9                 :  *
          10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
          11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
          12                 :  * for the specific language governing rights and limitations under the
          13                 :  * License.
          14                 :  *
          15                 :  * The Original Code is mozilla.org code.
          16                 :  *
          17                 :  * The Initial Developer of the Original Code is
          18                 :  * Netscape Communications Corporation.
          19                 :  * Portions created by the Initial Developer are Copyright (C) 1998
          20                 :  * the Initial Developer. All Rights Reserved.
          21                 :  *
          22                 :  * Contributor(s):
          23                 :  *
          24                 :  * Alternatively, the contents of this file may be used under the terms of
          25                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
          26                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
          27                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
          28                 :  * of those above. If you wish to allow use of your version of this file only
          29                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
          30                 :  * use your version of this file under the terms of the MPL, indicate your
          31                 :  * decision by deleting the provisions above and replace them with the notice
          32                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
          33                 :  * the provisions above, a recipient may use your version of this file under
          34                 :  * the terms of any one of the MPL, the GPL or the LGPL.
          35                 :  *
          36                 :  * ***** END LICENSE BLOCK ***** */
          37                 :
          38                 : /* constants for what needs to be recomputed in response to style changes */
          39                 :
          40                 : #ifndef nsChangeHint_h___
          41                 : #define nsChangeHint_h___
          42                 :
          43                 : #include "prtypes.h"
          44                 :
          45                 : // Defines for various style related constants
          46                 :
          47                 : // For hints that don't guarantee that the change will be applied to all descendant
          48                 : // frames, style structs returning those hints from CalcDifference must have
          49                 : // their ForceCompare() return true.
          50                 :
          51                 : enum nsChangeHint {
          52                 :   // change was visual only (e.g., COLOR=)
          53                 :   // Invalidates all descendant frames (including following
          54                 :   // placeholders to out-of-flow frames).
          55                 :   nsChangeHint_RepaintFrame = 0x01,
          56                 :
          57                 :   // For reflow, we want flags to give us arbitrary FrameNeedsReflow behavior.
          58                 :   // just do a FrameNeedsReflow.
          59                 :   nsChangeHint_NeedReflow = 0x02,
          60                 :
          61                 :   // Invalidate intrinsic widths on the frame's ancestors.  Must not be set
          62                 :   // without setting nsChangeHint_NeedReflow.
          63                 :   nsChangeHint_ClearAncestorIntrinsics = 0x04,
          64                 :
          65                 :   // Invalidate intrinsic widths on the frame's descendants.  Must not be set
          66                 :   // without also setting nsChangeHint_ClearAncestorIntrinsics.
          67                 :   nsChangeHint_ClearDescendantIntrinsics = 0x08,
          68                 :
          69                 :   // Force unconditional reflow of all descendants.  Must not be set without
          70                 :   // setting nsChangeHint_NeedReflow, but is independent of both the
          71                 :   // Clear*Intrinsics flags.
          72                 :   nsChangeHint_NeedDirtyReflow = 0x10,
          73                 :
          74                 :   // change requires view to be updated, if there is one (e.g., clip:).
          75                 :   // Updates all descendants (including following placeholders to out-of-flows).
          76                 :   nsChangeHint_SyncFrameView = 0x20,
          77                 :
          78                 :   // The currently shown mouse cursor needs to be updated
          79                 :   nsChangeHint_UpdateCursor = 0x40,
          80                 :
          81                 :   /**
          82                 :    * SVG filter/mask/clip effects need to be recomputed because the URI
          83                 :    * in the filter/mask/clip-path property has changed. This wipes
          84                 :    * out cached nsSVGPropertyBase and subclasses which hold a reference to
          85                 :    * the element referenced by the URI, and a mutation observer for
          86                 :    * the DOM subtree rooted at that element. Also, for filters they store a
          87                 :    * bounding-box for the filter result so that if the filter changes we can
          88                 :    * invalidate the old covered area.
          89                 :    */
          90                 :   nsChangeHint_UpdateEffects = 0x80,
          91                 :
          92                 :   /**
          93                 :    * Visual change only, but the change can be handled entirely by
          94                 :    * updating the layer(s) for the frame.
          95                 :    * Updates all descendants (including following placeholders to out-of-flows).
          96                 :    */
          97                 :   nsChangeHint_UpdateOpacityLayer = 0x100,
          98                 :   /**
          99                 :    * Updates all descendants. Any placeholder descendants' out-of-flows
         100                 :    * are also descendants of the transformed frame, so they're updated.
         101                 :    */
         102                 :   nsChangeHint_UpdateTransformLayer = 0x200,
         103                 :
         104                 :   /**
         105                 :    * Change requires frame change (e.g., display:).
         106                 :    * This subsumes all the above. Reconstructs all frame descendants,
         107                 :    * including following placeholders to out-of-flows.
         108                 :    */
         109                 :   nsChangeHint_ReconstructFrame = 0x400,
         110                 :
         111                 :   /**
         112                 :    * The frame's effect on its ancestors' overflow areas has changed,
         113                 :    * either through a change in its transform or a change in its position.
         114                 :    * Does not update any descendant frames.
         115                 :    */
         116                 :   nsChangeHint_UpdateOverflow = 0x800
         117                 : };
         118                 :
         119                 : // Redefine these operators to return nothing. This will catch any use
         120                 : // of these operators on hints. We should not be using these operators
         121                 : // on nsChangeHints
         122                 : inline void operator<(nsChangeHint s1, nsChangeHint s2) {}
         123                 : inline void operator>(nsChangeHint s1, nsChangeHint s2) {}
         124                 : inline void operator!=(nsChangeHint s1, nsChangeHint s2) {}
         125                 : inline void operator==(nsChangeHint s1, nsChangeHint s2) {}
         126                 : inline void operator<=(nsChangeHint s1, nsChangeHint s2) {}
         127                 : inline void operator>=(nsChangeHint s1, nsChangeHint s2) {}
         128                 :
         129                 : // Operators on nsChangeHints
         130                 :
         131                 : // Merge two hints, taking the union
         132                 : inline nsChangeHint NS_CombineHint(nsChangeHint aH1, nsChangeHint aH2) {
         133                 :   return (nsChangeHint)(aH1 | aH2);
         134                 : }
         135                 :
         136                 : // Merge two hints, taking the union
         137                 : inline nsChangeHint NS_SubtractHint(nsChangeHint aH1, nsChangeHint aH2) {
         138                 :   return (nsChangeHint)(aH1 & ~aH2);
         139                 : }
         140                 :
         141                 : // Merge the "src" hint into the "dst" hint
         142                 : // Returns true iff the destination changed
         143               0 : inline bool NS_UpdateHint(nsChangeHint& aDest, nsChangeHint aSrc) {
         144               0 :   nsChangeHint r = (nsChangeHint)(aDest | aSrc);
         145               0 :   bool changed = (int)r != (int)aDest;
         146               0 :   aDest = r;
         147               0 :   return changed;
         148                 : }
         149                 :
         150                 : // Returns true iff the second hint contains all the hints of the first hint
         151                 : inline bool NS_IsHintSubset(nsChangeHint aSubset, nsChangeHint aSuperSet) {
         152                 :   return (aSubset & aSuperSet) == aSubset;
         153                 : }
         154                 :
         155                 : // Redefine the old NS_STYLE_HINT constants in terms of the new hint structure
         156                 : #define NS_STYLE_HINT_NONE \
         157                 :   nsChangeHint(0)
         158                 : #define NS_STYLE_HINT_VISUAL \
         159                 :   nsChangeHint(nsChangeHint_RepaintFrame | nsChangeHint_SyncFrameView)
         160                 : #define nsChangeHint_ReflowFrame                        \
         161                 :   nsChangeHint(nsChangeHint_NeedReflow |                \
         162                 :                nsChangeHint_ClearAncestorIntrinsics |   \
         163                 :                nsChangeHint_ClearDescendantIntrinsics | \
         164                 :                nsChangeHint_NeedDirtyReflow)
         165                 : #define NS_STYLE_HINT_REFLOW \
         166                 :   nsChangeHint(NS_STYLE_HINT_VISUAL | nsChangeHint_ReflowFrame)
         167                 : #define NS_STYLE_HINT_FRAMECHANGE \
         168                 :   nsChangeHint(NS_STYLE_HINT_REFLOW | nsChangeHint_ReconstructFrame)
         169                 :
         170                 : /**
         171                 :  * |nsRestyleHint| is a bitfield for the result of
         172                 :  * |HasStateDependentStyle| and |HasAttributeDependentStyle|.  When no
         173                 :  * restyling is necessary, use |nsRestyleHint(0)|.
         174                 :  */
         175                 : enum nsRestyleHint {
         176                 :   eRestyle_Self = 0x1,
         177                 :   eRestyle_Subtree = 0x2, /* self and descendants */
         178                 :   eRestyle_LaterSiblings = 0x4 /* implies "and descendants" */
         179                 : };
         180                 :
         181                 :
         182                 : #endif /* nsChangeHint_h___ */

Generated by: LCOV version 1.7