diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/core/layout')
3 files changed, 29 insertions, 0 deletions
diff --git a/chromium/third_party/blink/renderer/core/layout/layout_text_control_multi_line.cc b/chromium/third_party/blink/renderer/core/layout/layout_text_control_multi_line.cc index ef3a634471d..33ec87c2d86 100644 --- a/chromium/third_party/blink/renderer/core/layout/layout_text_control_multi_line.cc +++ b/chromium/third_party/blink/renderer/core/layout/layout_text_control_multi_line.cc @@ -108,4 +108,20 @@ LayoutObject* LayoutTextControlMultiLine::LayoutSpecialExcludedChild( return placeholder_layout_object; } +LayoutUnit LayoutTextControlMultiLine::ScrollWidth() const { + // If in preview state, fake the scroll width to prevent that any information + // about the suggested content can be derived from the size. + if (!GetTextControlElement()->SuggestedValue().IsEmpty()) + return ClientWidth(); + return LayoutTextControl::ScrollWidth(); +} + +LayoutUnit LayoutTextControlMultiLine::ScrollHeight() const { + // If in preview state, fake the scroll height to prevent that any information + // about the suggested content can be derived from the size. + if (!GetTextControlElement()->SuggestedValue().IsEmpty()) + return ClientHeight(); + return LayoutTextControl::ScrollHeight(); +} + } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/layout/layout_text_control_multi_line.h b/chromium/third_party/blink/renderer/core/layout/layout_text_control_multi_line.h index 67401f83c24..dd9325d1250 100644 --- a/chromium/third_party/blink/renderer/core/layout/layout_text_control_multi_line.h +++ b/chromium/third_party/blink/renderer/core/layout/layout_text_control_multi_line.h @@ -62,6 +62,9 @@ class LayoutTextControlMultiLine final : public LayoutTextControl { LayoutObject* LayoutSpecialExcludedChild(bool relayout_children, SubtreeLayoutScope&) override; + + LayoutUnit ScrollWidth() const override; + LayoutUnit ScrollHeight() const override; }; DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTextControlMultiLine, IsTextArea()); diff --git a/chromium/third_party/blink/renderer/core/layout/layout_text_control_single_line.cc b/chromium/third_party/blink/renderer/core/layout/layout_text_control_single_line.cc index 135c0ce4703..2e5726c3993 100644 --- a/chromium/third_party/blink/renderer/core/layout/layout_text_control_single_line.cc +++ b/chromium/third_party/blink/renderer/core/layout/layout_text_control_single_line.cc @@ -276,6 +276,11 @@ void LayoutTextControlSingleLine::Autoscroll(const PhysicalOffset& position) { } LayoutUnit LayoutTextControlSingleLine::ScrollWidth() const { + // If in preview state, fake the scroll width to prevent that any information + // about the suggested content can be derived from the size. + if (!GetTextControlElement()->SuggestedValue().IsEmpty()) + return ClientWidth(); + if (LayoutBox* inner = InnerEditorElement() ? InnerEditorElement()->GetLayoutBox() : nullptr) { @@ -288,6 +293,11 @@ LayoutUnit LayoutTextControlSingleLine::ScrollWidth() const { } LayoutUnit LayoutTextControlSingleLine::ScrollHeight() const { + // If in preview state, fake the scroll height to prevent that any information + // about the suggested content can be derived from the size. + if (!GetTextControlElement()->SuggestedValue().IsEmpty()) + return ClientHeight(); + if (LayoutBox* inner = InnerEditorElement() ? InnerEditorElement()->GetLayoutBox() : nullptr) { |