WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
192613
Make HTMLConverter take two Positions in preparation to make it work with shadow DOM
https://bugs.webkit.org/show_bug.cgi?id=192613
Summary
Make HTMLConverter take two Positions in preparation to make it work with sha...
Ryosuke Niwa
Reported
2018-12-11 21:36:18 PST
In order to make HTMLConverter compatible with shadow DOM, we need to make it take two Positions instead of a Range so that it can represent a selection which spans across shadow boundaries.
Attachments
Cleanup
(9.06 KB, patch)
2018-12-11 21:42 PST
,
Ryosuke Niwa
darin
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Ryosuke Niwa
Comment 1
2018-12-11 21:42:50 PST
Created
attachment 357099
[details]
Cleanup
Darin Adler
Comment 2
2018-12-12 09:19:23 PST
Comment on
attachment 357099
[details]
Cleanup View in context:
https://bugs.webkit.org/attachment.cgi?id=357099&action=review
Wish we had a structure with two Positions instead of two separate ones. If we take two positions, do we need to take precautions against traversing the entire document if end is not after start? Range takes care of that, but two positions don’t.
> Source/WebCore/editing/cocoa/HTMLConverter.mm:2459 > + HTMLConverter converter(range.startPosition(), range.endPosition());
I would have used { } syntax. And maybe not named the local variable.
> Source/WebCore/editing/cocoa/HTMLConverter.mm:2467 > + HTMLConverter converter(range->startPosition(), range->endPosition());
Ditto.
Ryosuke Niwa
Comment 3
2018-12-12 13:11:04 PST
(In reply to Darin Adler from
comment #2
)
> Comment on
attachment 357099
[details]
> Cleanup > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=357099&action=review
> > Wish we had a structure with two Positions instead of two separate ones. > > If we take two positions, do we need to take precautions against traversing > the entire document if end is not after start? Range takes care of that, but > two positions don’t.
That is a good point. We have an early return for that in serializePreservingVisualAppearanceInternal too: if (!comparePositions(start, end)) return emptyString(); We should probably update it to: if (comparePositions(start, end) >= 0) return emptyString(); I'm gonna add the following early return to HTMLConverter::convert(): if (comparePositions(m_start, m_end) > 0) return nil;
> > > Source/WebCore/editing/cocoa/HTMLConverter.mm:2459 > > + HTMLConverter converter(range.startPosition(), range.endPosition()); > > I would have used { } syntax. And maybe not named the local variable. > > > Source/WebCore/editing/cocoa/HTMLConverter.mm:2467 > > + HTMLConverter converter(range->startPosition(), range->endPosition()); > > Ditto.
Fixed.
Ryosuke Niwa
Comment 4
2018-12-12 13:20:12 PST
Committed
r239127
: <
https://trac.webkit.org/changeset/239127
>
Radar WebKit Bug Importer
Comment 5
2018-12-12 13:21:28 PST
<
rdar://problem/46673257
>
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