• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR
33     , tapHighlightColor(RenderStyle::initialTapHighlightColor())
34 #endif
35     , textShadow(0)
36     , textSecurity(RenderStyle::initialTextSecurity())
37     , userModify(READ_ONLY)
38     , wordBreak(RenderStyle::initialWordBreak())
39     , wordWrap(RenderStyle::initialWordWrap())
40     , nbspMode(NBNORMAL)
41     , khtmlLineBreak(LBNORMAL)
42     , textSizeAdjust(RenderStyle::initialTextSizeAdjust())
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 #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR
54     , tapHighlightColor(o.tapHighlightColor)
55 #endif
56     , textShadow(o.textShadow ? new ShadowData(*o.textShadow) : 0)
57     , highlight(o.highlight)
58     , textSecurity(o.textSecurity)
59     , userModify(o.userModify)
60     , wordBreak(o.wordBreak)
61     , wordWrap(o.wordWrap)
62     , nbspMode(o.nbspMode)
63     , khtmlLineBreak(o.khtmlLineBreak)
64     , textSizeAdjust(o.textSizeAdjust)
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         && resize == o.resize
93         && userSelect == o.userSelect;
94 }
95 
shadowDataEquivalent(const StyleRareInheritedData & o) const96 bool StyleRareInheritedData::shadowDataEquivalent(const StyleRareInheritedData& o) const
97 {
98     if ((!textShadow && o.textShadow) || (textShadow && !o.textShadow))
99         return false;
100     if (textShadow && o.textShadow && (*textShadow != *o.textShadow))
101         return false;
102     return true;
103 }
104 
105 } // namespace WebCore
106