<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[205421] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/205421">205421</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2016-09-04 11:50:21 -0700 (Sun, 04 Sep 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Remove Style::PendingResources
https://bugs.webkit.org/show_bug.cgi?id=161574
Reviewed by Andreas Kling.
RenderStyle contains all the information needed to initialize resource loads. There is no need for this side structure.
* css/CSSFilterImageValue.cpp:
(WebCore::CSSFilterImageValue::loadSubimages):
Load external SVG resources along with any image resources.
* css/CSSToStyleMap.cpp:
(WebCore::CSSToStyleMap::styleImage):
(WebCore::CSSToStyleMap::mapFillImage):
(WebCore::CSSToStyleMap::mapNinePieceImage):
* css/CSSToStyleMap.h:
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertStyleImage):
(WebCore::StyleBuilderConverter::convertShapeValue):
* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderCustom::applyValueCursor):
(WebCore::StyleBuilderCustom::applyValueContent):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::State::clear):
(WebCore::StyleResolver::styleImage):
(WebCore::StyleResolver::createFilterOperations):
(WebCore::StyleResolver::loadPendingResources):
(WebCore::StyleResolver::State::ensurePendingResources): Deleted.
(WebCore::StyleResolver::styleCachedImageFromValue): Deleted.
(WebCore::StyleResolver::styleGeneratedImageFromValue): Deleted.
* css/StyleResolver.h:
(WebCore::StyleResolver::State::takePendingResources): Deleted.
* platform/graphics/filters/FilterOperation.cpp:
(WebCore::ReferenceFilterOperation::loadExternalDocumentIfNeeded):
(WebCore::ReferenceFilterOperation::getOrCreateCachedSVGDocumentReference): Deleted.
* platform/graphics/filters/FilterOperation.h:
(WebCore::ReferenceFilterOperation::cachedSVGDocumentReference):
* rendering/style/StyleCachedImage.cpp:
(WebCore::StyleCachedImage::StyleCachedImage):
* style/StylePendingResources.cpp:
(WebCore::Style::loadPendingResources):
Trigger resource loads by checking pending resources in RenderStyle unconditionally. Keeping track of them
separately wasn't necessary or a meaningful optimization.
(WebCore::Style::loadPendingImages): Deleted.
(WebCore::Style::loadPendingSVGFilters): Deleted.
* style/StylePendingResources.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSFilterImageValuecpp">trunk/Source/WebCore/css/CSSFilterImageValue.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSToStyleMapcpp">trunk/Source/WebCore/css/CSSToStyleMap.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSToStyleMaph">trunk/Source/WebCore/css/CSSToStyleMap.h</a></li>
<li><a href="#trunkSourceWebCorecssStyleBuilderConverterh">trunk/Source/WebCore/css/StyleBuilderConverter.h</a></li>
<li><a href="#trunkSourceWebCorecssStyleBuilderCustomh">trunk/Source/WebCore/css/StyleBuilderCustom.h</a></li>
<li><a href="#trunkSourceWebCorecssStyleResolvercpp">trunk/Source/WebCore/css/StyleResolver.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleResolverh">trunk/Source/WebCore/css/StyleResolver.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersFilterOperationcpp">trunk/Source/WebCore/platform/graphics/filters/FilterOperation.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersFilterOperationh">trunk/Source/WebCore/platform/graphics/filters/FilterOperation.h</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleStyleCachedImagecpp">trunk/Source/WebCore/rendering/style/StyleCachedImage.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleStylePendingResourcescpp">trunk/Source/WebCore/style/StylePendingResources.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleStylePendingResourcesh">trunk/Source/WebCore/style/StylePendingResources.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (205420 => 205421)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/ChangeLog        2016-09-04 18:50:21 UTC (rev 205421)
</span><span class="lines">@@ -1,5 +1,57 @@
</span><span class="cx"> 2016-09-04 Antti Koivisto <antti@apple.com>
</span><span class="cx">
</span><ins>+ Remove Style::PendingResources
+ https://bugs.webkit.org/show_bug.cgi?id=161574
+
+ Reviewed by Andreas Kling.
+
+ RenderStyle contains all the information needed to initialize resource loads. There is no need for this side structure.
+
+ * css/CSSFilterImageValue.cpp:
+ (WebCore::CSSFilterImageValue::loadSubimages):
+
+ Load external SVG resources along with any image resources.
+
+ * css/CSSToStyleMap.cpp:
+ (WebCore::CSSToStyleMap::styleImage):
+ (WebCore::CSSToStyleMap::mapFillImage):
+ (WebCore::CSSToStyleMap::mapNinePieceImage):
+ * css/CSSToStyleMap.h:
+ * css/StyleBuilderConverter.h:
+ (WebCore::StyleBuilderConverter::convertStyleImage):
+ (WebCore::StyleBuilderConverter::convertShapeValue):
+ * css/StyleBuilderCustom.h:
+ (WebCore::StyleBuilderCustom::applyValueCursor):
+ (WebCore::StyleBuilderCustom::applyValueContent):
+ * css/StyleResolver.cpp:
+ (WebCore::StyleResolver::State::clear):
+ (WebCore::StyleResolver::styleImage):
+ (WebCore::StyleResolver::createFilterOperations):
+ (WebCore::StyleResolver::loadPendingResources):
+ (WebCore::StyleResolver::State::ensurePendingResources): Deleted.
+ (WebCore::StyleResolver::styleCachedImageFromValue): Deleted.
+ (WebCore::StyleResolver::styleGeneratedImageFromValue): Deleted.
+ * css/StyleResolver.h:
+ (WebCore::StyleResolver::State::takePendingResources): Deleted.
+ * platform/graphics/filters/FilterOperation.cpp:
+ (WebCore::ReferenceFilterOperation::loadExternalDocumentIfNeeded):
+ (WebCore::ReferenceFilterOperation::getOrCreateCachedSVGDocumentReference): Deleted.
+ * platform/graphics/filters/FilterOperation.h:
+ (WebCore::ReferenceFilterOperation::cachedSVGDocumentReference):
+ * rendering/style/StyleCachedImage.cpp:
+ (WebCore::StyleCachedImage::StyleCachedImage):
+ * style/StylePendingResources.cpp:
+ (WebCore::Style::loadPendingResources):
+
+ Trigger resource loads by checking pending resources in RenderStyle unconditionally. Keeping track of them
+ separately wasn't necessary or a meaningful optimization.
+
+ (WebCore::Style::loadPendingImages): Deleted.
+ (WebCore::Style::loadPendingSVGFilters): Deleted.
+ * style/StylePendingResources.h:
+
+2016-09-04 Antti Koivisto <antti@apple.com>
+
</ins><span class="cx"> Reverse ownership relation of StyleCachedImage and CSSImageValue
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=161447
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSFilterImageValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSFilterImageValue.cpp (205420 => 205421)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSFilterImageValue.cpp        2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/css/CSSFilterImageValue.cpp        2016-09-04 18:50:21 UTC (rev 205421)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include "CSSImageValue.h"
</span><span class="cx"> #include "CachedImage.h"
</span><span class="cx"> #include "CachedResourceLoader.h"
</span><ins>+#include "CachedSVGDocumentReference.h"
</ins><span class="cx"> #include "CrossfadeGeneratedImage.h"
</span><span class="cx"> #include "FilterEffectRenderer.h"
</span><span class="cx"> #include "ImageBuffer.h"
</span><span class="lines">@@ -96,6 +97,13 @@
</span><span class="cx"> m_cachedImage->addClient(&m_filterSubimageObserver);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ for (auto& filterOperation : m_filterOperations.operations()) {
+ if (!is<ReferenceFilterOperation>(filterOperation.get()))
+ continue;
+ auto& referenceFilterOperation = downcast<ReferenceFilterOperation>(*filterOperation);
+ referenceFilterOperation.loadExternalDocumentIfNeeded(cachedResourceLoader, options);
+ }
+
</ins><span class="cx"> m_filterSubimageObserver.setReady(true);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSToStyleMapcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSToStyleMap.cpp (205420 => 205421)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSToStyleMap.cpp        2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/css/CSSToStyleMap.cpp        2016-09-04 18:50:21 UTC (rev 205421)
</span><span class="lines">@@ -66,9 +66,9 @@
</span><span class="cx"> return m_resolver->useSVGZoomRules();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<StyleImage> CSSToStyleMap::styleImage(CSSPropertyID propertyId, CSSValue& value)
</del><ins>+RefPtr<StyleImage> CSSToStyleMap::styleImage(CSSValue& value)
</ins><span class="cx"> {
</span><del>- return m_resolver->styleImage(propertyId, value);
</del><ins>+ return m_resolver->styleImage(value);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void CSSToStyleMap::mapFillAttachment(CSSPropertyID propertyID, FillLayer& layer, const CSSValue& value)
</span><span class="lines">@@ -155,7 +155,7 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- layer.setImage(styleImage(propertyID, value));
</del><ins>+ layer.setImage(styleImage(value));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void CSSToStyleMap::mapFillRepeatX(CSSPropertyID propertyID, FillLayer& layer, const CSSValue& value)
</span><span class="lines">@@ -557,18 +557,9 @@
</span><span class="cx"> // Retrieve the border image value.
</span><span class="cx"> CSSValueList& borderImage = downcast<CSSValueList>(*value);
</span><span class="cx">
</span><del>- // Set the image (this kicks off the load).
- CSSPropertyID imageProperty;
- if (property == CSSPropertyWebkitBorderImage)
- imageProperty = CSSPropertyBorderImageSource;
- else if (property == CSSPropertyWebkitMaskBoxImage)
- imageProperty = CSSPropertyWebkitMaskBoxImageSource;
- else
- imageProperty = property;
-
</del><span class="cx"> for (auto& current : borderImage) {
</span><span class="cx"> if (is<CSSImageValue>(current.get()) || is<CSSImageGeneratorValue>(current.get()) || is<CSSImageSetValue>(current.get()))
</span><del>- image.setImage(styleImage(imageProperty, current.get()));
</del><ins>+ image.setImage(styleImage(current.get()));
</ins><span class="cx"> else if (is<CSSBorderImageSliceValue>(current.get()))
</span><span class="cx"> mapNinePieceImageSlice(current, image);
</span><span class="cx"> else if (is<CSSValueList>(current.get())) {
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSToStyleMaph"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSToStyleMap.h (205420 => 205421)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSToStyleMap.h        2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/css/CSSToStyleMap.h        2016-09-04 18:50:21 UTC (rev 205421)
</span><span class="lines">@@ -87,7 +87,7 @@
</span><span class="cx"> // FIXME: This should be part of some sort of StyleImageCache object which
</span><span class="cx"> // is held by the StyleResolver, and likely provided to this object
</span><span class="cx"> // during the resolve.
</span><del>- RefPtr<StyleImage> styleImage(CSSPropertyID, CSSValue&);
</del><ins>+ RefPtr<StyleImage> styleImage(CSSValue&);
</ins><span class="cx">
</span><span class="cx"> StyleResolver* m_resolver;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleBuilderConverterh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleBuilderConverter.h (205420 => 205421)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleBuilderConverter.h        2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/css/StyleBuilderConverter.h        2016-09-04 18:50:21 UTC (rev 205421)
</span><span class="lines">@@ -408,7 +408,7 @@
</span><span class="cx"> template <CSSPropertyID property>
</span><span class="cx"> inline PassRefPtr<StyleImage> StyleBuilderConverter::convertStyleImage(StyleResolver& styleResolver, CSSValue& value)
</span><span class="cx"> {
</span><del>- return styleResolver.styleImage(property, value);
</del><ins>+ return styleResolver.styleImage(value);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> inline TransformOperations StyleBuilderConverter::convertTransform(StyleResolver& styleResolver, CSSValue& value)
</span><span class="lines">@@ -741,7 +741,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (isImageShape(value))
</span><del>- return ShapeValue::createImageValue(styleResolver.styleImage(CSSPropertyWebkitShapeOutside, value));
</del><ins>+ return ShapeValue::createImageValue(styleResolver.styleImage(value));
</ins><span class="cx">
</span><span class="cx"> RefPtr<BasicShape> shape;
</span><span class="cx"> CSSBoxType referenceBox = BoxMissing;
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleBuilderCustomh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleBuilderCustom.h (205420 => 205421)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleBuilderCustom.h        2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/css/StyleBuilderCustom.h        2016-09-04 18:50:21 UTC (rev 205421)
</span><span class="lines">@@ -1147,7 +1147,7 @@
</span><span class="cx"> for (auto& item : list) {
</span><span class="cx"> if (is<CSSCursorImageValue>(item.get())) {
</span><span class="cx"> auto& image = downcast<CSSCursorImageValue>(item.get());
</span><del>- styleResolver.style()->addCursor(styleResolver.styleImage(CSSPropertyCursor, image), image.hotSpot());
</del><ins>+ styleResolver.style()->addCursor(styleResolver.styleImage(image), image.hotSpot());
</ins><span class="cx"> continue;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1314,12 +1314,12 @@
</span><span class="cx"> styleResolver.style()->setContent(StyleGeneratedImage::create(downcast<CSSImageGeneratorValue>(item.get())), didSet);
</span><span class="cx"> didSet = true;
</span><span class="cx"> } else if (is<CSSImageSetValue>(item.get())) {
</span><del>- styleResolver.style()->setContent(styleResolver.styleCachedImageFromValue(CSSPropertyContent, item), didSet);
</del><ins>+ styleResolver.style()->setContent(StyleCachedImage::create(item), didSet);
</ins><span class="cx"> didSet = true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (is<CSSImageValue>(item.get())) {
</span><del>- styleResolver.style()->setContent(styleResolver.styleCachedImageFromValue(CSSPropertyContent, item), didSet);
</del><ins>+ styleResolver.style()->setContent(StyleCachedImage::create(item), didSet);
</ins><span class="cx"> didSet = true;
</span><span class="cx"> continue;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.cpp (205420 => 205421)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.cpp        2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/css/StyleResolver.cpp        2016-09-04 18:50:21 UTC (rev 205421)
</span><span class="lines">@@ -189,7 +189,6 @@
</span><span class="cx"> m_parentStyle = nullptr;
</span><span class="cx"> m_ownedParentStyle = nullptr;
</span><span class="cx"> m_regionForStyling = nullptr;
</span><del>- m_pendingResources = nullptr;
</del><span class="cx"> m_cssToLengthConversionData = CSSToLengthConversionData();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -378,13 +377,6 @@
</span><span class="cx"> m_parentStyle = m_ownedParentStyle.get();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Style::PendingResources& StyleResolver::State::ensurePendingResources()
-{
- if (!m_pendingResources)
- m_pendingResources = std::make_unique<Style::PendingResources>();
- return *m_pendingResources;
-}
-
</del><span class="cx"> static inline bool isAtShadowBoundary(const Element& element)
</span><span class="cx"> {
</span><span class="cx"> auto* parentNode = element.parentNode();
</span><span class="lines">@@ -1700,40 +1692,25 @@
</span><span class="cx"> return parser.parseVariableDependentValue(propID, value, m_state.style()->customProperties(), m_state.style()->direction(), m_state.style()->writingMode());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<StyleImage> StyleResolver::styleImage(CSSPropertyID property, CSSValue& value)
</del><ins>+RefPtr<StyleImage> StyleResolver::styleImage(CSSValue& value)
</ins><span class="cx"> {
</span><span class="cx"> if (is<CSSImageGeneratorValue>(value)) {
</span><span class="cx"> if (is<CSSGradientValue>(value))
</span><del>- return styleGeneratedImageFromValue(property, *downcast<CSSGradientValue>(value).gradientWithStylesResolved(this));
- return styleGeneratedImageFromValue(property, downcast<CSSImageGeneratorValue>(value));
</del><ins>+ return StyleGeneratedImage::create(*downcast<CSSGradientValue>(value).gradientWithStylesResolved(this));
+
+ if (is<CSSFilterImageValue>(value)) {
+ // FilterImage needs to calculate FilterOperations.
+ downcast<CSSFilterImageValue>(value).createFilterOperations(this);
+ }
+ return StyleGeneratedImage::create(downcast<CSSImageGeneratorValue>(value));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (is<CSSImageValue>(value) || is<CSSImageSetValue>(value) || is<CSSCursorImageValue>(value))
</span><del>- return styleCachedImageFromValue(property, value);
</del><ins>+ return StyleCachedImage::create(value);
</ins><span class="cx">
</span><span class="cx"> return nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Ref<StyleCachedImage> StyleResolver::styleCachedImageFromValue(CSSPropertyID property, CSSValue& value)
-{
- auto image = StyleCachedImage::create(value);
- if (image->isPending())
- m_state.ensurePendingResources().pendingImages.set(property, &value);
- return image;
-}
-
-Ref<StyleGeneratedImage> StyleResolver::styleGeneratedImageFromValue(CSSPropertyID property, CSSImageGeneratorValue& value)
-{
- if (is<CSSFilterImageValue>(value)) {
- // FilterImage needs to calculate FilterOperations.
- downcast<CSSFilterImageValue>(value).createFilterOperations(this);
- }
- if (value.isPending())
- m_state.ensurePendingResources().pendingImages.set(property, &value);
-
- return StyleGeneratedImage::create(value);
-}
-
</del><span class="cx"> #if ENABLE(IOS_TEXT_AUTOSIZING)
</span><span class="cx"> void StyleResolver::checkForTextSizeAdjust(RenderStyle* style)
</span><span class="cx"> {
</span><span class="lines">@@ -1968,9 +1945,6 @@
</span><span class="cx"> URL url = m_state.document().completeURL(cssUrl);
</span><span class="cx">
</span><span class="cx"> RefPtr<ReferenceFilterOperation> operation = ReferenceFilterOperation::create(cssUrl, url.fragmentIdentifier());
</span><del>- if (SVGURIReference::isExternalURIReference(cssUrl, m_state.document()))
- state.ensurePendingResources().pendingSVGFilters.append(operation);
-
</del><span class="cx"> operations.operations().append(operation);
</span><span class="cx"> continue;
</span><span class="cx"> }
</span><span class="lines">@@ -2078,8 +2052,7 @@
</span><span class="cx"> RELEASE_ASSERT(!m_inLoadPendingImages);
</span><span class="cx"> TemporaryChange<bool> changeInLoadPendingImages(m_inLoadPendingImages, true);
</span><span class="cx">
</span><del>- if (auto pendingResources = state().takePendingResources())
- Style::loadPendingResources(*pendingResources, document(), *style(), m_state.element());
</del><ins>+ Style::loadPendingResources(*style(), document(), m_state.element());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> inline StyleResolver::MatchedProperties::MatchedProperties()
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolverh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.h (205420 => 205421)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.h        2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/css/StyleResolver.h        2016-09-04 18:50:21 UTC (rev 205421)
</span><span class="lines">@@ -76,7 +76,6 @@
</span><span class="cx"> class StyleGeneratedImage;
</span><span class="cx"> class StyleImage;
</span><span class="cx"> class StyleKeyframe;
</span><del>-class StylePendingImage;
</del><span class="cx"> class StyleProperties;
</span><span class="cx"> class StyleRule;
</span><span class="cx"> class StyleRuleKeyframes;
</span><span class="lines">@@ -407,9 +406,6 @@
</span><span class="cx">
</span><span class="cx"> bool useSVGZoomRules() const { return m_element && m_element->isSVGElement(); }
</span><span class="cx">
</span><del>- Style::PendingResources& ensurePendingResources();
- std::unique_ptr<Style::PendingResources> takePendingResources() { return WTFMove(m_pendingResources); }
-
</del><span class="cx"> const CSSToLengthConversionData& cssToLengthConversionData() const { return m_cssToLengthConversionData; }
</span><span class="cx">
</span><span class="cx"> CascadeLevel cascadeLevel() const { return m_cascadeLevel; }
</span><span class="lines">@@ -446,7 +442,6 @@
</span><span class="cx"> FillLayer m_backgroundData { BackgroundFillLayer };
</span><span class="cx"> Color m_backgroundColor;
</span><span class="cx">
</span><del>- std::unique_ptr<Style::PendingResources> m_pendingResources;
</del><span class="cx"> CSSToLengthConversionData m_cssToLengthConversionData;
</span><span class="cx">
</span><span class="cx"> CascadeLevel m_cascadeLevel { UserAgentLevel };
</span><span class="lines">@@ -459,9 +454,7 @@
</span><span class="cx"> State& state() { return m_state; }
</span><span class="cx"> const State& state() const { return m_state; }
</span><span class="cx">
</span><del>- RefPtr<StyleImage> styleImage(CSSPropertyID, CSSValue&);
- Ref<StyleCachedImage> styleCachedImageFromValue(CSSPropertyID, CSSValue&);
- Ref<StyleGeneratedImage> styleGeneratedImageFromValue(CSSPropertyID, CSSImageGeneratorValue&);
</del><ins>+ RefPtr<StyleImage> styleImage(CSSValue&);
</ins><span class="cx">
</span><span class="cx"> bool applyPropertyToRegularStyle() const { return m_state.applyPropertyToRegularStyle(); }
</span><span class="cx"> bool applyPropertyToVisitedLinkStyle() const { return m_state.applyPropertyToVisitedLinkStyle(); }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersFilterOperationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/filters/FilterOperation.cpp (205420 => 205421)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/FilterOperation.cpp        2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterOperation.cpp        2016-09-04 18:50:21 UTC (rev 205421)
</span><span class="lines">@@ -27,8 +27,10 @@
</span><span class="cx"> #include "FilterOperation.h"
</span><span class="cx">
</span><span class="cx"> #include "AnimationUtilities.h"
</span><ins>+#include "CachedResourceLoader.h"
</ins><span class="cx"> #include "CachedSVGDocumentReference.h"
</span><span class="cx"> #include "FilterEffect.h"
</span><ins>+#include "SVGURIReference.h"
</ins><span class="cx"> #include "TextStream.h"
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -59,12 +61,15 @@
</span><span class="cx">
</span><span class="cx"> return m_url == downcast<ReferenceFilterOperation>(operation).m_url;
</span><span class="cx"> }
</span><del>-
-CachedSVGDocumentReference* ReferenceFilterOperation::getOrCreateCachedSVGDocumentReference()
</del><ins>+
+void ReferenceFilterOperation::loadExternalDocumentIfNeeded(CachedResourceLoader& cachedResourceLoader, const ResourceLoaderOptions& options)
</ins><span class="cx"> {
</span><del>- if (!m_cachedSVGDocumentReference)
- m_cachedSVGDocumentReference = std::make_unique<CachedSVGDocumentReference>(m_url);
- return m_cachedSVGDocumentReference.get();
</del><ins>+ if (m_cachedSVGDocumentReference)
+ return;
+ if (!SVGURIReference::isExternalURIReference(m_url, *cachedResourceLoader.document()))
+ return;
+ m_cachedSVGDocumentReference = std::make_unique<CachedSVGDocumentReference>(m_url);
+ m_cachedSVGDocumentReference->load(cachedResourceLoader, options);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void ReferenceFilterOperation::setFilterEffect(PassRefPtr<FilterEffect> filterEffect)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersFilterOperationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/filters/FilterOperation.h (205420 => 205421)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/FilterOperation.h        2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterOperation.h        2016-09-04 18:50:21 UTC (rev 205421)
</span><span class="lines">@@ -42,8 +42,10 @@
</span><span class="cx">
</span><span class="cx"> // CSS Filters
</span><span class="cx">
</span><ins>+class CachedResourceLoader;
</ins><span class="cx"> class CachedSVGDocumentReference;
</span><span class="cx"> class FilterEffect;
</span><ins>+struct ResourceLoaderOptions;
</ins><span class="cx">
</span><span class="cx"> class FilterOperation : public RefCounted<FilterOperation> {
</span><span class="cx"> public:
</span><span class="lines">@@ -184,8 +186,9 @@
</span><span class="cx"> const String& url() const { return m_url; }
</span><span class="cx"> const String& fragment() const { return m_fragment; }
</span><span class="cx">
</span><ins>+ void loadExternalDocumentIfNeeded(CachedResourceLoader&, const ResourceLoaderOptions&);
+
</ins><span class="cx"> CachedSVGDocumentReference* cachedSVGDocumentReference() const { return m_cachedSVGDocumentReference.get(); }
</span><del>- CachedSVGDocumentReference* getOrCreateCachedSVGDocumentReference();
</del><span class="cx">
</span><span class="cx"> FilterEffect* filterEffect() const { return m_filterEffect.get(); }
</span><span class="cx"> void setFilterEffect(PassRefPtr<FilterEffect>);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleStyleCachedImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/StyleCachedImage.cpp (205420 => 205421)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/StyleCachedImage.cpp        2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/rendering/style/StyleCachedImage.cpp        2016-09-04 18:50:21 UTC (rev 205421)
</span><span class="lines">@@ -38,6 +38,10 @@
</span><span class="cx"> ASSERT(is<CSSImageValue>(m_cssValue) || is<CSSImageSetValue>(m_cssValue) || is<CSSCursorImageValue>(m_cssValue));
</span><span class="cx">
</span><span class="cx"> m_isCachedImage = true;
</span><ins>+
+ // CSSImageValue doesn't get invalidated so we can grab the CachedImage immediately if it exists.
+ if (is<CSSImageValue>(m_cssValue))
+ m_cachedImage = downcast<CSSImageValue>(m_cssValue.get()).cachedImage();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> StyleCachedImage::~StyleCachedImage()
</span></span></pre></div>
<a id="trunkSourceWebCorestyleStylePendingResourcescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/StylePendingResources.cpp (205420 => 205421)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StylePendingResources.cpp        2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/style/StylePendingResources.cpp        2016-09-04 18:50:21 UTC (rev 205421)
</span><span class="lines">@@ -28,7 +28,6 @@
</span><span class="cx">
</span><span class="cx"> #include "CSSCursorImageValue.h"
</span><span class="cx"> #include "CachedResourceLoader.h"
</span><del>-#include "CachedSVGDocumentReference.h"
</del><span class="cx"> #include "ContentData.h"
</span><span class="cx"> #include "CursorData.h"
</span><span class="cx"> #include "CursorList.h"
</span><span class="lines">@@ -60,82 +59,37 @@
</span><span class="cx"> const_cast<StyleImage&>(*styleImage).load(document.cachedResourceLoader(), options);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void loadPendingImages(const PendingResources& pendingResources, Document& document, RenderStyle& style, const Element* element)
</del><ins>+void loadPendingResources(RenderStyle& style, Document& document, const Element* element)
</ins><span class="cx"> {
</span><del>- for (auto currentProperty : pendingResources.pendingImages.keys()) {
- switch (currentProperty) {
- case CSSPropertyBackgroundImage: {
- for (auto* backgroundLayer = &style.ensureBackgroundLayers(); backgroundLayer; backgroundLayer = backgroundLayer->next())
- loadPendingImage(document, backgroundLayer->image(), element);
- break;
</del><ins>+ for (auto* backgroundLayer = style.backgroundLayers(); backgroundLayer; backgroundLayer = backgroundLayer->next())
+ loadPendingImage(document, backgroundLayer->image(), element);
+
+ for (auto* contentData = style.contentData(); contentData; contentData = contentData->next()) {
+ if (is<ImageContentData>(*contentData)) {
+ auto& styleImage = downcast<ImageContentData>(*contentData).image();
+ loadPendingImage(document, &styleImage, element);
</ins><span class="cx"> }
</span><del>- case CSSPropertyContent: {
- for (auto* contentData = const_cast<ContentData*>(style.contentData()); contentData; contentData = contentData->next()) {
- if (is<ImageContentData>(*contentData)) {
- auto& styleImage = downcast<ImageContentData>(*contentData).image();
- loadPendingImage(document, &styleImage, element);
- }
- }
- break;
- }
- case CSSPropertyCursor: {
- if (auto* cursorList = style.cursors()) {
- for (size_t i = 0; i < cursorList->size(); ++i)
- loadPendingImage(document, cursorList->at(i).image(), element);
- }
- break;
- }
- case CSSPropertyListStyleImage: {
- loadPendingImage(document, style.listStyleImage(), element);
- break;
- }
- case CSSPropertyBorderImageSource: {
- loadPendingImage(document, style.borderImageSource(), element);
- break;
- }
- case CSSPropertyWebkitBoxReflect: {
- if (auto* reflection = style.boxReflect())
- loadPendingImage(document, reflection->mask().image(), element);
- break;
- }
- case CSSPropertyWebkitMaskBoxImageSource: {
- loadPendingImage(document, style.maskBoxImageSource(), element);
- break;
- }
- case CSSPropertyWebkitMaskImage: {
- for (auto* maskLayer = &style.ensureMaskLayers(); maskLayer; maskLayer = maskLayer->next())
- loadPendingImage(document, maskLayer->image(), element);
- break;
- }
-#if ENABLE(CSS_SHAPES)
- case CSSPropertyWebkitShapeOutside: {
- if (style.shapeOutside())
- loadPendingImage(document, style.shapeOutside()->image(), element, LoadPolicy::ShapeOutside);
- break;
- }
-#endif
- default:
- ASSERT_NOT_REACHED();
- }
</del><span class="cx"> }
</span><del>-}
</del><span class="cx">
</span><del>-static void loadPendingSVGFilters(const PendingResources& pendingResources, Document& document, const Element* element)
-{
- if (pendingResources.pendingSVGFilters.isEmpty())
- return;
</del><ins>+ if (auto* cursorList = style.cursors()) {
+ for (size_t i = 0; i < cursorList->size(); ++i)
+ loadPendingImage(document, cursorList->at(i).image(), element);
+ }
</ins><span class="cx">
</span><del>- ResourceLoaderOptions options = CachedResourceLoader::defaultCachedResourceOptions();
- options.contentSecurityPolicyImposition = element && element->isInUserAgentShadowTree() ? ContentSecurityPolicyImposition::SkipPolicyCheck : ContentSecurityPolicyImposition::DoPolicyCheck;
</del><ins>+ loadPendingImage(document, style.listStyleImage(), element);
+ loadPendingImage(document, style.borderImageSource(), element);
+ loadPendingImage(document, style.maskBoxImageSource(), element);
</ins><span class="cx">
</span><del>- for (auto& filterOperation : pendingResources.pendingSVGFilters)
- filterOperation->getOrCreateCachedSVGDocumentReference()->load(document.cachedResourceLoader(), options);
-}
</del><ins>+ if (auto* reflection = style.boxReflect())
+ loadPendingImage(document, reflection->mask().image(), element);
</ins><span class="cx">
</span><del>-void loadPendingResources(const PendingResources& pendingResources, Document& document, RenderStyle& style, const Element* element)
-{
- loadPendingImages(pendingResources, document, style, element);
- loadPendingSVGFilters(pendingResources, document, element);
</del><ins>+ for (auto* maskLayer = style.maskLayers(); maskLayer; maskLayer = maskLayer->next())
+ loadPendingImage(document, maskLayer->image(), element);
+
+#if ENABLE(CSS_SHAPES)
+ if (style.shapeOutside())
+ loadPendingImage(document, style.shapeOutside()->image(), element, LoadPolicy::ShapeOutside);
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorestyleStylePendingResourcesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/StylePendingResources.h (205420 => 205421)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StylePendingResources.h        2016-09-04 18:11:57 UTC (rev 205420)
+++ trunk/Source/WebCore/style/StylePendingResources.h        2016-09-04 18:50:21 UTC (rev 205421)
</span><span class="lines">@@ -25,13 +25,8 @@
</span><span class="cx">
</span><span class="cx"> #pragma once
</span><span class="cx">
</span><del>-#include "CSSPropertyNames.h"
-#include "FilterOperations.h"
-#include <wtf/HashMap.h>
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-class CSSValue;
</del><span class="cx"> class Document;
</span><span class="cx"> class Element;
</span><span class="cx"> class RenderStyle;
</span><span class="lines">@@ -38,14 +33,7 @@
</span><span class="cx">
</span><span class="cx"> namespace Style {
</span><span class="cx">
</span><del>-struct PendingResources {
- WTF_MAKE_FAST_ALLOCATED;
-public:
- HashMap<CSSPropertyID, RefPtr<CSSValue>> pendingImages;
- Vector<RefPtr<ReferenceFilterOperation>> pendingSVGFilters;
-};
</del><ins>+void loadPendingResources(RenderStyle&, Document&, const Element*);
</ins><span class="cx">
</span><del>-void loadPendingResources(const PendingResources&, Document&, RenderStyle&, const Element*);
-
</del><span class="cx"> }
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>