Changeset 153509 in webkit


Ignore:
Timestamp:
Jul 30, 2013 9:55:02 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Gmail reply email - Bold and Italic style get stuck
https://bugs.webkit.org/show_bug.cgi?id=118185

Patch by Vani Hegde <vani.hegde@samsung.com> on 2013-07-30
Reviewed by Ryosuke Niwa.

Source/WebCore:

When bold/italic style is applied to a content with mixed editability,
style is applied appropriately for the first time.
But after this, style toggling does not work any more. Same behavior
can be observed when the content on which style is applied contains
text node without renderer (Ex: text node corresponding to tab/space etc)

When bold/italic style is applied on a selection, we actually apply the
style only for text nodes that have renderers and also are contenteditable.
Similarly during style toggling, to check whether a style has been already
applied on a selection

Tests: editing/style/toggle-style-bold-italic-mixed-editability.html

editing/style/toggle-style-bold-italic.html

  • editing/EditingStyle.cpp:

(WebCore::EditingStyle::triStateOfStyle):
A particular selection on which style is applied may contain text nodes
without renderers(text nodes corresponding to tab/space) or text nodes
that are not contenteditable. We do not apply style to such text nodes.
Hence, even during style toggling we should not consider the styles
present in such nodes.

LayoutTests:

Layout tests added to test bold/italic style toggling on a content
with mixed editability.

  • editing/editing.js:

(runDumpAsTextEditingTest): Replaced markupResultList with
elementsForDumpingMarkupList to store all markup data to be logged
at the end of test.
(debugForDumpAsText): Changed to use elementsForDumpingMarkupList.
(startNewMarkupGroup): Added utility function to hold intermediate
data by separating <ol>.

  • editing/style/toggle-style-bold-italic-expected.txt: Added.
  • editing/style/toggle-style-bold-italic-mixed-editability-expected.txt: Added.
  • editing/style/toggle-style-bold-italic-mixed-editability.html: Added.
  • editing/style/toggle-style-bold-italic.html: Added.
Location:
trunk
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r153508 r153509  
     12013-07-30  Vani Hegde  <vani.hegde@samsung.com>
     2
     3        Gmail reply email - Bold and Italic style  get stuck
     4        https://bugs.webkit.org/show_bug.cgi?id=118185
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Layout tests added to test bold/italic style toggling on a content
     9        with mixed editability.
     10
     11        * editing/editing.js:
     12        (runDumpAsTextEditingTest): Replaced markupResultList with
     13        elementsForDumpingMarkupList to store all markup data to be logged
     14        at the end of test.
     15        (debugForDumpAsText): Changed to use elementsForDumpingMarkupList.
     16        (startNewMarkupGroup): Added utility function to hold intermediate
     17        data by separating <ol>.
     18        * editing/style/toggle-style-bold-italic-expected.txt: Added.
     19        * editing/style/toggle-style-bold-italic-mixed-editability-expected.txt: Added.
     20        * editing/style/toggle-style-bold-italic-mixed-editability.html: Added.
     21        * editing/style/toggle-style-bold-italic.html: Added.
     22
    1232013-07-30  Rob Buis  <rwlbuis@webkit.org>
    224
  • trunk/LayoutTests/editing/editing.js

    r137953 r153509  
    905905
    906906var dumpAsText = false;
    907 var markupResultList = document.createElement('ol');
     907var elementsForDumpingMarkupList = [document.createElement('ol')];
    908908
    909909function runDumpAsTextEditingTest(enableCallbacks) {
     
    921921    editingTest();
    922922
    923     document.body.appendChild(markupResultList);
     923    for (var i = 0; i < elementsForDumpingMarkupList.length; i++)
     924        document.body.appendChild(elementsForDumpingMarkupList[i]);
    924925}
    925926
     
    928929        var newItem = document.createElement('li');
    929930        newItem.appendChild(document.createTextNode(name+": "+document.getElementById("root").innerHTML));
    930         markupResultList.appendChild(newItem);
    931     }
     931        elementsForDumpingMarkupList[elementsForDumpingMarkupList.length - 1].appendChild(newItem);
     932    }
     933}
     934
     935function startNewMarkupGroup(label) {
     936    if (!elementsForDumpingMarkupList[elementsForDumpingMarkupList.length - 1].hasChildNodes())
     937        elementsForDumpingMarkupList.pop();
     938    elementsForDumpingMarkupList.push(document.createElement('br'));
     939    elementsForDumpingMarkupList.push(document.createTextNode(label));
     940    elementsForDumpingMarkupList.push(document.createElement('ol'));
    932941}
    933942
  • trunk/Source/WebCore/ChangeLog

    r153508 r153509  
     12013-07-30  Vani Hegde  <vani.hegde@samsung.com>
     2
     3        Gmail reply email - Bold and Italic style  get stuck
     4        https://bugs.webkit.org/show_bug.cgi?id=118185
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        When bold/italic style is applied to a content with mixed editability,
     9        style is applied appropriately for the first time.
     10        But after this, style toggling does not work any more. Same behavior
     11        can be observed when the content on which style is applied contains
     12        text node without renderer (Ex: text node corresponding to tab/space etc)
     13
     14        When bold/italic style is applied on a selection, we actually apply the
     15        style only for text nodes that have renderers and also are contenteditable.
     16        Similarly during style toggling, to check whether a style has been already
     17        applied on a selection
     18
     19        Tests: editing/style/toggle-style-bold-italic-mixed-editability.html
     20               editing/style/toggle-style-bold-italic.html
     21
     22        * editing/EditingStyle.cpp:
     23        (WebCore::EditingStyle::triStateOfStyle):
     24        A particular selection on which style is applied may contain text nodes
     25        without renderers(text nodes corresponding to tab/space) or text nodes
     26        that are not contenteditable. We do not apply style to such text nodes.
     27        Hence, even during style toggling we should not consider the styles
     28        present in such nodes.
     29
    1302013-07-30  Rob Buis  <rwlbuis@webkit.org>
    231
  • trunk/Source/WebCore/editing/EditingStyle.cpp

    r152286 r153509  
    684684
    685685    TriState state = FalseTriState;
     686    bool nodeIsStart = true;
    686687    for (Node* node = selection.start().deprecatedNode(); node; node = NodeTraversal::next(node)) {
    687         ComputedStyleExtractor computedStyle(node);
    688         TriState nodeState = triStateOfStyle(&computedStyle, node->isTextNode() ? EditingStyle::DoNotIgnoreTextOnlyProperties : EditingStyle::IgnoreTextOnlyProperties);
    689         if (node == selection.start().deprecatedNode())
    690             state = nodeState;
    691         else if (state != nodeState && node->isTextNode()) {
    692             state = MixedTriState;
    693             break;
     688        if (node->renderer() && node->rendererIsEditable()) {
     689            ComputedStyleExtractor computedStyle(node);
     690            TriState nodeState = triStateOfStyle(&computedStyle, node->isTextNode() ? EditingStyle::DoNotIgnoreTextOnlyProperties : EditingStyle::IgnoreTextOnlyProperties);
     691            if (nodeIsStart) {
     692                state = nodeState;
     693                nodeIsStart = false;
     694            } else if (state != nodeState && node->isTextNode()) {
     695                state = MixedTriState;
     696                break;
     697            }
    694698        }
     699
    695700        if (node == selection.end().deprecatedNode())
    696701            break;
Note: See TracChangeset for help on using the changeset viewer.