| OLD | NEW | 
|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/LayoutTestHelper.h" | 5 #include "core/layout/LayoutTestHelper.h" | 
| 6 #include "core/layout/LayoutView.h" | 6 #include "core/layout/LayoutView.h" | 
| 7 #include "core/layout/PaintInvalidationState.h" | 7 #include "core/layout/PaintInvalidationState.h" | 
| 8 #include "core/paint/PaintLayer.h" | 8 #include "core/paint/PaintLayer.h" | 
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" | 
| 10 | 10 | 
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 416     LayoutRect targetOverflowRect = target->localOverflowRectForPaintInvalidatio
     n(); | 416     LayoutRect targetOverflowRect = target->localOverflowRectForPaintInvalidatio
     n(); | 
| 417     // 140 = width(100) + box_shadow_offset_x(40) | 417     // 140 = width(100) + box_shadow_offset_x(40) | 
| 418     // 110 = height(90) + box_shadow_offset_y(20) | 418     // 110 = height(90) + box_shadow_offset_y(20) | 
| 419     EXPECT_EQ(LayoutRect(0, 0, 140, 110), targetOverflowRect); | 419     EXPECT_EQ(LayoutRect(0, 0, 140, 110), targetOverflowRect); | 
| 420     LayoutRect rect = targetOverflowRect; | 420     LayoutRect rect = targetOverflowRect; | 
| 421     EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(target, rect)); | 421     EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(target, rect)); | 
| 422     EXPECT_EQ(LayoutRect(0, 0, 140, 110), rect); | 422     EXPECT_EQ(LayoutRect(0, 0, 140, 110), rect); | 
| 423 | 423 | 
| 424     rect = targetOverflowRect; | 424     rect = targetOverflowRect; | 
| 425     EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(container, rect)); | 425     EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(container, rect)); | 
| 426     // Rect is clipped by container's overflow clip. | 426     // Rect is not clipped by container's overflow clip. | 
| 427     EXPECT_EQ(LayoutRect(10, 10, 50, 80), rect); | 427     EXPECT_EQ(LayoutRect(10, 10, 140, 110), rect); | 
| 428 } | 428 } | 
| 429 | 429 | 
| 430 TEST_F(VisualRectMappingTest, ContainerFlippedWritingModeAndOverflowHidden) | 430 TEST_F(VisualRectMappingTest, ContainerFlippedWritingModeAndOverflowHidden) | 
| 431 { | 431 { | 
| 432     setBodyInnerHTML( | 432     setBodyInnerHTML( | 
| 433         "<div id='container' style='writing-mode: vertical-rl; position: absolut
     e; top: 111px; left: 222px;" | 433         "<div id='container' style='writing-mode: vertical-rl; position: absolut
     e; top: 111px; left: 222px;" | 
| 434         "    border: solid red; border-width: 10px 20px 30px 40px;" | 434         "    border: solid red; border-width: 10px 20px 30px 40px;" | 
| 435         "    overflow: hidden; width: 50px; height: 80px'>" | 435         "    overflow: hidden; width: 50px; height: 80px'>" | 
| 436         "    <div id='target' style='box-shadow: 40px 20px black; width: 100px; 
     height: 90px'></div>" | 436         "    <div id='target' style='box-shadow: 40px 20px black; width: 100px; 
     height: 90px'></div>" | 
| 437         "    <div style='width: 100px; height: 100px'></div>" | 437         "    <div style='width: 100px; height: 100px'></div>" | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
| 456     LayoutRect rect = targetOverflowRect; | 456     LayoutRect rect = targetOverflowRect; | 
| 457     target->flipForWritingMode(rect); | 457     target->flipForWritingMode(rect); | 
| 458     EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(target, rect)); | 458     EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(target, rect)); | 
| 459     // This rect is in physical coordinates of target. | 459     // This rect is in physical coordinates of target. | 
| 460     EXPECT_EQ(LayoutRect(0, 0, 140, 110), rect); | 460     EXPECT_EQ(LayoutRect(0, 0, 140, 110), rect); | 
| 461 | 461 | 
| 462     rect = targetOverflowRect; | 462     rect = targetOverflowRect; | 
| 463     target->flipForWritingMode(rect); | 463     target->flipForWritingMode(rect); | 
| 464     EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(container, rect)); | 464     EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(container, rect)); | 
| 465     // 58 = target_physical_x(100) + container_border_left(40) - scroll_left(58) | 465     // 58 = target_physical_x(100) + container_border_left(40) - scroll_left(58) | 
| 466     // The other sides of the rect are clipped by container's overflow clip. | 466     EXPECT_EQ(LayoutRect(-10, 10, 140, 110), rect); | 
| 467     EXPECT_EQ(LayoutRect(58, 10, 32, 80), rect); |  | 
| 468 } | 467 } | 
| 469 | 468 | 
| 470 TEST_F(VisualRectMappingTest, ContainerAndTargetDifferentFlippedWritingMode) | 469 TEST_F(VisualRectMappingTest, ContainerAndTargetDifferentFlippedWritingMode) | 
| 471 { | 470 { | 
| 472     setBodyInnerHTML( | 471     setBodyInnerHTML( | 
| 473         "<div id='container' style='writing-mode: vertical-rl; position: absolut
     e; top: 111px; left: 222px;" | 472         "<div id='container' style='writing-mode: vertical-rl; position: absolut
     e; top: 111px; left: 222px;" | 
| 474         "    border: solid red; border-width: 10px 20px 30px 40px;" | 473         "    border: solid red; border-width: 10px 20px 30px 40px;" | 
| 475         "    overflow: scroll; width: 50px; height: 80px'>" | 474         "    overflow: scroll; width: 50px; height: 80px'>" | 
| 476         "    <div id='target' style='writing-mode: vertical-lr; box-shadow: 40px
      20px black; width: 100px; height: 90px'></div>" | 475         "    <div id='target' style='writing-mode: vertical-lr; box-shadow: 40px
      20px black; width: 100px; height: 90px'></div>" | 
| 477         "    <div style='width: 100px; height: 100px'></div>" | 476         "    <div style='width: 100px; height: 100px'></div>" | 
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 608 | 607 | 
| 609     LayoutRect targetOverflowRect = target->localOverflowRectForPaintInvalidatio
     n(); | 608     LayoutRect targetOverflowRect = target->localOverflowRectForPaintInvalidatio
     n(); | 
| 610     EXPECT_EQ(LayoutRect(0, 0, 400, 400), targetOverflowRect); | 609     EXPECT_EQ(LayoutRect(0, 0, 400, 400), targetOverflowRect); | 
| 611     LayoutRect rect = targetOverflowRect; | 610     LayoutRect rect = targetOverflowRect; | 
| 612     EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); | 611     EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); | 
| 613     EXPECT_EQ(LayoutRect(0, 0, 200, 200), rect); | 612     EXPECT_EQ(LayoutRect(0, 0, 200, 200), rect); | 
| 614     checkPaintInvalidationStateRectMapping(rect, targetOverflowRect, *target, la
     youtView(), layoutView()); | 613     checkPaintInvalidationStateRectMapping(rect, targetOverflowRect, *target, la
     youtView(), layoutView()); | 
| 615 } | 614 } | 
| 616 | 615 | 
| 617 } // namespace blink | 616 } // namespace blink | 
| OLD | NEW | 
|---|