<?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>31099</bug_id>
          
          <creation_ts>2009-11-03 22:24:51 -0800</creation_ts>
          <short_desc>[Qt] Add a way to access text nodes tree with QWebElement</short_desc>
          <delta_ts>2014-03-17 16:16:53 -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>WebKit Qt</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>Qt, QtTriaged</keywords>
          <priority>P3</priority>
          <bug_severity>Enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>48957</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Benjamin Poulain">benjamin</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>abecsi</cc>
    
    <cc>benjamin</cc>
    
    <cc>cmarcelo</cc>
    
    <cc>hausmann</cc>
    
    <cc>kenneth</cc>
    
    <cc>kling</cc>
    
    <cc>paul.masurel</cc>
    
    <cc>robert</cc>
    
    <cc>skyul</cc>
    
    <cc>tonikitoo</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>160319</commentid>
    <comment_count>0</comment_count>
    <who name="Benjamin Poulain">benjamin</who>
    <bug_when>2009-11-03 22:24:51 -0800</bug_when>
    <thetext>There is no way to access text nodes children of QWebElement. This limit the use of the API. Here is an example

How do I get &quot;prefix&quot; and &quot;suffix&quot; with QWebElement in the following snippet:
&quot;&lt;div&gt;
  prefix
  &lt;img src=&quot;&quot;/&gt;
  suffix
&lt;/div&gt;&quot;


To solve this, we could introduce a new class to iterate over the content of the QWebElement (QWebElementIterator || QWebElementCusor).

E.g.:

QWebElementCursor cursor(element);
while (cursor.next()) {
    if (cursor.isText()) {
        cursor.setHtml(QString(&quot;&lt;p&gt;%1&lt;/p&gt;&quot;).arg(cursor.text()));
        //? int selectionOffset = cursor.textSelectionBeginning();
    } else if (cursor.isElement()) {
        QWebElement child = cursor.element();
        child.encloseWith(&quot;&lt;div&gt;&quot;);
    }
}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>161559</commentid>
    <comment_count>1</comment_count>
    <who name="Kenneth Rohde Christiansen">kenneth</who>
    <bug_when>2009-11-09 06:36:46 -0800</bug_when>
    <thetext>4.7 stuff definately. I have also had requests for iterating the text itself, and querying for size, position etc.

This is useful for ebook readers etc that want to split text blocks to fit as much contents on a page as possible, and put all overflow to the next page.

There are probably more usecases for this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>306370</commentid>
    <comment_count>2</comment_count>
    <who name="Antonio Gomes">tonikitoo</who>
    <bug_when>2010-11-08 14:23:07 -0800</bug_when>
    <thetext>Maybe it should be not blocking 2.1 API metabug(?)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>663046</commentid>
    <comment_count>3</comment_count>
    <who name="Paul Masurel">paul.masurel</who>
    <bug_when>2012-07-04 10:05:32 -0700</bug_when>
    <thetext>Meanwhile, has anyone found any workaround?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>663160</commentid>
    <comment_count>4</comment_count>
    <who name="Benjamin Poulain">benjamin</who>
    <bug_when>2012-07-04 14:04:25 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; Meanwhile, has anyone found any workaround?

I think this is pretty much dead after the switch of focus to WebKit2. I don&apos;t know what API will replace QWebElement (if any).

I think the only way to workaround this is to use JavaScript to modify the DOM.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>975095</commentid>
    <comment_count>5</comment_count>
    <who name="Jocelyn Turcotte">jturcotte</who>
    <bug_when>2014-02-03 03:15:53 -0800</bug_when>
    <thetext>=== Bulk closing of Qt bugs ===

If you believe that this bug report is still relevant for a non-Qt port of webkit.org, please re-open it and remove [Qt] from the summary.

If you believe that this is still an important QtWebKit bug, please fill a new report at https://bugreports.qt-project.org and add a link to this issue. See http://qt-project.org/wiki/ReportingBugsInQt for additional guidelines.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>