Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinderTest.cpp

Issue 2714283002: Fix unexpected blurry text caused by combination of skew and promotion (Closed)
Patch Set: Layout test update && bug fix Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/layout/compositing/CompositingReasonFinder.h" 5 #include "core/layout/compositing/CompositingReasonFinder.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/layout/LayoutBlock.h" 8 #include "core/layout/LayoutBlock.h"
9 #include "core/layout/LayoutTestHelper.h" 9 #include "core/layout/LayoutTestHelper.h"
10 #include "core/paint/PaintLayer.h" 10 #include "core/paint/PaintLayer.h"
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 296
297 Element* innerSticky = document().getElementById("innerSticky"); 297 Element* innerSticky = document().getElementById("innerSticky");
298 PaintLayer* innerStickyLayer = 298 PaintLayer* innerStickyLayer =
299 toLayoutBoxModelObject(innerSticky->layoutObject())->layer(); 299 toLayoutBoxModelObject(innerSticky->layoutObject())->layer();
300 ASSERT_TRUE(innerStickyLayer); 300 ASSERT_TRUE(innerStickyLayer);
301 301
302 EXPECT_EQ(PaintsIntoOwnBacking, outerStickyLayer->compositingState()); 302 EXPECT_EQ(PaintsIntoOwnBacking, outerStickyLayer->compositingState());
303 EXPECT_EQ(NotComposited, innerStickyLayer->compositingState()); 303 EXPECT_EQ(NotComposited, innerStickyLayer->compositingState());
304 } 304 }
305 305
306 TEST_F(CompositingReasonFinderTest, CompositeSkewWithPromotedSkewedAncestor) {
307 setBodyInnerHTML(
308 "<style>.skew { transform: skew(20deg);}"
309 ".counter-skew { transform: skew(-20deg); }"
310 ".composited { will-change: transform; }</style>"
311 "<div class='skew'>"
312 " <div id='non-composited' class='counter-skew'></div>"
313 "</div>"
314 "<div id='skew' class='skew'>"
315 " <div id='should-composite' class='counter-skew'></div>"
316 " <div id='composited' class='composited counter-skew'></div>"
317 "</div>");
318 document().view()->updateAllLifecyclePhases();
319
320 // Skewed element is not composited automatically.
321 Element* nonComposited = document().getElementById("non-composited");
322 PaintLayer* nonCompositedLayer =
323 toLayoutBoxModelObject(nonComposited->layoutObject())->layer();
324 ASSERT_TRUE(nonCompositedLayer);
325 EXPECT_EQ(NotComposited, nonCompositedLayer->compositingState());
326
327 // Composite as it has composited descendant.
328 Element* compositedElement = document().getElementById("skew");
329 PaintLayer* compositedLayer =
330 toLayoutBoxModelObject(compositedElement->layoutObject())->layer();
331 ASSERT_TRUE(compositedLayer);
332 EXPECT_EQ(PaintsIntoOwnBacking, compositedLayer->compositingState());
333
334 // Skewed element with promoted skewed ancestor gets promoted as well.
335 compositedElement = document().getElementById("should-composite");
336 compositedLayer =
337 toLayoutBoxModelObject(compositedElement->layoutObject())->layer();
338 ASSERT_TRUE(compositedLayer);
339 EXPECT_EQ(PaintsIntoOwnBacking, compositedLayer->compositingState());
340
341 // Skewed element without promoted ancestor does not composite.
342 document().getElementById("composited")->removeAttribute("class");
343 document().view()->updateAllLifecyclePhases();
344 ASSERT_TRUE(compositedLayer);
345 EXPECT_EQ(NotComposited, compositedLayer->compositingState());
346
347 // Skewed element with promoted ancestor which is not skewed does not
348 // composite.
349 document()
350 .getElementById("composited")
351 ->setAttribute(HTMLNames::classAttr, "composited");
352 document().getElementById("skew")->removeAttribute("class");
353 document().view()->updateAllLifecyclePhases();
354 ASSERT_TRUE(compositedLayer);
355 EXPECT_EQ(NotComposited, compositedLayer->compositingState());
356 }
357
306 } // namespace blink 358 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698