Skip to content

Commit b1dd5ca

Browse files
committed
APL-CORE: June 2021 Bug Fix Release of the APL 1.6 compliant core engine (1.6.1)
For more details on this release refer to CHANGELOG.md To learn about APL see: https://developer.amazon.com/docs/alexa-presentation-language/understand-apl.html
1 parent 11e1d95 commit b1dd5ca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1256
-199
lines changed

CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog
22

3+
## [1.6.1]
4+
5+
### Changed
6+
7+
- Improved pager fling behavior to provide a more consistent navigation
8+
- Fixed keyboard and focus handling when wrapping an EditText in a TouchWrapper
9+
- Updated PEGTL to version 2.8.3
10+
- Visibility property in visual context rounded to 2 decimal points
11+
- Perfomance improvements
12+
- Other bug fixes
13+
314
## [1.6.0]
415

516
This release adds support for version 1.6 of the APL specification.

THIRD-PARTY-NOTICES.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,12 @@ SOFTWARE.
172172

173173
------
174174

175-
** pegtl 2.8; version 2.8.1 -- https://github.com/taocpp/PEGTL/
175+
** pegtl 2.8; version 2.8.3 -- https://github.com/taocpp/PEGTL/
176176
Copyright (c) 2007-2020 Dr. Colin Hirsch and Daniel Frey
177177

178178
The MIT License (MIT)
179179

180-
Copyright (c) 2007-2019 Dr. Colin Hirsch and Daniel Frey
180+
Copyright (c) 2007-2020 Dr. Colin Hirsch and Daniel Frey
181181

182182
Permission is hereby granted, free of charge, to any person obtaining a copy
183183
of this software and associated documentation files (the "Software"), to deal

aplcore/include/apl/component/corecomponent.h

+18-9
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@ inline EventPropertyMap eventPropertyMerge(const EventPropertyMap& first, EventP
5454
return std::move(second);
5555
}
5656

57+
enum PointerCaptureStatus {
58+
/// The pointer has not been captured by any component
59+
kPointerStatusNotCaptured,
60+
/// The pointer has been captured by a component
61+
kPointerStatusCaptured,
62+
/// A component wants to capture the pointer, but is allowing other components to process the
63+
// same pointer event first
64+
kPointerStatusPendingCapture
65+
};
66+
5767
/**
5868
* The native interface to a primitive APL Component.
5969
*
@@ -517,7 +527,7 @@ class CoreComponent : public Component,
517527
/**
518528
* @return The current calculated style. This may be null.
519529
*/
520-
const StyleInstancePtr getStyle() const;
530+
StyleInstancePtr getStyle() const;
521531

522532
/**
523533
* Update the style of the component
@@ -636,12 +646,6 @@ class CoreComponent : public Component,
636646

637647
void calculateDrawnBorder(bool useDirtyFlag);
638648

639-
/**
640-
* @param position Point in global coordinates.
641-
* @return Whether that point is within the bounds of this component.
642-
*/
643-
bool containsGlobalPosition(const Point& position) const;
644-
645649
/**
646650
* @param position Point in local coordinates.
647651
* @return Whether that point is within the bounds of this component.
@@ -772,9 +776,9 @@ class CoreComponent : public Component,
772776
* Defer pointer processing to component.
773777
* @param event pointer event.
774778
* @param timestamp event timestamp.
775-
* @return true if pointer captured by a component processing, false otherwise.
779+
* @return the status of the pointer following processing by this component
776780
*/
777-
virtual bool processPointerEvent(const PointerEvent& event, apl_time_t timestamp);
781+
virtual PointerCaptureStatus processPointerEvent(const PointerEvent& event, apl_time_t timestamp);
778782

779783
/**
780784
* @return The root configuration provided by the viewhost
@@ -906,6 +910,11 @@ class CoreComponent : public Component,
906910
*/
907911
virtual void ensureDisplayedChildren();
908912

913+
/**
914+
* @return True if layout change calculations should not be propagated to component's children. Usually the case
915+
* when component itself is not taking part in the layout tree.
916+
*/
917+
bool shouldNotPropagateLayoutChanges() const;
909918

