#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/core/layout/inline/inline_node.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/core/dom/dom_token_list.h"
#include "third_party/blink/renderer/core/dom/element_traversal.h"
#include "third_party/blink/renderer/core/dom/pseudo_element.h"
#include "third_party/blink/renderer/core/dom/text.h"
#include "third_party/blink/renderer/core/html_names.h"
#include "third_party/blink/renderer/core/layout/constraint_space.h"
#include "third_party/blink/renderer/core/layout/constraint_space_builder.h"
#include "third_party/blink/renderer/core/layout/inline/inline_child_layout_context.h"
#include "third_party/blink/renderer/core/layout/inline/inline_cursor.h"
#include "third_party/blink/renderer/core/layout/inline/inline_item_span.h"
#include "third_party/blink/renderer/core/layout/inline/inline_layout_algorithm.h"
#include "third_party/blink/renderer/core/layout/inline/physical_line_box_fragment.h"
#include "third_party/blink/renderer/core/layout/layout_block_flow.h"
#include "third_party/blink/renderer/core/layout/layout_result.h"
#include "third_party/blink/renderer/core/layout/layout_text_combine.h"
#include "third_party/blink/renderer/core/layout/physical_box_fragment.h"
#include "third_party/blink/renderer/core/layout/svg/layout_svg_text.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
#include "third_party/blink/renderer/core/svg_names.h"
#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"
#include "third_party/blink/renderer/core/testing/mock_hyphenation.h"
#include "third_party/blink/renderer/platform/fonts/shaping/shape_result_spacing.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
namespace blink {
#define SEGMENT_BREAK_TRANSFORMATION_FOR_EAST_ASIAN_WIDTH …
ElementsAre;
class InlineNodeForTest : public InlineNode { … };
class InlineNodeTest : public RenderingTest { … };
#define TEST_ITEM_TYPE_OFFSET(item, type, start, end) …
#define TEST_ITEM_TYPE_OFFSET_LEVEL(item, type, start, end, level) …
#define TEST_ITEM_OFFSET_DIR(item, start, end, direction) …
TEST_F(InlineNodeTest, CollectInlinesText) { … }
TEST_F(InlineNodeTest, CollectInlinesBR) { … }
TEST_F(InlineNodeTest, CollectInlinesFloat) { … }
TEST_F(InlineNodeTest, CollectInlinesInlineBlock) { … }
TEST_F(InlineNodeTest, CollectInlinesUTF16) { … }
TEST_F(InlineNodeTest, CollectInlinesMaybeRtl) { … }
TEST_F(InlineNodeTest, CollectInlinesRtl) { … }
TEST_F(InlineNodeTest, CollectInlinesRtlWithSpan) { … }
TEST_F(InlineNodeTest, CollectInlinesMixedText) { … }
TEST_F(InlineNodeTest, CollectInlinesMixedTextEndWithON) { … }
TEST_F(InlineNodeTest, CollectInlinesTextCombineBR) { … }
TEST_F(InlineNodeTest, CollectInlinesTextCombineListItemMarker) { … }
TEST_F(InlineNodeTest, CollectInlinesTextCombineNewline) { … }
TEST_F(InlineNodeTest, CollectInlinesTextCombineWBR) { … }
TEST_F(InlineNodeTest, SegmentASCII) { … }
TEST_F(InlineNodeTest, SegmentHebrew) { … }
TEST_F(InlineNodeTest, SegmentSplit1To2) { … }
TEST_F(InlineNodeTest, SegmentSplit3To4) { … }
TEST_F(InlineNodeTest, SegmentBidiOverride) { … }
static InlineNodeForTest CreateBidiIsolateNode(InlineNodeForTest node,
LayoutObject* layout_object) { … }
TEST_F(InlineNodeTest, SegmentBidiIsolate) { … }
struct MinMaxData { … } min_max_data[] = …;
std::ostream& operator<<(std::ostream& os, const MinMaxData& data) { … }
class MinMaxTest : public InlineNodeTest,
public testing::WithParamInterface<MinMaxData> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(MinMaxTest, Data) { … }
TEST_F(InlineNodeTest, MinMaxSizesSaturated) { … }
TEST_F(InlineNodeTest, MinMaxSizesNeedsLayout) { … }
TEST_F(InlineNodeTest, AssociatedItemsWithControlItem) { … }
TEST_F(InlineNodeTest, NeedsCollectInlinesOnSetText) { … }
TEST_F(InlineNodeTest, SetTextWithOffsetWithTextTransform) { … }
struct StyleChangeData { … } style_change_data[] = …;
std::ostream& operator<<(std::ostream& os, const StyleChangeData& data) { … }
class StyleChangeTest : public InlineNodeTest,
public testing::WithParamInterface<StyleChangeData> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(StyleChangeTest, NeedsCollectInlinesOnStyle) { … }
CreateNode;
static CreateNode node_creators[] = …* element = …* element = …;
class NodeInsertTest : public InlineNodeTest,
public testing::WithParamInterface<CreateNode> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(NodeInsertTest, NeedsCollectInlinesOnInsert) { … }
TEST_F(InlineNodeTest, NeedsCollectInlinesOnInsertToOutOfFlowButton) { … }
class NodeRemoveTest : public InlineNodeTest,
public testing::WithParamInterface<const char*> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(NodeRemoveTest, NeedsCollectInlinesOnRemove) { … }
TEST_F(InlineNodeTest, CollectInlinesShouldNotClearFirstInlineFragment) { … }
TEST_F(InlineNodeTest, SegmentBidiChangeSetsNeedsLayout) { … }
TEST_F(InlineNodeTest, InvalidateAddSpan) { … }
TEST_F(InlineNodeTest, InvalidateRemoveSpan) { … }
TEST_F(InlineNodeTest, InvalidateAddInnerSpan) { … }
TEST_F(InlineNodeTest, InvalidateRemoveInnerSpan) { … }
TEST_F(InlineNodeTest, InvalidateSetText) { … }
TEST_F(InlineNodeTest, InvalidateAddAbsolute) { … }
TEST_F(InlineNodeTest, InvalidateRemoveAbsolute) { … }
TEST_F(InlineNodeTest, InvalidateChangeToAbsolute) { … }
TEST_F(InlineNodeTest, InvalidateChangeFromAbsolute) { … }
TEST_F(InlineNodeTest, InvalidateAddFloat) { … }
TEST_F(InlineNodeTest, InvalidateRemoveFloat) { … }
TEST_F(InlineNodeTest, SpaceRestoredByInsertingWord) { … }
TEST_F(InlineNodeTest, RemoveInlineNodeDataIfBlockBecomesEmpty1) { … }
TEST_F(InlineNodeTest, RemoveInlineNodeDataIfBlockBecomesEmpty2) { … }
TEST_F(InlineNodeTest, RemoveInlineNodeDataIfBlockObtainsBlockChild) { … }
TEST_F(InlineNodeTest, ClearFirstInlineFragmentOnSplitFlow) { … }
TEST_F(InlineNodeTest, AddChildToSVGRoot) { … }
TEST_F(InlineNodeTest, PreservedNewlineWithBidiAndRelayout) { … }
TEST_F(InlineNodeTest, PreservedNewlineWithRemovedBidiAndRelayout) { … }
TEST_F(InlineNodeTest, PreservedNewlineWithRemovedLtrDirAndRelayout) { … }
TEST_F(InlineNodeTest, InsertedWBRWithLineBreakInRelayout) { … }
TEST_F(InlineNodeTest, CollapsibleSpaceFollowingBRWithNoWrapStyle) { … }
TEST_F(InlineNodeTest, CollapsibleSpaceFollowingNewlineWithPreStyle) { … }
#if SEGMENT_BREAK_TRANSFORMATION_FOR_EAST_ASIAN_WIDTH
TEST_F(InlineNodeTest, RemoveSegmentBreakFromJapaneseInRelayout) {
SetupHtml("container",
u"<div id=container>"
u"<span>\u30ED\u30B0\u30A4\u30F3</span>"
u"\n"
u"<span>\u767B\u9332</span>"
u"<br></div>");
EXPECT_EQ(String(u"\u30ED\u30B0\u30A4\u30F3\u767B\u9332\n"), GetText());
Node* new_text = Text::Create(GetDocument(), "foo");
GetElementById("container")->appendChild(new_text);
UpdateAllLifecyclePhasesForTest();
EXPECT_EQ(String(u"\u30ED\u30B0\u30A4\u30F3\u767B\u9332\nfoo"), GetText());
}
TEST_F(InlineNodeTest, RemoveSegmentBreakFromJapaneseInRelayout2) {
SetupHtml("container",
u"<div id=container>"
u"<span>\u30ED\u30B0\u30A4\u30F3</span>"
u"\n"
u"<span> \u767B\u9332</span>"
u"<br></div>");
EXPECT_EQ(String(u"\u30ED\u30B0\u30A4\u30F3\u767B\u9332\n"), GetText());
Node* new_text = Text::Create(GetDocument(), "foo");
GetElementById("container")->appendChild(new_text);
UpdateAllLifecyclePhasesForTest();
EXPECT_EQ(String(u"\u30ED\u30B0\u30A4\u30F3\u767B\u9332\nfoo"), GetText());
}
#endif
TEST_F(InlineNodeTest, SegmentRanges) { … }
TEST_F(InlineNodeTest, ReusingWithPreservedCase1) { … }
TEST_F(InlineNodeTest, ReusingWithPreservedCase2) { … }
TEST_F(InlineNodeTest, ReusingWithPreservedCase3) { … }
TEST_F(InlineNodeTest, ReusingWithCollapsed) { … }
TEST_F(InlineNodeTest, ReusingRTLAsLTR) { … }
TEST_F(InlineNodeTest, ReuseFirstNonSafe) { … }
TEST_F(InlineNodeTest, ReuseFirstNonSafeRtl) { … }
TEST_F(InlineNodeTest, ShouldNotResueLigature) { … }
TEST_F(InlineNodeTest, InitialLetter) { … }
TEST_F(InlineNodeTest, TextCombineUsesScalingX) { … }
TEST_F(InlineNodeTest, TextCombineWordSpacing) { … }
TEST_F(InlineNodeTest, FindSvgTextChunksCrash1) { … }
TEST_F(InlineNodeTest, FindSvgTextChunksCrash2) { … }
TEST_F(InlineNodeTest, FindSvgTextChunksCrash3) { … }
TEST_F(InlineNodeTest, ShapeCacheDisabled) { … }
TEST_F(InlineNodeTest, ShapeCacheLongString) { … }
TEST_F(InlineNodeTest, ShapeCacheMultiItems) { … }
TEST_F(InlineNodeTest, ShapeCacheSpacingRequired) { … }
}