1 | /* |
2 | * Copyright (C) 2015 Apple Inc. All rights reserved. |
3 | * |
4 | * Redistribution and use in source and binary forms, with or without |
5 | * modification, are permitted provided that the following conditions |
6 | * are met: |
7 | * 1. Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. |
9 | * 2. Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. |
12 | * |
13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 | */ |
25 | |
26 | #include "config.h" |
27 | #include "RenderStyleConstants.h" |
28 | |
29 | #include <wtf/text/TextStream.h> |
30 | |
31 | namespace WebCore { |
32 | |
33 | TextStream& operator<<(TextStream& ts, Visibility visibility) |
34 | { |
35 | switch (visibility) { |
36 | case Visibility::Visible: ts << "visible" ; break; |
37 | case Visibility::Hidden: ts << "hidden" ; break; |
38 | case Visibility::Collapse: ts << "collapse" ; break; |
39 | } |
40 | |
41 | return ts; |
42 | } |
43 | |
44 | TextStream& operator<<(TextStream& ts, ImageRendering imageRendering) |
45 | { |
46 | switch (imageRendering) { |
47 | case ImageRendering::Auto: ts << "auto" ; break; |
48 | case ImageRendering::OptimizeSpeed: ts << "optimizeSpeed" ; break; |
49 | case ImageRendering::OptimizeQuality: ts << "optimizeQuality" ; break; |
50 | case ImageRendering::CrispEdges: ts << "crispEdges" ; break; |
51 | case ImageRendering::Pixelated: ts << "pixelated" ; break; |
52 | } |
53 | |
54 | return ts; |
55 | } |
56 | |
57 | TextStream& operator<<(TextStream& ts, FillSizeType sizeType) |
58 | { |
59 | switch (sizeType) { |
60 | case FillSizeType::Contain: ts << "contain" ; break; |
61 | case FillSizeType::Cover: ts << "cover" ; break; |
62 | case FillSizeType::Size: ts << "size-length" ; break; |
63 | case FillSizeType::None: ts << "size-none" ; break; |
64 | } |
65 | |
66 | return ts; |
67 | } |
68 | |
69 | TextStream& operator<<(TextStream& ts, FillAttachment attachment) |
70 | { |
71 | switch (attachment) { |
72 | case FillAttachment::ScrollBackground: ts << "scroll" ; break; |
73 | case FillAttachment::LocalBackground: ts << "local" ; break; |
74 | case FillAttachment::FixedBackground: ts << "fixed" ; break; |
75 | } |
76 | return ts; |
77 | } |
78 | |
79 | TextStream& operator<<(TextStream& ts, FillBox fill) |
80 | { |
81 | switch (fill) { |
82 | case FillBox::Border: ts << "border" ; break; |
83 | case FillBox::Padding: ts << "padding" ; break; |
84 | case FillBox::Content: ts << "content" ; break; |
85 | case FillBox::Text: ts << "text" ; break; |
86 | } |
87 | return ts; |
88 | } |
89 | |
90 | TextStream& operator<<(TextStream& ts, FillRepeat repeat) |
91 | { |
92 | switch (repeat) { |
93 | case FillRepeat::Repeat: ts << "repeat" ; break; |
94 | case FillRepeat::NoRepeat: ts << "no-repeat" ; break; |
95 | case FillRepeat::Round: ts << "round" ; break; |
96 | case FillRepeat::Space: ts << "space" ; break; |
97 | } |
98 | |
99 | return ts; |
100 | } |
101 | |
102 | TextStream& operator<<(TextStream& ts, MaskSourceType maskSource) |
103 | { |
104 | switch (maskSource) { |
105 | case MaskSourceType::Alpha: ts << "alpha" ; break; |
106 | case MaskSourceType::Luminance: ts << "luminance" ; break; |
107 | } |
108 | |
109 | return ts; |
110 | } |
111 | |
112 | TextStream& operator<<(TextStream& ts, Edge edge) |
113 | { |
114 | switch (edge) { |
115 | case Edge::Top: ts << "top" ; break; |
116 | case Edge::Right: ts << "right" ; break; |
117 | case Edge::Bottom: ts << "bottom" ; break; |
118 | case Edge::Left: ts << "left" ; break; |
119 | } |
120 | return ts; |
121 | } |
122 | |
123 | bool alwaysPageBreak(BreakBetween between) |
124 | { |
125 | return between >= BreakBetween::Page; |
126 | } |
127 | |
128 | const float defaultMiterLimit = 4; |
129 | |
130 | } // namespace WebCore |
131 | |