910919
private:
911920
friend streamer& operator<<(streamer&, const Component&);

aplcore/include/apl/component/edittextcomponent.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class EditTextComponent : public ActionableComponent {
4646
protected:
4747
const ComponentPropDefSet& propDefSet() const override;
4848
const EventPropertyMap& eventPropertyMap() const override;
49-
bool processPointerEvent(const PointerEvent& event, apl_time_t timestamp) override;
49+
PointerCaptureStatus processPointerEvent(const PointerEvent& event, apl_time_t timestamp) override;
5050

5151
private:
5252
CharacterRangesPtr mCharacterRangesPtr;

aplcore/include/apl/component/gridsequencecomponent.h

+5
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class GridSequenceComponent : public MultiChildScrollableComponent {
4343
void layoutChildIfRequired(const CoreComponentPtr& child,
4444
size_t childIdx,
4545
bool useDirtyFlag) override;
46+
void ensureChildAttached(const CoreComponentPtr& child, int targetIdx) override;
4647
const EventPropertyMap & eventPropertyMap() const override;
4748

4849
void handlePropertyChange(const ComponentPropDef& def, const Object& value) override;
@@ -51,12 +52,16 @@ class GridSequenceComponent : public MultiChildScrollableComponent {
5152

5253
size_t getItemsPerCourse() const override { return mItemsPerCourse; }
5354

55+
size_t estimateChildrenToCover(float distance, size_t baseChild) override;
56+
5457
private:
5558
std::pair<float, std::vector<float>> adjustChildDimensions(
5659
const Dimension& transAxisChildDimension,
5760
float transAxisSize,
5861
const ObjectArray& crossAxisArray,
5962
float crossAxisSize);
63+
64+
Size getChildSize(size_t index) const;
6065
void applyChildSize(const CoreComponentPtr& coreChild, size_t index) const;
6166
void calculateAbsoluteChildSizes(float gridWidth, float gridHeight);
6267
void calculateItemsPerCourse();

aplcore/include/apl/component/multichildscrollablecomponent.h

+9-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,9 @@ class MultiChildScrollableComponent : public ScrollableComponent {
120120
void removeChild(const CoreComponentPtr& child, size_t index, bool useDirtyFlag) override;
121121
bool getTags(rapidjson::Value& outMap, rapidjson::Document::AllocatorType& allocator) override;
122122
virtual void layoutChildIfRequired(const CoreComponentPtr& child, size_t childIdx, bool useDirtyFlag);
123+
void relayoutInPlace(bool useDirtyFlag);
123124
float maxScroll() const override;
124-
bool shouldAttachChildYogaNode(int index) const override;
125+
bool shouldAttachChildYogaNode(int index) const override { return false; }
125126

126127
const EventPropertyMap & eventPropertyMap() const override;
127128
void handlePropertyChange(const ComponentPropDef& def, const Object& value) override;
@@ -130,10 +131,15 @@ class MultiChildScrollableComponent : public ScrollableComponent {
130131

131132
virtual size_t getItemsPerCourse() const { return 1; }
132133

133-
void ensureChildAttached(const CoreComponentPtr& child, int targetIdx);
134+
virtual void ensureChildAttached(const CoreComponentPtr& child, int targetIdx);
134135

135136
void attachYogaNode(const CoreComponentPtr& child) override;
136137

138+
/**
139+
* Estimate number of children required to cover provided distance based on parameters of child provided.
140+
*/
141+
virtual size_t estimateChildrenToCover(float distance, size_t baseChild) = 0;
142+
137143
private:
138144
/**
139145
* Ensure that current state of visibility parameters properly calculated.
@@ -173,6 +179,7 @@ class MultiChildScrollableComponent : public ScrollableComponent {
173179

174180
void attachYogaNodeIfRequired(const CoreComponentPtr& coreChild, int index) override;
175181
bool attachChild(const CoreComponentPtr& child, size_t index);
182+
void runLayoutHeuristics(size_t anchorIdx, float childCache, float pageSize, bool useDirtyFlag);
176183

177184
private:
178185
Range mIndexesSeen;

aplcore/include/apl/component/sequencecomponent.h

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class SequenceComponent : public MultiChildScrollableComponent {
3131
const ComponentPropDefSet& propDefSet() const override;
3232
const ComponentPropDefSet* layoutPropDefSet() const override;
3333
bool childrenUseSpacingProperty() const override { return true; }
34+
size_t estimateChildrenToCover(float distance, size_t baseChild) override;
3435

3536
};
3637

aplcore/include/apl/component/touchablecomponent.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class TouchableComponent : public ActionableComponent {
5454
// TODO: override to be removed once we support handing intrinsic/reserved keys
5555
void update(UpdateType type, float value) override;
5656
void setGestureHandlers();
57-
bool processPointerEvent(const PointerEvent& event, apl_time_t timestamp) override;
57+
PointerCaptureStatus processPointerEvent(const PointerEvent& event, apl_time_t timestamp) override;
5858
void invokeStandardAccessibilityAction(const std::string& name) override;
5959

6060
private:

aplcore/include/apl/engine/builder.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,17 @@ class Builder {
7979

8080
CoreComponentPtr expandSingleComponentFromArray(const ContextPtr& context,
8181
const std::vector<Object>& items,
82-
Properties& properties,
82+
Properties&& properties,
8383
const CoreComponentPtr& parent,
8484
const Path& path);
8585

8686
CoreComponentPtr expandSingleComponent(const ContextPtr& context,
8787
const Object& item,
88-
Properties& properties,
88+
Properties&& properties,
8989
const CoreComponentPtr& parent,
9090
const Path& path);
9191

92-
void attachBindings(const ContextPtr& context, const Object& item);
92+
static void attachBindings(const ContextPtr& context, const Object& item);
9393
private:
9494
CoreComponentPtr mOld;
9595
};

aplcore/include/apl/focus/focusfinder.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,17 @@ class FocusFinder {
4343

4444
/**
4545
* Find next focusable component.
46+
* @param focused currently focused component or nullptr if none.
4647
* @param focusedRect currently focused rectangle.
4748
* @param direction direction of search.
4849
* @param root root of search hierarchy.
4950
* @return Found component, nullptr otherwise.
5051
*/
51-
CoreComponentPtr findNext(const Rect& focusedRect, FocusDirection direction, const CoreComponentPtr& root);
52+
CoreComponentPtr findNext(
53+
const CoreComponentPtr& focused,
54+
const Rect& focusedRect,
55+
FocusDirection direction,
56+
const CoreComponentPtr& root);
5257

5358
/**
5459
* Get all focusable components in provided root.

aplcore/include/apl/focus/focusmanager.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,12 @@ class FocusManager {
103103
/**
104104
* Find next component to be focused based on provided parameters.
105105
* @param direction direction of search.
106-
* @param origin currently focused rectangle.
106+
* @param origin Component focus originates from if any, nullptr otherwise.
107+
* @param originRect currently focused rectangle.
107108
* @param root root of search hierarchy.
108109
* @return Found component, nullptr otherwise.
109110
*/
110-
CoreComponentPtr find(FocusDirection direction, const Rect& origin, const CoreComponentPtr& root);
111+
CoreComponentPtr find(FocusDirection direction, const CoreComponentPtr& origin, const Rect& originRect, const CoreComponentPtr& root);
111112

112113
/**
113114
* Get focusable areas available from APL Core.

aplcore/include/apl/utils/pagemovehandler.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ class PageMoveHandler {
9696

9797
private:
9898
static ContextPtr createPageMoveContext(
99-
float amount, SwipeDirection direction,
99+
float amount,
100+
SwipeDirection direction,
101+
const CoreComponentPtr& self,
100102
const CoreComponentPtr& currentChild,
101103
const CoreComponentPtr& nextChild);
102104
static ITPtr getPageTransformation(

aplcore/src/command/clearfocuscommand.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ ClearFocusCommand::execute(const TimersPtr& timers, bool fastMode) {
3030
return nullptr;
3131

3232
auto& fm = mContext->focusManager();
33-
fm.clearFocus(true);
33+
fm.clearFocus(true, kFocusDirectionNone, true);
3434
return nullptr;
3535
}
3636

0 commit comments

Comments
 (0)