From 283fa5f78a4e3395ea362b1c1b33af18fc458358 Mon Sep 17 00:00:00 2001 From: Elliott Sprehn Date: Fri, 7 Nov 2014 18:47:39 -0800 Subject: [PATCH] Remove ContentData. This was to support CSS generated content. R=ojan@chromium.org Review URL: https://codereview.chromium.org/709213002 --- engine/core/core.gni | 1 - .../core/css/CSSComputedStyleDeclaration.cpp | 18 --- engine/core/css/CSSProperties.in | 1 - engine/core/css/StylePropertySerializer.cpp | 4 - engine/core/css/parser/CSSPropertyParser.cpp | 64 -------- engine/core/css/parser/CSSPropertyParser.h | 1 - .../core/css/resolver/StyleBuilderCustom.cpp | 70 --------- .../core/css/resolver/StyleResourceLoader.cpp | 14 -- engine/core/loader/ImageLoader.cpp | 4 +- engine/core/rendering/RenderBlock.cpp | 4 - engine/core/rendering/RenderImage.cpp | 1 - engine/core/rendering/RenderImage.h | 5 - engine/core/rendering/RenderObject.cpp | 1 - engine/core/rendering/style/ContentData.cpp | 66 -------- engine/core/rendering/style/ContentData.h | 143 ------------------ engine/core/rendering/style/RenderStyle.cpp | 57 ------- engine/core/rendering/style/RenderStyle.h | 10 -- .../style/StyleRareNonInheritedData.cpp | 16 -- .../style/StyleRareNonInheritedData.h | 3 - 19 files changed, 1 insertion(+), 482 deletions(-) delete mode 100644 engine/core/rendering/style/ContentData.cpp delete mode 100644 engine/core/rendering/style/ContentData.h diff --git a/engine/core/core.gni b/engine/core/core.gni index 4c7d30016ce..2f2dff3420c 100644 --- a/engine/core/core.gni +++ b/engine/core/core.gni @@ -1098,7 +1098,6 @@ sky_core_files = [ "rendering/style/BasicShapes.cpp", "rendering/style/BorderImageLength.h", "rendering/style/BorderImageLengthBox.h", - "rendering/style/ContentData.cpp", "rendering/style/CounterDirectives.cpp", "rendering/style/FillLayer.cpp", "rendering/style/KeyframeList.cpp", diff --git a/engine/core/css/CSSComputedStyleDeclaration.cpp b/engine/core/css/CSSComputedStyleDeclaration.cpp index d042efb2001..9bd57867544 100644 --- a/engine/core/css/CSSComputedStyleDeclaration.cpp +++ b/engine/core/css/CSSComputedStyleDeclaration.cpp @@ -53,7 +53,6 @@ #include "core/dom/Document.h" #include "core/dom/ExceptionCode.h" #include "core/rendering/RenderBox.h" -#include "core/rendering/style/ContentData.h" #include "core/rendering/style/RenderStyle.h" #include "core/rendering/style/ShadowList.h" #include "core/rendering/style/ShapeValue.h" @@ -1131,21 +1130,6 @@ static PassRefPtr valueForFillSize(const FillSize& fillSize, const Ren return list.release(); } -static PassRefPtr valueForContentData(const RenderStyle& style) -{ - RefPtr list = CSSValueList::createSpaceSeparated(); - for (const ContentData* contentData = style.contentData(); contentData; contentData = contentData->next()) { - if (contentData->isImage()) { - const StyleImage* image = toImageContentData(contentData)->image(); - ASSERT(image); - list->append(image->cssValue()); - } else if (contentData->isText()) { - list->append(cssValuePool().createValue(toTextContentData(contentData)->text(), CSSPrimitiveValue::CSS_STRING)); - } - } - return list.release(); -} - static void logUnimplementedPropertyID(CSSPropertyID propertyID) { DEFINE_STATIC_LOCAL(HashSet, propertyIDSet, ()); @@ -2182,8 +2166,6 @@ PassRefPtr CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert return CSSPrimitiveValue::create(style->textOrientation()); case CSSPropertyWebkitLineBoxContain: return createLineBoxContainValue(style->lineBoxContain()); - case CSSPropertyContent: - return valueForContentData(*style); case CSSPropertyWebkitClipPath: if (ClipPathOperation* operation = style->clipPath()) { if (operation->type() == ClipPathOperation::SHAPE) diff --git a/engine/core/css/CSSProperties.in b/engine/core/css/CSSProperties.in index 31828921d9e..3b149d1f462 100644 --- a/engine/core/css/CSSProperties.in +++ b/engine/core/css/CSSProperties.in @@ -141,7 +141,6 @@ box-shadow animatable, converter=convertShadow box-sizing caption-side inherited clip animatable, converter=convertClip, custom_all -content custom_all cursor inherited, custom_all display empty-cells inherited, type_name=EEmptyCell diff --git a/engine/core/css/StylePropertySerializer.cpp b/engine/core/css/StylePropertySerializer.cpp index d746d635add..c43ab575895 100644 --- a/engine/core/css/StylePropertySerializer.cpp +++ b/engine/core/css/StylePropertySerializer.cpp @@ -88,10 +88,6 @@ String StylePropertySerializer::asText() const case CSSPropertyBackgroundRepeatY: shorthandPropertyAppeared.set(CSSPropertyBackground - firstCSSProperty); continue; - case CSSPropertyContent: - if (property.value()->isValueList()) - value = toCSSValueList(property.value())->customCSSText(AlwaysQuoteCSSString); - break; case CSSPropertyBorderTopWidth: case CSSPropertyBorderRightWidth: case CSSPropertyBorderBottomWidth: diff --git a/engine/core/css/parser/CSSPropertyParser.cpp b/engine/core/css/parser/CSSPropertyParser.cpp index 7f44a7e0d14..6cbef6bdbe6 100644 --- a/engine/core/css/parser/CSSPropertyParser.cpp +++ b/engine/core/css/parser/CSSPropertyParser.cpp @@ -487,10 +487,6 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important) parsedValue = parseQuotes(); break; - case CSSPropertyContent: // [ | | | attr(X) | open-quote | - // close-quote | no-open-quote | no-close-quote ]+ | inherit - return parseContent(propId, important); - case CSSPropertyClip: // | auto | inherit if (id == CSSValueAuto) validPrimitive = true; @@ -1882,66 +1878,6 @@ PassRefPtr CSSPropertyParser::parseQuotes() return nullptr; } -// [ | | | attr(X) | open-quote | close-quote | no-open-quote | no-close-quote ]+ | inherit -// in CSS 2.1 this got somewhat reduced: -// [ | attr(X) | open-quote | close-quote | no-open-quote | no-close-quote ]+ | inherit -bool CSSPropertyParser::parseContent(CSSPropertyID propId, bool important) -{ - RefPtr values = CSSValueList::createCommaSeparated(); - - while (CSSParserValue* val = m_valueList->current()) { - RefPtr parsedValue = nullptr; - if (val->unit == CSSPrimitiveValue::CSS_URI) { - // url - parsedValue = createCSSImageValueWithReferrer(val->string, completeURL(val->string)); - } else if (val->unit == CSSParserValue::Function) { - // attr(X) | counter(X [,Y]) | counters(X, Y, [,Z]) | -webkit-gradient(...) - CSSParserValueList* args = val->function->args.get(); - if (!args) - return false; - if (equalIgnoringCase(val->function->name, "attr(")) { - parsedValue = parseAttr(args); - if (!parsedValue) - return false; - } else if (equalIgnoringCase(val->function->name, "-webkit-image-set(")) { - parsedValue = parseImageSet(m_valueList); - if (!parsedValue) - return false; - } else if (isGeneratedImageValue(val)) { - if (!parseGeneratedImage(m_valueList, parsedValue)) - return false; - } else - return false; - } else if (val->unit == CSSPrimitiveValue::CSS_IDENT) { - // inherit - // FIXME: These are not yet implemented (http://bugs.webkit.org/show_bug.cgi?id=6503). - // none - // normal - switch (val->id) { - case CSSValueNone: - case CSSValueNormal: - parsedValue = cssValuePool().createIdentifierValue(val->id); - default: - break; - } - } else if (val->unit == CSSPrimitiveValue::CSS_STRING) { - parsedValue = createPrimitiveStringValue(val); - } - if (!parsedValue) - break; - values->append(parsedValue.release()); - m_valueList->next(); - } - - if (values->length()) { - addProperty(propId, values.release(), important); - m_valueList->next(); - return true; - } - - return false; -} - PassRefPtr CSSPropertyParser::parseAttr(CSSParserValueList* args) { if (args->size() != 1) diff --git a/engine/core/css/parser/CSSPropertyParser.h b/engine/core/css/parser/CSSPropertyParser.h index 412c58473bf..0580c519f20 100644 --- a/engine/core/css/parser/CSSPropertyParser.h +++ b/engine/core/css/parser/CSSPropertyParser.h @@ -90,7 +90,6 @@ private: bool parseShorthand(CSSPropertyID, const StylePropertyShorthand&, bool important); bool parse4Values(CSSPropertyID, const CSSPropertyID* properties, bool important); - bool parseContent(CSSPropertyID, bool important); PassRefPtr parseQuotes(); PassRefPtr parseAttr(CSSParserValueList* args); diff --git a/engine/core/css/resolver/StyleBuilderCustom.cpp b/engine/core/css/resolver/StyleBuilderCustom.cpp index bec148cc762..e762659f913 100644 --- a/engine/core/css/resolver/StyleBuilderCustom.cpp +++ b/engine/core/css/resolver/StyleBuilderCustom.cpp @@ -807,76 +807,6 @@ void StyleBuilderFunctions::applyValueCSSPropertyWillChange(StyleResolverState& state.style()->setSubtreeWillChangeContents(willChangeContents || state.parentStyle()->subtreeWillChangeContents()); } -void StyleBuilderFunctions::applyInitialCSSPropertyContent(StyleResolverState& state) -{ - state.style()->clearContent(); -} - -void StyleBuilderFunctions::applyInheritCSSPropertyContent(StyleResolverState&) -{ - // FIXME: In CSS3, it will be possible to inherit content. In CSS2 it is not. This - // note is a reminder that eventually "inherit" needs to be supported. -} - -void StyleBuilderFunctions::applyValueCSSPropertyContent(StyleResolverState& state, CSSValue* value) -{ - // list of string, uri, counter, attr, i - - if (!value->isValueList()) - return; - - bool didSet = false; - for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { - CSSValue* item = i.value(); - if (item->isImageGeneratorValue()) { - if (item->isGradientValue()) - state.style()->setContent(StyleGeneratedImage::create(toCSSGradientValue(item)->gradientWithStylesResolved(state.document().textLinkColors(), state.style()->color()).get()), didSet); - else - state.style()->setContent(StyleGeneratedImage::create(toCSSImageGeneratorValue(item)), didSet); - didSet = true; - } else if (item->isImageSetValue()) { - state.style()->setContent(state.elementStyleResources().setOrPendingFromValue(CSSPropertyContent, toCSSImageSetValue(item)), didSet); - didSet = true; - } - - if (item->isImageValue()) { - state.style()->setContent(state.elementStyleResources().cachedOrPendingFromValue(state.document(), CSSPropertyContent, toCSSImageValue(item)), didSet); - didSet = true; - continue; - } - - if (!item->isPrimitiveValue()) - continue; - - CSSPrimitiveValue* contentValue = toCSSPrimitiveValue(item); - - if (contentValue->isString()) { - state.style()->setContent(contentValue->getStringValue().impl(), didSet); - didSet = true; - } else if (contentValue->isAttr()) { - // FIXME: Can a namespace be specified for an attr(foo)? - if (state.style()->styleType() == NOPSEUDO) - state.style()->setUnique(); - else - state.parentStyle()->setUnique(); - QualifiedName attr(AtomicString(contentValue->getStringValue())); - const AtomicString& value = state.element()->getAttribute(attr); - state.style()->setContent(value.isNull() ? emptyString() : value.string(), didSet); - didSet = true; - // register the fact that the attribute value affects the style - state.contentAttrValues().append(attr.localName()); - } else { - switch (contentValue->getValueID()) { - default: - // normal and none do not have any effect. - { } - } - } - } - if (!didSet) - state.style()->clearContent(); -} - void StyleBuilderFunctions::applyInitialCSSPropertyFont(StyleResolverState&) { ASSERT_NOT_REACHED(); diff --git a/engine/core/css/resolver/StyleResourceLoader.cpp b/engine/core/css/resolver/StyleResourceLoader.cpp index f872766af50..fd445ab7b08 100644 --- a/engine/core/css/resolver/StyleResourceLoader.cpp +++ b/engine/core/css/resolver/StyleResourceLoader.cpp @@ -28,7 +28,6 @@ #include "core/css/CSSImageValue.h" #include "core/css/resolver/ElementStyleResources.h" #include "core/fetch/ResourceFetcher.h" -#include "core/rendering/style/ContentData.h" #include "core/rendering/style/FillLayer.h" #include "core/rendering/style/RenderStyle.h" #include "core/rendering/style/StyleFetchedImage.h" @@ -86,19 +85,6 @@ void StyleResourceLoader::loadPendingImages(RenderStyle* style, ElementStyleReso } break; } - case CSSPropertyContent: { - for (ContentData* contentData = const_cast(style->contentData()); contentData; contentData = contentData->next()) { - if (contentData->isImage()) { - StyleImage* image = toImageContentData(contentData)->image(); - if (image->isPendingImage()) { - RefPtr loadedImage = loadPendingImage(toStylePendingImage(image), elementStyleResources.deviceScaleFactor()); - if (loadedImage) - toImageContentData(contentData)->setImage(loadedImage.release()); - } - } - } - break; - } case CSSPropertyCursor: { if (CursorList* cursorList = style->cursors()) { for (size_t i = 0; i < cursorList->size(); ++i) { diff --git a/engine/core/loader/ImageLoader.cpp b/engine/core/loader/ImageLoader.cpp index e2e588e5831..b29803a0eda 100644 --- a/engine/core/loader/ImageLoader.cpp +++ b/engine/core/loader/ImageLoader.cpp @@ -364,9 +364,7 @@ RenderImageResource* ImageLoader::renderImageResource() if (!renderer) return 0; - // We don't return style generated image because it doesn't belong to the ImageLoader. - // See - if (renderer->isImage() && !static_cast(renderer)->isGeneratedContent()) + if (renderer->isImage()) return toRenderImage(renderer)->imageResource(); return 0; diff --git a/engine/core/rendering/RenderBlock.cpp b/engine/core/rendering/RenderBlock.cpp index 444fb1fbb5b..818bd768036 100644 --- a/engine/core/rendering/RenderBlock.cpp +++ b/engine/core/rendering/RenderBlock.cpp @@ -46,7 +46,6 @@ #include "core/rendering/RenderLayer.h" #include "core/rendering/RenderObjectInlines.h" #include "core/rendering/RenderView.h" -#include "core/rendering/style/ContentData.h" #include "core/rendering/style/RenderStyle.h" #include "platform/geometry/FloatQuad.h" #include "platform/geometry/TransformState.h" @@ -137,9 +136,6 @@ static void appendImagesFromStyle(Vector& images, RenderStyle& b appendLayers(images, blockStyle.backgroundLayers()); appendLayers(images, blockStyle.maskLayers()); - const ContentData* contentData = blockStyle.contentData(); - if (contentData && contentData->isImage()) - appendImageIfNotNull(images, toImageContentData(contentData)->image()); appendImageIfNotNull(images, blockStyle.listStyleImage()); appendImageIfNotNull(images, blockStyle.borderImageSource()); appendImageIfNotNull(images, blockStyle.maskBoxImageSource()); diff --git a/engine/core/rendering/RenderImage.cpp b/engine/core/rendering/RenderImage.cpp index e6dc9d38b54..6557a5edaa6 100644 --- a/engine/core/rendering/RenderImage.cpp +++ b/engine/core/rendering/RenderImage.cpp @@ -51,7 +51,6 @@ float deviceScaleFactor(LocalFrame*); RenderImage::RenderImage(Element* element) : RenderReplaced(element, IntSize()) - , m_isGeneratedContent(false) , m_imageDevicePixelRatio(1.0f) { updateAltText(); diff --git a/engine/core/rendering/RenderImage.h b/engine/core/rendering/RenderImage.h index 41f7deb97a9..fb0280deab5 100644 --- a/engine/core/rendering/RenderImage.h +++ b/engine/core/rendering/RenderImage.h @@ -50,10 +50,6 @@ public: void highQualityRepaintTimerFired(Timer*); - void setIsGeneratedContent(bool generated = true) { m_isGeneratedContent = generated; } - - bool isGeneratedContent() const { return m_isGeneratedContent; } - String altText() const { return m_altText; } inline void setImageDevicePixelRatio(float factor) { m_imageDevicePixelRatio = factor; } @@ -105,7 +101,6 @@ private: // Text to display as long as the image isn't available. String m_altText; OwnPtr m_imageResource; - bool m_isGeneratedContent; float m_imageDevicePixelRatio; friend class RenderImageScaleObserver; diff --git a/engine/core/rendering/RenderObject.cpp b/engine/core/rendering/RenderObject.cpp index 8fc2b6ea00f..5df878bf77f 100644 --- a/engine/core/rendering/RenderObject.cpp +++ b/engine/core/rendering/RenderObject.cpp @@ -59,7 +59,6 @@ #include "core/rendering/RenderView.h" #include "core/rendering/compositing/CompositedLayerMapping.h" #include "core/rendering/compositing/RenderLayerCompositor.h" -#include "core/rendering/style/ContentData.h" #include "core/rendering/style/ShadowList.h" #include "platform/JSONValues.h" #include "platform/Partitions.h" diff --git a/engine/core/rendering/style/ContentData.cpp b/engine/core/rendering/style/ContentData.cpp deleted file mode 100644 index 32ce65e34c3..00000000000 --- a/engine/core/rendering/style/ContentData.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#include "config.h" -#include "core/rendering/style/ContentData.h" - -#include "core/rendering/RenderImage.h" -#include "core/rendering/RenderImageResource.h" -#include "core/rendering/RenderImageResourceStyleImage.h" -#include "core/rendering/style/RenderStyle.h" - -namespace blink { - -PassOwnPtr ContentData::create(PassRefPtr image) -{ - return adoptPtr(new ImageContentData(image)); -} - -PassOwnPtr ContentData::create(const String& text) -{ - return adoptPtr(new TextContentData(text)); -} - -PassOwnPtr ContentData::clone() const -{ - OwnPtr result = cloneInternal(); - - ContentData* lastNewData = result.get(); - for (const ContentData* contentData = next(); contentData; contentData = contentData->next()) { - OwnPtr newData = contentData->cloneInternal(); - lastNewData->setNext(newData.release()); - lastNewData = lastNewData->next(); - } - - return result.release(); -} - -RenderObject* ImageContentData::createRenderer(Document& doc, RenderStyle* pseudoStyle) const -{ - return 0; -} - -RenderObject* TextContentData::createRenderer(Document& doc, RenderStyle* pseudoStyle) const -{ - return 0; -} - -} // namespace blink diff --git a/engine/core/rendering/style/ContentData.h b/engine/core/rendering/style/ContentData.h deleted file mode 100644 index cfdcefc20d3..00000000000 --- a/engine/core/rendering/style/ContentData.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (C) 2000 Lars Knoll (knoll@kde.org) - * (C) 2000 Antti Koivisto (koivisto@kde.org) - * (C) 2000 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. - * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef ContentData_h -#define ContentData_h - -#include "core/rendering/style/RenderStyleConstants.h" -#include "core/rendering/style/StyleImage.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" - -namespace blink { - -class Document; -class RenderObject; -class RenderStyle; - -class ContentData { - WTF_MAKE_FAST_ALLOCATED; -public: - static PassOwnPtr create(PassRefPtr); - static PassOwnPtr create(const String&); - - virtual ~ContentData() { } - - virtual bool isImage() const { return false; } - virtual bool isText() const { return false; } - - virtual RenderObject* createRenderer(Document&, RenderStyle*) const = 0; - - virtual PassOwnPtr clone() const; - - ContentData* next() const { return m_next.get(); } - void setNext(PassOwnPtr next) { m_next = next; } - - virtual bool equals(const ContentData&) const = 0; - -private: - virtual PassOwnPtr cloneInternal() const = 0; - - OwnPtr m_next; -}; - -#define DEFINE_CONTENT_DATA_TYPE_CASTS(typeName) \ - DEFINE_TYPE_CASTS(typeName##ContentData, ContentData, content, content->is##typeName(), content.is##typeName()) - -class ImageContentData final : public ContentData { - friend class ContentData; -public: - const StyleImage* image() const { return m_image.get(); } - StyleImage* image() { return m_image.get(); } - void setImage(PassRefPtr image) { m_image = image; } - - virtual bool isImage() const override { return true; } - virtual RenderObject* createRenderer(Document&, RenderStyle*) const override; - - virtual bool equals(const ContentData& data) const override - { - if (!data.isImage()) - return false; - return *static_cast(data).image() == *image(); - } - -private: - ImageContentData(PassRefPtr image) - : m_image(image) - { - } - - virtual PassOwnPtr cloneInternal() const override - { - RefPtr image = const_cast(this->image()); - return create(image.release()); - } - - RefPtr m_image; -}; - -DEFINE_CONTENT_DATA_TYPE_CASTS(Image); - -class TextContentData final : public ContentData { - friend class ContentData; -public: - const String& text() const { return m_text; } - void setText(const String& text) { m_text = text; } - - virtual bool isText() const override { return true; } - virtual RenderObject* createRenderer(Document&, RenderStyle*) const override; - - virtual bool equals(const ContentData& data) const override - { - if (!data.isText()) - return false; - return static_cast(data).text() == text(); - } - -private: - TextContentData(const String& text) - : m_text(text) - { - } - - virtual PassOwnPtr cloneInternal() const override { return create(text()); } - - String m_text; -}; - -DEFINE_CONTENT_DATA_TYPE_CASTS(Text); - -inline bool operator==(const ContentData& a, const ContentData& b) -{ - return a.equals(b); -} - -inline bool operator!=(const ContentData& a, const ContentData& b) -{ - return !(a == b); -} - -} // namespace blink - -#endif // ContentData_h diff --git a/engine/core/rendering/style/RenderStyle.cpp b/engine/core/rendering/style/RenderStyle.cpp index b43167aa92e..6faf8c9e8b7 100644 --- a/engine/core/rendering/style/RenderStyle.cpp +++ b/engine/core/rendering/style/RenderStyle.cpp @@ -27,7 +27,6 @@ #include "core/css/resolver/StyleResolver.h" #include "core/rendering/RenderTheme.h" #include "core/rendering/style/AppliedTextDecoration.h" -#include "core/rendering/style/ContentData.h" #include "core/rendering/style/DataEquivalency.h" #include "core/rendering/style/QuotesData.h" #include "core/rendering/style/ShadowList.h" @@ -147,7 +146,6 @@ StyleRecalcChange RenderStyle::stylePropagationDiff(const RenderStyle* oldStyle, return NoChange; if (oldStyle->display() != newStyle->display() - || !oldStyle->contentDataEquivalent(newStyle) || oldStyle->justifyItems() != newStyle->justifyItems() || oldStyle->alignItems() != newStyle->alignItems()) return Reattach; @@ -562,61 +560,6 @@ void RenderStyle::clearCursorList() rareInheritedData.access()->cursorData = nullptr; } -void RenderStyle::clearContent() -{ - if (rareNonInheritedData->m_content) - rareNonInheritedData.access()->m_content = nullptr; -} - -void RenderStyle::appendContent(PassOwnPtr contentData) -{ - OwnPtr& content = rareNonInheritedData.access()->m_content; - ContentData* lastContent = content.get(); - while (lastContent && lastContent->next()) - lastContent = lastContent->next(); - - if (lastContent) - lastContent->setNext(contentData); - else - content = contentData; -} - -void RenderStyle::setContent(PassRefPtr image, bool add) -{ - if (!image) - return; - - if (add) { - appendContent(ContentData::create(image)); - return; - } - - rareNonInheritedData.access()->m_content = ContentData::create(image); -} - -void RenderStyle::setContent(const String& string, bool add) -{ - OwnPtr& content = rareNonInheritedData.access()->m_content; - if (add) { - ContentData* lastContent = content.get(); - while (lastContent && lastContent->next()) - lastContent = lastContent->next(); - - if (lastContent) { - // We attempt to merge with the last ContentData if possible. - if (lastContent->isText()) { - TextContentData* textContent = toTextContentData(lastContent); - textContent->setText(textContent->text() + string); - } else - lastContent->setNext(ContentData::create(string)); - - return; - } - } - - content = ContentData::create(string); -} - WebBlendMode RenderStyle::blendMode() const { if (RuntimeEnabledFeatures::cssCompositingEnabled()) diff --git a/engine/core/rendering/style/RenderStyle.h b/engine/core/rendering/style/RenderStyle.h index e20a07e5035..515090ff732 100644 --- a/engine/core/rendering/style/RenderStyle.h +++ b/engine/core/rendering/style/RenderStyle.h @@ -100,8 +100,6 @@ class StyleInheritedData; class StyleResolver; class TransformationMatrix; -class ContentData; - class RenderStyle: public RefCounted { friend class AnimatedStyleBuilder; // Used by Web Animations CSS. Sets the color styles friend class CSSAnimatableValueFactory; // Used by Web Animations CSS. Gets visited and unvisited colors separately. @@ -1202,13 +1200,6 @@ public: static ClipPathOperation* initialClipPath() { return 0; } - bool hasContent() const { return contentData(); } - const ContentData* contentData() const { return rareNonInheritedData->m_content.get(); } - bool contentDataEquivalent(const RenderStyle* otherStyle) const { return const_cast(this)->rareNonInheritedData->contentDataEquivalent(*const_cast(otherStyle)->rareNonInheritedData); } - void clearContent(); - void setContent(const String&, bool add = false); - void setContent(PassRefPtr, bool add = false); - const CounterDirectiveMap* counterDirectives() const; CounterDirectiveMap& accessCounterDirectives(); const CounterDirectives getCounterDirectives(const AtomicString& identifier) const; @@ -1443,7 +1434,6 @@ private: StyleColor textDecorationColor() const { return rareNonInheritedData->m_textDecorationColor; } - void appendContent(PassOwnPtr); void addAppliedTextDecoration(const AppliedTextDecoration&); bool diffNeedsFullLayoutAndPaintInvalidation(const RenderStyle& other) const; diff --git a/engine/core/rendering/style/StyleRareNonInheritedData.cpp b/engine/core/rendering/style/StyleRareNonInheritedData.cpp index 2e38772aec8..d7964e1a35e 100644 --- a/engine/core/rendering/style/StyleRareNonInheritedData.cpp +++ b/engine/core/rendering/style/StyleRareNonInheritedData.cpp @@ -22,7 +22,6 @@ #include "config.h" #include "core/rendering/style/StyleRareNonInheritedData.h" -#include "core/rendering/style/ContentData.h" #include "core/rendering/style/DataEquivalency.h" #include "core/rendering/style/RenderStyle.h" #include "core/rendering/style/ShadowList.h" @@ -97,7 +96,6 @@ StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInherited , m_transform(o.m_transform) , m_willChange(o.m_willChange) , m_filter(o.m_filter) - , m_content(o.m_content ? o.m_content->clone() : nullptr) , m_counterDirectives(o.m_counterDirectives ? clone(*o.m_counterDirectives) : nullptr) , m_boxShadow(o.m_boxShadow) , m_animations(o.m_animations ? CSSAnimationData::create(*o.m_animations) : nullptr) @@ -164,7 +162,6 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c && m_transform == o.m_transform && m_willChange == o.m_willChange && m_filter == o.m_filter - && contentDataEquivalent(o) && counterDataEquivalent(o) && shadowDataEquivalent(o) && animationDataEquivalent(o) @@ -210,19 +207,6 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c && m_hasInlineTransform == o.m_hasInlineTransform; } -bool StyleRareNonInheritedData::contentDataEquivalent(const StyleRareNonInheritedData& o) const -{ - ContentData* a = m_content.get(); - ContentData* b = o.m_content.get(); - - while (a && b && *a == *b) { - a = a->next(); - b = b->next(); - } - - return !a && !b; -} - bool StyleRareNonInheritedData::counterDataEquivalent(const StyleRareNonInheritedData& o) const { return dataEquivalent(m_counterDirectives, o.m_counterDirectives); diff --git a/engine/core/rendering/style/StyleRareNonInheritedData.h b/engine/core/rendering/style/StyleRareNonInheritedData.h index 50a8b7d7481..ff280e9c8a9 100644 --- a/engine/core/rendering/style/StyleRareNonInheritedData.h +++ b/engine/core/rendering/style/StyleRareNonInheritedData.h @@ -43,7 +43,6 @@ namespace blink { -class ContentData; class CSSAnimationData; class CSSTransitionData; class LengthSize; @@ -75,7 +74,6 @@ public: bool operator==(const StyleRareNonInheritedData&) const; bool operator!=(const StyleRareNonInheritedData& o) const { return !(*this == o); } - bool contentDataEquivalent(const StyleRareNonInheritedData&) const; bool counterDataEquivalent(const StyleRareNonInheritedData&) const; bool shadowDataEquivalent(const StyleRareNonInheritedData&) const; bool animationDataEquivalent(const StyleRareNonInheritedData&) const; @@ -100,7 +98,6 @@ public: DataRef m_filter; // Filter operations (url, sepia, blur, etc.) - OwnPtr m_content; OwnPtr m_counterDirectives; RefPtr m_boxShadow;