Commit ffe1df92 authored by Chris Harrelson's avatar Chris Harrelson Committed by Commit Bot

Clear visual overflow of tables & single-line input during recalc.

Bug: 918848

Change-Id: I1b712a3aee6f8950160886141065e1b0a3799c34
Reviewed-on: https://chromium-review.googlesource.com/c/1394873
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Reviewed-by: default avatarAleks Totic <atotic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619819}
parent c6adefa8
...@@ -2021,6 +2021,7 @@ jumbo_source_set("unit_tests") { ...@@ -2021,6 +2021,7 @@ jumbo_source_set("unit_tests") {
"layout/layout_table_row_test.cc", "layout/layout_table_row_test.cc",
"layout/layout_table_section_test.cc", "layout/layout_table_section_test.cc",
"layout/layout_table_test.cc", "layout/layout_table_test.cc",
"layout/layout_text_control_single_line_test.cc",
"layout/layout_text_control_test.cc", "layout/layout_text_control_test.cc",
"layout/layout_text_fragment_test.cc", "layout/layout_text_fragment_test.cc",
"layout/layout_text_test.cc", "layout/layout_text_test.cc",
......
...@@ -925,6 +925,7 @@ void LayoutTable::InvalidateCollapsedBordersForAllCellsIfNeeded() { ...@@ -925,6 +925,7 @@ void LayoutTable::InvalidateCollapsedBordersForAllCellsIfNeeded() {
void LayoutTable::ComputeVisualOverflow(bool) { void LayoutTable::ComputeVisualOverflow(bool) {
LayoutRect previous_visual_overflow_rect = VisualOverflowRect(); LayoutRect previous_visual_overflow_rect = VisualOverflowRect();
ClearVisualOverflow();
AddVisualOverflowFromChildren(); AddVisualOverflowFromChildren();
AddVisualEffectOverflow(); AddVisualEffectOverflow();
......
...@@ -319,6 +319,24 @@ TEST_F(LayoutTableTest, OutOfOrderHeadFootAndBody) { ...@@ -319,6 +319,24 @@ TEST_F(LayoutTableTest, OutOfOrderHeadFootAndBody) {
table->BottomNonEmptySection()); table->BottomNonEmptySection());
} }
TEST_F(LayoutTableTest, VisualOverflowCleared) {
SetBodyInnerHTML(R"HTML(
<style>
#table {
width: 50px; height: 50px; box-shadow: 5px 5px 5px black;
}
</style>
<table id='table' style='width: 50px; height: 50px'></table>
)HTML");
auto* table = GetTableByElementId("table");
EXPECT_EQ(LayoutRect(-3, -3, 66, 66), table->SelfVisualOverflowRect());
ToElement(table->GetNode())
->setAttribute(html_names::kStyleAttr, "box-shadow: initial");
GetDocument().View()->UpdateAllLifecyclePhases(
DocumentLifecycle::LifecycleUpdateReason::kTest);
EXPECT_EQ(LayoutRect(0, 0, 50, 50), table->SelfVisualOverflowRect());
}
} // anonymous namespace } // anonymous namespace
} // namespace blink } // namespace blink
...@@ -321,6 +321,7 @@ HTMLInputElement* LayoutTextControlSingleLine::InputElement() const { ...@@ -321,6 +321,7 @@ HTMLInputElement* LayoutTextControlSingleLine::InputElement() const {
void LayoutTextControlSingleLine::ComputeVisualOverflow( void LayoutTextControlSingleLine::ComputeVisualOverflow(
bool recompute_floats) { bool recompute_floats) {
LayoutRect previous_visual_overflow_rect = VisualOverflowRect(); LayoutRect previous_visual_overflow_rect = VisualOverflowRect();
ClearVisualOverflow();
AddVisualOverflowFromChildren(); AddVisualOverflowFromChildren();
AddVisualEffectOverflow(); AddVisualEffectOverflow();
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/core/layout/layout_text_control_single_line.h"
#include "build/build_config.h"
#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"
namespace blink {
namespace {
class LayoutTextControlSingleLineTest : public RenderingTest {};
TEST_F(LayoutTextControlSingleLineTest, VisualOverflowCleared) {
SetBodyInnerHTML(R"HTML(
<style>
#input {
width: 50px; height: 50px; box-shadow: 5px 5px 5px black;
}
</style>
<input id=input type="text"></input.
)HTML");
auto* input =
ToLayoutTextControlSingleLine(GetLayoutObjectByElementId("input"));
#if defined(OS_MACOSX)
EXPECT_EQ(LayoutRect(-3, -3, 72, 72), input->SelfVisualOverflowRect());
#else
EXPECT_EQ(LayoutRect(-3, -3, 70, 72), input->SelfVisualOverflowRect());
#endif
ToElement(input->GetNode())
->setAttribute(html_names::kStyleAttr, "box-shadow: initial");
GetDocument().View()->UpdateAllLifecyclePhases(
DocumentLifecycle::LifecycleUpdateReason::kTest);
#if defined(OS_MACOSX)
EXPECT_EQ(LayoutRect(0, 0, 56, 56), input->SelfVisualOverflowRect());
#else
EXPECT_EQ(LayoutRect(0, 0, 54, 56), input->SelfVisualOverflowRect());
#endif
}
} // anonymous namespace
} // namespace blink
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