Changeset 92164 in webkit
- Timestamp:
- Aug 1, 2011 6:42:08 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r92161 r92164 1 2011-08-01 Luke Macpherson <macpherson@chromium.org> 2 3 Don't set m_fontDirty when setting zoom unless zoom has actually changed 4 https://bugs.webkit.org/show_bug.cgi?id=65092 5 6 Reviewed by Darin Adler. 7 8 No new tests as no functionality changed - this is an optimization that 9 should be logically equivalent to the current code. 10 11 The intent here is to avoid setting m_fontDirty unless the fornt information is actually dirty. 12 13 * css/CSSStyleSelector.cpp: 14 (WebCore::CSSStyleSelector::styleForDocument): 15 (WebCore::CSSStyleSelector::applyProperty): 16 Use setZoom and setEffectiveZoom wrapper functions. 17 * css/CSSStyleSelector.h: 18 (WebCore::CSSStyleSelector::setZoom): 19 Wrapper for m_style->setZoom() that automatically updates m_fontDirty. 20 (WebCore::CSSStyleSelector::setEffectiveZoom): 21 Wrapper for m_style->setEffectiveZoom that automatically updates m_fontDirty. 22 * page/animation/AnimationBase.cpp: 23 (WebCore::AnimationBase::ensurePropertyMap): 24 Use 25 * rendering/style/RenderStyle.h: 26 (WebCore::InheritedFlags::setZoom): 27 Return true only if underlying values change. 28 (WebCore::InheritedFlags::setZoomWithoutReturnValue): 29 Return void to match function pointer type where required. 30 (WebCore::InheritedFlags::setEffectiveZoom): 31 Return true only if underlying values change. 32 1 33 2011-08-01 Jean-luc Brouillet <jeanluc@chromium.org> 2 34 -
trunk/Source/WebCore/css/CSSStyleSelector.cpp
r92140 r92164 4277 4277 // Reset the zoom in effect before we do anything. This allows the setZoom method to accurately compute a new 4278 4278 // zoom in effect. 4279 m_style->setEffectiveZoom(m_parentStyle ? m_parentStyle->effectiveZoom() : RenderStyle::initialZoom()); 4280 4281 // Now we can handle inherit and initial. 4282 HANDLE_INHERIT_AND_INITIAL(zoom, Zoom) 4283 4284 // Handle normal/reset, numbers and percentages. 4285 int type = primitiveValue->primitiveType(); 4286 if (primitiveValue->getIdent() == CSSValueNormal) 4287 m_style->setZoom(RenderStyle::initialZoom()); 4279 setEffectiveZoom(m_parentStyle ? m_parentStyle->effectiveZoom() : RenderStyle::initialZoom()); 4280 4281 if (isInherit) 4282 setZoom(m_parentStyle->zoom()); 4283 else if (isInitial || primitiveValue->getIdent() == CSSValueNormal) 4284 setZoom(RenderStyle::initialZoom()); 4288 4285 else if (primitiveValue->getIdent() == CSSValueReset) { 4289 m_style->setEffectiveZoom(RenderStyle::initialZoom());4290 m_style->setZoom(RenderStyle::initialZoom());4286 setEffectiveZoom(RenderStyle::initialZoom()); 4287 setZoom(RenderStyle::initialZoom()); 4291 4288 } else if (primitiveValue->getIdent() == CSSValueDocument) { 4292 4289 float docZoom = m_checker.m_document->renderer()->style()->zoom(); 4293 m_style->setEffectiveZoom(docZoom);4294 m_style->setZoom(docZoom);4295 } else if ( type== CSSPrimitiveValue::CSS_PERCENTAGE) {4290 setEffectiveZoom(docZoom); 4291 setZoom(docZoom); 4292 } else if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE) { 4296 4293 if (primitiveValue->getFloatValue()) 4297 m_style->setZoom(primitiveValue->getFloatValue() / 100.0f);4298 } else if ( type== CSSPrimitiveValue::CSS_NUMBER) {4294 setZoom(primitiveValue->getFloatValue() / 100.0f); 4295 } else if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_NUMBER) { 4299 4296 if (primitiveValue->getFloatValue()) 4300 m_style->setZoom(primitiveValue->getFloatValue()); 4301 } 4302 4303 m_fontDirty = true; 4297 setZoom(primitiveValue->getFloatValue()); 4298 } 4304 4299 return; 4305 4300 } -
trunk/Source/WebCore/css/CSSStyleSelector.h
r91860 r92164 117 117 FontDescription parentFontDescription() {return parentStyle()->fontDescription(); } 118 118 void setFontDescription(FontDescription fontDescription) { m_fontDirty |= style()->setFontDescription(fontDescription); } 119 void setZoom(float f) { m_fontDirty |= style()->setZoom(f); } 120 void setEffectiveZoom(float f) { m_fontDirty |= style()->setEffectiveZoom(f); } 119 121 120 122 private: -
trunk/Source/WebCore/page/animation/AnimationBase.cpp
r91187 r92164 742 742 gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderBottomRightRadius, &RenderStyle::borderBottomRightRadius, &RenderStyle::setBorderBottomRightRadius)); 743 743 gPropertyWrappers->append(new PropertyWrapper<EVisibility>(CSSPropertyVisibility, &RenderStyle::visibility, &RenderStyle::setVisibility)); 744 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyZoom, &RenderStyle::zoom, &RenderStyle::setZoom ));744 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyZoom, &RenderStyle::zoom, &RenderStyle::setZoomWithoutReturnValue)); 745 745 746 746 gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyClip, &RenderStyle::clip, &RenderStyle::setClip)); -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r91702 r92164 946 946 void setDirection(TextDirection v) { inherited_flags._direction = v; } 947 947 void setLineHeight(Length v) { SET_VAR(inherited, line_height, v) } 948 void setZoom(float f) { SET_VAR(visual, m_zoom, f); setEffectiveZoom(effectiveZoom() * zoom()); } 949 void setEffectiveZoom(float f) { SET_VAR(rareInheritedData, m_effectiveZoom, f) } 948 bool setZoom(float); 949 void setZoomWithoutReturnValue(float f) { setZoom(f); } 950 bool setEffectiveZoom(float); 950 951 void setImageRendering(EImageRendering v) { SET_VAR(rareInheritedData, m_imageRendering, v) } 951 952 … … 1432 1433 } 1433 1434 1435 inline bool RenderStyle::setZoom(float f) 1436 { 1437 if (compareEqual(visual->m_zoom, f)) 1438 return false; 1439 visual.access()->m_zoom = f; 1440 setEffectiveZoom(effectiveZoom() * zoom()); 1441 return true; 1442 } 1443 1444 inline bool RenderStyle::setEffectiveZoom(float f) 1445 { 1446 if (compareEqual(rareInheritedData->m_effectiveZoom, f)) 1447 return false; 1448 rareInheritedData.access()->m_effectiveZoom = f; 1449 return true; 1450 } 1451 1434 1452 } // namespace WebCore 1435 1453
Note: See TracChangeset
for help on using the changeset viewer.