-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[web] DomManager for each FlutterView (#47388)
The PR may seem large, but the main changes are simple: - Introduce a `DomManager` that aims to take over all DOM responsibilities from `FlutterViewEmbedder`. - Update all references to `flutterViewEmbedder.*domElement*` to `domManager.*domElement*`. - Describe the general DOM structure of a Flutter View in a doc comment. Next steps (in future PRs): - Move all DOM manipulation methods out of `FlutterViewEmbedder` into `DomManager`. - Move DOM creation logic out of `FlutterViewEmbedder` into `DomManager`.
- Loading branch information
Showing
19 changed files
with
387 additions
and
278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'package:ui/ui.dart' as ui; | ||
|
||
import '../dom.dart'; | ||
import '../embedder.dart'; | ||
|
||
/// Manages DOM elements and the DOM structure for a [ui.FlutterView]. | ||
/// | ||
/// Here's the general DOM structure of a Flutter View: | ||
/// | ||
/// [rootElement] <flutter-view> | ||
/// | | ||
/// +- [platformViewsHost] <flt-glass-pane> | ||
/// | | | ||
/// | +- [renderingHost] #shadow-root | ||
/// | | | | ||
/// | | +- <flt-semantics-placeholder> | ||
/// | | | | ||
/// | | +- <flt-scene-host> | ||
/// | | | | | ||
/// | | | +- <flt-scene> | ||
/// | | | | ||
/// | | +- <flt-announcement-host> | ||
/// | | | ||
/// | +- ...platform views | ||
/// | | ||
/// +- [textEditingHost] <text-editing-host> | ||
/// | | | ||
/// | +- ...text fields | ||
/// | | ||
/// +- [semanticsHost] <semantics-host> | ||
/// | | ||
/// +- ...semantics nodes | ||
/// | ||
class DomManager { | ||
DomManager.fromFlutterViewEmbedderDEPRECATED(this._embedder); | ||
|
||
final FlutterViewEmbedder _embedder; | ||
|
||
/// The root DOM element for the entire Flutter View. | ||
/// | ||
/// This is where input events are captured, such as pointer events. | ||
/// | ||
/// If semantics is enabled, this element also contains the semantics DOM tree, | ||
/// which captures semantics input events. | ||
DomElement get rootElement => _embedder.flutterViewElementDEPRECATED; | ||
|
||
/// Hosts all platform view elements. | ||
DomElement get platformViewsHost => _embedder.glassPaneElementDEPRECATED; | ||
|
||
/// Hosts all rendering elements and canvases. | ||
DomShadowRoot get renderingHost => _embedder.glassPaneShadowDEPRECATED; | ||
|
||
/// Hosts all text editing elements. | ||
DomElement get textEditingHost => _embedder.textEditingHostNodeDEPRECATED; | ||
|
||
/// Hosts the semantics tree. | ||
/// | ||
/// This element is in front of the [renderingHost] and [platformViewsHost]. | ||
/// Otherwise, the phone will disable focusing by touch, only by tabbing | ||
/// around the UI. | ||
DomElement get semanticsHost => _embedder.semanticsHostElementDEPRECATED; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.