Bug 158773 - Decouple the percent height and positioned descendants maps.
Summary: Decouple the percent height and positioned descendants maps.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: zalan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-14 20:07 PDT by zalan
Modified: 2016-06-15 20:30 PDT (History)
9 users (show)

See Also:


Attachments
Patch (22.18 KB, patch)
2016-06-14 20:49 PDT, zalan
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews102 for mac-yosemite (940.00 KB, application/zip)
2016-06-14 21:36 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews105 for mac-yosemite-wk2 (941.64 KB, text/plain)
2016-06-14 21:40 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews126 for ios-simulator-wk2 (653.98 KB, application/zip)
2016-06-14 21:46 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews114 for mac-yosemite (1.42 MB, application/zip)
2016-06-14 21:50 PDT, Build Bot
no flags Details
Patch (22.69 KB, patch)
2016-06-14 21:51 PDT, zalan
no flags Details | Formatted Diff | Diff
Patch (24.82 KB, patch)
2016-06-15 19:47 PDT, zalan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description zalan 2016-06-14 20:07:32 PDT
While we track the elements with percent height through multiple containers (direct parent, indirect parent), a positioned element can only have one containing block.
Sharing the same data structure between these 2 concepts is defective.
precent height element with multiple containers -> typedef WTF::HashMap<const RenderBox*, std::unique_ptr<HashSet<const RenderBlock*>>> TrackedContainerMap;
positioned element with single containing block -> typedef HashMap<const RenderBox*, const RenderBlock*> TrackedContainerMap;
Comment 1 zalan 2016-06-14 20:49:48 PDT
Created attachment 281322 [details]
Patch
Comment 2 Build Bot 2016-06-14 21:36:53 PDT
Comment on attachment 281322 [details]
Patch

Attachment 281322 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/1504857

New failing tests:
fast/block/fixed-position-reparent-when-transition-is-removed.html
Comment 3 Build Bot 2016-06-14 21:36:57 PDT
Created attachment 281327 [details]
Archive of layout-test-results from ews102 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews102  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 4 Build Bot 2016-06-14 21:40:22 PDT
Comment on attachment 281322 [details]
Patch

Attachment 281322 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/1504870

New failing tests:
fast/block/fixed-position-reparent-when-transition-is-removed.html
Comment 5 Build Bot 2016-06-14 21:40:26 PDT
Created attachment 281328 [details]
Archive of layout-test-results from ews105 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews105  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 6 Build Bot 2016-06-14 21:46:36 PDT
Comment on attachment 281322 [details]
Patch

Attachment 281322 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/1504872

New failing tests:
fast/block/fixed-position-reparent-when-transition-is-removed.html
Comment 7 Build Bot 2016-06-14 21:46:41 PDT
Created attachment 281330 [details]
Archive of layout-test-results from ews126 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews126  Port: ios-simulator-wk2  Platform: Mac OS X 10.11.4
Comment 8 Build Bot 2016-06-14 21:50:54 PDT
Comment on attachment 281322 [details]
Patch

Attachment 281322 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/1504895

New failing tests:
fast/block/fixed-position-reparent-when-transition-is-removed.html
Comment 9 Build Bot 2016-06-14 21:50:58 PDT
Created attachment 281332 [details]
Archive of layout-test-results from ews114 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews114  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 10 zalan 2016-06-14 21:51:59 PDT
Created attachment 281333 [details]
Patch
Comment 11 Dave Hyatt 2016-06-15 13:21:13 PDT
Comment on attachment 281333 [details]
Patch

r=me
Comment 12 Chris Dumez 2016-06-15 13:53:40 PDT
Comment on attachment 281333 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=281333&action=review

> Source/WebCore/rendering/RenderBlock.cpp:98
>  static TrackedDescendantsMap* gPercentHeightDescendantsMap;

We normally don't use 'g' prefix for statics.

> Source/WebCore/rendering/RenderBlock.cpp:108
> +    auto* descendantSet = gPercentHeightDescendantsMap->get(&container);

Could use HashMap::ensure() and std::make_unique<>()

> Source/WebCore/rendering/RenderBlock.cpp:121
> +    auto* containerSet = gPercentHeightContainerMap->get(&descendant);

Could use HashMap::ensure() and std::make_unique<>()

> Source/WebCore/rendering/RenderBlock.cpp:148
>          auto* descendantSet = descendantsMapIterator->value.get();

Auto& descendantSet = *descendantsMapIterator->value;

> Source/WebCore/rendering/RenderBlock.cpp:158
> +    void addDescendant(const RenderBlock& containingBlock, RenderBox& positionedDescendant, bool moveDescendantToEnd = false)

