Changeset 46373 in webkit


Ignore:
Timestamp:
Jul 24, 2009 2:12:07 PM (15 years ago)
Author:
rniwa@webkit.org
Message:

WebCore:

2009-07-24 Ryosuke Niwa <rniwa@webkit.org>

Reviewed by Justin Garcia.

execCommand('underline') can modify DOM outside of the contentEditable area
https://bugs.webkit.org/show_bug.cgi?id=24333

highestAncestorWithTextDecoration stops at the closest unsplittable element so that if text-decoration is applied
outside of it, we don't accidently modify the style attribute.

Tests: editing/style/textdecoration-outside-of-rooteditable.html

editing/style/textdecoration-outside-of-unsplittable-element.html

  • editing/ApplyStyleCommand.cpp: (WebCore::StyleChange::init): (WebCore::highestAncestorWithTextDecoration):

LayoutTests:

2009-07-24 Ryosuke Niwa <rniwa@webkit.org>

Reviewed by Justin Garcia.

execCommand('underline') can modify DOM outside of the contentEditable area
https://bugs.webkit.org/show_bug.cgi?id=24333

Tests to make sure we are not removing underline applied outside of root editable node or unsplittable element.

  • editing/style/textdecoration-outside-of-rooteditable-expected.txt: Added.
  • editing/style/textdecoration-outside-of-rooteditable.html: Added.
  • editing/style/textdecoration-outside-of-unsplittable-element-expected.txt: Added.
  • editing/style/textdecoration-outside-of-unsplittable-element.html: Added.
Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r46372 r46373  
     12009-07-24  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Reviewed by Justin Garcia.
     4
     5        execCommand('underline') can modify DOM outside of the contentEditable area
     6        https://bugs.webkit.org/show_bug.cgi?id=24333
     7
     8        Tests to make sure we are not removing underline applied outside of root editable node or unsplittable element.
     9
     10        * editing/style/textdecoration-outside-of-rooteditable-expected.txt: Added.
     11        * editing/style/textdecoration-outside-of-rooteditable.html: Added.
     12        * editing/style/textdecoration-outside-of-unsplittable-element-expected.txt: Added.
     13        * editing/style/textdecoration-outside-of-unsplittable-element.html: Added.
     14
    1152009-07-24  Daniel Bates  <dbates@intudata.com>
    216
  • trunk/WebCore/ChangeLog

    r46372 r46373  
     12009-07-24  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Reviewed by Justin Garcia.
     4
     5        execCommand('underline') can modify DOM outside of the contentEditable area
     6        https://bugs.webkit.org/show_bug.cgi?id=24333
     7
     8        highestAncestorWithTextDecoration stops at the closest unsplittable element so that if text-decoration is applied
     9        outside of it, we don't accidently modify the style attribute.
     10
     11        Tests: editing/style/textdecoration-outside-of-rooteditable.html
     12               editing/style/textdecoration-outside-of-unsplittable-element.html
     13
     14        * editing/ApplyStyleCommand.cpp:
     15        (WebCore::StyleChange::init):
     16        (WebCore::highestAncestorWithTextDecoration):
     17
    1182009-07-24  Daniel Bates  <dbates@intudata.com>
    219
  • trunk/WebCore/editing/ApplyStyleCommand.cpp

    r46286 r46373  
    134134            CSSProperty alteredProperty(CSSPropertyTextDecoration, property->value(), property->isImportant());
    135135            // We don't add "text-decoration: none" because it doesn't override the existing text decorations; i.e. redundant
    136             if (alteredProperty.cssText() != "none")
     136            if (!equalIgnoringCase(alteredProperty.value()->cssText(), "none"))
    137137                styleText += alteredProperty.cssText();
    138138        } else
     
    10941094static Node* highestAncestorWithTextDecoration(Node *node)
    10951095{
    1096     Node *result = NULL;
     1096    ASSERT(node);
     1097    Node* result = 0;
     1098    Node* unsplittableElement = unsplittableElementForPosition(Position(node, 0));
    10971099
    10981100    for (Node *n = node; n; n = n->parentNode()) {
    10991101        if (hasTextDecorationProperty(n))
    11001102            result = n;
     1103        // Should stop at the editable root (cannot cross editing boundary) and
     1104        // also stop at the unsplittable element to be consistent with other UAs
     1105        if (n == unsplittableElement)
     1106            break;
    11011107    }
    11021108
Note: See TracChangeset for help on using the changeset viewer.