| Differences between
and this patch
- Source/WebCore/ChangeLog +18 lines
Lines 1-3 Source/WebCore/ChangeLog_sec1
1
2013-09-20  Ryosuke Niwa  <rniwa@webkit.org>
2
3
        renderStyleOfEnclosingTextNode should update style before using a renderer
4
        https://bugs.webkit.org/show_bug.cgi?id=121690
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Merge https://chromium.googlesource.com/chromium/blink/+/65f089545e8c18cb268dfcbe56cba1cd8045527a
9
10
        When accessing a renderer editing should always make sure that the style has been updated for the node.
11
        Editing calls splitTextNode in a number of places and then accesses the renderer later. This patch is
12
        the first of many to make sure editing always updates the style before attempting to access the renderer
13
        (or style) of a node after calling a mutation method.
14
15
        * editing/ApplyBlockElementCommand.cpp:
16
        (WebCore::ApplyBlockElementCommand::renderStyleOfEnclosingTextNode):
17
        * editing/ApplyBlockElementCommand.h:
18
1
2013-09-20  Sam White  <samuel_white@apple.com>
19
2013-09-20  Sam White  <samuel_white@apple.com>
2
20
3
        AX: WebArea claims to have a subrole, but always returns nil.
21
        AX: WebArea claims to have a subrole, but always returns nil.
- Source/WebCore/editing/ApplyBlockElementCommand.cpp -4 / +10 lines
Lines 169-182 static bool isNewLineAtPosition(const Po Source/WebCore/editing/ApplyBlockElementCommand.cpp_sec1
169
    return textAtPosition[0] == '\n';
169
    return textAtPosition[0] == '\n';
170
}
170
}
171
171
172
static RenderStyle* renderStyleOfEnclosingTextNode(const Position& position)
172
RenderStyle* ApplyBlockElementCommand::renderStyleOfEnclosingTextNode(const Position& position)
173
{
173
{
174
    if (position.anchorType() != Position::PositionIsOffsetInAnchor
174
    if (position.anchorType() != Position::PositionIsOffsetInAnchor
175
        || !position.containerNode()
175
        || !position.containerNode()
176
        || !position.containerNode()->isTextNode()
176
        || !position.containerNode()->isTextNode())
177
        || !position.containerNode()->renderer())
178
        return 0;
177
        return 0;
179
    return position.containerNode()->renderer()->style();
178
179
    document().updateStyleIfNeeded();
180
181
    RenderObject* renderer = position.containerNode()->renderer();
182
    if (!renderer)
183
        return 0;
184
185
    return renderer->style();
180
}
186
}
181
187
182
void ApplyBlockElementCommand::rangeForParagraphSplittingTextNodesIfNeeded(const VisiblePosition& endOfCurrentParagraph, Position& start, Position& end)
188
void ApplyBlockElementCommand::rangeForParagraphSplittingTextNodesIfNeeded(const VisiblePosition& endOfCurrentParagraph, Position& start, Position& end)
- Source/WebCore/editing/ApplyBlockElementCommand.h +1 lines
Lines 48-53 protected: Source/WebCore/editing/ApplyBlockElementCommand.h_sec1
48
private:
48
private:
49
    virtual void doApply();
49
    virtual void doApply();
50
    virtual void formatRange(const Position& start, const Position& end, const Position& endOfSelection, RefPtr<Element>&) = 0;
50
    virtual void formatRange(const Position& start, const Position& end, const Position& endOfSelection, RefPtr<Element>&) = 0;
51
    RenderStyle* renderStyleOfEnclosingTextNode(const Position&);
51
    void rangeForParagraphSplittingTextNodesIfNeeded(const VisiblePosition&, Position&, Position&);
52
    void rangeForParagraphSplittingTextNodesIfNeeded(const VisiblePosition&, Position&, Position&);
52
    VisiblePosition endOfNextParagrahSplittingTextNodesIfNeeded(VisiblePosition&, Position&, Position&);
53
    VisiblePosition endOfNextParagrahSplittingTextNodesIfNeeded(VisiblePosition&, Position&, Position&);
53
54

Return to Bug 121690