Commit 95a91226 authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Commit Bot

TextIterator NG

This patch reimplements TextIteratorTextNodeHandler on top of the NG offset mapping
APIs to make TextIterator work with Layout NG.

Most critical changes are in TextIteratorTextNodeHandler.cpp, which gives a new and clean
implementation of the class. Other changes are rebaseline of layout tests and changes to
test expectations.

New failure due to LayoutText writeback:
- editing/text-iterator/findString-restarts-at-last-position.html
- editing/pasteboard/19644-1.html
- editing/pasteboard/19644-2.html
- virtual/layout_ng/fast/block/float/overhanging-float-crashes-when-sibling-becomes-formatting-context.html
- minimal repro: https://jsfiddle.net/767q3cbc/.
  There should be a trailing space in |container.innerText|, which is missing when LayoutNG
  is enabled

New failures due to lack of support for rect-related APIs:
- accessibility/selection-affinity.html
- fast/multicol/float-truncation.html
- fast/multicol/vertical-lr/float-truncation.html

Some new failures are due to irrelevant bugs in layout test framework.

Other tests are rebaselined.

Bug: 699017
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_layout_ng
Change-Id: I8670c1d879437a36788c6ff50d83c7609cf08e79
Reviewed-on: https://chromium-review.googlesource.com/580371Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#493273}
parent ac26b6ce
......@@ -4404,6 +4404,7 @@ crbug.com/591099 fast/block/float/float-forced-below-other-floats.html [ Crash F
crbug.com/591099 fast/block/float/float-in-float-hit-testing.html [ Failure ]
crbug.com/591099 fast/block/float/float-in-float-painting.html [ Failure ]
crbug.com/591099 fast/block/float/float-inserted-into-clean-line.html [ Failure ]
crbug.com/635619 fast/block/float/float-not-removed-from-first-letter.html [ Crash Failure ]
crbug.com/591099 fast/block/float/float-not-removed-from-next-sibling-crash.html [ Failure ]
crbug.com/591099 fast/block/float/float-not-removed-from-next-sibling5.html [ Crash Failure ]
crbug.com/591099 fast/block/float/float-on-empty-line.html [ Failure ]
......@@ -16888,6 +16889,7 @@ crbug.com/591099 virtual/layout_ng/fast/block/float/017.html [ Failure ]
crbug.com/591099 virtual/layout_ng/fast/block/float/assert-when-moving-float-2.html [ Failure Pass ]
crbug.com/591099 virtual/layout_ng/fast/block/float/assert-when-moving-float.html [ Failure ]
crbug.com/591099 virtual/layout_ng/fast/block/float/floats-offset-image-quirk-line-height.html [ Crash Failure ]
crbug.com/635619 virtual/layout_ng/fast/block/float/float-not-removed-from-first-letter.html [ Crash Failure ]
crbug.com/591099 virtual/layout_ng/fast/block/float/formatting-context-changes.html [ Crash Failure ]
crbug.com/591099 virtual/layout_ng/fast/block/float/overhanging-float-add-in-static-position-block.html [ Failure Pass ]
crbug.com/591099 virtual/layout_ng/fast/block/float/overhanging-float-add-in-static-position-block2.html [ Failure Pass ]
......@@ -17674,3 +17676,27 @@ crbug.com/591099 webmidi/requestmidiaccess.html [ Failure ]
crbug.com/591099 webmidi/send-messages.html [ Failure ]
crbug.com/591099 webmidi/send-system-messages.html [ Failure ]
crbug.com/591099 xmlviewer/extensions-api.html [ Failure ]
# Need support for getBoundingClientRect() with LayoutNG.
# TODO(xiaochengh): Investigate and file a new bug to replace 699017
crbug.com/699017 accessibility/selection-affinity.html [ Failure ]
crbug.com/699017 fast/multicol/float-truncation.html [ Failure ]
crbug.com/699017 fast/multicol/vertical-lr/float-truncation.html [ Failure ]
# We currently write back whitespace-collapsed strings to LayoutText, causing
# the following failures. Once we can paint inlines directly from fragment tree,
# we can stop the writeback.
crbug.com/714962 editing/pasteboard/19644-1.html [ Failure ]
crbug.com/714962 editing/pasteboard/19644-2.html [ Failure ]
crbug.com/714962 editing/text-iterator/findString-restarts-at-last-position.html [ Failure ]
# Flags enable-blink-features and additional-driver-flag=--enable-blink-features
# don't work together.
crbug.com/753141 virtual/mojo-loading/fast/table/convert-inline-anonoymous-wrapper-to-block.html [ Failure ]
crbug.com/753141 virtual/mojo-loading/http/tests/cache/cached-main-resource.html [ Failure ]
crbug.com/753141 virtual/mojo-loading/http/tests/cache/iframe-304-crash.html [ Failure ]
crbug.com/753141 virtual/mojo-loading/http/tests/loading/nested_bad_objects.php [ Failure ]
crbug.com/753141 virtual/mojo-loading/http/tests/loading/preload-picture-nested.html [ Failure ]
crbug.com/753141 virtual/mojo-loading/http/tests/loading/preload-picture-sizes-2x.html [ Failure ]
crbug.com/753141 virtual/mojo-loading/http/tests/loading/preload-picture-sizes.html [ Failure ]
crbug.com/753141 virtual/mojo-loading/http/tests/misc/recreate-location-after-detach.html [ Failure ]
......@@ -404,6 +404,11 @@ crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/min-width-a
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/replaced-intrinsic-001.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/replaced-intrinsic-002.xht [ Failure ]
# We currently write back whitespace-collapsed strings to LayoutText, causing
# the following failures. Once we can paint inlines directly from fragment tree,
# we can stop the writeback.
crbug.com/714962 virtual/layout_ng/fast/block/float/overhanging-float-crashes-when-sibling-becomes-formatting-context.html [ Failure ]
### virtual/layout_ng/external/wpt/css/CSS2/positioning
# tests absolute-replaced-width-036->071 would pass if reference page rendered correctly. It is an inline bug, not oof bug
crbug.com/740993 virtual/layout_ng/external/wpt/css/CSS2/positioning/absolute-replaced-width-036.xht [ Failure ]
......
PASS axButton1.x is 50
PASS axButton1.y is 50
PASS axButton1.width is 200
PASS axButton1.height is 100
PASS axContainer.x is 50
PASS axContainer.y is 200
PASS axContainer.width is 200
PASS axContainer.height is 100
PASS axButton2.x is 50
PASS axButton2.y is 200
PASS axButton2.width is 200
PASS axButton2.height is 100
PASS successfullyParsed is true
TEST COMPLETE
Image map - test 2 - 2 Links (alt tags)
----------------------
------------
AXRole: AXGenericContainer
------------
Link1
AXRole: AXLink
------------
Link2
AXRole: AXLink
{
"layers": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"contentsOpaque": true,
"drawsContent": true
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-simple'",
"position": [13, 8],
"bounds": [50, 50],
"contentsOpaque": true,
"drawsContent": true,
"backgroundColor": "#008000"
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-transparent-background'",
"position": [13, 73],
"bounds": [50, 50],
"drawsContent": true,
"backgroundColor": "#00FF0080"
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-padding'",
"position": [13, 138],
"bounds": [60, 60],
"drawsContent": true,
"backgroundColor": "#008000"
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-border'",
"position": [13, 203],
"bounds": [60, 60],
"drawsContent": true,
"backgroundColor": "#008000"
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-image'",
"position": [13, 268],
"bounds": [50, 50],
"drawsContent": true,
"backgroundColor": "#008000"
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-opaque'",
"position": [13, 333],
"bounds": [50, 50],
"contentsOpaque": true,
"drawsContent": true,
"backgroundColor": "#008000"
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-opaque-border'",
"position": [13, 398],
"bounds": [60, 60],
"drawsContent": true,
"backgroundColor": "#008000"
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-opaque-box-shadow'",
"position": [13, 463],
"bounds": [60, 60],
"drawsContent": true,
"backgroundColor": "#008000"
}
]
}
{
"layers": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"contentsOpaque": true,
"drawsContent": true
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-simple'",
"position": [13, 8],
"bounds": [50, 50],
"contentsOpaque": true,
"drawsContent": true,
"backgroundColor": "#008000"
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-padding'",
"position": [13, 73],
"bounds": [60, 60],
"drawsContent": true,
"backgroundColor": "#008000"
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-border'",
"position": [13, 138],
"bounds": [60, 60],
"drawsContent": true,
"backgroundColor": "#008000"
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-image'",
"position": [13, 203],
"bounds": [50, 50],
"drawsContent": true,
"backgroundColor": "#008000"
},
{
"name": "LayoutHTMLCanvas CANVAS id='canvas-transparent-background'",
"position": [13, 268],
"bounds": [50, 50],
"drawsContent": true,
"backgroundColor": "#00FF0080"
}
]
}
PASS successfullyParsed is true
TEST COMPLETE
Link 1
Target Link.
Link 2This test is successful if "Target Link" above is covered in a green rectangle with rounded corners.
PASS successfullyParsed is true
TEST COMPLETE
PASS pixel[0] is within 1 of 255
PASS pixel[1] is within 1 of 0
PASS pixel[2] is within 1 of 0
XYZSaft
crbug.com/517030: Ensure trailing float gets a layout. Passes if it does not assert
Tests that intrinsic width values on replaced element with fit-content container work.
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
Tests that intrinsic width values on blocks work.
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
PASS
Bug 64842: LayoutDeprecatedFlexibleBox does not call its children's layout method
This test passes if it does not CRASH.
Make sure the focus management API is available to XML documents.On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".PASS document.__proto__ is not HTMLDocument.prototype
PASS document.__proto__ is XMLDocument.prototype
PASS document.hasFocus() is true
PASS document.activeElement is document.body
PASS document.activeElement is testElement
PASS document.hasFocus() is true
PASS successfullyParsed is true
TEST COMPLETE
PASS successfullyParsed is true
TEST COMPLETE
PASS document.getElementById("canary").clientWidth is 75
PASS currentSrcFileName("canary") is "blue_rect.jpg?0"
PASS document.getElementById("simple").clientWidth is 800
PASS currentSrcFileName("simple") is "image-set-2x.png?2"
PASS document.getElementById("multiple").clientWidth is 800
PASS currentSrcFileName("multiple") is "image-set-2x.png?2"
PASS document.getElementById("other_children").clientWidth is 800
PASS currentSrcFileName("other_children") is "image-set-2x.png?2"
PASS document.getElementById("img_before_source").clientWidth is 75
PASS currentSrcFileName("img_before_source") is "blue_rect.jpg?1"
PASS document.getElementById("unknown_type").clientWidth is 1600
PASS currentSrcFileName("unknown_type") is "image-set-4x.png?3"
PASS document.getElementById("svg_type").clientWidth is 800
PASS currentSrcFileName("svg_type") is "image-set-2x.png?2"
PASS document.getElementById("empty_type").clientWidth is 800
PASS currentSrcFileName("empty_type") is "image-set-2x.png?2"
PASS document.getElementById("whitespace_type").clientWidth is 800
PASS currentSrcFileName("whitespace_type") is "image-set-2x.png?2"
PASS document.getElementById("parameter_type").clientWidth is 800
PASS currentSrcFileName("parameter_type") is "image-set-2x.png?2"
PASS document.getElementById("empty_srcset").clientWidth is 1600
PASS currentSrcFileName("empty_srcset") is "image-set-4x.png?3"
PASS document.getElementById("no_srcset").clientWidth is 1600
PASS currentSrcFileName("no_srcset") is "image-set-4x.png?3"
some text
PASS document.getElementById("canary").clientWidth is 75
PASS currentSrcFileName("canary") is "blue_rect.jpg?0"
PASS document.querySelector("#clone img").currentSrc.indexOf("image-set-2x") is not -1
PASS document.querySelector("#clone img").currentSrc.indexOf("blue_rect") is -1
PASS document.querySelector("#import img").currentSrc.indexOf("image-set-2x") is not -1
PASS document.querySelector("#import img").currentSrc.indexOf("blue_rect") is -1
PASS successfullyParsed is true
TEST COMPLETE
PASS successfullyParsed is true
TEST COMPLETE
PASS document.getElementById("canary").clientWidth is 75
PASS currentSrcFileName("canary") is "blue_rect.jpg?0"
PASS document.getElementById("div_end_picture").clientWidth is 800
PASS currentSrcFileName("div_end_picture") is "image-set-2x.png?2"
PASS document.getElementById("div_multiple_end").clientWidth is 800
PASS currentSrcFileName("div_multiple_end") is "image-set-2x.png?2"
PASS document.getElementById("source_in_div").clientWidth is 75
PASS currentSrcFileName("source_in_div") is "blue_rect.jpg"
PASS document.getElementById("not_in_picture").clientWidth is 75
PASS currentSrcFileName("not_in_picture") is "blue_rect.jpg"
PASS successfullyParsed is true
TEST COMPLETE
PASS document.getElementById("canary").clientWidth is 75
PASS currentSrcFileName("canary") is "blue_rect.jpg?0"
PASS document.getElementById("picture_in_picture").clientWidth is 800
PASS currentSrcFileName("picture_in_picture") is "image-set-2x.png?2"
PASS document.getElementById("picture_in_div_in_picture").clientWidth is 800
PASS currentSrcFileName("picture_in_div_in_picture") is "image-set-2x.png?2"
PASS document.getElementById("picture_in_div_with_source_above").clientWidth is 800
PASS currentSrcFileName("picture_in_div_with_source_above") is "image-set-2x.png?2"
PASS document.getElementById("picture_in_the_way").clientWidth is 800
PASS currentSrcFileName("picture_in_the_way") is "image-set-2x.png?2"
PASS document.getElementById("picture_in_picture_1").clientWidth is 800
PASS currentSrcFileName("picture_in_picture_1") is "image-set-2x.png?2"
PASS document.getElementById("picture_in_picture_2").clientWidth is 800
PASS currentSrcFileName("picture_in_picture_2") is "image-set-2x.png?2"
PASS document.getElementById("picture_at_end").clientWidth is 75
PASS currentSrcFileName("picture_at_end") is "blue_rect.jpg?52"
PASS document.getElementById("picture_no_source").clientWidth is 75
PASS currentSrcFileName("picture_no_source") is "blue_rect.jpg?6"
PASS document.getElementById("simple").clientWidth is 400
PASS currentSrcFileName("simple") is "image-set-1x.png?1"
PASS document.getElementById("simple").clientWidth is 1600
PASS currentSrcFileName("simple") is "image-set-4x.png"
PASS document.getElementById("simple").clientWidth is 75
PASS currentSrcFileName("simple") is "blue_rect.jpg?1"
PASS document.getElementById("simple").clientWidth is 400
PASS currentSrcFileName("simple") is "image-set-1x.png?2"
PASS currentSrcFileName("simple") is "image-set-1x.png?2"
PASS successfullyParsed is true
TEST COMPLETE
CONSOLE WARNING: <source src> with a <picture> parent is invalid and therefore ignored. Please use <source srcset> instead.
CONSOLE WARNING: <source src> with a <picture> parent is invalid and therefore ignored. Please use <source srcset> instead.
Dispaching a click event on #details-child
event.path on node #details-child
#details-child, #details, #sandbox, [object HTMLBodyElement], [object HTMLHtmlElement], [object HTMLDocument], [object Window], length: 7
event.path on node #details
#details-child, #details, #sandbox, [object HTMLBodyElement], [object HTMLHtmlElement], [object HTMLDocument], [object Window], length: 7
event.path on node #sandbox
#details-child, #details, #sandbox, [object HTMLBodyElement], [object HTMLHtmlElement], [object HTMLDocument], [object Window], length: 7
Dispaching a click event on #summary-child
event.path on node #summary-child
#summary-child, #summary, #details, #sandbox, [object HTMLBodyElement], [object HTMLHtmlElement], [object HTMLDocument], [object Window], length: 8
event.path on node #summary
#summary-child, #summary, #details, #sandbox, [object HTMLBodyElement], [object HTMLHtmlElement], [object HTMLDocument], [object Window], length: 8
event.path on node #details
#summary-child, #summary, #details, #sandbox, [object HTMLBodyElement], [object HTMLHtmlElement], [object HTMLDocument], [object Window], length: 8
event.path on node #sandbox
#summary-child, #summary, #details, #sandbox, [object HTMLBodyElement], [object HTMLHtmlElement], [object HTMLDocument], [object Window], length: 8
PASS successfullyParsed is true
TEST COMPLETE
Blocked access to external URL http://blocked/does-not-exist.html
Test passes if it does not crash.
PASS: windows-1252
This test baselines charset sniffer behavior where the opening bracket inside a tag is consumed as part of the tag data, causing the meta tag to be missed.
This tests that you can set selection in an textfield contained in an anchor element even though we try to prevent selection from starting within anchor elements.
PASS
crbug.com/604144: In an inline formatting context with a mix of top and bottom vertically aligned inline-blocks use the lowest.
PASS
crbug.com/482214: Don't crash when hit testing while moving across a broken image that contains an image map.
This test checks that <ruby> doesn't leave any pointer in the percentage height descendant when it splits a ruby run.
For this test to pass it should not crash or ASSERT!
DivInLinkA
DivInLinkB
PASS successfullyParsed is true
TEST COMPLETE
PASS gFocusedDocument.activeElement.getAttribute("id") is "e1"
This test is testing that we can navigate on links with divs inside.
test
H                               ow Now Brown Cow
Ho                                w Now Brown Cow
How                                 Now Brown Cow
How N                                ow Brown Cow
How No                                w Brown Cow
How Now                                 Brown Cow
How Now B                                rown Cow
How Now Br                                own Cow
How Now Bro                                wn Cow
How Now Brow                                n Cow
How Now Brown                                 Cow
How Now Brown C                                ow
How Now Brown Co                                w
How Now Brown Cow
test
PASS successfullyParsed is true
TEST COMPLETE
PASS gFocusedDocument.activeElement.getAttribute("id") is "1"
PASS gFocusedDocument.activeElement.getAttribute("id") is "2"
PASS gFocusedDocument.activeElement.getAttribute("id") is "4"
PASS gFocusedDocument.activeElement.getAttribute("id") is "3"
PASS gFocusedDocument.activeElement.getAttribute("id") is "5"
PASS gFocusedDocument.activeElement.getAttribute("id") is "6"
PASS gFocusedDocument.activeElement.getAttribute("id") is "8"
PASS gFocusedDocument.activeElement.getAttribute("id") is "7"
PASS gFocusedDocument.activeElement.getAttribute("id") is "9"
PASS gFocusedDocument.activeElement.getAttribute("id") is "10"
PASS gFocusedDocument.activeElement.getAttribute("id") is "12"
PASS gFocusedDocument.activeElement.getAttribute("id") is "11"
PASS gFocusedDocument.activeElement.getAttribute("id") is "13"
PASS gFocusedDocument.activeElement.getAttribute("id") is "14"
PASS gFocusedDocument.activeElement.getAttribute("id") is "16"
PASS gFocusedDocument.activeElement.getAttribute("id") is "15"
PASS gFocusedDocument.activeElement.getAttribute("id") is "17"
PASS gFocusedDocument.activeElement.getAttribute("id") is "18"
PASS gFocusedDocument.activeElement.getAttribute("id") is "20"
PASS gFocusedDocument.activeElement.getAttribute("id") is "19"
PASS gFocusedDocument.activeElement.getAttribute("id") is "21"
PASS gFocusedDocument.activeElement.getAttribute("id") is "22"
PASS gFocusedDocument.activeElement.getAttribute("id") is "24"
PASS gFocusedDocument.activeElement.getAttribute("id") is "23"
PASS gFocusedDocument.activeElement.getAttribute("id") is "25"
PASS gFocusedDocument.activeElement.getAttribute("id") is "26"
PASS gFocusedDocument.activeElement.getAttribute("id") is "27"
PASS gFocusedDocument.activeElement.getAttribute("id") is "end"
PASS successfullyParsed is true
TEST COMPLETE
PASS gFocusedDocument.activeElement.getAttribute("id") is "1"
PASS gFocusedDocument.activeElement.getAttribute("id") is "3"
PASS gFocusedDocument.activeElement.getAttribute("id") is "1"
PASS gFocusedDocument.activeElement.getAttribute("id") is "start"
This test tests that areas of an imagemap without an href are not focusable, thus can not be reached with spatial navigation.
PASS successfullyParsed is true
TEST COMPLETE
PASS gFocusedDocument.activeElement.getAttribute("id") is "3"
PASS gFocusedDocument.activeElement.getAttribute("id") is "start"
This test tests that areas of an imagemap without an image using it, are not focusable, thus can not be reached with spatial navigation.
PASS successfullyParsed is true
TEST COMPLETE
PASS gFocusedDocument.activeElement.getAttribute("id") is "4"
PASS gFocusedDocument.activeElement.getAttribute("id") is "1"
PASS gFocusedDocument.activeElement.getAttribute("id") is "2"
PASS gFocusedDocument.activeElement.getAttribute("id") is "5"
PASS gFocusedDocument.activeElement.getAttribute("id") is "4"
PASS gFocusedDocument.activeElement.getAttribute("id") is "3"
PASS gFocusedDocument.activeElement.getAttribute("id") is "2"
PASS gFocusedDocument.activeElement.getAttribute("id") is "1"
PASS gFocusedDocument.activeElement.getAttribute("id") is "3"
PASS gFocusedDocument.activeElement.getAttribute("id") is "2"
PASS gFocusedDocument.activeElement.getAttribute("id") is "1"
PASS gFocusedDocument.activeElement.getAttribute("id") is "start"
This test tests that areas of an imagemap can be reached with spatial navigation even if they are overlapped.
PASS successfullyParsed is true
TEST COMPLETE
PASS gFocusedDocument.activeElement.getAttribute("id") is "1"
PASS gFocusedDocument.activeElement.getAttribute("id") is "3"
PASS gFocusedDocument.activeElement.getAttribute("id") is "5"
PASS gFocusedDocument.activeElement.getAttribute("id") is "3"
PASS gFocusedDocument.activeElement.getAttribute("id") is "4"
PASS gFocusedDocument.activeElement.getAttribute("id") is "6"
PASS gFocusedDocument.activeElement.getAttribute("id") is "4"
PASS gFocusedDocument.activeElement.getAttribute("id") is "2"
PASS gFocusedDocument.activeElement.getAttribute("id") is "1"
PASS gFocusedDocument.activeElement.getAttribute("id") is "start"
This test tests that areas of an imagemap can be reached with spatial navigation.
test1 test2
PASS successfullyParsed is true
TEST COMPLETE
PASS gFocusedDocument.activeElement.getAttribute("id") is "end"
PASS
crbug.com/372832: The div should be inserted before the anonymous table wrapper surrounding the table-row and the anonymous table wrapper should be in the last anonymous block, not the middle one.
Querying in the following...
<div xmlns="http://www.w3.org/1999/xhtml" id="test">
<span id="A"></span>
<div>
<span id="B">
<span id="C"></span>
</span>
</div>
<span id="D"></span>
</div>
Query "preceding::xhtml:span" from span#D
Result: span#A span#B span#C
Expected: span#A span#B span#C
***SUCCESS***
Querying in the following...
<div xmlns="http://www.w3.org/1999/xhtml" id="test">
<span id="A">
<span id="B"></span>
</span>
<span id="C">
<span id="D"></span>
</span>
</div>
Query "ancestor::xhtml:span" from span#B
Result: span#A
Expected: span#A
SUCCESS
Query ".|ancestor::xhtml:span" from span#B
Result: span#A span#B
Expected: span#A span#B
SUCCESS
Query "ancestor::xhtml:span|." from span#B
Result: span#A span#B
Expected: span#A span#B
SUCCESS
Query "ancestor::xhtml:*[local-name()='span']" from span#B
Result: span#A
Expected: span#A
SUCCESS
Query ".|ancestor::xhtml:*[local-name()='span']" from span#B
Result: span#A span#B
Expected: span#A span#B
SUCCESS
Query "ancestor::xhtml:*[local-name()='span']|." from span#B
Result: span#A span#B
Expected: span#A span#B
SUCCESS
Query "(ancestor::xhtml:*[local-name()='span'])|." from span#B
Result: span#A span#B
Expected: span#A span#B
SUCCESS
Query "following::xhtml:*[local-name()='span']" from span#B
Result: span#C span#D
Expected: span#C span#D
SUCCESS
Query ".|following::xhtml:*[local-name()='span']" from span#B
Result: span#B span#C span#D
Expected: span#B span#C span#D
SUCCESS
Query "following::xhtml:*[local-name()='span']|." from span#B
Result: span#B span#C span#D
Expected: span#B span#C span#D
SUCCESS
http://127.0.0.1:8000/cache/resources/iframe304.php - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/cache/resources/iframe304.php, main document URL http://127.0.0.1:8000/cache/iframe-304-crash.html, http method GET>
http://127.0.0.1:8000/cache/resources/iframe304.php - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/cache/resources/iframe304.php, http status code 200>
http://127.0.0.1:8000/cache/resources/iframe304.php - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/cache/resources/iframe304.php, main document URL http://127.0.0.1:8000/cache/iframe-304-crash.html, http method GET>
http://127.0.0.1:8000/cache/resources/iframe304.php - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/cache/resources/iframe304.php, http status code 200>
main frame - didStartProvisionalLoadForFrame
main frame - didCommitLoadForFrame
main frame - didFinishDocumentLoadForFrame
main frame - didHandleOnloadEventsForFrame
main frame - didFinishLoadForFrame
PASS - nested image objects with bad mimetype do not cause a crash.
main frame - didStartProvisionalLoadForFrame
main frame - didCommitLoadForFrame
main frame - didFinishDocumentLoadForFrame
main frame - didHandleOnloadEventsForFrame
main frame - didFinishLoadForFrame
PASS internals.isPreloaded('resources/preload-test.jpg?0'); is true
PASS internals.isPreloaded('resources/image2.png'); is true
PASS internals.isPreloaded('resources/preload-test.jpg?1'); is false
PASS internals.isPreloaded('resources/base-image1.png?1'); is false
PASS internals.isPreloaded('resources/base-image2.png?1'); is false
PASS internals.isPreloaded('resources/base-image3.png?1'); is true
PASS internals.isPreloaded('resources/preload-test.jpg?2'); is false
PASS internals.isPreloaded('resources/base-image1.png?2'); is false
PASS internals.isPreloaded('resources/base-image2.png?2'); is false
PASS internals.isPreloaded('resources/base-image3.png?2'); is true
PASS internals.isPreloaded('resources/preload-test.jpg?3'); is true
PASS internals.isPreloaded('resources/base-image1.png?3'); is false
PASS internals.isPreloaded('resources/base-image2.png?3'); is false
PASS internals.isPreloaded('resources/base-image3.png?3'); is false
PASS internals.isPreloaded('resources/preload-test.jpg?4'); is false
PASS internals.isPreloaded('resources/base-image1.png?4'); is false
PASS internals.isPreloaded('resources/base-image2.png?4'); is false
PASS internals.isPreloaded('resources/base-image3.png?4'); is true
PASS internals.isPreloaded('resources/preload-test.jpg?5'); is true
PASS internals.isPreloaded('resources/base-image1.png?5'); is false
PASS internals.isPreloaded('resources/base-image2.png?5'); is false
PASS internals.isPreloaded('resources/base-image3.png?5'); is false
PASS internals.isPreloaded('resources/preload-test.jpg?6'); is false
PASS internals.isPreloaded('resources/base-image1.png?6'); is false
PASS internals.isPreloaded('resources/base-image2.png?6'); is false
PASS internals.isPreloaded('resources/base-image3.png?6'); is true
PASS internals.isPreloaded('resources/preload-test.jpg?7'); is false
PASS internals.isPreloaded('resources/base-image1.png?7'); is false
PASS internals.isPreloaded('resources/base-image2.png?7'); is false
PASS internals.isPreloaded('resources/base-image3.png?7'); is true
PASS internals.isPreloaded('resources/preload-test.jpg?71'); is false
PASS internals.isPreloaded('resources/preload-test.jpg?72'); is true
PASS internals.isPreloaded('resources/preload-test.jpg?8'); is true
PASS successfullyParsed is true
TEST COMPLETE
main frame - didStartProvisionalLoadForFrame
main frame - didCommitLoadForFrame
CONSOLE WARNING: <source src> with a <picture> parent is invalid and therefore ignored. Please use <source srcset> instead.
main frame - didFinishDocumentLoadForFrame
main frame - didHandleOnloadEventsForFrame
main frame - didFinishLoadForFrame
main frame - didStartProvisionalLoadForFrame
main frame - didCommitLoadForFrame
CONSOLE WARNING: <source src> with a <picture> parent is invalid and therefore ignored. Please use <source srcset> instead.
main frame - didFinishDocumentLoadForFrame
main frame - didHandleOnloadEventsForFrame
main frame - didFinishLoadForFrame
PASS internals.isPreloaded('resources/image2.png'); is true
PASS internals.isPreloaded('resources/preload-test.jpg?1'); is false
PASS internals.isPreloaded('resources/base-image1.png?1'); is false
PASS internals.isPreloaded('resources/base-image2.png?1'); is true
PASS internals.isPreloaded('resources/base-image3.png?1'); is false
PASS internals.isPreloaded('resources/preload-test.jpg?2'); is false
PASS internals.isPreloaded('resources/base-image1.png?2'); is false
PASS internals.isPreloaded('resources/base-image2.png?2'); is true
PASS internals.isPreloaded('resources/base-image3.png?2'); is false
PASS internals.isPreloaded('resources/preload-test.jpg?3'); is false
PASS internals.isPreloaded('resources/base-image1.png?3'); is false
PASS internals.isPreloaded('resources/base-image2.png?3'); is true
PASS internals.isPreloaded('resources/base-image3.png?3'); is false
PASS internals.isPreloaded('resources/preload-test.jpg?4'); is false
PASS internals.isPreloaded('resources/base-image1.png?4'); is false
PASS internals.isPreloaded('resources/base-image2.png?4'); is true
PASS internals.isPreloaded('resources/base-image3.png?4'); is false
PASS internals.isPreloaded('resources/preload-test.jpg?5'); is false
PASS internals.isPreloaded('resources/base-image1.png?5'); is false
PASS internals.isPreloaded('resources/base-image2.png?5'); is true
PASS internals.isPreloaded('resources/base-image3.png?5'); is false
PASS internals.isPreloaded('resources/preload-test.jpg?6'); is false
PASS internals.isPreloaded('resources/base-image1.png?6'); is false
PASS internals.isPreloaded('resources/base-image2.png?6'); is true
PASS internals.isPreloaded('resources/base-image3.png?6'); is false
PASS internals.isPreloaded('resources/preload-test.jpg?7'); is false
PASS internals.isPreloaded('resources/base-image1.png?7'); is false
PASS internals.isPreloaded('resources/base-image2.png?7'); is true
PASS internals.isPreloaded('resources/base-image3.png?7'); is false
PASS internals.isPreloaded('resources/preload-test.jpg?8'); is false
PASS internals.isPreloaded('resources/base-image1.png?8'); is false
PASS internals.isPreloaded('resources/base-image2.png?8'); is true
PASS internals.isPreloaded('resources/base-image3.png?8'); is false
PASS internals.isPreloaded('resources/preload-test.jpg?9'); is false
PASS internals.isPreloaded('resources/base-image1.png?9'); is false
PASS internals.isPreloaded('resources/base-image2.png?9'); is true
PASS internals.isPreloaded('resources/base-image3.png?9'); is false
PASS internals.isPreloaded('resources/dup-image1.png?7'); is false
PASS internals.isPreloaded('resources/dup-image1.png?8'); is false
PASS internals.isPreloaded('resources/dup-image2.png?8'); is false
PASS internals.isPreloaded('resources/dup-image3.png?8'); is false
PASS internals.isPreloaded('resources/preload-test.jpg?10'); is false
PASS internals.isPreloaded('resources/base-image1.png?10'); is true
PASS internals.isPreloaded('resources/base-image2.png?10'); is false
PASS internals.isPreloaded('resources/base-image3.png?10'); is false
PASS successfullyParsed is true
TEST COMPLETE
main frame - didStartProvisionalLoadForFrame
main frame - didCommitLoadForFrame
CONSOLE WARNING: <source src> with a <picture> parent is invalid and therefore ignored. Please use <source srcset> instead.
main frame - didFinishDocumentLoadForFrame
main frame - didHandleOnloadEventsForFrame
main frame - didFinishLoadForFrame
PASS internals.isPreloaded('resources/image2.png'); is true
PASS internals.isPreloaded('resources/preload-test.jpg?1'); is false
PASS internals.isPreloaded('resources/base-image1.png?1'); is false
PASS internals.isPreloaded('resources/base-image2.png?1'); is false
PASS internals.isPreloaded('resources/base-image3.png?1'); is true
PASS internals.isPreloaded('resources/preload-test.jpg?2'); is false
PASS internals.isPreloaded('resources/base-image1.png?2'); is false
PASS internals.isPreloaded('resources/base-image2.png?2'); is false
PASS internals.isPreloaded('resources/base-image3.png?2'); is true
PASS internals.isPreloaded('resources/preload-test.jpg?3'); is false
PASS internals.isPreloaded('resources/base-image1.png?3'); is false
PASS internals.isPreloaded('resources/base-image2.png?3'); is false
PASS internals.isPreloaded('resources/base-image3.png?3'); is true
PASS internals.isPreloaded('resources/preload-test.jpg?4'); is false
PASS internals.isPreloaded('resources/base-image1.png?4'); is false
PASS internals.isPreloaded('resources/base-image2.png?4'); is false
PASS internals.isPreloaded('resources/base-image3.png?4'); is true
PASS internals.isPreloaded('resources/preload-test.jpg?5'); is false
PASS internals.isPreloaded('resources/base-image1.png?5'); is false
PASS internals.isPreloaded('resources/base-image2.png?5'); is false
PASS internals.isPreloaded('resources/base-image3.png?5'); is true
PASS internals.isPreloaded('resources/preload-test.jpg?6'); is false
PASS internals.isPreloaded('resources/base-image1.png?6'); is false
PASS internals.isPreloaded('resources/base-image2.png?6'); is false
PASS internals.isPreloaded('resources/base-image3.png?6'); is true
PASS internals.isPreloaded('resources/preload-test.jpg?7'); is false
PASS internals.isPreloaded('resources/base-image1.png?7'); is false
PASS internals.isPreloaded('resources/base-image2.png?7'); is false
PASS internals.isPreloaded('resources/base-image3.png?7'); is true
PASS internals.isPreloaded('resources/preload-test.jpg?8'); is false
PASS internals.isPreloaded('resources/base-image1.png?8'); is false
PASS internals.isPreloaded('resources/base-image2.png?8'); is false
PASS internals.isPreloaded('resources/base-image3.png?8'); is true
PASS internals.isPreloaded('resources/preload-test.jpg?9'); is false
PASS internals.isPreloaded('resources/base-image1.png?9'); is false
PASS internals.isPreloaded('resources/base-image2.png?9'); is false
PASS internals.isPreloaded('resources/base-image3.png?9'); is true
PASS internals.isPreloaded('resources/preload-test.jpg?10'); is false
PASS internals.isPreloaded('resources/base-image1.png?10'); is false
PASS internals.isPreloaded('resources/base-image2.png?10'); is false
PASS internals.isPreloaded('resources/base-image3.png?10'); is true
PASS internals.isPreloaded('resources/dup-image1.png?7'); is false
PASS internals.isPreloaded('resources/dup-image1.png?8'); is false
PASS internals.isPreloaded('resources/dup-image2.png?8'); is false
PASS internals.isPreloaded('resources/dup-image3.png?8'); is false
PASS internals.isPreloaded('resources/base-image1.png?101'); is false
PASS internals.isPreloaded('resources/base-image2.png?101'); is false
PASS internals.isPreloaded('resources/base-image3.png?101'); is false
PASS internals.isPreloaded('resources/preload-test.jpg?10'); is false
PASS internals.isPreloaded('resources/preload-test.jpg?11'); is true
PASS internals.isPreloaded('resources/base-image1.png?11'); is false
PASS internals.isPreloaded('resources/base-image2.png?11'); is false
PASS internals.isPreloaded('resources/base-image3.png?11'); is false
PASS successfullyParsed is true
TEST COMPLETE
Color Actual Expected dE
--------------------------------------------
Dark Skin 114,80,64 115,80,64 1
Light Skin 195,150,130 195,151,130 1
Blue Sky 94,123,156 94,123,156 0
Foliage 88,108,65 88,108,65 0
Blue Flower 130,129,177 130,129,177 0
Bluish Green 100,190,171 100,190,171 0
--------------------------------------------
Orange 217,121,37 217,122,37 1
Purplish Blue 72,90,166 72,91,165 1
Moderate Red 194,84,97 194,84,98 1
Purple 90,60,106 91,59,107 2
Yellow Green 160,188,60 160,188,60 0
Orange Yellow 231,163,42 230,163,42 1
--------------------------------------------
Blue 47,60,153 46,60,153 1
Green 70,149,69 71,150,69 1
Red 177,45,56 177,44,56 1
Yellow 239,200,27 238,200,27 1
Magenta 187,82,147 187,82,148 1
Cyan (*) 0,135,166 0,135,166 0
--------------------------------------------
White 243,242,236 243,242,237 1
Neutral 8 202,202,200 201,201,201 2
Neutral 6.5 160,161,160 161,161,161 1
Neutral 5 123,121,120 122,122,121 2
Neutral 3.5 83,83,83 83,83,83 0
Black 50,50,50 50,49,50 1
--------------------------------------------
Result: total RMS color error: 1.04
* Munsell Cyan is outside 255 sRGB gamut
Color Actual Expected dE
--------------------------------------------
Dark Skin 115,80,64 115,80,64 0
Light Skin 195,151,130 195,151,130 0
Blue Sky 94,123,156 94,123,156 0
Foliage 88,108,65 88,108,65 0
Blue Flower 130,129,177 130,129,177 0
Bluish Green 100,190,171 100,190,171 0
--------------------------------------------
Orange 217,122,37 217,122,37 0
Purplish Blue 72,91,165 72,91,165 0
Moderate Red 194,84,98 194,84,98 0
Purple 91,59,107 91,59,107 0
Yellow Green 160,188,60 160,188,60 0
Orange Yellow 230,163,42 230,163,42 0
--------------------------------------------
Blue 46,60,153 46,60,153 0
Green 71,150,69 71,150,69 0
Red 177,44,56 177,44,56 0
Yellow 238,200,27 238,200,27 0
Magenta 187,82,148 187,82,148 0
Cyan (*) 0,135,166 0,135,166 0
--------------------------------------------
White 243,242,237 243,242,237 0
Neutral 8 201,201,201 201,201,201 0
Neutral 6.5 161,161,161 161,161,161 0
Neutral 5 122,122,121 122,122,121 0
Neutral 3.5 83,83,83 83,83,83 0
Black 50,49,50 50,49,50 0
--------------------------------------------
Result: total RMS color error: 0.00
* Munsell Cyan is outside 255 sRGB gamut
This tests that pressing Tab focuses areas in an image map even if they're not direct children.
Test Passed
== Matched rules before @import added ==
[expanded]
element.style { ()
[expanded]
span { (add-import-rule.html:4 -> add-import-rule.html:4:14)
color: red;
== Matched rules after @import added ==
[expanded]
element.style { ()
[expanded]
span { (data:text/css,s…color:green}:1 -> data:text/css,span{color:green}:1:6)
color: green;
Sticky position constraint
Model elements dump
{
_containingBlockRect : {
height : 400
width : 100
x : 0
y : 0
}
_nearestLayerShiftingContainingBlock : null
_nearestLayerShiftingStickyBox : null
_stickyBoxRect : {
height : 50
width : 50
x : 0
y : 0
}
}
{
_containingBlockRect : {
height : 50
width : 50
x : 0
y : 0
}
_nearestLayerShiftingContainingBlock : <object>
_nearestLayerShiftingStickyBox : null
_stickyBoxRect : {
height : 25
width : 25
x : 0
y : 0
}
}
{
_containingBlockRect : {
height : 350
width : 100
x : 0
y : 0
}
_nearestLayerShiftingContainingBlock : null
_nearestLayerShiftingStickyBox : null
_stickyBoxRect : {
height : 0
width : 0
x : 0
y : 0
}
}
{
_containingBlockRect : {
height : 350
width : 100
x : 0
y : 0
}
_nearestLayerShiftingContainingBlock : null
_nearestLayerShiftingStickyBox : <object>
_stickyBoxRect : {
height : 0
width : 0
x : 0
y : 0
}
}
PASS successfullyParsed is true
TEST COMPLETE
Snapshot width: 800 height: 600
Test 0: canvas should be green
PASS pixel[0] is within 1 of 0
PASS pixel[1] is within 1 of 255
PASS pixel[2] is within 1 of 0
Snapshot width: 800 height: 600
Test 1: canvas should be red
PASS pixel[0] is within 1 of 255
PASS pixel[1] is within 1 of 0
PASS pixel[2] is within 1 of 0
Snapshot width: 800 height: 600
Test 2: canvas should be blue
PASS pixel[0] is within 1 of 0
PASS pixel[1] is within 1 of 0
PASS pixel[2] is within 1 of 255
PASS successfullyParsed is true
TEST COMPLETE
Snapshot width: 800 height: 600
Test 0: canvas should be green
PASS pixel[0] is within 1 of 0
PASS pixel[1] is within 1 of 255
PASS pixel[2] is within 1 of 0
Snapshot width: 800 height: 600
Test 1: canvas should be red
PASS pixel[0] is within 1 of 255
PASS pixel[1] is within 1 of 0
PASS pixel[2] is within 1 of 0
Snapshot width: 800 height: 600
Test 2: canvas should be blue
PASS pixel[0] is within 1 of 0
PASS pixel[1] is within 1 of 0
PASS pixel[2] is within 1 of 255
Tree Walker:
A
A.1
A.2
A.3
B
B.1
B.1.1
C
C.1
C.1.1
C.1.1.1
C.1.1.2
C.1.1.3
C.1.2
C.2.1
D
PASS rect.width.animVal.value is 100
PASS rect.height.animVal.value is 200
PASS rect["transform"].animVal.numberOfItems is 1
PASS rect["transform"].animVal.getItem(0).angle is 300
XYZSaft
crbug.com/517030: Ensure trailing float gets a layout. Passes if it does not assert
......@@ -10,15 +10,69 @@
#include "core/layout/LayoutTextFragment.h"
#include "core/layout/line/InlineTextBox.h"
#include "core/layout/line/RootInlineBox.h"
#include "core/layout/ng/inline/ng_inline_node.h"
#include "core/layout/ng/inline/ng_offset_mapping_result.h"
// TODO(layout-dev): Try not to include them. They are not needed by this file,
// but are only included from ng_inline_node.h as partial classes.
// However, Windows debug compiler requires complete classes to compile.
#include "core/layout/ng/ng_layout_result.h"
#include "core/layout/ng/ng_unpositioned_float.h"
namespace blink {
namespace {
// A magic value for infinity, used to indicate that text emission should
// proceed till the end of the text node. Can be removed when we can handle text
// length differences due to text-transform correctly.
const unsigned kMaxOffset = std::numeric_limits<unsigned>::max();
bool ShouldSkipInvisibleTextAt(const Text& text,
unsigned offset,
bool ignores_visibility) {
// TODO(xiaochengh): Get style from NGInlineItem or NGPhysicalTextFragment.
const LayoutObject* layout_object = AssociatedLayoutObjectOf(text, offset);
if (!layout_object)
return true;
if (layout_object->Style()->Display() == EDisplay::kNone)
return true;
if (ignores_visibility)
return false;
return layout_object->Style()->Visibility() != EVisibility::kVisible;
}
std::pair<String, std::pair<unsigned, unsigned>>
ComputeTextAndOffsetsForEmission(const NGInlineNode& inline_node,
const NGOffsetMappingUnit& unit,
unsigned run_start,
unsigned run_end,
const TextIteratorBehavior& behavior) {
// TODO(xiaochengh): Handle EmitsOriginalText.
unsigned text_content_start = unit.ConvertDOMOffsetToTextContent(run_start);
unsigned text_content_end = unit.ConvertDOMOffsetToTextContent(run_end);
if (behavior.EmitsSpaceForNbsp()) {
String string = inline_node.Text(text_content_start, text_content_end)
.ToString()
.Replace(kNoBreakSpaceCharacter, kSpaceCharacter);
return {string, {0u, 0u}};
}
return {inline_node.Text(), {text_content_start, text_content_end}};
}
} // namespace
TextIteratorTextNodeHandler::TextIteratorTextNodeHandler(
const TextIteratorBehavior& behavior,
TextIteratorTextState* text_state)
: behavior_(behavior), text_state_(*text_state) {}
bool TextIteratorTextNodeHandler::HandleRemainingTextRuns() {
if (uses_layout_ng_) {
HandleTextNodeWithLayoutNG();
return text_state_.PositionNode();
}
if (ShouldProceedToRemainingText())
ProceedToRemainingText();
// Handle remembered text box
......@@ -33,6 +87,50 @@ bool TextIteratorTextNodeHandler::HandleRemainingTextRuns() {
return text_state_.PositionNode();
}
void TextIteratorTextNodeHandler::HandleTextNodeWithLayoutNG() {
DCHECK_LE(offset_, end_offset_);
DCHECK_LE(end_offset_, text_node_->data().length());
if (ShouldSkipInvisibleTextAt(*text_node_, offset_,
IgnoresStyleVisibility())) {
offset_ = end_offset_;
return;
}
while (offset_ < end_offset_ && !text_state_.PositionNode()) {
// TODO(xiaochengh): Try fetch the next offset mapping unit instead of doing
// another binary search.
Optional<NGInlineNode> inline_node =
GetNGInlineNodeFor(*text_node_, offset_);
const NGOffsetMappingUnit* unit =
inline_node
? inline_node->GetMappingUnitForDOMOffset(*text_node_, offset_)
: nullptr;
// No more text on this node to emit.
if (!unit || offset_ == unit->DOMEnd()) {
offset_ = end_offset_;
return;
}
const unsigned run_end = std::min(end_offset_, unit->DOMEnd());
if (unit->TextContentStart() == unit->TextContentEnd()) {
offset_ = run_end;
continue;
}
auto string_and_offsets = ComputeTextAndOffsetsForEmission(
*inline_node, *unit, offset_, run_end, behavior_);
const String& string = string_and_offsets.first;
const unsigned text_content_start = string_and_offsets.second.first;
const unsigned text_content_end = string_and_offsets.second.second;
text_state_.EmitText(text_node_, offset_, run_end, string,
text_content_start, text_content_end);
offset_ = run_end;
return;
}
}
bool TextIteratorTextNodeHandler::ShouldHandleFirstLetter(
const LayoutText& layout_text) const {
if (handled_first_letter_)
......@@ -119,13 +217,6 @@ void TextIteratorTextNodeHandler::HandleTextNodeInRange(Text* node,
unsigned end_offset) {
DCHECK(node);
// TODO(editing-dev): Add the following DCHECK once we stop assuming equal
// number of code units in DOM string and LayoutText::GetText(). Currently
// violated by
// - external/wpt/innerText/getter.html
// - fast/css/case-transform.html
// DCHECK_LE(end_offset, node->data().length());
// TODO(editing-dev): Stop passing in |start_offset == end_offset|.
DCHECK_LE(start_offset, end_offset);
......@@ -134,10 +225,24 @@ void TextIteratorTextNodeHandler::HandleTextNodeInRange(Text* node,
end_offset_ = end_offset;
handled_first_letter_ = false;
first_letter_text_ = nullptr;
uses_layout_ng_ = false;
if (GetNGInlineNodeFor(*node, offset_)) {
// Restore end offset from magic value.
if (end_offset_ == kMaxOffset)
end_offset_ = node->data().length();
uses_layout_ng_ = true;
HandleTextNodeWithLayoutNG();
return;
}
LayoutText* layout_object = text_node_->GetLayoutObject();
String str = layout_object->GetText();
// Restore end offset from magic value.
if (end_offset_ == kMaxOffset)
end_offset_ = layout_object->TextStartOffset() + str.length();
// handle pre-formatted text
if (!layout_object->Style()->CollapseWhiteSpace()) {
HandlePreFormattedTextNode();
......@@ -183,9 +288,7 @@ void TextIteratorTextNodeHandler::HandleTextNodeInRange(Text* node,
void TextIteratorTextNodeHandler::HandleTextNodeStartFrom(
Text* node,
unsigned start_offset) {
HandleTextNodeInRange(node, start_offset,
node->GetLayoutObject()->TextStartOffset() +
node->GetLayoutObject()->GetText().length());
HandleTextNodeInRange(node, start_offset, kMaxOffset);
}
void TextIteratorTextNodeHandler::HandleTextNodeEndAt(Text* node,
......@@ -406,6 +509,8 @@ bool TextIteratorTextNodeHandler::FixLeadingWhiteSpaceForReplacedElement(
Node* parent) {
// This is a hacky way for white space fixup in legacy layout. With LayoutNG,
// we can get rid of this function.
if (uses_layout_ng_)
return false;
if (behavior_.CollapseTrailingSpace()) {
if (text_node_) {
......
......@@ -54,6 +54,8 @@ class TextIteratorTextNodeHandler {
size_t RestoreCollapsedTrailingSpace(InlineTextBox* next_text_box,
size_t subrun_end);
void HandleTextNodeWithLayoutNG();
// Used when the visibility of the style should not affect text gathering.
bool IgnoresStyleVisibility() const {
return behavior_.IgnoresStyleVisibility();
......@@ -74,6 +76,9 @@ class TextIteratorTextNodeHandler {
unsigned offset_ = 0;
unsigned end_offset_ = 0;
// Indicates if the text node is laid out with LayoutNG.
bool uses_layout_ng_ = false;
InlineTextBox* text_box_ = nullptr;
// Remember if we are in the middle of handling a pre-formatted text node.
......
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