Whitespace in particular source code changes rendering; does not in Firefox

https://bugs.webkit.org/show_bug.cgi?id=100943

Patch by Arnaud Renevier <a.renevier@sisa.samsung.com> on 2013-04-09
Reviewed by Darin Adler.

Source/WebCore:

A render inline which requires a line box is considered a possible
trailing object. So, ensureLineBoxInsideIgnoredSpaces will be called
for it, even if it is placed after a text render ending with a single
space.

Tests: fast/text/whitespace/trailing-space-before-empty-span-1.html
       fast/text/whitespace/trailing-space-before-empty-span-2.html

* rendering/RenderBlockLineLayout.cpp:
(TrailingObjects):
(WebCore::TrailingObjects::appendBoxIfNeeded):
(WebCore::RenderBlock::LineBreaker::nextSegmentBreak):

LayoutTests:

* fast/text/whitespace/trailing-space-before-empty-span-1-expected.html: Added.
* fast/text/whitespace/trailing-space-before-empty-span-1.html: A test
    with a span whose text ends with a single span. A following span
    is empty but requires a line box (because it has some padding).
    The second span should be rendered.
* fast/text/whitespace/trailing-space-before-empty-span-2-expected.html: Added.
* fast/text/whitespace/trailing-space-before-empty-span-2.html: Same
    test as trailing-space-before-empty-span-1.html except that second
    span contains whitespace only text.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148027 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 259fe836
2013-04-09 Arnaud Renevier <a.renevier@sisa.samsung.com>
Whitespace in particular source code changes rendering; does not in Firefox
https://bugs.webkit.org/show_bug.cgi?id=100943
Reviewed by Darin Adler.
* fast/text/whitespace/trailing-space-before-empty-span-1-expected.html: Added.
* fast/text/whitespace/trailing-space-before-empty-span-1.html: A test
with a span whose text ends with a single span. A following span
is empty but requires a line box (because it has some padding).
The second span should be rendered.
* fast/text/whitespace/trailing-space-before-empty-span-2-expected.html: Added.
* fast/text/whitespace/trailing-space-before-empty-span-2.html: Same
test as trailing-space-before-empty-span-1.html except that second
span contains whitespace only text.
2013-04-09 Andrei Bucur <abucur@adobe.com>
Use DOM ordering for list counts
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.colored {
background-color: yellow;
padding: 16px;
}
</style>
</head>
<div><span>AB</span><span class="colored"></span></div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.colored {
background-color: yellow;
padding: 16px;
}
</style>
</head>
<div><span>AB </span><span class="colored"></span></div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.colored {
background-color: yellow;
padding: 16px;
}
</style>
</head>
<div><span>AB</span><span class="colored"></span></div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.colored {
background-color: yellow;
padding: 16px;
}
</style>
</head>
<div><span>AB </span><span class="colored"> </span></div>
</body>
</html>
2013-04-09 Arnaud Renevier <a.renevier@sisa.samsung.com>
Whitespace in particular source code changes rendering; does not in Firefox
https://bugs.webkit.org/show_bug.cgi?id=100943
Reviewed by Darin Adler.
A render inline which requires a line box is considered a possible
trailing object. So, ensureLineBoxInsideIgnoredSpaces will be called
for it, even if it is placed after a text render ending with a single
space.
Tests: fast/text/whitespace/trailing-space-before-empty-span-1.html
fast/text/whitespace/trailing-space-before-empty-span-2.html
* rendering/RenderBlockLineLayout.cpp:
(TrailingObjects):
(WebCore::TrailingObjects::appendBoxIfNeeded):
(WebCore::RenderBlock::LineBreaker::nextSegmentBreak):
2013-04-09 Andrei Bucur <abucur@adobe.com>
Use DOM ordering for list counts
......@@ -2514,7 +2514,7 @@ public:
TrailingObjects();
void setTrailingWhitespace(RenderText*);
void clear();
void appendBoxIfNeeded(RenderBox*);
void appendBoxIfNeeded(RenderBoxModelObject*);
enum CollapseFirstSpaceOrNot { DoNotCollapseFirstSpace, CollapseFirstSpace };
......@@ -2522,7 +2522,7 @@ public:
private:
RenderText* m_whitespace;
Vector<RenderBox*, 4> m_boxes;
Vector<RenderBoxModelObject*, 4> m_boxes;
};
TrailingObjects::TrailingObjects()
......@@ -2542,7 +2542,7 @@ inline void TrailingObjects::clear()
m_boxes.clear();
}
inline void TrailingObjects::appendBoxIfNeeded(RenderBox* box)
inline void TrailingObjects::appendBoxIfNeeded(RenderBoxModelObject* box)
{
if (m_whitespace)
m_boxes.append(box);
......@@ -2813,6 +2813,8 @@ InlineIterator RenderBlock::LineBreaker::nextSegmentBreak(InlineBidiResolver& re
currentCharacterIsSpace = true;
currentCharacterIsWS = true;
ignoringSpaces = true;
} else {
trailingObjects.appendBoxIfNeeded(flowBox);
}
}
......
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