Skip to content

Commit

Permalink
[RemoveLegacy] Remove LayoutFileUploadControl and FileUploadControlPa…
Browse files Browse the repository at this point in the history
…inter

We don't use them in LayoutNG.
This CL should have no user-visible behavior changes.

Bug: 1229581
Change-Id: If3733a4fcdf4eb7c016431e218e93a0fd5f355ad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4369803
Commit-Queue: Koji Ishii <kojii@chromium.org>
Auto-Submit: Kent Tamura <tkent@chromium.org>
Reviewed-by: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1122248}
  • Loading branch information
tkent-google authored and Chromium LUCI CQ committed Mar 27, 2023
1 parent ad1d4af commit 2dbba9b
Show file tree
Hide file tree
Showing 14 changed files with 8 additions and 346 deletions.
12 changes: 2 additions & 10 deletions third_party/blink/renderer/core/html/forms/file_input_type.cc
Expand Up @@ -38,8 +38,7 @@
#include "third_party/blink/renderer/core/html_names.h"
#include "third_party/blink/renderer/core/input_type_names.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/core/layout/layout_block_flow.h"
#include "third_party/blink/renderer/core/layout/layout_object_factory.h"
#include "third_party/blink/renderer/core/layout/ng/layout_ng_block_flow.h"
#include "third_party/blink/renderer/core/page/chrome_client.h"
#include "third_party/blink/renderer/core/page/drag_data.h"
#include "third_party/blink/renderer/core/probe/core_probes.h"
Expand Down Expand Up @@ -219,8 +218,7 @@ void FileInputType::AdjustStyle(ComputedStyleBuilder& builder) {

LayoutObject* FileInputType::CreateLayoutObject(const ComputedStyle& style,
LegacyLayout legacy) const {
return LayoutObjectFactory::CreateFileUploadControl(GetElement(), style,
legacy);
return MakeGarbageCollected<LayoutNGBlockFlow>(&GetElement());
}

InputType::ValueMode FileInputType::GetValueMode() const {
Expand Down Expand Up @@ -348,8 +346,6 @@ void FileInputType::CreateShadowSubtree() {
button->SetActive(GetElement().CanReceiveDroppedFiles());
GetElement().UserAgentShadowRoot()->AppendChild(button);

// The following element is used only in LayoutNG.
// See LayoutFileUploadControl::IsChildAllowed().
auto* span = document.CreateRawElement(html_names::kSpanTag);
GetElement().UserAgentShadowRoot()->AppendChild(span);

Expand Down Expand Up @@ -577,10 +573,6 @@ String FileInputType::FileStatusText() const {
}

void FileInputType::UpdateView() {
auto* layout_object = GetElement().GetLayoutObject();
if (layout_object && layout_object->IsFileUploadControl())
layout_object->SetShouldDoFullPaintInvalidation();

if (auto* span = FileStatusElement())
span->setTextContent(FileStatusText());
}
Expand Down
2 changes: 1 addition & 1 deletion third_party/blink/renderer/core/html/resources/html.css
Expand Up @@ -669,7 +669,7 @@ input[type="file" i]::-webkit-file-upload-button {
-webkit-user-modify: read-only !important;
white-space: nowrap;
margin: 0;
margin-inline-end: 4px;
margin-inline-end: 4px; /* See FileUploadControlIntrinsicInlineSize() */
font-size: inherit;
}

Expand Down
2 changes: 0 additions & 2 deletions third_party/blink/renderer/core/layout/build.gni
Expand Up @@ -132,8 +132,6 @@ blink_core_sources_layout = [
"layout_embedded_object.h",
"layout_fieldset.cc",
"layout_fieldset.h",
"layout_file_upload_control.cc",
"layout_file_upload_control.h",
"layout_flexible_box.cc",
"layout_flexible_box.h",
"layout_flow_thread.cc",
Expand Down
10 changes: 5 additions & 5 deletions third_party/blink/renderer/core/layout/layout_box.cc
Expand Up @@ -67,7 +67,6 @@
#include "third_party/blink/renderer/core/layout/layout_deprecated_flexible_box.h"
#include "third_party/blink/renderer/core/layout/layout_embedded_content.h"
#include "third_party/blink/renderer/core/layout/layout_fieldset.h"
#include "third_party/blink/renderer/core/layout/layout_file_upload_control.h"
#include "third_party/blink/renderer/core/layout/layout_flexible_box.h"
#include "third_party/blink/renderer/core/layout/layout_inline.h"
#include "third_party/blink/renderer/core/layout/layout_list_marker.h"
Expand Down Expand Up @@ -255,6 +254,9 @@ LayoutUnit TextFieldIntrinsicBlockSize(const HTMLInputElement& input,

LayoutUnit FileUploadControlIntrinsicInlineSize(const HTMLInputElement& input,
const LayoutBox& box) {
// This should match to margin-inline-end of ::-webkit-file-upload-button UA
// style.
constexpr int kAfterButtonSpacing = 4;
// Figure out how big the filename space needs to be for a given number of
// characters (using "0" as the nominal character).
constexpr int kDefaultWidthNumChars = 34;
Expand All @@ -274,8 +276,7 @@ LayoutUnit FileUploadControlIntrinsicInlineSize(const HTMLInputElement& input,
if (LayoutObject* button_layout_object = button->GetLayoutObject()) {
default_label_width +=
button_layout_object->PreferredLogicalWidths().max_size +
(LayoutFileUploadControl::kAfterButtonSpacing *
box.StyleRef().EffectiveZoom());
(kAfterButtonSpacing * box.StyleRef().EffectiveZoom());
}
}
return LayoutUnit(
Expand Down Expand Up @@ -3007,8 +3008,7 @@ PhysicalRect LayoutBox::OverflowClipRect(

bool LayoutBox::HasControlClip() const {
NOT_DESTROYED();
return UNLIKELY(IsTextFieldIncludingNG() || IsFileUploadControl() ||
IsMenuList(this) ||
return UNLIKELY(IsTextFieldIncludingNG() || IsMenuList(this) ||
(IsButtonIncludingNG() && IsA<HTMLInputElement>(GetNode())));
}

Expand Down

This file was deleted.

This file was deleted.

5 changes: 0 additions & 5 deletions third_party/blink/renderer/core/layout/layout_object.h
Expand Up @@ -892,10 +892,6 @@ class CORE_EXPORT LayoutObject : public GarbageCollected<LayoutObject>,
NOT_DESTROYED();
return IsFieldset() || IsLayoutNGFieldset();
}
bool IsFileUploadControl() const {
NOT_DESTROYED();
return IsOfType(kLayoutObjectFileUploadControl);
}
bool IsFrame() const {
NOT_DESTROYED();
return IsOfType(kLayoutObjectFrame);
Expand Down Expand Up @@ -3755,7 +3751,6 @@ class CORE_EXPORT LayoutObject : public GarbageCollected<LayoutObject>,
kLayoutObjectCustomScrollbarPart,
kLayoutObjectEmbeddedObject,
kLayoutObjectFieldset,
kLayoutObjectFileUploadControl,
kLayoutObjectFrame,
kLayoutObjectFrameSet,
kLayoutObjectIFrame,
Expand Down
Expand Up @@ -14,7 +14,6 @@
#include "third_party/blink/renderer/core/layout/layout_counter.h"
#include "third_party/blink/renderer/core/layout/layout_deprecated_flexible_box.h"
#include "third_party/blink/renderer/core/layout/layout_fieldset.h"
#include "third_party/blink/renderer/core/layout/layout_file_upload_control.h"
#include "third_party/blink/renderer/core/layout/layout_flexible_box.h"
#include "third_party/blink/renderer/core/layout/layout_frame_set.h"
#include "third_party/blink/renderer/core/layout/layout_inside_list_marker.h"
Expand Down Expand Up @@ -271,14 +270,6 @@ LayoutBlock* LayoutObjectFactory::CreateFieldset(Node& node,
legacy);
}

LayoutBlockFlow* LayoutObjectFactory::CreateFileUploadControl(
Node& node,
const ComputedStyle& style,
LegacyLayout legacy) {
return CreateObject<LayoutBlockFlow, LayoutNGBlockFlow,
LayoutFileUploadControl>(node, legacy);
}

LayoutBox* LayoutObjectFactory::CreateFrameSet(HTMLFrameSetElement& element,
const ComputedStyle& style,
LegacyLayout legacy) {
Expand Down
Expand Up @@ -80,9 +80,6 @@ class LayoutObjectFactory {
const CounterContentData& counter,
LegacyLayout legacy);
static LayoutBlock* CreateFieldset(Node&, const ComputedStyle&, LegacyLayout);
static LayoutBlockFlow* CreateFileUploadControl(Node& node,
const ComputedStyle& style,
LegacyLayout legacy);
static LayoutBox* CreateFrameSet(HTMLFrameSetElement& element,
const ComputedStyle& style,
LegacyLayout legacy);
Expand Down
7 changes: 0 additions & 7 deletions third_party/blink/renderer/core/layout/layout_tree_as_text.cc
Expand Up @@ -40,7 +40,6 @@
#include "third_party/blink/renderer/core/html_names.h"
#include "third_party/blink/renderer/core/layout/layout_block_flow.h"
#include "third_party/blink/renderer/core/layout/layout_embedded_content.h"
#include "third_party/blink/renderer/core/layout/layout_file_upload_control.h"
#include "third_party/blink/renderer/core/layout/layout_inline.h"
#include "third_party/blink/renderer/core/layout/layout_list_item.h"
#include "third_party/blink/renderer/core/layout/layout_list_marker.h"
Expand Down Expand Up @@ -175,12 +174,6 @@ void LayoutTreeAsText::WriteLayoutObject(WTF::TextStream& ts,
ts << " " << rect;

if (!(o.IsText() && !o.IsBR())) {
if (o.IsFileUploadControl()) {
ts << " "
<< QuoteAndEscapeNonPrintables(
To<LayoutFileUploadControl>(o).FileTextValue());
}

if (o.Parent()) {
Color color = o.ResolveColor(GetCSSPropertyColor());
if (o.Parent()->ResolveColor(GetCSSPropertyColor()) != color)
Expand Down
2 changes: 0 additions & 2 deletions third_party/blink/renderer/core/paint/build.gni
Expand Up @@ -54,8 +54,6 @@ blink_core_sources_paint = [
"fieldset_painter.h",
"fieldset_paint_info.cc",
"fieldset_paint_info.h",
"file_upload_control_painter.cc",
"file_upload_control_painter.h",
"filter_effect_builder.cc",
"filter_effect_builder.h",
"find_paint_offset_needing_update.h",
Expand Down

0 comments on commit 2dbba9b

Please sign in to comment.