Changeset 220383 in webkit
- Timestamp:
- Aug 7, 2017 7:52:10 PM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r220382 r220383 1 2017-08-07 Simon Fraser <simon.fraser@apple.com> 2 3 RenderStyle:diff() was inadvertently doing deep compares of StyleRareNonInheritedData etc 4 https://bugs.webkit.org/show_bug.cgi?id=175304 5 6 Reviewed by Tim Horton. 7 8 r210758 changed DataRef::get() from returning a pointer to a reference. This caused all the places 9 in RenderStyle::diff() and related functions, where we intended to do a quick pointer comparison, 10 to doing deep compares via operator!=. This made the code slightly slower. 11 12 Fix by exposing ptr() on DataRef and using it wherever we wish to do pointer comparison. 13 14 * rendering/style/DataRef.h: 15 (WebCore::DataRef::ptr const): 16 * rendering/style/RenderStyle.cpp: 17 (WebCore::RenderStyle::inheritedDataShared const): 18 (WebCore::RenderStyle::changeAffectsVisualOverflow const): 19 (WebCore::RenderStyle::changeRequiresLayout const): 20 (WebCore::RenderStyle::changeRequiresRecompositeLayer const): 21 (WebCore::RenderStyle::listStyleImage const): Expand the function onto multiple lines. 22 1 23 2017-08-07 Simon Fraser <simon.fraser@apple.com> 2 24 -
trunk/Source/WebCore/rendering/style/DataRef.h
r210758 r220383 56 56 } 57 57 58 const T* ptr() const 59 { 60 return m_data.ptr(); 61 } 62 58 63 const T& get() const 59 64 { -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r219544 r220383 453 453 // This is a fast check that only looks if the data structures are shared. 454 454 return m_inheritedFlags == other->m_inheritedFlags 455 && m_inheritedData. get() == other->m_inheritedData.get()456 && m_svgStyle. get() == other->m_svgStyle.get()457 && m_rareInheritedData. get() == other->m_rareInheritedData.get();455 && m_inheritedData.ptr() == other->m_inheritedData.ptr() 456 && m_svgStyle.ptr() == other->m_svgStyle.ptr() 457 && m_rareInheritedData.ptr() == other->m_rareInheritedData.ptr(); 458 458 } 459 459 … … 487 487 inline bool RenderStyle::changeAffectsVisualOverflow(const RenderStyle& other) const 488 488 { 489 if (m_rareNonInheritedData. get() != other.m_rareNonInheritedData.get()489 if (m_rareNonInheritedData.ptr() != other.m_rareNonInheritedData.ptr() 490 490 && !arePointingToEqualData(m_rareNonInheritedData->boxShadow, other.m_rareNonInheritedData->boxShadow)) 491 491 return true; 492 492 493 if (m_rareInheritedData. get() != other.m_rareInheritedData.get()493 if (m_rareInheritedData.ptr() != other.m_rareInheritedData.ptr() 494 494 && !arePointingToEqualData(m_rareInheritedData->textShadow, other.m_rareInheritedData->textShadow)) 495 495 return true; … … 537 537 return true; 538 538 539 if (m_rareNonInheritedData. get() != other.m_rareNonInheritedData.get()) {539 if (m_rareNonInheritedData.ptr() != other.m_rareNonInheritedData.ptr()) { 540 540 if (m_rareNonInheritedData->appearance != other.m_rareNonInheritedData->appearance 541 541 || m_rareNonInheritedData->marginBeforeCollapse != other.m_rareNonInheritedData->marginBeforeCollapse … … 598 598 } 599 599 600 if (m_rareInheritedData. get() != other.m_rareInheritedData.get()) {600 if (m_rareInheritedData.ptr() != other.m_rareInheritedData.ptr()) { 601 601 if (m_rareInheritedData->indent != other.m_rareInheritedData->indent 602 602 #if ENABLE(CSS3_TEXT) … … 911 911 bool RenderStyle::changeRequiresRecompositeLayer(const RenderStyle& other, unsigned&) const 912 912 { 913 if (m_rareNonInheritedData. get() != other.m_rareNonInheritedData.get()) {913 if (m_rareNonInheritedData.ptr() != other.m_rareNonInheritedData.ptr()) { 914 914 if (m_rareNonInheritedData->transformStyle3D != other.m_rareNonInheritedData->transformStyle3D 915 915 || m_rareNonInheritedData->backfaceVisibility != other.m_rareNonInheritedData->backfaceVisibility … … 1197 1197 } 1198 1198 1199 StyleImage* RenderStyle::listStyleImage() const { return m_rareInheritedData->listStyleImage.get(); } 1199 StyleImage* RenderStyle::listStyleImage() const 1200 { 1201 return m_rareInheritedData->listStyleImage.get(); 1202 } 1200 1203 1201 1204 void RenderStyle::setListStyleImage(RefPtr<StyleImage>&& v)
Note: See TracChangeset
for help on using the changeset viewer.