Commit c02e02c4 authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Make ElementInnerTextCollector::IsAfterWhiteSpace() to use IsInlineTextBox()

This patch changes  |ElementInnerTextCollector::IsAfterWhiteSpace()| to use
|IsInlineTextBox()| instead of |InlineBox::IsText()| to detect |InlineTextBox|
type properly.

Note: |InlineBox::IsText()| is used for handling <br> in quirk mode, and list
marker.

This patch is follow-up of the patch[1] to fix the bug found by Cluster Fuzz.

[1] http://crrev.com/c/1114673 Implement Element#innerText to conform the spec

Bug: 877498
Change-Id: I484a93afba351b74a8b3cae0c6736e3ccdfde45d
Reviewed-on: https://chromium-review.googlesource.com/1189242Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Reviewed-by: default avatarYoichi Osato <yoichio@chromium.org>
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#586222}
parent caf38a10
......@@ -357,6 +357,7 @@ jumbo_source_set("unit_tests") {
"editing_style_test.cc",
"editing_utilities_test.cc",
"editor_test.cc",
"element_inner_text_test.cc",
"ephemeral_range_test.cc",
"frame_caret_test.cc",
"frame_selection_test.cc",
......
......@@ -210,7 +210,7 @@ bool ElementInnerTextCollector::IsAfterWhiteSpace(
}
if (InlineTextBox* text_box = layout_text.FirstTextBox()) {
const InlineBox* previous = text_box->PrevLeafChild();
if (!previous || !previous->IsText())
if (!previous || !previous->IsInlineTextBox())
return false;
return EndsWithWhiteSpace(ToInlineTextBox(*previous));
}
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/editing/testing/editing_test_base.h"
namespace blink {
class ElementInnerTest : public EditingTestBase {};
// http://crbug.com/877498
TEST_F(ElementInnerTest, ListItemWithLeadingWhiteSpace) {
SetBodyContent("<li id=target> abc</li>");
Element& target = *GetDocument().getElementById("target");
EXPECT_EQ("abc", target.innerText());
}
} // namespace blink
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment