1 /* 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org) 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Library General Public 10 * License as published by the Free Software Foundation; either 11 * version 2 of the License, or (at your option) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Library General Public License for more details. 17 * 18 * You should have received a copy of the GNU Library General Public License 19 * along with this library; see the file COPYING.LIB. If not, write to 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 * Boston, MA 02110-1301, USA. 22 * 23 */ 24 25 #ifndef StyleRareInheritedData_h 26 #define StyleRareInheritedData_h 27 28 #include "core/css/StyleColor.h" 29 #include "core/rendering/style/DataRef.h" 30 #include "platform/Length.h" 31 #include "platform/graphics/Color.h" 32 #include "wtf/PassRefPtr.h" 33 #include "wtf/RefCounted.h" 34 #include "wtf/RefVector.h" 35 #include "wtf/text/AtomicString.h" 36 37 namespace WebCore { 38 39 class AppliedTextDecoration; 40 class CursorData; 41 class QuotesData; 42 class ShadowList; 43 class StyleImage; 44 45 typedef RefVector<AppliedTextDecoration> AppliedTextDecorationList; 46 typedef RefVector<CursorData> CursorList; 47 48 // This struct is for rarely used inherited CSS3, CSS2, and WebKit-specific properties. 49 // By grouping them together, we save space, and only allocate this object when someone 50 // actually uses one of these properties. 51 class StyleRareInheritedData : public RefCounted<StyleRareInheritedData> { 52 public: create()53 static PassRefPtr<StyleRareInheritedData> create() { return adoptRef(new StyleRareInheritedData); } copy()54 PassRefPtr<StyleRareInheritedData> copy() const { return adoptRef(new StyleRareInheritedData(*this)); } 55 ~StyleRareInheritedData(); 56 57 bool operator==(const StyleRareInheritedData& o) const; 58 bool operator!=(const StyleRareInheritedData& o) const 59 { 60 return !(*this == o); 61 } 62 bool shadowDataEquivalent(const StyleRareInheritedData&) const; 63 bool quotesDataEquivalent(const StyleRareInheritedData&) const; 64 65 RefPtr<StyleImage> listStyleImage; 66 textStrokeColor()67 StyleColor textStrokeColor() const { return m_textStrokeColorIsCurrentColor ? StyleColor::currentColor() : StyleColor(m_textStrokeColor); } textFillColor()68 StyleColor textFillColor() const { return m_textFillColorIsCurrentColor ? StyleColor::currentColor() : StyleColor(m_textFillColor); } textEmphasisColor()69 StyleColor textEmphasisColor() const { return m_textEmphasisColorIsCurrentColor ? StyleColor::currentColor() : StyleColor(m_textEmphasisColor); } visitedLinkTextStrokeColor()70 StyleColor visitedLinkTextStrokeColor() const { return m_visitedLinkTextStrokeColorIsCurrentColor ? StyleColor::currentColor() : StyleColor(m_visitedLinkTextStrokeColor); } visitedLinkTextFillColor()71 StyleColor visitedLinkTextFillColor() const { return m_visitedLinkTextFillColorIsCurrentColor ? StyleColor::currentColor() : StyleColor(m_visitedLinkTextFillColor); } visitedLinkTextEmphasisColor()72 StyleColor visitedLinkTextEmphasisColor() const { return m_visitedLinkTextEmphasisColorIsCurrentColor ? StyleColor::currentColor() : StyleColor(m_visitedLinkTextEmphasisColor); } 73 setTextStrokeColor(const StyleColor & color)74 void setTextStrokeColor(const StyleColor& color) { m_textStrokeColor = color.resolve(Color()); m_textStrokeColorIsCurrentColor = color.isCurrentColor(); } setTextFillColor(const StyleColor & color)75 void setTextFillColor(const StyleColor& color) { m_textFillColor = color.resolve(Color()); m_textFillColorIsCurrentColor = color.isCurrentColor(); } setTextEmphasisColor(const StyleColor & color)76 void setTextEmphasisColor(const StyleColor& color) { m_textEmphasisColor = color.resolve(Color()); m_textEmphasisColorIsCurrentColor = color.isCurrentColor(); } setVisitedLinkTextStrokeColor(const StyleColor & color)77 void setVisitedLinkTextStrokeColor(const StyleColor& color) { m_visitedLinkTextStrokeColor = color.resolve(Color()); m_visitedLinkTextStrokeColorIsCurrentColor = color.isCurrentColor(); } setVisitedLinkTextFillColor(const StyleColor & color)78 void setVisitedLinkTextFillColor(const StyleColor& color) { m_visitedLinkTextFillColor = color.resolve(Color()); m_visitedLinkTextFillColorIsCurrentColor = color.isCurrentColor(); } setVisitedLinkTextEmphasisColor(const StyleColor & color)79 void setVisitedLinkTextEmphasisColor(const StyleColor& color) { m_visitedLinkTextEmphasisColor = color.resolve(Color()); m_visitedLinkTextEmphasisColorIsCurrentColor = color.isCurrentColor(); } 80 81 Color m_textStrokeColor; 82 float textStrokeWidth; 83 Color m_textFillColor; 84 Color m_textEmphasisColor; 85 86 Color m_visitedLinkTextStrokeColor; 87 Color m_visitedLinkTextFillColor; 88 Color m_visitedLinkTextEmphasisColor; 89 90 RefPtr<ShadowList> textShadow; // Our text shadow information for shadowed text drawing. 91 AtomicString highlight; // Apple-specific extension for custom highlight rendering. 92 93 RefPtr<CursorList> cursorData; 94 Length indent; 95 float m_effectiveZoom; 96 97 // Paged media properties. 98 short widows; 99 short orphans; 100 unsigned m_hasAutoWidows : 1; 101 unsigned m_hasAutoOrphans : 1; 102 103 unsigned m_textStrokeColorIsCurrentColor : 1; 104 unsigned m_textFillColorIsCurrentColor : 1; 105 unsigned m_textEmphasisColorIsCurrentColor : 1; 106 unsigned m_visitedLinkTextStrokeColorIsCurrentColor : 1; 107 unsigned m_visitedLinkTextFillColorIsCurrentColor : 1; 108 unsigned m_visitedLinkTextEmphasisColorIsCurrentColor : 1; 109 110 unsigned textSecurity : 2; // ETextSecurity 111 unsigned userModify : 2; // EUserModify (editing) 112 unsigned wordBreak : 2; // EWordBreak 113 unsigned overflowWrap : 1; // EOverflowWrap 114 unsigned lineBreak : 3; // LineBreak 115 unsigned resize : 2; // EResize 116 unsigned userSelect : 2; // EUserSelect 117 unsigned speak : 3; // ESpeak 118 unsigned hyphens : 2; // Hyphens 119 unsigned textEmphasisFill : 1; // TextEmphasisFill 120 unsigned textEmphasisMark : 3; // TextEmphasisMark 121 unsigned textEmphasisPosition : 1; // TextEmphasisPosition 122 unsigned m_textAlignLast : 3; // TextAlignLast 123 unsigned m_textJustify : 2; // TextJustify 124 unsigned m_textOrientation : 2; // TextOrientation 125 unsigned m_textIndentLine : 1; // TextIndentEachLine 126 unsigned m_textIndentType : 1; // TextIndentHanging 127 unsigned m_lineBoxContain: 7; // LineBoxContain 128 // CSS Image Values Level 3 129 unsigned m_imageRendering : 2; // EImageRendering 130 unsigned m_textUnderlinePosition : 2; // TextUnderlinePosition 131 unsigned m_rubyPosition : 1; // RubyPosition 132 unsigned m_touchActionDelay : 1; // TouchActionDelay 133 134 // Though will-change is not itself an inherited property, the intent 135 // expressed by 'will-change: contents' includes descendants. 136 unsigned m_subtreeWillChangeContents : 1; 137 138 AtomicString hyphenationString; 139 short hyphenationLimitBefore; 140 short hyphenationLimitAfter; 141 short hyphenationLimitLines; 142 143 AtomicString locale; 144 145 AtomicString textEmphasisCustomMark; 146 RefPtr<QuotesData> quotes; 147 148 unsigned m_tabSize; 149 150 Color tapHighlightColor; 151 152 RefPtr<AppliedTextDecorationList> appliedTextDecorations; 153 154 private: 155 StyleRareInheritedData(); 156 StyleRareInheritedData(const StyleRareInheritedData&); 157 }; 158 159 } // namespace WebCore 160 161 #endif // StyleRareInheritedData_h 162