diff options
| author | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-29 12:18:48 +0100 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-29 12:18:57 +0100 |
| commit | 4c01d0526ba4dd8cff0c0ff22a6f0ab5eb973064 (patch) | |
| tree | bed2fe914fe0f7ec70abfb47d2d84af8a3604d09 /Source/WebCore/rendering/style | |
| parent | 01485457c9a5da3f1121015afd25bb53af77662e (diff) | |
| download | qtwebkit-4c01d0526ba4dd8cff0c0ff22a6f0ab5eb973064.tar.gz | |
Imported WebKit commit c60cfe0fc09efd257aa0111d7b133b02deb8a63e (http://svn.webkit.org/repository/webkit/trunk@136119)
New snapshot that includes the fix for installing the QtWebProcess into libexec
Change-Id: I01344e079cbdac5678c4cba6ffcc05f4597cf0d7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Source/WebCore/rendering/style')
7 files changed, 53 insertions, 129 deletions
diff --git a/Source/WebCore/rendering/style/RenderStyle.cpp b/Source/WebCore/rendering/style/RenderStyle.cpp index 6ecaa0417..a51658b00 100644 --- a/Source/WebCore/rendering/style/RenderStyle.cpp +++ b/Source/WebCore/rendering/style/RenderStyle.cpp @@ -61,8 +61,6 @@ struct SameSizeAsBorderValue { COMPILE_ASSERT(sizeof(BorderValue) == sizeof(SameSizeAsBorderValue), BorderValue_should_not_grow); struct SameSizeAsRenderStyle : public RefCounted<SameSizeAsRenderStyle> { - unsigned m_bitfields; - void* dataRefs[7]; void* ownPtrs[1]; #if ENABLE(SVG) @@ -207,6 +205,7 @@ void RenderStyle::copyNonInheritedFrom(const RenderStyle* other) noninherited_flags._page_break_before = other->noninherited_flags._page_break_before; noninherited_flags._page_break_after = other->noninherited_flags._page_break_after; noninherited_flags._page_break_inside = other->noninherited_flags._page_break_inside; + noninherited_flags.explicitInheritance = other->noninherited_flags.explicitInheritance; #if ENABLE(SVG) if (m_svgStyle != other->m_svgStyle) m_svgStyle.access()->copyNonInheritedFrom(other->m_svgStyle.get()); @@ -491,7 +490,8 @@ StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon || rareInheritedData->m_imageResolution != other->rareInheritedData->m_imageResolution #endif || rareInheritedData->m_lineSnap != other->rareInheritedData->m_lineSnap - || rareInheritedData->m_lineAlign != other->rareInheritedData->m_lineAlign) + || rareInheritedData->m_lineAlign != other->rareInheritedData->m_lineAlign + || rareInheritedData->listStyleImage != other->rareInheritedData->listStyleImage) return StyleDifferenceLayout; if (!rareInheritedData->shadowDataEquivalent(*other->rareInheritedData.get())) @@ -507,7 +507,6 @@ StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon #endif if (inherited->line_height != other->inherited->line_height - || inherited->list_style_image != other->inherited->list_style_image || inherited->font != other->inherited->font || inherited->horizontal_border_spacing != other->inherited->horizontal_border_spacing || inherited->vertical_border_spacing != other->inherited->vertical_border_spacing @@ -966,11 +965,11 @@ static float calcConstraintScaleFor(const IntRect& rect, const RoundedRect::Radi return factor; } -StyleImage* RenderStyle::listStyleImage() const { return inherited->list_style_image.get(); } +StyleImage* RenderStyle::listStyleImage() const { return rareInheritedData->listStyleImage.get(); } void RenderStyle::setListStyleImage(PassRefPtr<StyleImage> v) { - if (inherited->list_style_image != v) - inherited.access()->list_style_image = v; + if (rareInheritedData->listStyleImage != v) + rareInheritedData.access()->listStyleImage = v; } Color RenderStyle::color() const { return inherited->color; } diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h index 31996fa05..74044f82f 100644 --- a/Source/WebCore/rendering/style/RenderStyle.h +++ b/Source/WebCore/rendering/style/RenderStyle.h @@ -134,77 +134,6 @@ class RenderStyle: public RefCounted<RenderStyle> { friend class StyleResolver; // Sets members directly. protected: - class RenderStyleBitfields { - public: - RenderStyleBitfields() - : m_affectedByUncommonAttributeSelectors(false) - , m_unique(false) - , m_affectedByEmpty(false) - , m_emptyState(false) - , m_childrenAffectedByFirstChildRules(false) - , m_childrenAffectedByLastChildRules(false) - , m_childrenAffectedByDirectAdjacentRules(false) - , m_childrenAffectedByForwardPositionalRules(false) - , m_childrenAffectedByBackwardPositionalRules(false) - , m_firstChildState(false) - , m_lastChildState(false) - , m_explicitInheritance(false) - , m_childIndex(0) - { - } - - bool affectedByUncommonAttributeSelectors() const { return m_affectedByUncommonAttributeSelectors; } - void setAffectedByUncommonAttributeSelectors(bool value) { m_affectedByUncommonAttributeSelectors = value; } - bool unique() const { return m_unique; } - void setUnique(bool value) { m_unique = value; } - bool affectedByEmpty() const { return m_affectedByEmpty; } - void setAffectedByEmpty(bool value) { m_affectedByEmpty = value; } - bool emptyState() const { return m_emptyState; } - void setEmptyState(bool value) { m_emptyState = value; } - bool childrenAffectedByFirstChildRules() const { return m_childrenAffectedByFirstChildRules; } - void setChildrenAffectedByFirstChildRules(bool value) { m_childrenAffectedByFirstChildRules = value; } - bool childrenAffectedByLastChildRules() const { return m_childrenAffectedByLastChildRules; } - void setChildrenAffectedByLastChildRules(bool value) { m_childrenAffectedByLastChildRules = value; } - bool childrenAffectedByDirectAdjacentRules() const { return m_childrenAffectedByDirectAdjacentRules; } - void setChildrenAffectedByDirectAdjacentRules(bool value) { m_childrenAffectedByDirectAdjacentRules = value; } - bool childrenAffectedByForwardPositionalRules() const { return m_childrenAffectedByForwardPositionalRules; } - void setChildrenAffectedByForwardPositionalRules(bool value) { m_childrenAffectedByForwardPositionalRules = value; } - bool childrenAffectedByBackwardPositionalRules() const { return m_childrenAffectedByBackwardPositionalRules; } - void setChildrenAffectedByBackwardPositionalRules(bool value) { m_childrenAffectedByBackwardPositionalRules = value; } - bool firstChildState() const { return m_firstChildState; } - void setFirstChildState(bool value) { m_firstChildState = value; } - bool lastChildState() const { return m_lastChildState; } - void setLastChildState(bool value) { m_lastChildState = value; } - bool explicitInheritance() const { return m_explicitInheritance; } - void setExplicitInheritance(bool value) { m_explicitInheritance = value; } - - unsigned childIndex() const { return m_childIndex; } - void setChildIndex(unsigned index) { m_childIndex = index; } - - private: - // The following bitfield is 32-bits long, which optimizes padding with the - // int refCount in the base class. Beware when adding more bits. - unsigned m_affectedByUncommonAttributeSelectors : 1; - unsigned m_unique : 1; - - // Bits for dynamic child matching. - unsigned m_affectedByEmpty : 1; - unsigned m_emptyState : 1; - - // We optimize for :first-child and :last-child. The other positional child selectors like nth-child or - // *-child-of-type, we will just give up and re-evaluate whenever children change at all. - unsigned m_childrenAffectedByFirstChildRules : 1; - unsigned m_childrenAffectedByLastChildRules : 1; - unsigned m_childrenAffectedByDirectAdjacentRules : 1; - unsigned m_childrenAffectedByForwardPositionalRules : 1; - unsigned m_childrenAffectedByBackwardPositionalRules : 1; - unsigned m_firstChildState : 1; - unsigned m_lastChildState : 1; - unsigned m_explicitInheritance : 1; - unsigned m_childIndex : 20; // Plenty of bits to cache an index. - }; - RenderStyleBitfields m_bitfields; - // non-inherited attributes DataRef<StyleBoxData> m_box; DataRef<StyleVisualData> visual; @@ -300,6 +229,11 @@ protected: && _affectedByDrag == other._affectedByDrag && _pseudoBits == other._pseudoBits && _unicodeBidi == other._unicodeBidi + && explicitInheritance == other.explicitInheritance + && unique == other.unique + && emptyState == other.emptyState + && firstChildState == other.firstChildState + && lastChildState == other.lastChildState && _isLink == other._isLink; } @@ -316,13 +250,18 @@ protected: unsigned _table_layout : 1; // ETableLayout unsigned _unicodeBidi : 3; // EUnicodeBidi + // 31 bits unsigned _page_break_before : 2; // EPageBreak - // 32 bits unsigned _page_break_after : 2; // EPageBreak unsigned _page_break_inside : 2; // EPageBreak unsigned _styleType : 6; // PseudoId unsigned _pseudoBits : 7; + unsigned explicitInheritance : 1; // Explicitly inherits a non-inherited property + unsigned unique : 1; // Style can not be shared. + unsigned emptyState : 1; + unsigned firstChildState : 1; + unsigned lastChildState : 1; bool affectedByHover() const { return _affectedByHover; } void setAffectedByHover(bool value) { _affectedByHover = value; } @@ -338,7 +277,7 @@ protected: unsigned _affectedByDrag : 1; unsigned _isLink : 1; // If you add more style bits here, you will also need to update RenderStyle::copyNonInheritedFrom() - // 54 bits + // 59 bits } noninherited_flags; // !END SYNC! @@ -379,6 +318,11 @@ protected: noninherited_flags._page_break_inside = initialPageBreak(); noninherited_flags._styleType = NOPSEUDO; noninherited_flags._pseudoBits = 0; + noninherited_flags.explicitInheritance = false; + noninherited_flags.unique = false; + noninherited_flags.emptyState = false; + noninherited_flags.firstChildState = false; + noninherited_flags.lastChildState = false; noninherited_flags.setAffectedByHover(false); noninherited_flags.setAffectedByActive(false); noninherited_flags.setAffectedByDrag(false); @@ -419,13 +363,13 @@ public: const HashMap<AtomicString, String>* variables() { return &(rareInheritedData->m_variables->m_data); } #endif - bool affectedByHoverRules() const { return noninherited_flags.affectedByHover(); } - bool affectedByActiveRules() const { return noninherited_flags.affectedByActive(); } - bool affectedByDragRules() const { return noninherited_flags.affectedByDrag(); } + bool affectedByHover() const { return noninherited_flags.affectedByHover(); } + bool affectedByActive() const { return noninherited_flags.affectedByActive(); } + bool affectedByDrag() const { return noninherited_flags.affectedByDrag(); } - void setAffectedByHoverRules(bool b) { noninherited_flags.setAffectedByHover(b); } - void setAffectedByActiveRules(bool b) { noninherited_flags.setAffectedByActive(b); } - void setAffectedByDragRules(bool b) { noninherited_flags.setAffectedByDrag(b); } + void setAffectedByHover() { noninherited_flags.setAffectedByHover(true); } + void setAffectedByActive() { noninherited_flags.setAffectedByActive(true); } + void setAffectedByDrag() { noninherited_flags.setAffectedByDrag(true); } bool operator==(const RenderStyle& other) const; bool operator!=(const RenderStyle& other) const { return !(*this == other); } @@ -710,7 +654,6 @@ public: EFillRepeat maskRepeatX() const { return static_cast<EFillRepeat>(rareNonInheritedData->m_mask.repeatX()); } EFillRepeat maskRepeatY() const { return static_cast<EFillRepeat>(rareNonInheritedData->m_mask.repeatY()); } CompositeOperator maskComposite() const { return static_cast<CompositeOperator>(rareNonInheritedData->m_mask.composite()); } - EFillAttachment maskAttachment() const { return static_cast<EFillAttachment>(rareNonInheritedData->m_mask.attachment()); } EFillBox maskClip() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.clip()); } EFillBox maskOrigin() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.origin()); } Length maskXPosition() const { return rareNonInheritedData->m_mask.xPosition(); } @@ -1527,39 +1470,21 @@ public: void setWritingMode(WritingMode v) { inherited_flags.m_writingMode = v; } - // To tell if this style matched attribute selectors. This makes it impossible to share. - bool affectedByUncommonAttributeSelectors() const { return m_bitfields.affectedByUncommonAttributeSelectors(); } - void setAffectedByUncommonAttributeSelectors() { m_bitfields.setAffectedByUncommonAttributeSelectors(true); } - - bool unique() const { return m_bitfields.unique(); } - void setUnique() { m_bitfields.setUnique(true); } - - // Methods for indicating the style is affected by dynamic updates (e.g., children changing, our position changing in our sibling list, etc.) - bool affectedByEmpty() const { return m_bitfields.affectedByEmpty(); } - bool emptyState() const { return m_bitfields.emptyState(); } - void setEmptyState(bool b) { m_bitfields.setAffectedByEmpty(true); m_bitfields.setUnique(true); m_bitfields.setEmptyState(b); } - bool childrenAffectedByPositionalRules() const { return childrenAffectedByForwardPositionalRules() || childrenAffectedByBackwardPositionalRules(); } - bool childrenAffectedByFirstChildRules() const { return m_bitfields.childrenAffectedByFirstChildRules(); } - void setChildrenAffectedByFirstChildRules() { m_bitfields.setChildrenAffectedByFirstChildRules(true); } - bool childrenAffectedByLastChildRules() const { return m_bitfields.childrenAffectedByLastChildRules(); } - void setChildrenAffectedByLastChildRules() { m_bitfields.setChildrenAffectedByLastChildRules(true); } - bool childrenAffectedByDirectAdjacentRules() const { return m_bitfields.childrenAffectedByDirectAdjacentRules(); } - void setChildrenAffectedByDirectAdjacentRules() { m_bitfields.setChildrenAffectedByDirectAdjacentRules(true); } - bool childrenAffectedByForwardPositionalRules() const { return m_bitfields.childrenAffectedByForwardPositionalRules(); } - void setChildrenAffectedByForwardPositionalRules() { m_bitfields.setChildrenAffectedByForwardPositionalRules(true); } - bool childrenAffectedByBackwardPositionalRules() const { return m_bitfields.childrenAffectedByBackwardPositionalRules(); } - void setChildrenAffectedByBackwardPositionalRules() { m_bitfields.setChildrenAffectedByBackwardPositionalRules(true); } - bool firstChildState() const { return m_bitfields.firstChildState(); } - void setFirstChildState() { m_bitfields.setUnique(true); m_bitfields.setFirstChildState(true); } - bool lastChildState() const { return m_bitfields.lastChildState(); } - void setLastChildState() { m_bitfields.setUnique(true); m_bitfields.setLastChildState(true); } - unsigned childIndex() const { return m_bitfields.childIndex(); } - void setChildIndex(unsigned index) { m_bitfields.setUnique(true); m_bitfields.setChildIndex(index); } + // A unique style is one that has matches something that makes it impossible to share. + bool unique() const { return noninherited_flags.unique; } + void setUnique() { noninherited_flags.unique = true; } + + bool emptyState() const { return noninherited_flags.emptyState; } + void setEmptyState(bool b) { setUnique(); noninherited_flags.emptyState = b; } + bool firstChildState() const { return noninherited_flags.firstChildState; } + void setFirstChildState() { setUnique(); noninherited_flags.firstChildState = true; } + bool lastChildState() const { return noninherited_flags.lastChildState; } + void setLastChildState() { setUnique(); noninherited_flags.lastChildState = true; } Color visitedDependentColor(int colorProperty) const; - void setHasExplicitlyInheritedProperties() { m_bitfields.setExplicitInheritance(true); } - bool hasExplicitlyInheritedProperties() const { return m_bitfields.explicitInheritance(); } + void setHasExplicitlyInheritedProperties() { noninherited_flags.explicitInheritance = true; } + bool hasExplicitlyInheritedProperties() const { return noninherited_flags.explicitInheritance; } void reportMemoryUsage(MemoryObjectInfo*) const; @@ -1674,7 +1599,7 @@ public: static Order initialRTLOrdering() { return LogicalOrder; } static float initialTextStrokeWidth() { return 0; } static unsigned short initialColumnCount() { return 1; } - static ColumnSpan initialColumnSpan() { return ColumnSpanOne; } + static ColumnSpan initialColumnSpan() { return ColumnSpanNone; } static const TransformOperations& initialTransform() { DEFINE_STATIC_LOCAL(TransformOperations, ops, ()); return ops; } static Length initialTransformOriginX() { return Length(50.0, Percent); } static Length initialTransformOriginY() { return Length(50.0, Percent); } diff --git a/Source/WebCore/rendering/style/RenderStyleConstants.h b/Source/WebCore/rendering/style/RenderStyleConstants.h index 72e0c4c33..bfc1a5eab 100644 --- a/Source/WebCore/rendering/style/RenderStyleConstants.h +++ b/Source/WebCore/rendering/style/RenderStyleConstants.h @@ -81,7 +81,7 @@ enum PseudoId { PUBLIC_PSEUDOID_MASK = ((1 << FIRST_INTERNAL_PSEUDOID) - 1) & ~((1 << FIRST_PUBLIC_PSEUDOID) - 1) }; -enum ColumnSpan { ColumnSpanOne = 0, ColumnSpanAll}; +enum ColumnSpan { ColumnSpanNone = 0, ColumnSpanAll }; enum EBorderCollapse { BSEPARATE = 0, BCOLLAPSE = 1 }; diff --git a/Source/WebCore/rendering/style/StyleInheritedData.cpp b/Source/WebCore/rendering/style/StyleInheritedData.cpp index 021740f15..b72395631 100644 --- a/Source/WebCore/rendering/style/StyleInheritedData.cpp +++ b/Source/WebCore/rendering/style/StyleInheritedData.cpp @@ -23,7 +23,6 @@ #include "StyleInheritedData.h" #include "RenderStyle.h" -#include "StyleImage.h" namespace WebCore { @@ -31,7 +30,6 @@ StyleInheritedData::StyleInheritedData() : horizontal_border_spacing(RenderStyle::initialHorizontalBorderSpacing()) , vertical_border_spacing(RenderStyle::initialVerticalBorderSpacing()) , line_height(RenderStyle::initialLineHeight()) - , list_style_image(RenderStyle::initialListStyleImage()) , color(RenderStyle::initialColor()) , visitedLinkColor(RenderStyle::initialColor()) { @@ -46,7 +44,6 @@ StyleInheritedData::StyleInheritedData(const StyleInheritedData& o) , horizontal_border_spacing(o.horizontal_border_spacing) , vertical_border_spacing(o.vertical_border_spacing) , line_height(o.line_height) - , list_style_image(o.list_style_image) , font(o.font) , color(o.color) , visitedLinkColor(o.visitedLinkColor) @@ -56,7 +53,6 @@ StyleInheritedData::StyleInheritedData(const StyleInheritedData& o) bool StyleInheritedData::operator==(const StyleInheritedData& o) const { return line_height == o.line_height - && StyleImage::imagesEquivalent(list_style_image.get(), o.list_style_image.get()) && font == o.font && color == o.color && visitedLinkColor == o.visitedLinkColor diff --git a/Source/WebCore/rendering/style/StyleInheritedData.h b/Source/WebCore/rendering/style/StyleInheritedData.h index 6cb7bc5bb..06a79273e 100644 --- a/Source/WebCore/rendering/style/StyleInheritedData.h +++ b/Source/WebCore/rendering/style/StyleInheritedData.h @@ -34,8 +34,6 @@ namespace WebCore { -class StyleImage; - class StyleInheritedData : public RefCounted<StyleInheritedData> { public: static PassRefPtr<StyleInheritedData> create() { return adoptRef(new StyleInheritedData); } @@ -55,8 +53,6 @@ public: // make a difference currently because of padding Length line_height; - RefPtr<StyleImage> list_style_image; - Font font; Color color; Color visitedLinkColor; diff --git a/Source/WebCore/rendering/style/StyleRareInheritedData.cpp b/Source/WebCore/rendering/style/StyleRareInheritedData.cpp index 434e3ccf0..c02c10591 100644 --- a/Source/WebCore/rendering/style/StyleRareInheritedData.cpp +++ b/Source/WebCore/rendering/style/StyleRareInheritedData.cpp @@ -27,12 +27,14 @@ #include "RenderStyle.h" #include "RenderStyleConstants.h" #include "ShadowData.h" +#include "StyleImage.h" #include "WebCoreMemoryInstrumentation.h" #include <wtf/MemoryObjectInfo.h> namespace WebCore { struct SameSizeAsStyleRareInheritedData : public RefCounted<SameSizeAsStyleRareInheritedData> { + void* styleImage; Color firstColor; float firstFloat; Color colors[5]; @@ -62,7 +64,8 @@ struct SameSizeAsStyleRareInheritedData : public RefCounted<SameSizeAsStyleRareI COMPILE_ASSERT(sizeof(StyleRareInheritedData) == sizeof(SameSizeAsStyleRareInheritedData), StyleRareInheritedData_should_bit_pack); StyleRareInheritedData::StyleRareInheritedData() - : textStrokeWidth(RenderStyle::initialTextStrokeWidth()) + : listStyleImage(RenderStyle::initialListStyleImage()) + , textStrokeWidth(RenderStyle::initialTextStrokeWidth()) , indent(RenderStyle::initialTextIndent()) , m_effectiveZoom(RenderStyle::initialZoom()) , widows(RenderStyle::initialWidows()) @@ -118,6 +121,7 @@ StyleRareInheritedData::StyleRareInheritedData() StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o) : RefCounted<StyleRareInheritedData>() + , listStyleImage(o.listStyleImage) , textStrokeColor(o.textStrokeColor) , textStrokeWidth(o.textStrokeWidth) , textFillColor(o.textFillColor) @@ -260,7 +264,8 @@ bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const #if ENABLE(CSS_VARIABLES) && m_variables == o.m_variables #endif - && m_lineAlign == o.m_lineAlign; + && m_lineAlign == o.m_lineAlign + && StyleImage::imagesEquivalent(listStyleImage.get(), o.listStyleImage.get()); } bool StyleRareInheritedData::shadowDataEquivalent(const StyleRareInheritedData& o) const diff --git a/Source/WebCore/rendering/style/StyleRareInheritedData.h b/Source/WebCore/rendering/style/StyleRareInheritedData.h index d07e04c33..22388336a 100644 --- a/Source/WebCore/rendering/style/StyleRareInheritedData.h +++ b/Source/WebCore/rendering/style/StyleRareInheritedData.h @@ -41,6 +41,7 @@ namespace WebCore { class CursorList; class QuotesData; class ShadowData; +class StyleImage; // This struct is for rarely used inherited CSS3, CSS2, and WebKit-specific properties. // By grouping them together, we save space, and only allocate this object when someone @@ -60,6 +61,8 @@ public: void reportMemoryUsage(MemoryObjectInfo*) const; + RefPtr<StyleImage> listStyleImage; + Color textStrokeColor; float textStrokeWidth; Color textFillColor; |
