- Revision
- 201086
- Author
- an...@apple.com
- Date
- 2016-05-18 11:32:43 -0700 (Wed, 18 May 2016)
Log Message
Allow RenderStyles marked unique in matched properties cache
https://bugs.webkit.org/show_bug.cgi?id=157844
Reviewed by Andreas Kling.
Depending on content this can improve matched properties cache hit rate quite a bit and so reduce
time spent building styles.
* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderCustom::applyValueContent):
Set the attr bit on render style.
* css/StyleResolver.cpp:
(WebCore::isCacheableInMatchedPropertiesCache):
Allow caching of styles marked "unique". It only means that they are not shareable by style
sharing code because there were some complex selectors in the rules used for building them. It
doesn't affect matched properties cache the cache how the properties were resolved.
We still need to test against "content: attr()" as that makes the style depend on the element
being matched. It now has a separate bit in RenderStyle.
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::setHasAttrContent):
Bit for "content: attr()". It also sets unique() to keep style sharing code happy.
(WebCore::requireTransformOrigin):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::hasAttrContent):
* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator==):
* rendering/style/StyleRareNonInheritedData.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (201085 => 201086)
--- trunk/Source/WebCore/ChangeLog 2016-05-18 17:46:09 UTC (rev 201085)
+++ trunk/Source/WebCore/ChangeLog 2016-05-18 18:32:43 UTC (rev 201086)
@@ -1,3 +1,41 @@
+2016-05-18 Antti Koivisto <an...@apple.com>
+
+ Allow RenderStyles marked unique in matched properties cache
+ https://bugs.webkit.org/show_bug.cgi?id=157844
+
+ Reviewed by Andreas Kling.
+
+ Depending on content this can improve matched properties cache hit rate quite a bit and so reduce
+ time spent building styles.
+
+ * css/StyleBuilderCustom.h:
+ (WebCore::StyleBuilderCustom::applyValueContent):
+
+ Set the attr bit on render style.
+
+ * css/StyleResolver.cpp:
+ (WebCore::isCacheableInMatchedPropertiesCache):
+
+ Allow caching of styles marked "unique". It only means that they are not shareable by style
+ sharing code because there were some complex selectors in the rules used for building them. It
+ doesn't affect matched properties cache the cache how the properties were resolved.
+
+ We still need to test against "content: attr()" as that makes the style depend on the element
+ being matched. It now has a separate bit in RenderStyle.
+
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle::setHasAttrContent):
+
+ Bit for "content: attr()". It also sets unique() to keep style sharing code happy.
+
+ (WebCore::requireTransformOrigin):
+ * rendering/style/RenderStyle.h:
+ (WebCore::RenderStyle::hasAttrContent):
+ * rendering/style/StyleRareNonInheritedData.cpp:
+ (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
+ (WebCore::StyleRareNonInheritedData::operator==):
+ * rendering/style/StyleRareNonInheritedData.h:
+
2016-05-18 Csaba Osztrogonác <o...@webkit.org>
Fix the allinone-build on Linux in Source/WebCore/html/HTMLElementsAllInOne.cpp
Modified: trunk/Source/WebCore/css/StyleBuilderCustom.h (201085 => 201086)
--- trunk/Source/WebCore/css/StyleBuilderCustom.h 2016-05-18 17:46:09 UTC (rev 201085)
+++ trunk/Source/WebCore/css/StyleBuilderCustom.h 2016-05-18 18:32:43 UTC (rev 201086)
@@ -1335,9 +1335,9 @@
} else if (contentValue.isAttr()) {
// FIXME: Can a namespace be specified for an attr(foo)?
if (styleResolver.style()->styleType() == NOPSEUDO)
- styleResolver.style()->setUnique();
+ styleResolver.style()->setHasAttrContent();
else
- const_cast<RenderStyle*>(styleResolver.parentStyle())->setUnique();
+ const_cast<RenderStyle*>(styleResolver.parentStyle())->setHasAttrContent();
QualifiedName attr(nullAtom, contentValue.getStringValue().impl(), nullAtom);
const AtomicString& value = styleResolver.element()->getAttribute(attr);
styleResolver.style()->setContent(value.isNull() ? emptyAtom : value.impl(), didSet);
Modified: trunk/Source/WebCore/css/StyleResolver.cpp (201085 => 201086)
--- trunk/Source/WebCore/css/StyleResolver.cpp 2016-05-18 17:46:09 UTC (rev 201085)
+++ trunk/Source/WebCore/css/StyleResolver.cpp 2016-05-18 18:32:43 UTC (rev 201086)
@@ -1245,7 +1245,8 @@
// Document::setWritingMode/DirectionSetOnDocumentElement. We can't skip the applying by caching.
if (&element == element.document().documentElement())
return false;
- if (style->unique() || (style->styleType() != NOPSEUDO && parentStyle->unique()))
+ // content:attr() value depends on the element it is being applied to.
+ if (style->hasAttrContent() || (style->styleType() != NOPSEUDO && parentStyle->hasAttrContent()))
return false;
if (style->hasAppearance())
return false;
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (201085 => 201086)
--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2016-05-18 17:46:09 UTC (rev 201085)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2016-05-18 18:32:43 UTC (rev 201086)
@@ -1073,6 +1073,12 @@
return rareNonInheritedData->m_altText;
}
+void RenderStyle::setHasAttrContent()
+{
+ setUnique();
+ SET_VAR(rareNonInheritedData, m_hasAttrContent, true);
+}
+
// FIXME: use affectedByTransformOrigin().
static inline bool requireTransformOrigin(const Vector<RefPtr<TransformOperation>>& transformOperations, RenderStyle::ApplyTransformOrigin applyOrigin)
{
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (201085 => 201086)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2016-05-18 17:46:09 UTC (rev 201085)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2016-05-18 18:32:43 UTC (rev 201086)
@@ -1834,6 +1834,8 @@
void setContent(QuoteType, bool add = false);
void setContentAltText(const String&);
const String& contentAltText() const;
+ bool hasAttrContent() const { return rareNonInheritedData->m_hasAttrContent; }
+ void setHasAttrContent();
const CounterDirectiveMap* counterDirectives() const;
CounterDirectiveMap& accessCounterDirectives();
Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp (201085 => 201086)
--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp 2016-05-18 17:46:09 UTC (rev 201085)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp 2016-05-18 18:32:43 UTC (rev 201086)
@@ -109,6 +109,7 @@
, m_breakAfter(RenderStyle::initialBreakBetween())
, m_breakInside(RenderStyle::initialBreakInside())
, m_resize(RenderStyle::initialResize())
+ , m_hasAttrContent(false)
, m_isPlaceholderStyle(false)
{
m_maskBoxImage.setMaskDefaults();
@@ -204,6 +205,7 @@
, m_breakAfter(o.m_breakAfter)
, m_breakInside(o.m_breakInside)
, m_resize(o.m_resize)
+ , m_hasAttrContent(o.m_hasAttrContent)
, m_isPlaceholderStyle(o.m_isPlaceholderStyle)
{
}
@@ -310,6 +312,7 @@
&& m_breakBefore == o.m_breakBefore
&& m_breakInside == o.m_breakInside
&& m_resize == o.m_resize
+ && m_hasAttrContent == o.m_hasAttrContent
&& m_isPlaceholderStyle == o.m_isPlaceholderStyle;
}
Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h (201085 => 201086)
--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h 2016-05-18 17:46:09 UTC (rev 201085)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h 2016-05-18 18:32:43 UTC (rev 201086)
@@ -227,6 +227,8 @@
unsigned m_breakInside : 3; // BreakInside
unsigned m_resize : 2; // EResize
+ unsigned m_hasAttrContent : 1;
+
unsigned m_isPlaceholderStyle : 1;
private: