Commit 87f1a1ec authored by Ian Kilpatrick's avatar Ian Kilpatrick Committed by Commit Bot

[cleanup] Remove some now dead code!

"NeedsHackForTextControlWithFontFamily" behaviour was removed:
https://chromium-review.googlesource.com/c/chromium/src/+/1019405/

And TextBlockLogical{Width,Height} was simply dead. :)

This shouldn't change any behaviour. \o/

Change-Id: Ia267e88593cea94606b6f286058a4be887c01bff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1909267
Auto-Submit: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714399}
parent fcd43774
...@@ -70,22 +70,6 @@ void LayoutTextControl::StyleDidChange(StyleDifference diff, ...@@ -70,22 +70,6 @@ void LayoutTextControl::StyleDidChange(StyleDifference diff,
} }
} }
int LayoutTextControl::TextBlockLogicalHeight() const {
return (LogicalHeight() - BorderAndPaddingLogicalHeight()).ToInt();
}
int LayoutTextControl::TextBlockLogicalWidth() const {
Element* inner_editor = InnerEditorElement();
DCHECK(inner_editor);
LayoutUnit unit_width = LogicalWidth() - BorderAndPaddingLogicalWidth();
if (inner_editor->GetLayoutObject())
unit_width -= inner_editor->GetLayoutBox()->PaddingStart() +
inner_editor->GetLayoutBox()->PaddingEnd();
return unit_width.ToInt();
}
int LayoutTextControl::ScrollbarThickness() const { int LayoutTextControl::ScrollbarThickness() const {
// FIXME: We should get the size of the scrollbar from the LayoutTheme // FIXME: We should get the size of the scrollbar from the LayoutTheme
// instead. // instead.
...@@ -224,14 +208,6 @@ float LayoutTextControl::GetAvgCharWidth(const AtomicString& family) const { ...@@ -224,14 +208,6 @@ float LayoutTextControl::GetAvgCharWidth(const AtomicString& family) const {
return font.Width(text_run); return font.Width(text_run);
} }
float LayoutTextControl::ScaleEmToUnits(int x) const {
// This matches the unitsPerEm value for MS Shell Dlg and Courier New from the
// "head" font table.
float units_per_em = 2048.0f;
return roundf(StyleRef().GetFont().GetFontDescription().ComputedSize() * x /
units_per_em);
}
void LayoutTextControl::ComputeIntrinsicLogicalWidths( void LayoutTextControl::ComputeIntrinsicLogicalWidths(
LayoutUnit& min_logical_width, LayoutUnit& min_logical_width,
LayoutUnit& max_logical_width) const { LayoutUnit& max_logical_width) const {
......
...@@ -60,14 +60,9 @@ class CORE_EXPORT LayoutTextControl : public LayoutBlockFlow { ...@@ -60,14 +60,9 @@ class CORE_EXPORT LayoutTextControl : public LayoutBlockFlow {
const HitTestLocation&, const HitTestLocation&,
const PhysicalOffset& accumulated_offset); const PhysicalOffset& accumulated_offset);
int TextBlockLogicalWidth() const;
int TextBlockLogicalHeight() const;
float ScaleEmToUnits(int x) const;
static bool HasValidAvgCharWidth(const SimpleFontData*, static bool HasValidAvgCharWidth(const SimpleFontData*,
const AtomicString& family); const AtomicString& family);
virtual float GetAvgCharWidth(const AtomicString& family) const; float GetAvgCharWidth(const AtomicString& family) const;
virtual LayoutUnit PreferredContentLogicalWidth(float char_width) const = 0; virtual LayoutUnit PreferredContentLogicalWidth(float char_width) const = 0;
virtual LayoutUnit ComputeControlLogicalHeight( virtual LayoutUnit ComputeControlLogicalHeight(
LayoutUnit line_height, LayoutUnit line_height,
......
...@@ -56,18 +56,6 @@ bool LayoutTextControlMultiLine::NodeAtPoint( ...@@ -56,18 +56,6 @@ bool LayoutTextControlMultiLine::NodeAtPoint(
return true; return true;
} }
float LayoutTextControlMultiLine::GetAvgCharWidth(
const AtomicString& family) const {
// Match the default system font to the width of MS Shell Dlg, the default
// font for textareas in Firefox, Safari Win and IE for some encodings (in
// IE, the default font is encoding specific). 1229 is the avgCharWidth
// value in the OS/2 table for Courier New.
if (LayoutTheme::GetTheme().NeedsHackForTextControlWithFontFamily(family))
return ScaleEmToUnits(1229);
return LayoutTextControl::GetAvgCharWidth(family);
}
LayoutUnit LayoutTextControlMultiLine::PreferredContentLogicalWidth( LayoutUnit LayoutTextControlMultiLine::PreferredContentLogicalWidth(
float char_width) const { float char_width) const {
int factor = ToHTMLTextAreaElement(GetNode())->cols(); int factor = ToHTMLTextAreaElement(GetNode())->cols();
......
...@@ -44,7 +44,6 @@ class LayoutTextControlMultiLine final : public LayoutTextControl { ...@@ -44,7 +44,6 @@ class LayoutTextControlMultiLine final : public LayoutTextControl {
const PhysicalOffset& accumulated_offset, const PhysicalOffset& accumulated_offset,
HitTestAction) override; HitTestAction) override;
float GetAvgCharWidth(const AtomicString& family) const override;
LayoutUnit PreferredContentLogicalWidth(float char_width) const override; LayoutUnit PreferredContentLogicalWidth(float char_width) const override;
LayoutUnit ComputeControlLogicalHeight( LayoutUnit ComputeControlLogicalHeight(
LayoutUnit line_height, LayoutUnit line_height,
......
...@@ -208,18 +208,6 @@ PhysicalRect LayoutTextControlSingleLine::ControlClipRect( ...@@ -208,18 +208,6 @@ PhysicalRect LayoutTextControlSingleLine::ControlClipRect(
return clip_rect; return clip_rect;
} }
float LayoutTextControlSingleLine::GetAvgCharWidth(
const AtomicString& family) const {
// Match the default system font to the width of MS Shell Dlg, the default
// font for textareas in Firefox, Safari Win and IE for some encodings (in
// IE, the default font is encoding specific). 901 is the avgCharWidth value
// in the OS/2 table for MS Shell Dlg.
if (LayoutTheme::GetTheme().NeedsHackForTextControlWithFontFamily(family))
return ScaleEmToUnits(901);
return LayoutTextControl::GetAvgCharWidth(family);
}
LayoutUnit LayoutTextControlSingleLine::PreferredContentLogicalWidth( LayoutUnit LayoutTextControlSingleLine::PreferredContentLogicalWidth(
float char_width) const { float char_width) const {
int factor; int factor;
...@@ -233,13 +221,7 @@ LayoutUnit LayoutTextControlSingleLine::PreferredContentLogicalWidth( ...@@ -233,13 +221,7 @@ LayoutUnit LayoutTextControlSingleLine::PreferredContentLogicalWidth(
float max_char_width = 0.f; float max_char_width = 0.f;
const Font& font = StyleRef().GetFont(); const Font& font = StyleRef().GetFont();
AtomicString family = font.GetFontDescription().Family().Family(); AtomicString family = font.GetFontDescription().Family().Family();
// Match the default system font to the width of MS Shell Dlg, the default if (HasValidAvgCharWidth(font.PrimaryFont(), family))
// font for textareas in Firefox, Safari Win and IE for some encodings (in
// IE, the default font is encoding specific). 4027 is the (xMax - xMin)
// value in the "head" font table for MS Shell Dlg.
if (LayoutTheme::GetTheme().NeedsHackForTextControlWithFontFamily(family))
max_char_width = ScaleEmToUnits(4027);
else if (HasValidAvgCharWidth(font.PrimaryFont(), family))
max_char_width = roundf(font.PrimaryFont()->MaxCharWidth()); max_char_width = roundf(font.PrimaryFont()->MaxCharWidth());
// For text inputs, IE adds some extra width. // For text inputs, IE adds some extra width.
......
...@@ -68,7 +68,6 @@ class LayoutTextControlSingleLine : public LayoutTextControl { ...@@ -68,7 +68,6 @@ class LayoutTextControlSingleLine : public LayoutTextControl {
LayoutUnit ScrollHeight() const final; LayoutUnit ScrollHeight() const final;
int TextBlockWidth() const; int TextBlockWidth() const;
float GetAvgCharWidth(const AtomicString& family) const final;
LayoutUnit PreferredContentLogicalWidth(float char_width) const final; LayoutUnit PreferredContentLogicalWidth(float char_width) const final;
LayoutUnit ComputeControlLogicalHeight( LayoutUnit ComputeControlLogicalHeight(
LayoutUnit line_height, LayoutUnit line_height,
......
...@@ -200,13 +200,6 @@ class CORE_EXPORT LayoutTheme : public RefCounted<LayoutTheme> { ...@@ -200,13 +200,6 @@ class CORE_EXPORT LayoutTheme : public RefCounted<LayoutTheme> {
void SystemFont(CSSValueID system_font_id, FontDescription&); void SystemFont(CSSValueID system_font_id, FontDescription&);
virtual Color SystemColor(CSSValueID, WebColorScheme color_scheme) const; virtual Color SystemColor(CSSValueID, WebColorScheme color_scheme) const;
// Whether the default system font should have its average character width
// adjusted to match MS Shell Dlg.
virtual bool NeedsHackForTextControlWithFontFamily(
const AtomicString&) const {
return false;
}
virtual int MinimumMenuListSize(const ComputedStyle&) const { return 0; } virtual int MinimumMenuListSize(const ComputedStyle&) const { return 0; }
virtual void AdjustSliderThumbSize(ComputedStyle&) const; virtual void AdjustSliderThumbSize(ComputedStyle&) const;
......
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