Commit 8ac19ac7 authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Revert "Store new ComputedStyle object if style did not change."

This reverts commit 5b37246c.

Reason for revert: hover-after-affected-by-change.html consistently fails on WebKit Linux Trusty Leak: https://uberchromegw.corp.google.com/i/chromium.webkit/builders/WebKit%20Linux%20Trusty%20Leak

Original change's description:
> Store new ComputedStyle object if style did not change.
> 
> The comparison of ComputedStyle does not take additional flags into
> account. For instance, the AffectedBy* flags used for updating pseudo
> classes like :hover. We used to call SetStyleInternal, but this was
> removed because the previous comment said it was because of style
> sharing which is now removed.
> 
> The display:contents case (768406) never worked because the code path
> for StoreNonLayoutObjectComputedStyle() was always skipped when
> computed style compared to be equal.
> 
> Bug: 768406, 767832
> Change-Id: Iac4708e3cd3a6451d99c1bb2bb69efb74289b8eb
> Reviewed-on: https://chromium-review.googlesource.com/681755
> Reviewed-by: nainar <nainar@chromium.org>
> Commit-Queue: Rune Lillesveen <rune@opera.com>
> Cr-Commit-Position: refs/heads/master@{#504285}

TBR=rune@opera.com,nainar@chromium.org

Change-Id: I34a54b694bb719b278426f9a76076fa77cd9e82f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 768406, 767832
Reviewed-on: https://chromium-review.googlesource.com/684275Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#504313}
parent a3f3699b
<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<style>
.affected:hover { color: green }
#hoveredContents { display: contents }
</style>
<div id="hovered">Hover me - should become green</div>
<div id="hoveredContents">
<div id="hovered2">Hover me - should become green</div>
</div>
<script>
function mouseMoveTo(element) {
return new Promise((resolve, reject) => {
chrome.gpuBenchmarking.pointerActionSequence([{source: "mouse",
actions: [{ name: "pointerMove",
x: element.offsetLeft + 1,
y: element.offsetTop + 1 }]}],
resolve);
});
}
test(() => {
hovered.offsetTop;
hovered.className = "affected";
hoveredContents.className = "affected";
}, "Change selector matching causes different AffectedByHover flags.");
test(() => {
assert_exists(window, "chrome", "This test requires window.chrome.");
assert_exists(window.chrome, "gpuBenchmarking",
"This test requires chrome.gpuBenchmarking.");
}, "Preconditions.");
test(() => {
assert_equals(getComputedStyle(hovered).color, "rgb(0, 0, 0)");
mouseMoveTo(hovered).then(() => {
assert_equals(getComputedStyle(hovered).color, "rgb(0, 128, 0)");
});
}, "Check that :hover rule is applied.");
test(() => {
assert_equals(getComputedStyle(hoveredContents).color, "rgb(0, 0, 0)");
mouseMoveTo(hovered2).then(() => {
assert_equals(getComputedStyle(hoveredContents).color, "rgb(0, 128, 0)");
});
}, "Check that :hover rule is applied to display:contents element.");
</script>
......@@ -2168,21 +2168,15 @@ StyleRecalcChange Element::RecalcOwnStyle(StyleRecalcChange change) {
if (local_change != kNoChange)
UpdateCallbackSelectors(old_style.Get(), new_style.Get());
if (LayoutObject* layout_object = this->GetLayoutObject()) {
// kNoChange may means that the computed style didn't change, but there are
// additional flags in ComputedStyle which may have changed. For instance,
// the AffectedBy* flags. We don't need to go through the visual
// invalidation diffing in that case, but we replace the old ComputedStyle
// object with the new one to ensure the mentioned flags are up to date.
if (local_change == kNoChange)
layout_object->SetStyleInternal(new_style.Get());
else
if (local_change != kNoChange) {
if (LayoutObject* layout_object = this->GetLayoutObject()) {
layout_object->SetStyle(new_style.Get());
} else {
if (ShouldStoreNonLayoutObjectComputedStyle(*new_style))
StoreNonLayoutObjectComputedStyle(new_style);
else if (HasRareData())
GetElementRareData()->ClearComputedStyle();
} else {
if (ShouldStoreNonLayoutObjectComputedStyle(*new_style))
StoreNonLayoutObjectComputedStyle(new_style);
else if (HasRareData())
GetElementRareData()->ClearComputedStyle();
}
}
if (GetStyleChangeType() >= kSubtreeStyleChange)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment