Commit 3bcef6f0 authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

Slider NG: Add blink::SliderTrackElement

This is a preparation to attach LayoutSliderContainer to the slider
track part, instead of the slider container part. LayoutSliderContainer
adjusts the position of the thumb part, but the thumb part is not a
child of the slider container part, and it's a child of the slider
track part.

This CL has no behavior changes.

Bug: 1040826
Change-Id: Ie520e4f9fe5c474c40b55eb0e2d5d308c05300cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2391893
Commit-Queue: Koji Ishii <kojii@chromium.org>
Auto-Submit: Kent Tamura <tkent@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#804315}
parent 43cc7617
...@@ -252,6 +252,8 @@ blink_core_sources("html") { ...@@ -252,6 +252,8 @@ blink_core_sources("html") {
"forms/select_type.h", "forms/select_type.h",
"forms/slider_thumb_element.cc", "forms/slider_thumb_element.cc",
"forms/slider_thumb_element.h", "forms/slider_thumb_element.h",
"forms/slider_track_element.cc",
"forms/slider_track_element.h",
"forms/spin_button_element.cc", "forms/spin_button_element.cc",
"forms/spin_button_element.h", "forms/spin_button_element.h",
"forms/step_range.cc", "forms/step_range.cc",
......
...@@ -46,8 +46,8 @@ ...@@ -46,8 +46,8 @@
#include "third_party/blink/renderer/core/html/forms/html_input_element.h" #include "third_party/blink/renderer/core/html/forms/html_input_element.h"
#include "third_party/blink/renderer/core/html/forms/html_option_element.h" #include "third_party/blink/renderer/core/html/forms/html_option_element.h"
#include "third_party/blink/renderer/core/html/forms/slider_thumb_element.h" #include "third_party/blink/renderer/core/html/forms/slider_thumb_element.h"
#include "third_party/blink/renderer/core/html/forms/slider_track_element.h"
#include "third_party/blink/renderer/core/html/forms/step_range.h" #include "third_party/blink/renderer/core/html/forms/step_range.h"
#include "third_party/blink/renderer/core/html/html_div_element.h"
#include "third_party/blink/renderer/core/html/parser/html_parser_idioms.h" #include "third_party/blink/renderer/core/html/parser/html_parser_idioms.h"
#include "third_party/blink/renderer/core/html/shadow/shadow_element_names.h" #include "third_party/blink/renderer/core/html/shadow/shadow_element_names.h"
#include "third_party/blink/renderer/core/html_names.h" #include "third_party/blink/renderer/core/html_names.h"
...@@ -244,7 +244,7 @@ void RangeInputType::CreateShadowSubtree() { ...@@ -244,7 +244,7 @@ void RangeInputType::CreateShadowSubtree() {
DCHECK(IsShadowHost(GetElement())); DCHECK(IsShadowHost(GetElement()));
Document& document = GetElement().GetDocument(); Document& document = GetElement().GetDocument();
auto* track = MakeGarbageCollected<HTMLDivElement>(document); auto* track = MakeGarbageCollected<blink::SliderTrackElement>(document);
track->SetShadowPseudoId(AtomicString("-webkit-slider-runnable-track")); track->SetShadowPseudoId(AtomicString("-webkit-slider-runnable-track"));
track->setAttribute(html_names::kIdAttr, track->setAttribute(html_names::kIdAttr,
shadow_element_names::kIdSliderTrack); shadow_element_names::kIdSliderTrack);
......
// Copyright 2020 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/html/forms/slider_track_element.h"
namespace blink {
SliderTrackElement::SliderTrackElement(Document& document)
: HTMLDivElement(document) {}
LayoutObject* SliderTrackElement::CreateLayoutObject(const ComputedStyle& style,
LegacyLayout legacy) {
// TODO(crbug.com/1040826): Introduce LayoutSliderTrack, and use it here.
return HTMLDivElement::CreateLayoutObject(style, legacy);
}
} // namespace blink
// Copyright 2020 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.
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_HTML_FORMS_SLIDER_TRACK_ELEMENT_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_HTML_FORMS_SLIDER_TRACK_ELEMENT_H_
#include "third_party/blink/renderer/core/html/html_div_element.h"
namespace blink {
// SliderTrackElement represents a track part of <input type=range>, and it's a
// parent of a SliderThumbElement. We need this dedicated C++ class because we'd
// like to provide a dedicated LayoutObject for this.
class SliderTrackElement final : public HTMLDivElement {
public:
explicit SliderTrackElement(Document& document);
private:
LayoutObject* CreateLayoutObject(const ComputedStyle& style,
LegacyLayout legacy) override;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_HTML_FORMS_SLIDER_TRACK_ELEMENT_H_
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