Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: Source/core/paint/PaintPhase.h

Issue 1236183003: Add 'printing' flag to PaintInfo (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Move flag to PaintInfo. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 PaintPhaseCollapsedTableBorders = 9, 50 PaintPhaseCollapsedTableBorders = 9,
51 PaintPhaseTextClip = 10, 51 PaintPhaseTextClip = 10,
52 PaintPhaseMask = 11, 52 PaintPhaseMask = 11,
53 PaintPhaseClippingMask = 12, 53 PaintPhaseClippingMask = 12,
54 PaintPhaseMax = PaintPhaseClippingMask, 54 PaintPhaseMax = PaintPhaseClippingMask,
55 // These values must be kept in sync with DisplayItem::Type and DisplayItem: :typeAsDebugString(). 55 // These values must be kept in sync with DisplayItem::Type and DisplayItem: :typeAsDebugString().
56 }; 56 };
57 57
58 enum PaintBehaviorFlags { 58 enum PaintBehaviorFlags {
59 PaintBehaviorNormal = 0, 59 PaintBehaviorNormal = 0,
60 // TODO(jchaffraix): Remove those 2 once we have migrated to GlobalPaintFlag s. 60 // TODO(jchaffraix): Remove those 3 once we have migrated to GlobalPaintFlag s.
61 PaintBehaviorSelectionOnly = 1 << 0, 61 PaintBehaviorSelectionOnly = 1 << 0,
62 PaintBehaviorPrintAdaption = 1 << 1,
62 PaintBehaviorFlattenCompositingLayers = 1 << 2, 63 PaintBehaviorFlattenCompositingLayers = 1 << 2,
63 PaintBehaviorRenderingClipPathAsMask = 1 << 3, 64 PaintBehaviorRenderingClipPathAsMask = 1 << 3,
64 PaintBehaviorSkipRootBackground = 1 << 4, 65 PaintBehaviorSkipRootBackground = 1 << 4,
65 PaintBehaviorRootBackgroundOnly = 1 << 5 66 PaintBehaviorRootBackgroundOnly = 1 << 5
66 }; 67 };
67 68
68 typedef unsigned PaintBehavior; 69 typedef unsigned PaintBehavior;
69 70
70 // Those flags are meant as global tree operations. This means 71 // Those flags are meant as global tree operations. This means
71 // that they should be constant for a paint phase. 72 // that they should be constant for a paint phase.
72 // TODO(jchaffraix): We should pass these as a const variable 73 // TODO(jchaffraix): We should pass these as a const variable
73 // during paint to ensure they are not modified. 74 // during paint to ensure they are not modified.
74 enum GlobalPaintFlag { 75 enum GlobalPaintFlag {
75 GlobalPaintNormalPhase = 0, 76 GlobalPaintNormalPhase = 0,
76 // Used when painting selection as part of a drag-image. This 77 // Used when painting selection as part of a drag-image. This
77 // flag disables a lot of the painting code and specifically 78 // flag disables a lot of the painting code and specifically
78 // triggers a PaintPhaseSelection. 79 // triggers a PaintPhaseSelection.
79 GlobalPaintSelectionOnly = 1 << 0, 80 GlobalPaintSelectionOnly = 1 << 0,
80 // Used when painting a drag-image or printing in order to 81 // Used when painting a drag-image or printing in order to
81 // ignore the hardware layers and paint the whole tree 82 // ignore the hardware layers and paint the whole tree
82 // into the topmost layer. 83 // into the topmost layer.
83 GlobalPaintFlattenCompositingLayers = 1 << 1 84 GlobalPaintFlattenCompositingLayers = 1 << 1,
85 // Used when printing in order to adapt the output to the medium, for
86 // instance by not painting shadows and selections on text, and add
87 // annotations for links.
Julien - ping for review 2015/07/15 17:14:25 Not sure what 'annotation for links' represents.
fs 2015/07/15 18:25:58 When I wrote this I was thinking about: https://c
88 GlobalPaintPrintAdaption = 1 << 2
Julien - ping for review 2015/07/15 17:14:25 Not a huge fan of "print adaption" (first TIL that
fs 2015/07/15 18:25:58 "Adaption" (or adaptation for the longer word) see
84 }; 89 };
85 90
86 typedef unsigned GlobalPaintFlags; 91 typedef unsigned GlobalPaintFlags;
87 92
88 // TODO(jchaffraix): This is a scaffolding as we roll in GlobalPaintFlags 93 // TODO(jchaffraix): This is a scaffolding as we roll in GlobalPaintFlags
89 // as a replacement for PaintBehavior. Remove when it's fully done. 94 // as a replacement for PaintBehavior. Remove when it's fully done.
90 inline PaintBehavior toPaintBehavior(GlobalPaintFlags flags) 95 inline PaintBehavior toPaintBehavior(GlobalPaintFlags flags)
91 { 96 {
92 PaintBehavior behavior = PaintBehaviorNormal; 97 PaintBehavior behavior = PaintBehaviorNormal;
93 if (flags & GlobalPaintSelectionOnly) 98 if (flags & GlobalPaintSelectionOnly)
94 behavior |= PaintBehaviorSelectionOnly; 99 behavior |= PaintBehaviorSelectionOnly;
95 if (flags & GlobalPaintFlattenCompositingLayers) 100 if (flags & GlobalPaintFlattenCompositingLayers)
96 behavior |= PaintBehaviorFlattenCompositingLayers; 101 behavior |= PaintBehaviorFlattenCompositingLayers;
102 if (flags & GlobalPaintPrintAdaption)
103 behavior |= PaintBehaviorPrintAdaption;
97 return behavior; 104 return behavior;
98 } 105 }
99 inline GlobalPaintFlags toGlobalPaintFlags(PaintBehavior behavior) 106 inline GlobalPaintFlags toGlobalPaintFlags(PaintBehavior behavior)
100 { 107 {
101 GlobalPaintFlags flags = GlobalPaintNormalPhase; 108 GlobalPaintFlags flags = GlobalPaintNormalPhase;
102 if (behavior & PaintBehaviorSelectionOnly) 109 if (behavior & PaintBehaviorSelectionOnly)
103 flags |= GlobalPaintSelectionOnly; 110 flags |= GlobalPaintSelectionOnly;
104 if (behavior & PaintBehaviorFlattenCompositingLayers) 111 if (behavior & PaintBehaviorFlattenCompositingLayers)
105 flags |= GlobalPaintFlattenCompositingLayers; 112 flags |= GlobalPaintFlattenCompositingLayers;
113 if (behavior & PaintBehaviorPrintAdaption)
114 flags |= GlobalPaintPrintAdaption;
106 return flags; 115 return flags;
107 } 116 }
108 117
109 } // namespace blink 118 } // namespace blink
110 119
111 #endif // PaintPhase_h 120 #endif // PaintPhase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698