| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) | 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
| 14 * | 14 * |
| 15 * You should have received a copy of the GNU Library General Public License | 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 | 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, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
| 19 * | 19 * |
| 20 */ | 20 */ |
| 21 | 21 |
| 22 #include "core/style/StyleRareInheritedData.h" | 22 #include "core/style/StyleRareInheritedData.h" |
| 23 | 23 |
| 24 #include "core/style/AppliedTextDecoration.h" | |
| 25 #include "core/style/CursorData.h" | |
| 26 #include "core/style/DataEquivalency.h" | |
| 27 #include "core/style/ComputedStyle.h" | |
| 28 #include "core/style/ComputedStyleConstants.h" | |
| 29 #include "core/style/QuotesData.h" | |
| 30 #include "core/style/ShadowList.h" | |
| 31 #include "core/style/StyleImage.h" | |
| 32 #include "core/style/StyleVariableData.h" | |
| 33 | |
| 34 namespace blink { | 24 namespace blink { |
| 35 | 25 |
| 36 struct SameSizeAsStyleRareInheritedData : public RefCounted<SameSizeAsStyleRareI
nheritedData> { | |
| 37 void* styleImage; | |
| 38 Color firstColor; | |
| 39 float firstFloat; | |
| 40 Color colors[5]; | |
| 41 void* ownPtrs[1]; | |
| 42 AtomicString atomicStrings[3]; | |
| 43 void* refPtrs[1]; | |
| 44 Persistent<void*> persistentHandles[2]; | |
| 45 Length lengths[1]; | |
| 46 float secondFloat; | |
| 47 unsigned m_bitfields[2]; | |
| 48 short pagedMediaShorts[2]; | |
| 49 short hyphenationShorts[3]; | |
| 50 uint8_t snapHeight; | |
| 51 | |
| 52 Color touchColors; | |
| 53 TabSize tabSize; | |
| 54 void* variables[1]; | |
| 55 TextSizeAdjust textSizeAdjust; | |
| 56 }; | |
| 57 | |
| 58 static_assert(sizeof(StyleRareInheritedData) <= sizeof(SameSizeAsStyleRareInheri
tedData), "StyleRareInheritedData should stay small"); | |
| 59 | |
| 60 StyleRareInheritedData::StyleRareInheritedData() | 26 StyleRareInheritedData::StyleRareInheritedData() |
| 61 : listStyleImage(ComputedStyle::initialListStyleImage()) | 27 : m_textStrokeColorIsCurrentColor(true) |
| 62 , textStrokeWidth(ComputedStyle::initialTextStrokeWidth()) | |
| 63 , indent(ComputedStyle::initialTextIndent()) | |
| 64 , m_effectiveZoom(ComputedStyle::initialZoom()) | |
| 65 , widows(ComputedStyle::initialWidows()) | |
| 66 , orphans(ComputedStyle::initialOrphans()) | |
| 67 , m_textStrokeColorIsCurrentColor(true) | |
| 68 , m_textFillColorIsCurrentColor(true) | |
| 69 , m_textEmphasisColorIsCurrentColor(true) | |
| 70 , m_visitedLinkTextStrokeColorIsCurrentColor(true) | |
| 71 , m_visitedLinkTextFillColorIsCurrentColor(true) | 28 , m_visitedLinkTextFillColorIsCurrentColor(true) |
| 72 , m_visitedLinkTextEmphasisColorIsCurrentColor(true) | 29 , m_textDecorationColor(StyleColor::currentColor()) |
| 73 , textSecurity(ComputedStyle::initialTextSecurity()) | 30 , m_visitedLinkTextDecorationColor(StyleColor::currentColor()) |
| 74 , userModify(READ_ONLY) | |
| 75 , wordBreak(ComputedStyle::initialWordBreak()) | |
| 76 , overflowWrap(ComputedStyle::initialOverflowWrap()) | |
| 77 , lineBreak(LineBreakAuto) | |
| 78 , userSelect(ComputedStyle::initialUserSelect()) | |
| 79 , speak(SpeakNormal) | |
| 80 , hyphens(HyphensManual) | |
| 81 , textEmphasisFill(TextEmphasisFillFilled) | |
| 82 , textEmphasisMark(TextEmphasisMarkNone) | |
| 83 , textEmphasisPosition(TextEmphasisPositionOver) | |
| 84 , m_textAlignLast(ComputedStyle::initialTextAlignLast()) | |
| 85 , m_textJustify(ComputedStyle::initialTextJustify()) | |
| 86 , m_textOrientation(TextOrientationMixed) | |
| 87 , m_textCombine(ComputedStyle::initialTextCombine()) | |
| 88 , m_textIndentLine(ComputedStyle::initialTextIndentLine()) | |
| 89 , m_textIndentType(ComputedStyle::initialTextIndentLine()) | |
| 90 , m_imageRendering(ComputedStyle::initialImageRendering()) | |
| 91 , m_textUnderlinePosition(ComputedStyle::initialTextUnderlinePosition()) | |
| 92 , m_rubyPosition(ComputedStyle::initialRubyPosition()) | |
| 93 , m_subtreeWillChangeContents(false) | |
| 94 , m_selfOrAncestorHasDirAutoAttribute(false) | |
| 95 , m_respectImageOrientation(false) | |
| 96 , m_snapHeightPosition(0) | |
| 97 , hyphenationLimitBefore(-1) | |
| 98 , hyphenationLimitAfter(-1) | |
| 99 , hyphenationLimitLines(-1) | |
| 100 , m_snapHeightUnit(0) | |
| 101 , tapHighlightColor(ComputedStyle::initialTapHighlightColor()) | |
| 102 , m_tabSize(ComputedStyle::initialTabSize()) | |
| 103 , m_textSizeAdjust(ComputedStyle::initialTextSizeAdjust()) | |
| 104 { | 31 { |
| 105 } | 32 } |
| 106 | 33 |
| 107 StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o) | |
| 108 : RefCounted<StyleRareInheritedData>() | |
| 109 , listStyleImage(o.listStyleImage) | |
| 110 , m_textStrokeColor(o.m_textStrokeColor) | |
| 111 , textStrokeWidth(o.textStrokeWidth) | |
| 112 , m_textFillColor(o.m_textFillColor) | |
| 113 , m_textEmphasisColor(o.m_textEmphasisColor) | |
| 114 , m_visitedLinkTextStrokeColor(o.m_visitedLinkTextStrokeColor) | |
| 115 , m_visitedLinkTextFillColor(o.m_visitedLinkTextFillColor) | |
| 116 , m_visitedLinkTextEmphasisColor(o.m_visitedLinkTextEmphasisColor) | |
| 117 , textShadow(o.textShadow) | |
| 118 , highlight(o.highlight) | |
| 119 , cursorData(o.cursorData) | |
| 120 , indent(o.indent) | |
| 121 , m_effectiveZoom(o.m_effectiveZoom) | |
| 122 , widows(o.widows) | |
| 123 , orphans(o.orphans) | |
| 124 , m_textStrokeColorIsCurrentColor(o.m_textStrokeColorIsCurrentColor) | |
| 125 , m_textFillColorIsCurrentColor(o.m_textFillColorIsCurrentColor) | |
| 126 , m_textEmphasisColorIsCurrentColor(o.m_textEmphasisColorIsCurrentColor) | |
| 127 , m_visitedLinkTextStrokeColorIsCurrentColor(o.m_visitedLinkTextStrokeColorI
sCurrentColor) | |
| 128 , m_visitedLinkTextFillColorIsCurrentColor(o.m_visitedLinkTextFillColorIsCur
rentColor) | |
| 129 , m_visitedLinkTextEmphasisColorIsCurrentColor(o.m_visitedLinkTextEmphasisCo
lorIsCurrentColor) | |
| 130 , textSecurity(o.textSecurity) | |
| 131 , userModify(o.userModify) | |
| 132 , wordBreak(o.wordBreak) | |
| 133 , overflowWrap(o.overflowWrap) | |
| 134 , lineBreak(o.lineBreak) | |
| 135 , userSelect(o.userSelect) | |
| 136 , speak(o.speak) | |
| 137 , hyphens(o.hyphens) | |
| 138 , textEmphasisFill(o.textEmphasisFill) | |
| 139 , textEmphasisMark(o.textEmphasisMark) | |
| 140 , textEmphasisPosition(o.textEmphasisPosition) | |
| 141 , m_textAlignLast(o.m_textAlignLast) | |
| 142 , m_textJustify(o.m_textJustify) | |
| 143 , m_textOrientation(o.m_textOrientation) | |
| 144 , m_textCombine(o.m_textCombine) | |
| 145 , m_textIndentLine(o.m_textIndentLine) | |
| 146 , m_textIndentType(o.m_textIndentType) | |
| 147 , m_imageRendering(o.m_imageRendering) | |
| 148 , m_textUnderlinePosition(o.m_textUnderlinePosition) | |
| 149 , m_rubyPosition(o.m_rubyPosition) | |
| 150 , m_subtreeWillChangeContents(o.m_subtreeWillChangeContents) | |
| 151 , m_selfOrAncestorHasDirAutoAttribute(o.m_selfOrAncestorHasDirAutoAttribute) | |
| 152 , m_respectImageOrientation(o.m_respectImageOrientation) | |
| 153 , m_snapHeightPosition(o.m_snapHeightPosition) | |
| 154 , hyphenationString(o.hyphenationString) | |
| 155 , hyphenationLimitBefore(o.hyphenationLimitBefore) | |
| 156 , hyphenationLimitAfter(o.hyphenationLimitAfter) | |
| 157 , hyphenationLimitLines(o.hyphenationLimitLines) | |
| 158 , m_snapHeightUnit(o.m_snapHeightUnit) | |
| 159 , textEmphasisCustomMark(o.textEmphasisCustomMark) | |
| 160 , tapHighlightColor(o.tapHighlightColor) | |
| 161 , appliedTextDecorations(o.appliedTextDecorations) | |
| 162 , m_tabSize(o.m_tabSize) | |
| 163 , variables(o.variables) | |
| 164 , m_textSizeAdjust(o.m_textSizeAdjust) | |
| 165 { | |
| 166 } | |
| 167 | |
| 168 StyleRareInheritedData::~StyleRareInheritedData() | 34 StyleRareInheritedData::~StyleRareInheritedData() |
| 169 { | 35 { |
| 170 } | 36 } |
| 171 | 37 |
| 172 bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const | 38 const RGBA32 Color::black; |
| 39 const RGBA32 Color::transparent; |
| 40 |
| 41 RGBA32 makeRGB(int r, int g, int b) |
| 173 { | 42 { |
| 174 return m_textStrokeColor == o.m_textStrokeColor | 43 //return 0xFF000000 | clampTo(r, 0, 255) << 16 | clampTo(g, 0, 255) << 8 | c
lampTo(b, 0, 255); |
| 175 && textStrokeWidth == o.textStrokeWidth | 44 return 0xFF000000 | r << 16 | g << 8 | b; |
| 176 && m_textFillColor == o.m_textFillColor | |
| 177 && m_textEmphasisColor == o.m_textEmphasisColor | |
| 178 && m_visitedLinkTextStrokeColor == o.m_visitedLinkTextStrokeColor | |
| 179 && m_visitedLinkTextFillColor == o.m_visitedLinkTextFillColor | |
| 180 && m_visitedLinkTextEmphasisColor == o.m_visitedLinkTextEmphasisColor | |
| 181 && tapHighlightColor == o.tapHighlightColor | |
| 182 && shadowDataEquivalent(o) | |
| 183 && highlight == o.highlight | |
| 184 && dataEquivalent(cursorData.get(), o.cursorData.get()) | |
| 185 && indent == o.indent | |
| 186 && m_effectiveZoom == o.m_effectiveZoom | |
| 187 && widows == o.widows | |
| 188 && orphans == o.orphans | |
| 189 && m_textStrokeColorIsCurrentColor == o.m_textStrokeColorIsCurrentColor | |
| 190 && m_textFillColorIsCurrentColor == o.m_textFillColorIsCurrentColor | |
| 191 && m_textEmphasisColorIsCurrentColor == o.m_textEmphasisColorIsCurrentCo
lor | |
| 192 && m_visitedLinkTextStrokeColorIsCurrentColor == o.m_visitedLinkTextStro
keColorIsCurrentColor | |
| 193 && m_visitedLinkTextFillColorIsCurrentColor == o.m_visitedLinkTextFillCo
lorIsCurrentColor | |
| 194 && m_visitedLinkTextEmphasisColorIsCurrentColor == o.m_visitedLinkTextEm
phasisColorIsCurrentColor | |
| 195 && textSecurity == o.textSecurity | |
| 196 && userModify == o.userModify | |
| 197 && wordBreak == o.wordBreak | |
| 198 && overflowWrap == o.overflowWrap | |
| 199 && lineBreak == o.lineBreak | |
| 200 && userSelect == o.userSelect | |
| 201 && speak == o.speak | |
| 202 && hyphens == o.hyphens | |
| 203 && hyphenationLimitBefore == o.hyphenationLimitBefore | |
| 204 && hyphenationLimitAfter == o.hyphenationLimitAfter | |
| 205 && hyphenationLimitLines == o.hyphenationLimitLines | |
| 206 && textEmphasisFill == o.textEmphasisFill | |
| 207 && textEmphasisMark == o.textEmphasisMark | |
| 208 && textEmphasisPosition == o.textEmphasisPosition | |
| 209 && m_textAlignLast == o.m_textAlignLast | |
| 210 && m_textJustify == o.m_textJustify | |
| 211 && m_textOrientation == o.m_textOrientation | |
| 212 && m_textCombine == o.m_textCombine | |
| 213 && m_textIndentLine == o.m_textIndentLine | |
| 214 && m_textIndentType == o.m_textIndentType | |
| 215 && m_subtreeWillChangeContents == o.m_subtreeWillChangeContents | |
| 216 && m_selfOrAncestorHasDirAutoAttribute == o.m_selfOrAncestorHasDirAutoAt
tribute | |
| 217 && m_respectImageOrientation == o.m_respectImageOrientation | |
| 218 && m_snapHeightPosition == o.m_snapHeightPosition | |
| 219 && hyphenationString == o.hyphenationString | |
| 220 && m_snapHeightUnit == o.m_snapHeightUnit | |
| 221 && textEmphasisCustomMark == o.textEmphasisCustomMark | |
| 222 && quotesDataEquivalent(o) | |
| 223 && m_tabSize == o.m_tabSize | |
| 224 && m_imageRendering == o.m_imageRendering | |
| 225 && m_textUnderlinePosition == o.m_textUnderlinePosition | |
| 226 && m_rubyPosition == o.m_rubyPosition | |
| 227 && dataEquivalent(listStyleImage.get(), o.listStyleImage.get()) | |
| 228 && dataEquivalent(appliedTextDecorations, o.appliedTextDecorations) | |
| 229 && dataEquivalent(variables, o.variables) | |
| 230 && m_textSizeAdjust == o.m_textSizeAdjust; | |
| 231 } | |
| 232 | |
| 233 bool StyleRareInheritedData::shadowDataEquivalent(const StyleRareInheritedData&
o) const | |
| 234 { | |
| 235 return dataEquivalent(textShadow.get(), o.textShadow.get()); | |
| 236 } | |
| 237 | |
| 238 bool StyleRareInheritedData::quotesDataEquivalent(const StyleRareInheritedData&
o) const | |
| 239 { | |
| 240 return dataEquivalent(quotes, o.quotes); | |
| 241 } | 45 } |
| 242 | 46 |
| 243 } // namespace blink | 47 } // namespace blink |
| OLD | NEW |