Skip to content
Permalink
Browse files
Recompute maximum outline size only when outline changes.
https://bugs.webkit.org/show_bug.cgi?id=148576

Reviewed by Andreas Kling.

We should only recompute the cached maximum outline size when
either the outline size (offset/width) or the style (from or to
auto) changes.
Setting 'outline-style: auto' can change the final outline width as 'auto' triggers
the focus ring mode. In this mode, we ignore outline-width and use the platform default value instead.

Covered by existing test cases.

* rendering/RenderElement.cpp:
(WebCore::RenderElement::computeMaxOutlineSize):
(WebCore::RenderElement::styleWillChange):
(WebCore::RenderElement::initializeStyle): Deleted.
(WebCore::RenderElement::setStyle): Deleted.
* rendering/RenderElement.h:


Canonical link: https://commits.webkit.org/166820@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189242 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
alanbujtas committed Sep 2, 2015
1 parent 860658f commit 10ad5a1c06439d0b0e97fd1a032531c5ea97c31a
Showing 3 changed files with 33 additions and 10 deletions.
@@ -1,3 +1,25 @@
2015-09-01 Zalan Bujtas <zalan@apple.com>

Recompute maximum outline size only when outline changes.
https://bugs.webkit.org/show_bug.cgi?id=148576

Reviewed by Andreas Kling.

We should only recompute the cached maximum outline size when
either the outline size (offset/width) or the style (from or to
auto) changes.
Setting 'outline-style: auto' can change the final outline width as 'auto' triggers
the focus ring mode. In this mode, we ignore outline-width and use the platform default value instead.

Covered by existing test cases.

* rendering/RenderElement.cpp:
(WebCore::RenderElement::computeMaxOutlineSize):
(WebCore::RenderElement::styleWillChange):
(WebCore::RenderElement::initializeStyle): Deleted.
(WebCore::RenderElement::setStyle): Deleted.
* rendering/RenderElement.h:

2015-09-01 Chris Dumez <cdumez@apple.com>

Range API should throw a TypeError for null Node parameters
@@ -364,15 +364,15 @@ void RenderElement::updateShapeImage(const ShapeValue* oldShapeValue, const Shap
}
#endif

void RenderElement::computeMaxOutlineSize() const
void RenderElement::computeMaxOutlineSize(const RenderStyle& style) const
{
// We need to ensure that view->maximalOutlineSize() is valid for any repaints that happen
// during styleDidChange (it's used by clippedOverflowRectForRepaint()).
if (!m_style->outlineWidth())
if (!style.outlineWidth())
return;
int maxOutlineSize = m_style->outlineSize();
if (m_style->outlineStyleIsAuto())
maxOutlineSize = std::max(theme().platformFocusRingWidth() + m_style->outlineOffset(), maxOutlineSize);
int maxOutlineSize = style.outlineSize();
if (style.outlineStyleIsAuto())
maxOutlineSize = std::max(theme().platformFocusRingWidth() + style.outlineOffset(), maxOutlineSize);

if (maxOutlineSize < view().maximalOutlineSize())
return;
@@ -396,8 +396,6 @@ void RenderElement::initializeStyle()
updateShapeImage(nullptr, m_style->shapeOutside());
#endif

computeMaxOutlineSize();

styleDidChange(StyleDifferenceNewStyle, nullptr);

// We shouldn't have any text children that would need styleDidChange at this point.
@@ -447,8 +445,6 @@ void RenderElement::setStyle(Ref<RenderStyle>&& style, StyleDifference minimalSt
updateShapeImage(oldStyle.get().shapeOutside(), m_style->shapeOutside());
#endif

computeMaxOutlineSize();

bool doesNotNeedLayout = !parent();

styleDidChange(diff, oldStyle.ptr());
@@ -916,6 +912,11 @@ void RenderElement::styleWillChange(StyleDifference diff, const RenderStyle& new

if (isRoot() || isBody())
view().frameView().updateExtendBackgroundIfNecessary();

if (!oldStyle || (oldStyle->outlineSize() != newStyle.outlineSize()
|| (oldStyle->outlineStyleIsAuto() && !newStyle.outlineStyleIsAuto())
|| (!oldStyle->outlineStyleIsAuto() && newStyle.outlineStyleIsAuto())))
computeMaxOutlineSize(newStyle);
}

void RenderElement::handleDynamicFloatPositionChange()
@@ -307,7 +307,7 @@ class RenderElement : public RenderObject {

bool shouldWillChangeCreateStackingContext() const;

void computeMaxOutlineSize() const;
void computeMaxOutlineSize(const RenderStyle&) const;

unsigned m_baseTypeFlags : 6;
unsigned m_ancestorLineBoxDirty : 1;

0 comments on commit 10ad5a1

Please sign in to comment.