1 /*
2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 *
20 */
21
22 #include "config.h"
23 #include "StyleRareInheritedData.h"
24
25 #include "RenderStyle.h"
26 #include "RenderStyleConstants.h"
27
28 namespace WebCore {
29
StyleRareInheritedData()30 StyleRareInheritedData::StyleRareInheritedData()
31 : textStrokeWidth(RenderStyle::initialTextStrokeWidth())
32 , textShadow(0)
33 , textSecurity(RenderStyle::initialTextSecurity())
34 , userModify(READ_ONLY)
35 , wordBreak(RenderStyle::initialWordBreak())
36 , wordWrap(RenderStyle::initialWordWrap())
37 , nbspMode(NBNORMAL)
38 , khtmlLineBreak(LBNORMAL)
39 , textSizeAdjust(RenderStyle::initialTextSizeAdjust())
40 #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR
41 , tapHighlightColor(RenderStyle::initialTapHighlightColor())
42 #endif
43 , resize(RenderStyle::initialResize())
44 , userSelect(RenderStyle::initialUserSelect())
45 {
46 }
47
StyleRareInheritedData(const StyleRareInheritedData & o)48 StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o)
49 : RefCounted<StyleRareInheritedData>()
50 , textStrokeColor(o.textStrokeColor)
51 , textStrokeWidth(o.textStrokeWidth)
52 , textFillColor(o.textFillColor)
53 , textShadow(o.textShadow ? new ShadowData(*o.textShadow) : 0)
54 , highlight(o.highlight)
55 , textSecurity(o.textSecurity)
56 , userModify(o.userModify)
57 , wordBreak(o.wordBreak)
58 , wordWrap(o.wordWrap)
59 , nbspMode(o.nbspMode)
60 , khtmlLineBreak(o.khtmlLineBreak)
61 , textSizeAdjust(o.textSizeAdjust)
62 #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR
63 , tapHighlightColor(o.tapHighlightColor)
64 #endif
65 , resize(o.resize)
66 , userSelect(o.userSelect)
67 {
68 }
69
~StyleRareInheritedData()70 StyleRareInheritedData::~StyleRareInheritedData()
71 {
72 delete textShadow;
73 }
74
operator ==(const StyleRareInheritedData & o) const75 bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const
76 {
77 return textStrokeColor == o.textStrokeColor
78 && textStrokeWidth == o.textStrokeWidth
79 && textFillColor == o.textFillColor
80 && shadowDataEquivalent(o)
81 && highlight == o.highlight
82 && textSecurity == o.textSecurity
83 && userModify == o.userModify
84 && wordBreak == o.wordBreak
85 && wordWrap == o.wordWrap
86 && nbspMode == o.nbspMode
87 && khtmlLineBreak == o.khtmlLineBreak
88 && textSizeAdjust == o.textSizeAdjust
89 #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR
90 && tapHighlightColor == o.tapHighlightColor
91 #endif
92 && userSelect == o.userSelect;
93 }
94
shadowDataEquivalent(const StyleRareInheritedData & o) const95 bool StyleRareInheritedData::shadowDataEquivalent(const StyleRareInheritedData& o) const
96 {
97 if (!textShadow && o.textShadow || textShadow && !o.textShadow)
98 return false;
99 if (textShadow && o.textShadow && (*textShadow != *o.textShadow))
100 return false;
101 return true;
102 }
103
104 } // namespace WebCore
105