mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Remove ContentData.
This was to support CSS generated content. R=ojan@chromium.org Review URL: https://codereview.chromium.org/709213002
This commit is contained in:
parent
8252c250f3
commit
283fa5f78a
@ -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",
|
||||
|
||||
@ -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<CSSValue> valueForFillSize(const FillSize& fillSize, const Ren
|
||||
return list.release();
|
||||
}
|
||||
|
||||
static PassRefPtr<CSSValue> valueForContentData(const RenderStyle& style)
|
||||
{
|
||||
RefPtr<CSSValueList> 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<CSSPropertyID>, propertyIDSet, ());
|
||||
@ -2182,8 +2166,6 @@ PassRefPtr<CSSValue> 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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -487,10 +487,6 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
|
||||
parsedValue = parseQuotes();
|
||||
break;
|
||||
|
||||
case CSSPropertyContent: // [ <string> | <uri> | <counter> | attr(X) | open-quote |
|
||||
// close-quote | no-open-quote | no-close-quote ]+ | inherit
|
||||
return parseContent(propId, important);
|
||||
|
||||
case CSSPropertyClip: // <shape> | auto | inherit
|
||||
if (id == CSSValueAuto)
|
||||
validPrimitive = true;
|
||||
@ -1882,66 +1878,6 @@ PassRefPtr<CSSValue> CSSPropertyParser::parseQuotes()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// [ <string> | <uri> | <counter> | attr(X) | open-quote | close-quote | no-open-quote | no-close-quote ]+ | inherit
|
||||
// in CSS 2.1 this got somewhat reduced:
|
||||
// [ <string> | attr(X) | open-quote | close-quote | no-open-quote | no-close-quote ]+ | inherit
|
||||
bool CSSPropertyParser::parseContent(CSSPropertyID propId, bool important)
|
||||
{
|
||||
RefPtr<CSSValueList> values = CSSValueList::createCommaSeparated();
|
||||
|
||||
while (CSSParserValue* val = m_valueList->current()) {
|
||||
RefPtr<CSSValue> 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<CSSValue> CSSPropertyParser::parseAttr(CSSParserValueList* args)
|
||||
{
|
||||
if (args->size() != 1)
|
||||
|
||||
@ -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<CSSValue> parseQuotes();
|
||||
|
||||
PassRefPtr<CSSValue> parseAttr(CSSParserValueList* args);
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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<ContentData*>(style->contentData()); contentData; contentData = contentData->next()) {
|
||||
if (contentData->isImage()) {
|
||||
StyleImage* image = toImageContentData(contentData)->image();
|
||||
if (image->isPendingImage()) {
|
||||
RefPtr<StyleImage> 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) {
|
||||
|
||||
@ -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 <https://bugs.webkit.org/show_bug.cgi?id=42840>
|
||||
if (renderer->isImage() && !static_cast<RenderImage*>(renderer)->isGeneratedContent())
|
||||
if (renderer->isImage())
|
||||
return toRenderImage(renderer)->imageResource();
|
||||
|
||||
return 0;
|
||||
|
||||
@ -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<ImageResource*>& 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());
|
||||
|
||||
@ -51,7 +51,6 @@ float deviceScaleFactor(LocalFrame*);
|
||||
|
||||
RenderImage::RenderImage(Element* element)
|
||||
: RenderReplaced(element, IntSize())
|
||||
, m_isGeneratedContent(false)
|
||||
, m_imageDevicePixelRatio(1.0f)
|
||||
{
|
||||
updateAltText();
|
||||
|
||||
@ -50,10 +50,6 @@ public:
|
||||
|
||||
void highQualityRepaintTimerFired(Timer<RenderImage>*);
|
||||
|
||||
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<RenderImageResource> m_imageResource;
|
||||
bool m_isGeneratedContent;
|
||||
float m_imageDevicePixelRatio;
|
||||
|
||||
friend class RenderImageScaleObserver;
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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> ContentData::create(PassRefPtr<StyleImage> image)
|
||||
{
|
||||
return adoptPtr(new ImageContentData(image));
|
||||
}
|
||||
|
||||
PassOwnPtr<ContentData> ContentData::create(const String& text)
|
||||
{
|
||||
return adoptPtr(new TextContentData(text));
|
||||
}
|
||||
|
||||
PassOwnPtr<ContentData> ContentData::clone() const
|
||||
{
|
||||
OwnPtr<ContentData> result = cloneInternal();
|
||||
|
||||
ContentData* lastNewData = result.get();
|
||||
for (const ContentData* contentData = next(); contentData; contentData = contentData->next()) {
|
||||
OwnPtr<ContentData> 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
|
||||
@ -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<ContentData> create(PassRefPtr<StyleImage>);
|
||||
static PassOwnPtr<ContentData> 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<ContentData> clone() const;
|
||||
|
||||
ContentData* next() const { return m_next.get(); }
|
||||
void setNext(PassOwnPtr<ContentData> next) { m_next = next; }
|
||||
|
||||
virtual bool equals(const ContentData&) const = 0;
|
||||
|
||||
private:
|
||||
virtual PassOwnPtr<ContentData> cloneInternal() const = 0;
|
||||
|
||||
OwnPtr<ContentData> 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<StyleImage> 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<const ImageContentData&>(data).image() == *image();
|
||||
}
|
||||
|
||||
private:
|
||||
ImageContentData(PassRefPtr<StyleImage> image)
|
||||
: m_image(image)
|
||||
{
|
||||
}
|
||||
|
||||
virtual PassOwnPtr<ContentData> cloneInternal() const override
|
||||
{
|
||||
RefPtr<StyleImage> image = const_cast<StyleImage*>(this->image());
|
||||
return create(image.release());
|
||||
}
|
||||
|
||||
RefPtr<StyleImage> 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<const TextContentData&>(data).text() == text();
|
||||
}
|
||||
|
||||
private:
|
||||
TextContentData(const String& text)
|
||||
: m_text(text)
|
||||
{
|
||||
}
|
||||
|
||||
virtual PassOwnPtr<ContentData> 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
|
||||
@ -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> contentData)
|
||||
{
|
||||
OwnPtr<ContentData>& 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<StyleImage> 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<ContentData>& 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())
|
||||
|
||||
@ -100,8 +100,6 @@ class StyleInheritedData;
|
||||
class StyleResolver;
|
||||
class TransformationMatrix;
|
||||
|
||||
class ContentData;
|
||||
|
||||
class RenderStyle: public RefCounted<RenderStyle> {
|
||||
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<RenderStyle*>(this)->rareNonInheritedData->contentDataEquivalent(*const_cast<RenderStyle*>(otherStyle)->rareNonInheritedData); }
|
||||
void clearContent();
|
||||
void setContent(const String&, bool add = false);
|
||||
void setContent(PassRefPtr<StyleImage>, 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<ContentData>);
|
||||
void addAppliedTextDecoration(const AppliedTextDecoration&);
|
||||
|
||||
bool diffNeedsFullLayoutAndPaintInvalidation(const RenderStyle& other) const;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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<StyleFilterData> m_filter; // Filter operations (url, sepia, blur, etc.)
|
||||
|
||||
OwnPtr<ContentData> m_content;
|
||||
OwnPtr<CounterDirectiveMap> m_counterDirectives;
|
||||
|
||||
RefPtr<ShadowList> m_boxShadow;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user