The bool parameter would read nicer at call sites if this used an enum class:
Enum class MoveDescendantToEnd { No, Yes }

> Source/WebCore/rendering/RenderBlock.cpp:204
> +        for (const auto* renderer : *descendants)

Const does not really bring much.

> Source/WebCore/rendering/RenderBlock.cpp:214
> +    typedef HashMap<const RenderBlock*, std::unique_ptr<TrackedRendererListHashSet>> DescendantsMap;

We using using instead of typedef these days:
Using DescendantsMap = HashMap<const RenderBlock*, std::unique_ptr<TrackedRendererListHashSet>>;

> Source/WebCore/rendering/RenderBlock.cpp:325
> +    if (std::unique_ptr<TrackedRendererListHashSet> descendantSet = gPercentHeightDescendantsMap->take(block)) {

We would usually do the if (!....) Return early.

> Source/WebCore/rendering/RenderBlock.cpp:327
>          for (TrackedRendererListHashSet::iterator descendant = descendantSet->begin(); descendant != end; ++descendant) {

Would probably be nicer with a new range loop.

> Source/WebCore/rendering/RenderBlock.cpp:328
> +            TrackedContainerMap::iterator it = gPercentHeightContainerMap->find(*descendant);

auto

> Source/WebCore/rendering/RenderBlock.cpp:3834
> +    for (auto it = positionedDescendants->begin(), end = positionedDescendants->end(); it != end; ++it) {

New range loop?
Comment 13 zalan 2016-06-15 19:47:13 PDT
Created attachment 281428 [details]
Patch
Comment 14 zalan 2016-06-15 20:09:38 PDT
(In reply to comment #12)
> Comment on attachment 281333 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=281333&action=review
> 
> > Source/WebCore/rendering/RenderBlock.cpp:98
> >  static TrackedDescendantsMap* gPercentHeightDescendantsMap;
> 
> We normally don't use 'g' prefix for statics.
> 
> > Source/WebCore/rendering/RenderBlock.cpp:108
> > +    auto* descendantSet = gPercentHeightDescendantsMap->get(&container);
> 
> Could use HashMap::ensure() and std::make_unique<>()
> 
> > Source/WebCore/rendering/RenderBlock.cpp:121
> > +    auto* containerSet = gPercentHeightContainerMap->get(&descendant);
> 
> Could use HashMap::ensure() and std::make_unique<>()
> 
> > Source/WebCore/rendering/RenderBlock.cpp:148
> >          auto* descendantSet = descendantsMapIterator->value.get();
> 
> Auto& descendantSet = *descendantsMapIterator->value;
> 
> > Source/WebCore/rendering/RenderBlock.cpp:158
> > +    void addDescendant(const RenderBlock& containingBlock, RenderBox& positionedDescendant, bool moveDescendantToEnd = false)
> 
> The bool parameter would read nicer at call sites if this used an enum class:
> Enum class MoveDescendantToEnd { No, Yes }
> 
> > Source/WebCore/rendering/RenderBlock.cpp:204
> > +        for (const auto* renderer : *descendants)
> 
> Const does not really bring much.
> 
> > Source/WebCore/rendering/RenderBlock.cpp:214
> > +    typedef HashMap<const RenderBlock*, std::unique_ptr<TrackedRendererListHashSet>> DescendantsMap;
> 
> We using using instead of typedef these days:
> Using DescendantsMap = HashMap<const RenderBlock*,
> std::unique_ptr<TrackedRendererListHashSet>>;
> 
> > Source/WebCore/rendering/RenderBlock.cpp:325
> > +    if (std::unique_ptr<TrackedRendererListHashSet> descendantSet = gPercentHeightDescendantsMap->take(block)) {
> 
> We would usually do the if (!....) Return early.
> 
> > Source/WebCore/rendering/RenderBlock.cpp:327
> >          for (TrackedRendererListHashSet::iterator descendant = descendantSet->begin(); descendant != end; ++descendant) {
> 
> Would probably be nicer with a new range loop.
> 
> > Source/WebCore/rendering/RenderBlock.cpp:328
> > +            TrackedContainerMap::iterator it = gPercentHeightContainerMap->find(*descendant);
> 
> auto
> 
> > Source/WebCore/rendering/RenderBlock.cpp:3834
> > +    for (auto it = positionedDescendants->begin(), end = positionedDescendants->end(); it != end; ++it) {
> 
> New range loop?
Done.
Comment 15 WebKit Commit Bot 2016-06-15 20:30:21 PDT
Comment on attachment 281428 [details]
Patch

Clearing flags on attachment: 281428

Committed r202123: <http://trac.webkit.org/changeset/202123>
Comment 16 WebKit Commit Bot 2016-06-15 20:30:28 PDT
All reviewed patches have been landed.  Closing bug.