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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerTest.cpp

Issue 2647383004: Float layer should ignore offsets from ancestor inline layers under containing block (Closed)
Patch Set: - Created 3 years, 11 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/paint/PaintLayer.h" 5 #include "core/paint/PaintLayer.h"
6 6
7 #include "core/html/HTMLIFrameElement.h" 7 #include "core/html/HTMLIFrameElement.h"
8 #include "core/layout/LayoutBoxModelObject.h" 8 #include "core/layout/LayoutBoxModelObject.h"
9 #include "core/layout/LayoutTestHelper.h" 9 #include "core/layout/LayoutTestHelper.h"
10 #include "core/layout/LayoutView.h" 10 #include "core/layout/LayoutView.h"
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 ->layer(); 518 ->layer();
519 519
520 // enclosingLayerWithCompositedLayerMapping is not needed or applicable to 520 // enclosingLayerWithCompositedLayerMapping is not needed or applicable to
521 // SPv2. 521 // SPv2.
522 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 522 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
523 EXPECT_EQ(compositedContainer, 523 EXPECT_EQ(compositedContainer,
524 target->enclosingLayerWithCompositedLayerMapping(ExcludeSelf)); 524 target->enclosingLayerWithCompositedLayerMapping(ExcludeSelf));
525 } 525 }
526 } 526 }
527 527
528 TEST_P(PaintLayerTest, FloatLayerAndAbsoluteUnderInlineLayer) {
529 setBodyInnerHTML(
530 "<div id='container' style='position: absolute; top: 20px; left: 20px'>"
531 " <div style='margin: 33px'>"
532 " <span id='span' style='position: relative; top: 100px; left: 100px'>"
533 " <div id='floating'"
534 " style='float: left; position: relative; top: 50px; left: 50px'>"
535 " </div>"
536 " <div id='absolute'"
537 " style='position: absolute; top: 50px; left: 50px'>"
538 " </div>"
539 " </span>"
540 " </div>"
541 "</div>");
542
543 PaintLayer* floating =
544 toLayoutBoxModelObject(getLayoutObjectByElementId("floating"))->layer();
545 PaintLayer* absolute =
546 toLayoutBoxModelObject(getLayoutObjectByElementId("absolute"))->layer();
547 PaintLayer* span =
548 toLayoutBoxModelObject(getLayoutObjectByElementId("span"))->layer();
549 PaintLayer* container =
550 toLayoutBoxModelObject(getLayoutObjectByElementId("container"))->layer();
551
552 EXPECT_EQ(span, floating->parent());
553 EXPECT_EQ(span, absolute->parent());
554 EXPECT_EQ(container, span->parent());
555
556 EXPECT_EQ(LayoutPoint(83, 83), floating->location());
557 EXPECT_EQ(LayoutPoint(50, 50), absolute->location());
558 EXPECT_EQ(LayoutPoint(133, 133), span->location());
559 EXPECT_EQ(LayoutPoint(20, 20), container->location());
560
561 EXPECT_EQ(LayoutPoint(-50, -50), floating->visualOffsetFromAncestor(span));
562 EXPECT_EQ(LayoutPoint(50, 50), absolute->visualOffsetFromAncestor(span));
563 EXPECT_EQ(LayoutPoint(83, 83), floating->visualOffsetFromAncestor(container));
564 EXPECT_EQ(LayoutPoint(183, 183),
565 absolute->visualOffsetFromAncestor(container));
566 }
567
568 TEST_P(PaintLayerTest, FloatLayerUnderBlockUnderInlineLayer) {
569 setBodyInnerHTML(
570 "<style>body {margin: 0}</style>"
571 "<span id='span' style='position: relative; top: 100px; left: 100px'>"
572 " <div style='display: inline-block; margin: 33px'>"
573 " <div id='floating'"
574 " style='float: left; position: relative; top: 50px; left: 50px'>"
575 " </div>"
576 " </div>"
577 "</span>");
578
579 PaintLayer* floating =
580 toLayoutBoxModelObject(getLayoutObjectByElementId("floating"))->layer();
581 PaintLayer* span =
582 toLayoutBoxModelObject(getLayoutObjectByElementId("span"))->layer();
583
584 EXPECT_EQ(span, floating->parent());
585
586 EXPECT_EQ(LayoutPoint(83, 83), floating->location());
587 EXPECT_EQ(LayoutPoint(100, 100), span->location());
588 EXPECT_EQ(LayoutPoint(83, 83), floating->visualOffsetFromAncestor(span));
589 EXPECT_EQ(LayoutPoint(183, 183), floating->visualOffsetFromAncestor(
590 document().layoutView()->layer()));
591 }
592
528 TEST_P(PaintLayerTest, CompositingContainerFloatingIframe) { 593 TEST_P(PaintLayerTest, CompositingContainerFloatingIframe) {
529 enableCompositing(); 594 enableCompositing();
530 setBodyInnerHTML( 595 setBodyInnerHTML(
531 "<div id='compositedContainer' style='position: relative;" 596 "<div id='compositedContainer' style='position: relative;"
532 " will-change: transform'>" 597 " will-change: transform'>"
533 " <div id='containingBlock' style='position: relative; z-index: 0'>" 598 " <div id='containingBlock' style='position: relative; z-index: 0'>"
534 " <div style='backface-visibility: hidden'></div>" 599 " <div style='backface-visibility: hidden'></div>"
535 " <span id='span'" 600 " <span id='span'"
536 " style='clip-path: polygon(0px 15px, 0px 54px, 100px 0px)'>" 601 " style='clip-path: polygon(0px 15px, 0px 54px, 100px 0px)'>"
537 " <iframe srcdoc='foo' id='target' style='float: right'></iframe>" 602 " <iframe srcdoc='foo' id='target' style='float: right'></iframe>"
(...skipping 17 matching lines...) Expand all
555 620
556 // enclosingLayerWithCompositedLayerMapping is not needed or applicable to 621 // enclosingLayerWithCompositedLayerMapping is not needed or applicable to
557 // SPv2. 622 // SPv2.
558 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 623 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
559 EXPECT_EQ(compositedContainer, 624 EXPECT_EQ(compositedContainer,
560 target->enclosingLayerWithCompositedLayerMapping(ExcludeSelf)); 625 target->enclosingLayerWithCompositedLayerMapping(ExcludeSelf));
561 } 626 }
562 } 627 }
563 628
564 } // namespace blink 629 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698