<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>63040</bug_id>
          
          <creation_ts>2011-06-20 20:15:25 -0700</creation_ts>
          <short_desc>[meta] positionIsOffsetInAnchor should only accept text nodes</short_desc>
          <delta_ts>2017-07-18 08:29:58 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>HTML Editing</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>63037</dependson>
    
    <dependson>63100</dependson>
    
    <dependson>63181</dependson>
    
    <dependson>63384</dependson>
          <blocked>52098</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Ryosuke Niwa">rniwa</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>darin</cc>
    
    <cc>enrica</cc>
    
    <cc>eric</cc>
    
    <cc>leviw</cc>
    
    <cc>sullivan</cc>
    
    <cc>yosin</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>424213</commentid>
    <comment_count>0</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2011-06-20 20:15:25 -0700</bug_when>
    <thetext>During the contributor&apos;s meeting, we have concluded that we should not have positions with offsets in non-text nodes for performance reasons and for comparison.  We should refactor the code to enforce this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>425418</commentid>
    <comment_count>1</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2011-06-22 11:33:56 -0700</bug_when>
    <thetext>The current plan is follows:
1. Fix the bug 63100 - Add BeforeChildren/AfterChildren anchor types.
2. Add Position(PassRefPtr&lt;Text&gt;, unsigned offset)
3. Remove instantes of Position(..., PositionIsOffsetInAnchor)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>427409</commentid>
    <comment_count>2</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2011-06-25 12:53:19 -0700</bug_when>
    <thetext>There are few files in WebKit that instantiates Position directly:
Source/WebKit/chromium/src/WebViewImpl.cpp:1302:                                      Position::PositionIsOffsetInAnchor);
Source/WebKit/mac/WebView/WebFrame.mm:743:    Position start = Position(startContainer, [proposedRange startOffset], Position::PositionIsOffsetInAnchor);
Source/WebKit/mac/WebView/WebFrame.mm:744:    Position end = Position(endContainer, [proposedRange endOffset], Position::PositionIsOffsetInAnchor);
Source/WebKit/mac/WebView/WebFrame.mm:1107:    Position startPos(startContainer, [rangeToReplace startOffset], Position::PositionIsOffsetInAnchor);
Source/WebKit/mac/WebView/WebFrame.mm:1108:    Position endPos(endContainer, [rangeToReplace endOffset], Position::PositionIsOffsetInAnchor);
Source/WebKit/mac/WebView/WebTextCompletionController.mm:208:            NSRect wordRect = [frame _caretRectAtPosition:Position(core([wholeWord startContainer]), [wholeWord startOffset], Position::PositionIsOffsetInAnchor) affinity:NSSelectionAffinityDownstream];</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1105332</commentid>
    <comment_count>3</comment_count>
    <who name="">yosin</who>
    <bug_when>2015-06-28 19:13:50 -0700</bug_when>
    <thetext>It seems there are no alternative way to represent child node other than PositionIsOffsetInAnchor.

What do you mind to represent child node w/o PositionIsOffsetInAnchor?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1105333</commentid>
    <comment_count>4</comment_count>
    <who name="Levi Weintraub">leviw</who>
    <bug_when>2015-06-28 19:34:22 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; It seems there are no alternative way to represent child node other than
&gt; PositionIsOffsetInAnchor.
&gt; 
&gt; What do you mind to represent child node w/o PositionIsOffsetInAnchor?

For non-text nodes, we want to use the other types: 

PositionIsBeforeAnchor,
PositionIsAfterAnchor,
PositionIsBeforeChildren,
PositionIsAfterChildren,

This avoids having to walk the child list.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1105334</commentid>
    <comment_count>5</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2015-06-28 19:34:49 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; It seems there are no alternative way to represent child node other than
&gt; PositionIsOffsetInAnchor.
&gt; 
&gt; What do you mind to represent child node w/o PositionIsOffsetInAnchor?

Performance.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1105337</commentid>
    <comment_count>6</comment_count>
    <who name="">yosin</who>
    <bug_when>2015-06-28 20:50:18 -0700</bug_when>
    <thetext>&gt;&gt; What do you mind to represent child node w/o PositionIsOffsetInAnchor?
&gt; Performance.

Oops, my question is unclear.
How do we represent a position at child node w/o PositionIsOffsetInAnchor?
Use LegacyEditingPosition?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1105338</commentid>
    <comment_count>7</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2015-06-28 21:52:56 -0700</bug_when>
    <thetext>(In reply to comment #6)
&gt; &gt;&gt; What do you mind to represent child node w/o PositionIsOffsetInAnchor?
&gt; &gt; Performance.
&gt; 
&gt; Oops, my question is unclear.
&gt; How do we represent a position at child node w/o PositionIsOffsetInAnchor?
&gt; Use LegacyEditingPosition?

Use BeforeChildren, AfterChildren, BeforeAnchor, or AfterAnchor (for the latter two, you need to change the anchor node since we&apos;re no longer anchoring at the parent)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1105346</commentid>
    <comment_count>8</comment_count>
    <who name="">yosin</who>
    <bug_when>2015-06-28 22:52:57 -0700</bug_when>
    <thetext>(In reply to comment #7)
&gt; (In reply to comment #6)
&gt; &gt; &gt;&gt; What do you mind to represent child node w/o PositionIsOffsetInAnchor?
&gt; &gt; &gt; Performance.
&gt; &gt; 
&gt; &gt; Oops, my question is unclear.
&gt; &gt; How do we represent a position at child node w/o PositionIsOffsetInAnchor?
&gt; &gt; Use LegacyEditingPosition?
&gt; 
&gt; Use BeforeChildren, AfterChildren, BeforeAnchor, or AfterAnchor (for the
&gt; latter two, you need to change the anchor node since we&apos;re no longer
&gt; anchoring at the parent)

Thanks for explanation. So, you want to avoid computing node index. But, why not use RangeBoundaryPoint?
It seems AnchorType introduces complexity in Position class.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1105355</commentid>
    <comment_count>9</comment_count>
    <who name="Levi Weintraub">leviw</who>
    <bug_when>2015-06-28 23:46:23 -0700</bug_when>
    <thetext>(In reply to comment #8)
&gt; (In reply to comment #7)
&gt; &gt; (In reply to comment #6)
&gt; &gt; &gt; &gt;&gt; What do you mind to represent child node w/o PositionIsOffsetInAnchor?
&gt; &gt; &gt; &gt; Performance.
&gt; &gt; &gt; 
&gt; &gt; &gt; Oops, my question is unclear.
&gt; &gt; &gt; How do we represent a position at child node w/o PositionIsOffsetInAnchor?
&gt; &gt; &gt; Use LegacyEditingPosition?
&gt; &gt; 
&gt; &gt; Use BeforeChildren, AfterChildren, BeforeAnchor, or AfterAnchor (for the
&gt; &gt; latter two, you need to change the anchor node since we&apos;re no longer
&gt; &gt; anchoring at the parent)
&gt; 
&gt; Thanks for explanation. So, you want to avoid computing node index. But, why
&gt; not use RangeBoundaryPoint?

It&apos;s not only about *computing* the node index, it&apos;s about finding the child nodes when you just have a pointer to the parent node and index. If you have a position between two non-text nodes in a node list with 1000 siblings, just having [parent, 500] will be very expensive...

&gt; It seems AnchorType introduces complexity in Position class.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>