| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| 11 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
| 12 * | 12 * |
| 13 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 * Library General Public License for more details. | 16 * Library General Public License for more details. |
| 17 * | 17 * |
| 18 * You should have received a copy of the GNU Library General Public License | 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 | 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, | 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 21 * Boston, MA 02110-1301, USA. | 21 * Boston, MA 02110-1301, USA. |
| 22 * | 22 * |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #ifndef StyleRareNonInheritedData_h | 25 #ifndef StyleRareNonInheritedData_h |
| 26 #define StyleRareNonInheritedData_h | 26 #define StyleRareNonInheritedData_h |
| 27 | 27 |
| 28 #include "core/CoreExport.h" | 28 #include "core/CoreExport.h" |
| 29 #include "core/css/StyleColor.h" | 29 #include "core/css/StyleColor.h" |
| 30 #include "core/style/ClipPathOperation.h" | |
| 31 #include "core/style/ComputedStyleConstants.h" | |
| 32 #include "core/style/CounterDirectives.h" | |
| 33 #include "core/style/DataPersistent.h" | |
| 34 #include "core/style/DataRef.h" | |
| 35 #include "core/style/FillLayer.h" | |
| 36 #include "core/style/LineClampValue.h" | |
| 37 #include "core/style/NinePieceImage.h" | |
| 38 #include "core/style/ShapeValue.h" | |
| 39 #include "core/style/StyleContentAlignmentData.h" | |
| 40 #include "core/style/StyleScrollSnapData.h" | |
| 41 #include "core/style/StyleSelfAlignmentData.h" | |
| 42 #include "platform/LengthPoint.h" | |
| 43 #include "wtf/PassRefPtr.h" | 30 #include "wtf/PassRefPtr.h" |
| 44 #include "wtf/RefCounted.h" | 31 #include "wtf/RefCounted.h" |
| 45 #include "wtf/Vector.h" | |
| 46 #include <memory> | |
| 47 | 32 |
| 48 namespace blink { | 33 namespace blink { |
| 49 | 34 |
| 50 class ContentData; | |
| 51 class CSSAnimationData; | |
| 52 class CSSTransitionData; | |
| 53 class LengthSize; | |
| 54 class ShadowList; | |
| 55 class StyleDeprecatedFlexibleBoxData; | |
| 56 class StyleFilterData; | |
| 57 class StyleFlexibleBoxData; | |
| 58 class StyleGridData; | |
| 59 class StyleGridItemData; | |
| 60 class StyleMultiColData; | |
| 61 class StyleReflection; | |
| 62 class StyleTransformData; | |
| 63 class StyleWillChangeData; | |
| 64 | |
| 65 // Page size type. | |
| 66 // StyleRareNonInheritedData::m_pageSize is meaningful only when | |
| 67 // StyleRareNonInheritedData::m_pageSizeType is PAGE_SIZE_RESOLVED. | |
| 68 enum PageSizeType { | |
| 69 PAGE_SIZE_AUTO, // size: auto | |
| 70 PAGE_SIZE_AUTO_LANDSCAPE, // size: landscape | |
| 71 PAGE_SIZE_AUTO_PORTRAIT, // size: portrait | |
| 72 PAGE_SIZE_RESOLVED // Size is fully resolved. | |
| 73 }; | |
| 74 | |
| 75 // This struct is for rarely used non-inherited CSS3, CSS2, and WebKit-specific
properties. | |
| 76 // By grouping them together, we save space, and only allocate this object when
someone | |
| 77 // actually uses one of these properties. | |
| 78 // TODO(sashab): Move this into a private class on ComputedStyle, and remove | |
| 79 // all methods on it, merging them into copy/creation methods on ComputedStyle | |
| 80 // instead. Keep the allocation logic, only allocating a new object if needed. | |
| 81 class CORE_EXPORT StyleRareNonInheritedData : public RefCounted<StyleRareNonInhe
ritedData> { | |
| 82 public: | |
| 83 static PassRefPtr<StyleRareNonInheritedData> create() { return adoptRef(new
StyleRareNonInheritedData); } | |
| 84 PassRefPtr<StyleRareNonInheritedData> copy() const { return adoptRef(new Sty
leRareNonInheritedData(*this)); } | |
| 85 ~StyleRareNonInheritedData(); | |
| 86 | |
| 87 bool operator==(const StyleRareNonInheritedData&) const; | |
| 88 bool operator!=(const StyleRareNonInheritedData& o) const { return !(*this =
= o); } | |
| 89 | |
| 90 bool contentDataEquivalent(const StyleRareNonInheritedData&) const; | |
| 91 bool counterDataEquivalent(const StyleRareNonInheritedData&) const; | |
| 92 bool shadowDataEquivalent(const StyleRareNonInheritedData&) const; | |
| 93 bool reflectionDataEquivalent(const StyleRareNonInheritedData&) const; | |
| 94 bool animationDataEquivalent(const StyleRareNonInheritedData&) const; | |
| 95 bool transitionDataEquivalent(const StyleRareNonInheritedData&) const; | |
| 96 bool shapeOutsideDataEquivalent(const StyleRareNonInheritedData&) const; | |
| 97 bool clipPathDataEquivalent(const StyleRareNonInheritedData&) const; | |
| 98 bool hasFilters() const; | |
| 99 bool hasBackdropFilters() const; | |
| 100 bool hasOpacity() const { return opacity < 1; } | |
| 101 | |
| 102 float opacity; // Whether or not we're transparent. | |
| 103 | |
| 104 float m_perspective; | |
| 105 float m_shapeImageThreshold; | |
| 106 | |
| 107 int m_order; | |
| 108 | |
| 109 LengthPoint m_perspectiveOrigin; | |
| 110 LengthPoint m_objectPosition; | |
| 111 | |
| 112 LineClampValue lineClamp; // An Apple extension. | |
| 113 DraggableRegionMode m_draggableRegionMode; | |
| 114 | |
| 115 DataRef<StyleDeprecatedFlexibleBoxData> m_deprecatedFlexibleBox; // Flexible
box properties | |
| 116 DataRef<StyleFlexibleBoxData> m_flexibleBox; | |
| 117 DataRef<StyleMultiColData> m_multiCol; // CSS3 multicol properties | |
| 118 DataRef<StyleTransformData> m_transform; // Transform properties (rotate, sc
ale, skew, etc.) | |
| 119 DataRef<StyleWillChangeData> m_willChange; // CSS Will Change | |
| 120 | |
| 121 DataPersistent<StyleFilterData> m_filter; // Filter operations (url, sepia,
blur, etc.) | |
| 122 DataPersistent<StyleFilterData> m_backdropFilter; // Backdrop filter operati
ons (url, sepia, blur, etc.) | |
| 123 | |
| 124 DataRef<StyleGridData> m_grid; | |
| 125 DataRef<StyleGridItemData> m_gridItem; | |
| 126 DataRef<StyleScrollSnapData> m_scrollSnap; | |
| 127 | |
| 128 Persistent<ContentData> m_content; | |
| 129 std::unique_ptr<CounterDirectiveMap> m_counterDirectives; | |
| 130 std::unique_ptr<CSSAnimationData> m_animations; | |
| 131 std::unique_ptr<CSSTransitionData> m_transitions; | |
| 132 | |
| 133 RefPtr<ShadowList> m_boxShadow; | |
| 134 | |
| 135 RefPtr<StyleReflection> m_boxReflect; | |
| 136 | |
| 137 Persistent<ShapeValue> m_shapeOutside; | |
| 138 RefPtr<ClipPathOperation> m_clipPath; | |
| 139 | |
| 140 FillLayer m_mask; | |
| 141 NinePieceImage m_maskBoxImage; | |
| 142 | |
| 143 FloatSize m_pageSize; | |
| 144 Length m_shapeMargin; | |
| 145 | |
| 146 StyleColor m_textDecorationColor; | |
| 147 StyleColor m_visitedLinkTextDecorationColor; | |
| 148 StyleColor m_visitedLinkBackgroundColor; | |
| 149 StyleColor m_visitedLinkOutlineColor; | |
| 150 StyleColor m_visitedLinkBorderLeftColor; | |
| 151 StyleColor m_visitedLinkBorderRightColor; | |
| 152 StyleColor m_visitedLinkBorderTopColor; | |
| 153 StyleColor m_visitedLinkBorderBottomColor; | |
| 154 | |
| 155 Vector<String> m_callbackSelectors; | |
| 156 | |
| 157 std::unique_ptr<Vector<Persistent<StyleImage>>> m_paintImages; | |
| 158 | |
| 159 StyleContentAlignmentData m_alignContent; | |
| 160 StyleSelfAlignmentData m_alignItems; | |
| 161 StyleSelfAlignmentData m_alignSelf; | |
| 162 StyleContentAlignmentData m_justifyContent; | |
| 163 StyleSelfAlignmentData m_justifyItems; | |
| 164 StyleSelfAlignmentData m_justifySelf; | |
| 165 | |
| 166 unsigned m_pageSizeType : 2; // PageSizeType | |
| 167 unsigned m_transformStyle3D : 1; // ETransformStyle3D | |
| 168 unsigned m_backfaceVisibility : 1; // EBackfaceVisibility | |
| 169 | |
| 170 unsigned userDrag : 2; // EUserDrag | |
| 171 unsigned textOverflow : 1; // Whether or not lines that spill out should be
truncated with "..." | |
| 172 unsigned marginBeforeCollapse : 2; // EMarginCollapse | |
| 173 unsigned marginAfterCollapse : 2; // EMarginCollapse | |
| 174 unsigned m_appearance : 6; // EAppearance | |
| 175 | |
| 176 unsigned m_textDecorationStyle : 3; // TextDecorationStyle | |
| 177 | |
| 178 unsigned m_hasCurrentOpacityAnimation : 1; | |
| 179 unsigned m_hasCurrentTransformAnimation : 1; | |
| 180 unsigned m_hasCurrentFilterAnimation : 1; | |
| 181 unsigned m_hasCurrentBackdropFilterAnimation : 1; | |
| 182 unsigned m_runningOpacityAnimationOnCompositor : 1; | |
| 183 unsigned m_runningTransformAnimationOnCompositor : 1; | |
| 184 unsigned m_runningFilterAnimationOnCompositor : 1; | |
| 185 unsigned m_runningBackdropFilterAnimationOnCompositor : 1; | |
| 186 | |
| 187 unsigned m_isStackingContext : 1; | |
| 188 | |
| 189 unsigned m_effectiveBlendMode: 5; // EBlendMode | |
| 190 | |
| 191 unsigned m_touchAction : TouchActionBits; // TouchAction | |
| 192 | |
| 193 unsigned m_objectFit : 3; // ObjectFit | |
| 194 | |
| 195 unsigned m_isolation : 1; // Isolation | |
| 196 | |
| 197 unsigned m_contain : 4; // Containment | |
| 198 | |
| 199 // ScrollBehavior. 'scroll-behavior' has 2 accepted values, but ScrollBehavi
or has a third | |
| 200 // value (that can only be specified using CSSOM scroll APIs) so 2 bits are
needed. | |
| 201 unsigned m_scrollBehavior: 2; | |
| 202 | |
| 203 unsigned m_scrollSnapType: 2; // ScrollSnapType | |
| 204 | |
| 205 // Plugins require accelerated compositing for reasons external to blink. | |
| 206 // In which case, we need to update the ComputedStyle on the LayoutEmbeddedO
bject, | |
| 207 // so store this bit so that the style actually changes when the plugin | |
| 208 // becomes composited. | |
| 209 unsigned m_requiresAcceleratedCompositingForExternalReasons: 1; | |
| 210 | |
| 211 // Whether the transform (if it exists) is stored in the element's inline st
yle. | |
| 212 unsigned m_hasInlineTransform : 1; | |
| 213 unsigned m_resize : 2; // EResize | |
| 214 unsigned m_hasCompositorProxy : 1; | |
| 215 | |
| 216 // Style adjustment for appearance is disabled when certain properties are s
et. | |
| 217 unsigned m_hasAuthorBackground : 1; // Whether there is a author-defined bac
kground. | |
| 218 unsigned m_hasAuthorBorder : 1; // Whether there is a author-defined border. | |
| 219 | |
| 220 private: | |
| 221 StyleRareNonInheritedData(); | |
| 222 StyleRareNonInheritedData(const StyleRareNonInheritedData&); | |
| 223 }; | |
| 224 | |
| 225 } // namespace blink | 35 } // namespace blink |
| 226 | 36 |
| 227 #endif // StyleRareNonInheritedData_h | 37 #endif // StyleRareNonInheritedData_h |
| OLD | NEW |