Commit 9a96b0b0 authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

Slider NG: Remove LayoutSlider::BaselinePosition()

Fold it into LayoutFlexibleBox, which is the current super class.
This CL has no behavior changes.

Bug: 1040826
Change-Id: I8ebdf9b508e0253f3ac6781a340c15cf4b3b1e05
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2386440
Commit-Queue: Kent Tamura <tkent@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#803435}
parent fb8a86a4
...@@ -33,7 +33,9 @@ ...@@ -33,7 +33,9 @@
#include <limits> #include <limits>
#include "base/auto_reset.h" #include "base/auto_reset.h"
#include "third_party/blink/renderer/core/frame/web_feature.h" #include "third_party/blink/renderer/core/frame/web_feature.h"
#include "third_party/blink/renderer/core/html/forms/html_input_element.h"
#include "third_party/blink/renderer/core/html/forms/html_select_element.h" #include "third_party/blink/renderer/core/html/forms/html_select_element.h"
#include "third_party/blink/renderer/core/input_type_names.h"
#include "third_party/blink/renderer/core/layout/flexible_box_algorithm.h" #include "third_party/blink/renderer/core/layout/flexible_box_algorithm.h"
#include "third_party/blink/renderer/core/layout/layout_state.h" #include "third_party/blink/renderer/core/layout/layout_state.h"
#include "third_party/blink/renderer/core/layout/layout_video.h" #include "third_party/blink/renderer/core/layout/layout_video.h"
...@@ -212,6 +214,14 @@ LayoutUnit LayoutFlexibleBox::BaselinePosition(FontBaseline, ...@@ -212,6 +214,14 @@ LayoutUnit LayoutFlexibleBox::BaselinePosition(FontBaseline,
LineDirectionMode direction, LineDirectionMode direction,
LinePositionMode mode) const { LinePositionMode mode) const {
DCHECK_EQ(mode, kPositionOnContainingLine); DCHECK_EQ(mode, kPositionOnContainingLine);
// TODO(crbug.com/1040826): input[type=range] should not use
// LayoutFlexibleBox. We should move out this code.
if (const auto* input = DynamicTo<HTMLInputElement>(GetNode())) {
if (input->type() == input_type_names::kRange) {
return SynthesizedBaselineFromBorderBox(*this, direction) +
MarginBefore();
}
}
LayoutUnit baseline = FirstLineBoxBaseline(); LayoutUnit baseline = FirstLineBoxBaseline();
if (baseline == -1) { if (baseline == -1) {
return SynthesizedBaselineFromBorderBox(*this, direction) + return SynthesizedBaselineFromBorderBox(*this, direction) +
......
...@@ -35,14 +35,4 @@ LayoutSlider::LayoutSlider(HTMLInputElement* element) ...@@ -35,14 +35,4 @@ LayoutSlider::LayoutSlider(HTMLInputElement* element)
LayoutSlider::~LayoutSlider() = default; LayoutSlider::~LayoutSlider() = default;
LayoutUnit LayoutSlider::BaselinePosition(
FontBaseline,
bool /*firstLine*/,
LineDirectionMode,
LinePositionMode line_position_mode) const {
DCHECK_EQ(line_position_mode, kPositionOnContainingLine);
// FIXME: Patch this function for writing-mode.
return Size().Height() + MarginTop();
}
} // namespace blink } // namespace blink
...@@ -42,12 +42,6 @@ class CORE_EXPORT LayoutSlider final : public LayoutFlexibleBox { ...@@ -42,12 +42,6 @@ class CORE_EXPORT LayoutSlider final : public LayoutFlexibleBox {
bool IsOfType(LayoutObjectType type) const override { bool IsOfType(LayoutObjectType type) const override {
return type == kLayoutObjectSlider || LayoutFlexibleBox::IsOfType(type); return type == kLayoutObjectSlider || LayoutFlexibleBox::IsOfType(type);
} }
LayoutUnit BaselinePosition(
FontBaseline,
bool first_line,
LineDirectionMode,
LinePositionMode = kPositionOnContainingLine) const override;
}; };
template <> template <>
......
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