WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
150982
Web Inspector: Add View.prototype.contentElement, to protect the "private" part of the view's DOM
https://bugs.webkit.org/show_bug.cgi?id=150982
Summary
Web Inspector: Add View.prototype.contentElement, to protect the "private" pa...
Matt Baker
Reported
2015-11-06 16:00:17 PST
* SUMMARY Add View.prototype.contentElement, to protect the "private" part of the view's DOM. There are two advantages to doing this: 1) Views with scrollbars and other chrome cannot be broken by a subclass naively calling this.element.removeChildren(). 2) The view's root element, and the element to which subviews and other elements are added by subclasses and other clients are not always the same. Proposal: 1) A new contentElement property will be added to View. It will be the logical container to which subviews and other DOM elements are added. View's implicit contract guarantees that DOM mutations can safely be done to contentElement without breaking other parts of the view. 2) View.prototype.element will remain the view's root DOM element. It is appended to the parent view's contentElement, and may be styled by subclasses and other clients (as is currently the case). 3) A view begins life with element === contentElement. It's the responsibility of each subclass to create a separate contentElement, if needed. 4) Each class in a view's hierarchy may have a different contentElement. This is an implementation detail used by addSubview and friends. To view clients there is a single contentElement, which is that of the most derived class.
Attachments
Add attachment
proposed patch, testcase, etc.
Matt Baker
Comment 1
2015-12-14 13:49:52 PST
Building this functionality into class View might be overkill. For the following cases it's straightforward to just create a "contentView" with a public getter: - TimelineOverivew: graphContainerElement (fixed in
https://webkit.org/b/152235
) - SidebarPanel: contentElement -> contentView - DetailsSection: contentElement -> contentView - ScrollableView: will need a content view to hide scrollbars, etc, from derived classes and view clients. - Popovers
Radar WebKit Bug Importer
Comment 2
2015-12-14 13:50:15 PST
<
rdar://problem/23888254
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug