Breaking Float: floated block level element following inline element in...

Breaking Float: floated block level element following inline element in floated container breaks to next line
https://bugs.webkit.org/show_bug.cgi?id=45274

Patch by ChangSeok Oh <shivamidow@gmail.com> on 2013-04-17
Reviewed by David Hyatt.

Source/WebCore:

Fix position issue of floating element in floating element.
Inner floating element has placed at next line when outer floating element has text,
even though previous line has spaces enough to fit it.
To solve this, the width of a space added temporarily for prohibiting duplication more than 2 empty spaces
is subtracted when floating element is checked whether it fits on a line.

Tests: css2.1/20110323/floats-001.html
       css2.1/20110323/floats-102.html
       fast/inline-block/float-both-whitespace.html
       fast/inline-block/float-leading-whitespace.html
       fast/inline-block/float-no-whitespace.html
       fast/inline-block/float-trailing-whitespace.html
       fast/inline-block/multiple-floats-with-whitespace.html

* rendering/RenderBlockLineLayout.cpp:
(WebCore::LineWidth::LineWidth):
(WebCore::LineWidth::fitsOnLine):
(WebCore::LineWidth::trailingWhitespaceWidth):
(WebCore::LineWidth::setTrailingWhitespaceWidth):
(LineWidth):
(WebCore::RenderBlock::LineBreaker::nextSegmentBreak):

LayoutTests:

* css2.1/20110323/floats-001-expected.html: Added.
* css2.1/20110323/floats-001.html: Added.
* css2.1/20110323/floats-102-expected.html: Added.
* css2.1/20110323/floats-102.html: Added.

Tests for whitespace around floating elements.
Following test cases are provied by Joseph Pecoraro.
See https://bugs.webkit.org/show_bug.cgi?id=58806

* fast/exclusions/shape-outside-floats/shape-outside-floats-stacked.html: Updated to match new treatment of trailing space.
* fast/inline-block/float-both-whitespace-expected.png: Added.
* fast/inline-block/float-both-whitespace-expected.txt: Added.
* fast/inline-block/float-both-whitespace.html: Added.
* fast/inline-block/float-leading-whitespace-expected.png: Added.
* fast/inline-block/float-leading-whitespace-expected.txt: Added.
* fast/inline-block/float-leading-whitespace.html: Added.
* fast/inline-block/float-no-whitespace-expected.png: Added.
* fast/inline-block/float-no-whitespace-expected.txt: Added.
* fast/inline-block/float-no-whitespace.html: Added.
* fast/inline-block/float-trailing-whitespace-expected.png: Added.
* fast/inline-block/float-trailing-whitespace-expected.txt: Added.
* fast/inline-block/float-trailing-whitespace.html: Added.
* fast/inline-block/multiple-floats-with-whitespace-expected.png: Added.
* fast/inline-block/multiple-floats-with-whitespace-expected.txt: Added.
* fast/inline-block/multiple-floats-with-whitespace.html: Added.

Update the following tests so that wrapping happens as it
did before. With this change the float:left div progressed
and could fit on an earlier line when we position after
collapsing whitespace. This moved the float a line earlier
and changed the results of the test. By adding a character
to the line, the float won't fit and goes back on to the
line that it was on before this change.

* fast/multicol/float-truncation.html:
* fast/multicol/vertical-lr/float-truncation.html:
* fast/multicol/vertical-rl/float-truncation.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148622 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a30cf776
2013-04-17 ChangSeok Oh <shivamidow@gmail.com>
Breaking Float: floated block level element following inline element in floated container breaks to next line
https://bugs.webkit.org/show_bug.cgi?id=45274
Reviewed by David Hyatt.
* css2.1/20110323/floats-001-expected.html: Added.
* css2.1/20110323/floats-001.html: Added.
* css2.1/20110323/floats-102-expected.html: Added.
* css2.1/20110323/floats-102.html: Added.
Tests for whitespace around floating elements.
Following test cases are provied by Joseph Pecoraro.
See https://bugs.webkit.org/show_bug.cgi?id=58806
* fast/exclusions/shape-outside-floats/shape-outside-floats-stacked.html: Updated to match new treatment of trailing space.
* fast/inline-block/float-both-whitespace-expected.png: Added.
* fast/inline-block/float-both-whitespace-expected.txt: Added.
* fast/inline-block/float-both-whitespace.html: Added.
* fast/inline-block/float-leading-whitespace-expected.png: Added.
* fast/inline-block/float-leading-whitespace-expected.txt: Added.
* fast/inline-block/float-leading-whitespace.html: Added.
* fast/inline-block/float-no-whitespace-expected.png: Added.
* fast/inline-block/float-no-whitespace-expected.txt: Added.
* fast/inline-block/float-no-whitespace.html: Added.
* fast/inline-block/float-trailing-whitespace-expected.png: Added.
* fast/inline-block/float-trailing-whitespace-expected.txt: Added.
* fast/inline-block/float-trailing-whitespace.html: Added.
* fast/inline-block/multiple-floats-with-whitespace-expected.png: Added.
* fast/inline-block/multiple-floats-with-whitespace-expected.txt: Added.
* fast/inline-block/multiple-floats-with-whitespace.html: Added.
Update the following tests so that wrapping happens as it
did before. With this change the float:left div progressed
and could fit on an earlier line when we position after
collapsing whitespace. This moved the float a line earlier
and changed the results of the test. By adding a character
to the line, the float won't fit and goes back on to the
line that it was on before this change.
* fast/multicol/float-truncation.html:
* fast/multicol/vertical-lr/float-truncation.html:
* fast/multicol/vertical-rl/float-truncation.html:
2013-04-17 Chris Fleizach <cfleizach@apple.com>
When img@alt is undefined, WebKit should use @title as accessibility label if available
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>CSS Reftest Reference</title>
<link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
<style type="text/css">
div
{
border: black solid 5px;
height: 1in;
width: 2in;
}
img {vertical-align: top;}
</style>
</head>
<body>
<p>Test passes if the blue square is on the left inner edge of the hollow black rectangle.</p>
<div><img src="support/swatch-blue.png" width="96" height="96" alt="Image download support must be enabled"></div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>CSS Test: Floats, shifting left until it touches container edge</title>
<link rel="author" title="Microsoft" href="http://www.microsoft.com/">
<link rel="reviewer" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/"> <!-- 2012-07-02 -->
<link rel="help" href="http://www.w3.org/TR/CSS21/visuren.html#floats">
<link rel="match" href="reference/floats-001-ref.htm">
<meta name="flags" content="">
<meta name="assert" content="A left floated box shifts left until its outer edge touches the containing block edge.">
<style type="text/css">
#div1
{
border: solid 5px black;
height: 1in;
width: 2in;
}
div div
{
display: inline-block;
height: 1in;
width: 1in;
}
#div3
{
background-color: blue;
float: left;
}
</style>
</head>
<body>
<p>Test passes if the blue square is on the left inner edge of the hollow black rectangle.</p>
<div id="div1">
<div id="div2"></div>
<div id="div3"></div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<style type="text/css">
div { border: 1px solid teal; padding: 4px; margin: 4px; }
.left { float: left; }
.right { float: right; }
.size { width: 150px; height: 150px; }
</style>
</head>
<body>
<p>The content before should be to the right of the inner square,
and both it and the inner square should be surrounded by an outer box.</p>
<div class="left"><div class="size left"></div>content before</div>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>CSS Test: CSS Floats: Nested floats (some inline content before nested float)</title>
<link rel="author" title="Ian Hickson" href="mailto:ian@hixie.ch">
<link rel="alternate" href="http://www.hixie.ch/tests/adhoc/css/box/float/002-demo.html" type="text/html">
<link rel="help" href="http://www.w3.org/TR/CSS21/visuren.html#floats">
<style type="text/css">
div { border: 1px solid teal; padding: 4px; margin: 4px; }
.left { float: left; }
.right { float: right; }
.size { width: 150px; height: 150px; }
</style>
</head>
<body>
<p>The content before should be to the right of the inner square,
and both it and the inner square should be surrounded by an outer box.</p>
<div class="left">content before <div class="size left"></div></div>
</body>
</html>
\ No newline at end of file
......@@ -56,14 +56,14 @@
the triangles shoud overlap, and the black boxes should wrap around the triangles on the left.</h2>
<div class="container">
<div class="triangle-left"></div>
X X X X
X X X X X
<div style="float:right" class="triangle-left"></div>
X X X X
<div class="triangle-left"></div>
X X X X
X X X X
X X X X
X X X X X X
X X X X X
</div>
<h2>There should be two trianges on the right, and one on the left. None of
the triangles shoud overlap, and the black boxes should wrap around the triangles on the right.</h2>
......
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x166
RenderBlock {HTML} at (0,0) size 800x166
RenderBody {BODY} at (8,8) size 784x150
RenderBlock {DIV} at (0,0) size 400x30
RenderBlock {DIV} at (0,0) size 300x30 [bgcolor=#008000]
RenderText {#text} at (0,0) size 0x0
RenderBlock (floating) {DIV} at (300,0) size 100x30 [bgcolor=#0000FF]
RenderText {#text} at (0,0) size 0x0
RenderBlock {DIV} at (0,30) size 400x30
RenderBlock {DIV} at (0,0) size 300x30 [bgcolor=#008000]
RenderText {#text} at (0,0) size 0x0
RenderBlock (floating) {DIV} at (300,0) size 100x30 [bgcolor=#0000FF]
RenderText {#text} at (0,0) size 0x0
RenderBlock {DIV} at (0,60) size 400x30
RenderBlock {DIV} at (0,0) size 300x30 [bgcolor=#008000]
RenderText {#text} at (0,0) size 0x0
RenderBlock (floating) {DIV} at (300,0) size 100x30 [bgcolor=#0000FF]
RenderText {#text} at (0,0) size 0x0
RenderBlock {DIV} at (0,90) size 400x30
RenderBlock {DIV} at (0,0) size 300x30 [bgcolor=#008000]
RenderText {#text} at (0,0) size 0x0
RenderBlock (floating) {DIV} at (300,0) size 100x30 [bgcolor=#0000FF]
RenderText {#text} at (0,0) size 0x0
RenderBlock {DIV} at (0,120) size 400x30
RenderBlock {DIV} at (0,0) size 300x30 [bgcolor=#008000]
RenderText {#text} at (0,0) size 0x0
RenderBlock (floating) {DIV} at (300,0) size 100x30 [bgcolor=#0000FF]
RenderText {#text} at (0,0) size 0x0
<!DOCTYPE html>
<html>
<head>
<title>Test With Both Leading and Trailing Whitespace</title>
<style>
div { height:30px; margin:0; padding:0; border:none; }
.container { width:400px; }
.floater { float:right; width:100px; background-color:blue; }
.middle { display:inline-block; width:300px; background-color:green; }
</style>
</head>
<body>
<!-- Single Leading and Trailing Space -->
<div class="container"><div class="middle"></div> <div class="floater"></div> </div>
<!-- Single Leading and Multiple Trailing Spaces -->
<div class="container"><div class="middle"></div> <div class="floater"></div> </div>
<!-- Multiple Leading and Single Trailing Spaces -->
<div class="container"><div class="middle"></div> <div class="floater"></div> </div>
<!-- Multiple Leading and Trailing Spaces -->
<div class="container"><div class="middle"></div> <div class="floater"></div> </div>
<!-- Mixture of Leading and Trailing Whitespace -->
<div class="container">
<div class="middle"></div>
<div class="floater"></div>
</div>
</body>
</html>
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x106
RenderBlock {HTML} at (0,0) size 800x106
RenderBody {BODY} at (8,8) size 784x90
RenderBlock {DIV} at (0,0) size 400x30
RenderBlock {DIV} at (0,0) size 300x30 [bgcolor=#008000]
RenderText {#text} at (0,0) size 0x0
RenderBlock (floating) {DIV} at (300,0) size 100x30 [bgcolor=#0000FF]
RenderBlock {DIV} at (0,30) size 400x30
RenderBlock {DIV} at (0,0) size 300x30 [bgcolor=#008000]
RenderText {#text} at (0,0) size 0x0
RenderBlock (floating) {DIV} at (300,0) size 100x30 [bgcolor=#0000FF]
RenderBlock {DIV} at (0,60) size 400x30
RenderBlock {DIV} at (0,0) size 300x30 [bgcolor=#008000]
RenderText {#text} at (0,0) size 0x0
RenderBlock (floating) {DIV} at (300,0) size 100x30 [bgcolor=#0000FF]
<!DOCTYPE html>
<html>
<head>
<title>Test With Leading Whitespace</title>
<style>
div { height:30px; margin:0; padding:0; border:none; }
.container { width:400px; }
.floater { float:right; width:100px; background-color:blue; }
.middle { display:inline-block; width:300px; background-color:green; }
</style>
</head>
<body>
<!-- Single Leading Space -->
<div class="container"><div class="middle"></div> <div class="floater"></div></div>
<!-- Single Leading Newline -->
<div class="container"><div class="middle"></div>
<div class="floater"></div></div>
<!-- Mixture of Leading Whitespace -->
<div class="container"><div class="middle"></div>
<div class="floater"></div></div>
</body>
</html>
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x76
RenderBlock {HTML} at (0,0) size 800x76
RenderBody {BODY} at (8,8) size 784x60
RenderBlock {DIV} at (0,0) size 400x30
RenderBlock {DIV} at (0,0) size 300x30 [bgcolor=#008000]
RenderBlock (floating) {DIV} at (300,0) size 100x30 [bgcolor=#0000FF]
RenderBlock {DIV} at (0,30) size 400x30
RenderBlock {DIV} at (0,0) size 300x30 [bgcolor=#008000]
RenderBlock (floating) {DIV} at (300,0) size 100x30 [bgcolor=#0000FF]
<!DOCTYPE html>
<html>
<head>
<title>Test Without Whitespace</title>
<style>
div { height:30px; margin:0; padding:0; border:none; }
.container { width:400px; }
.floater { float:right; width:100px; background-color:blue; }
.middle { display:inline-block; width:300px; background-color:green; }
</style>
</head>
<body>
<div class="container"><div class="middle"></div><div class="floater"></div></div>
<div class="container"><div class="middle"></div><div class="floater"></div></div>
</body>
</html>
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x106
RenderBlock {HTML} at (0,0) size 800x106
RenderBody {BODY} at (8,8) size 784x90
RenderBlock {DIV} at (0,0) size 400x30
RenderBlock {DIV} at (0,0) size 300x30 [bgcolor=#008000]
RenderBlock (floating) {DIV} at (300,0) size 100x30 [bgcolor=#0000FF]
RenderText {#text} at (0,0) size 0x0
RenderBlock {DIV} at (0,30) size 400x30
RenderBlock {DIV} at (0,0) size 300x30 [bgcolor=#008000]
RenderBlock (floating) {DIV} at (300,0) size 100x30 [bgcolor=#0000FF]
RenderText {#text} at (0,0) size 0x0
RenderBlock {DIV} at (0,60) size 400x30
RenderBlock {DIV} at (0,0) size 300x30 [bgcolor=#008000]
RenderBlock (floating) {DIV} at (300,0) size 100x30 [bgcolor=#0000FF]
RenderText {#text} at (0,0) size 0x0
<!DOCTYPE html>
<html>
<head>
<title>Test With Trailing Whitespace</title>
<style>
div { height:30px; margin:0; padding:0; border:none; }
.container { width:400px; }
.floater { float:right; width:100px; background-color:blue; }
.middle { display:inline-block; width:300px; background-color:green; }
</style>
</head>
<body>
<!-- Single Trailing Space -->
<div class="container"><div class="middle"></div><div class="floater"></div> </div>
<!-- Single Trailing Newline -->
<div class="container"><div class="middle"></div><div class="floater"></div>
</div>
<!-- Mixture of Trailing Whitespace -->
<div class="container"><div class="middle"></div><div class="floater"></div>
</div>
</body>
</html>
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x106
RenderBlock {HTML} at (0,0) size 800x106
RenderBody {BODY} at (8,8) size 784x90
RenderBlock {DIV} at (0,0) size 400x30
RenderBlock (floating) {DIV} at (0,0) size 100x30 [bgcolor=#FFA500]
RenderBlock {DIV} at (100,0) size 100x30 [bgcolor=#008000]
RenderBlock (floating) {DIV} at (300,0) size 100x30 [bgcolor=#0000FF]
RenderBlock (floating) {DIV} at (200,0) size 100x30 [bgcolor=#FFFF00]
RenderBlock {DIV} at (0,30) size 400x30
RenderBlock (floating) {DIV} at (0,0) size 100x30 [bgcolor=#FFA500]
RenderBlock {DIV} at (100,0) size 100x30 [bgcolor=#008000]
RenderText {#text} at (0,0) size 0x0
RenderBlock (floating) {DIV} at (300,0) size 100x30 [bgcolor=#0000FF]
RenderText {#text} at (0,0) size 0x0
RenderBlock (floating) {DIV} at (200,0) size 100x30 [bgcolor=#FFFF00]
RenderText {#text} at (0,0) size 0x0
RenderBlock {DIV} at (0,60) size 400x30
RenderBlock (floating) {DIV} at (300,0) size 100x30 [bgcolor=#0000FF]
RenderBlock (floating) {DIV} at (0,0) size 100x30 [bgcolor=#FFA500]
RenderBlock {DIV} at (100,0) size 100x30 [bgcolor=#008000]
RenderText {#text} at (0,0) size 0x0
RenderBlock (floating) {DIV} at (200,0) size 100x30 [bgcolor=#FFFF00]
RenderText {#text} at (0,0) size 0x0
<!DOCTYPE html>
<html>
<head>
<title>Test Multiple Floats for a Single Line</title>
<style>
div { width: 100px; height:30px; margin:0; padding:0; border:none; }
.container { width:400px; }
.left { float:left; background-color:orange; }
.a { float:right; background-color:blue; }
.b { float:right; background-color:yellow; }
.middle { display:inline-block; background-color:green; }
</style>
</head>
<body>
<!-- No whitespace -->
<div class="container"><div class="left"></div><div class="middle"></div><div class="floater a"></div><div class="floater b"></div></div>
<!-- Some whitespace -->
<div class="container">
<div class="left"></div>
<div class="middle"></div>
<div class="floater a"></div>
<div class="floater b"></div>
</div>
<!-- Order should not matter -->
<div class="container">
<div class="floater a"></div>
<div class="left"></div>
<div class="middle"></div>
<div class="floater b"></div>
</div>
</body>
</html>
......@@ -23,7 +23,7 @@
<body>
<div id="tests">
<div class="columns" style="height: 80px;">
one line two lines three lines
one line two lines three lines!
<div class="float" id="f1">
three line float
</div>
......@@ -32,7 +32,7 @@
<!-- In this case, the float fits, but then the main content causes the break
to occur earlier and the float gets split. -->
<div class="columns" style="height: 75px;">
one line two lines three lines
one line two lines three lines!
<div class="float" id="f2">
three line float
</div>
......@@ -40,7 +40,7 @@
</div>
<!-- In this case, the float paginates after its second line. -->
<div class="columns" style="height: 70px;">
one line two lines three lines
one line two lines three lines!
<div class="float" id="f3">
three line float
</div>
......
......@@ -20,7 +20,7 @@
</style>
<div id="tests">
<div class="columns" style="width: 80px;">
one line two lines three lines
one line two lines three lines!
<div class="float" id="f1">
three line float
</div>
......@@ -29,7 +29,7 @@
<!-- In this case, the float fits, but then the main content causes the break
to occur earlier and the float gets split. -->
<div class="columns" style="width: 75px;">
one line two lines three lines
one line two lines three lines!
<div class="float" id="f2">
three line float
</div>
......@@ -37,7 +37,7 @@
</div>
<!-- In this case, the float paginates after its second line. -->
<div class="columns" style="width: 70px;">
one line two lines three lines
one line two lines three lines!
<div class="float" id="f3">
three line float
</div>
......
......@@ -23,7 +23,7 @@
<body style="-webkit-writing-mode:vertical-rl; width:800px">
<div id="tests">
<div class="columns" style="width: 80px;">
one line two lines three lines
one line two lines three lines!
<div class="float" id="f1">
three line float
</div>
......@@ -32,7 +32,7 @@
<!-- In this case, the float fits, but then the main content causes the break
to occur earlier and the float gets split. -->
<div class="columns" style="width: 75px;">
one line two lines three lines
one line two lines three lines!
<div class="float" id="f2">
three line float
</div>
......@@ -40,7 +40,7 @@
</div>
<!-- In this case, the float paginates after its second line. -->
<div class="columns" style="width: 70px;">
one line two lines three lines
one line two lines three lines!
<div class="float" id="f3">
three line float
</div>
......
2013-04-17 ChangSeok Oh <shivamidow@gmail.com>
Breaking Float: floated block level element following inline element in floated container breaks to next line
https://bugs.webkit.org/show_bug.cgi?id=45274
Reviewed by David Hyatt.
Fix position issue of floating element in floating element.
Inner floating element has placed at next line when outer floating element has text,
even though previous line has spaces enough to fit it.
To solve this, the width of a space added temporarily for prohibiting duplication more than 2 empty spaces
is subtracted when floating element is checked whether it fits on a line.
Tests: css2.1/20110323/floats-001.html
css2.1/20110323/floats-102.html
fast/inline-block/float-both-whitespace.html
fast/inline-block/float-leading-whitespace.html
fast/inline-block/float-no-whitespace.html
fast/inline-block/float-trailing-whitespace.html
fast/inline-block/multiple-floats-with-whitespace.html
* rendering/RenderBlockLineLayout.cpp:
(WebCore::LineWidth::LineWidth):
(WebCore::LineWidth::fitsOnLine):
(WebCore::LineWidth::trailingWhitespaceWidth):
(WebCore::LineWidth::setTrailingWhitespaceWidth):
(LineWidth):
(WebCore::RenderBlock::LineBreaker::nextSegmentBreak):
2013-04-17 Leo Yang <leoyang@rim.com>
Lots of unused parameter warnings in filesystem code
......@@ -2,6 +2,7 @@
* Copyright (C) 2000 Lars Knoll (knoll@kde.org)
* Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All right reserved.
* Copyright (C) 2010 Google Inc. All rights reserved.
* Copyright (C) 2013 ChangSeok Oh <shivamidow@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -104,6 +105,7 @@ public:
, m_uncommittedWidth(0)
, m_committedWidth(0)
, m_overhangWidth(0)
, m_trailingWhitespaceWidth(0)
, m_left(0)
, m_right(0)
, m_availableWidth(0)
......@@ -123,12 +125,14 @@ public:
}
bool fitsOnLine() const { return currentWidth() <= m_availableWidth; }
bool fitsOnLine(float extra) const { return currentWidth() + extra <= m_availableWidth; }
bool fitsOnLine(float extra, bool excludeWhitespace) const { return currentWidth() - (excludeWhitespace ? trailingWhitespaceWidth() : 0) + extra <= m_availableWidth; }
float currentWidth() const { return m_committedWidth + m_uncommittedWidth; }
// FIXME: We should eventually replace these three functions by ones that work on a higher abstraction.
float uncommittedWidth() const { return m_uncommittedWidth; }
float committedWidth() const { return m_committedWidth; }
float availableWidth() const { return m_availableWidth; }
float trailingWhitespaceWidth() const { return m_trailingWhitespaceWidth; }
void updateAvailableWidth(LayoutUnit minimumHeight = 0);
void shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::FloatingObject*);
......@@ -140,6 +144,7 @@ public:
}
void applyOverhang(RenderRubyRun*, RenderObject* startRenderer, RenderObject* endRenderer);
void fitBelowFloats();
void setTrailingWhitespaceWidth(float width) { m_trailingWhitespaceWidth = width; }
bool shouldIndentText() { return m_shouldIndentText == IndentText; }
......@@ -154,6 +159,7 @@ private:
float m_uncommittedWidth;
float m_committedWidth;
float m_overhangWidth; // The amount by which |m_availableWidth| has been inflated to account for possible contraction due to ruby overhang.
float m_trailingWhitespaceWidth;
float m_left;
float m_right;
float m_availableWidth;
......@@ -2816,7 +2822,7 @@ InlineIterator RenderBlock::LineBreaker::nextSegmentBreak(InlineBidiResolver& re
// If it does, position it now, otherwise, position
// it after moving to next line (in newLine() func)
// FIXME: Bug 110372: Properly position multiple stacked floats with non-rectangular shape outside.
if (floatsFitOnLine && width.fitsOnLine(m_block->logicalWidthForFloat(f))) {
if (floatsFitOnLine && width.fitsOnLine(m_block->logicalWidthForFloat(f), true)) {
m_block->positionNewFloatOnLine(f, lastFloatFromPreviousLine, lineInfo, width);
if (lBreak.m_obj == current.m_obj) {
ASSERT(!lBreak.m_pos);
......@@ -3023,15 +3029,19 @@ InlineIterator RenderBlock::LineBreaker::nextSegmentBreak(InlineBidiResolver& re
wordMeasurement.endOffset = current.m_pos;
wordMeasurement.startOffset = lastSpace;
float additionalTmpW;
float additionalTempWidth;
if (wordTrailingSpaceWidth && c == ' ')
additionalTmpW = textWidth(t, lastSpace, current.m_pos + 1 - lastSpace, f, width.currentWidth(), isFixedPitch, collapseWhiteSpace, &wordMeasurement.fallbackFonts, textLayout) - wordTrailingSpaceWidth;
additionalTempWidth = textWidth(t, lastSpace, current.m_pos + 1 - lastSpace, f, width.currentWidth(), isFixedPitch, collapseWhiteSpace, &wordMeasurement.fallbackFonts, textLayout) - wordTrailingSpaceWidth;
else
additionalTmpW = textWidth(t, lastSpace, current.m_pos - lastSpace, f, width.currentWidth(), isFixedPitch, collapseWhiteSpace, &wordMeasurement.fallbackFonts, textLayout);
additionalTempWidth = textWidth(t, lastSpace, current.m_pos - lastSpace, f, width.currentWidth(), isFixedPitch, collapseWhiteSpace, &wordMeasurement.fallbackFonts, textLayout);
wordMeasurement.width = additionalTempWidth + wordSpacingForWordMeasurement;
additionalTempWidth += lastSpaceWordSpacing;
width.addUncommittedWidth(additionalTempWidth);
if (collapseWhiteSpace && previousCharacterIsSpace && currentCharacterIsSpace && additionalTempWidth)
width.setTrailingWhitespaceWidth(additionalTempWidth);
wordMeasurement.width = additionalTmpW + wordSpacingForWordMeasurement;
additionalTmpW += lastSpaceWordSpacing;
width.addUncommittedWidth(additionalTmpW);
if (!appliedStartWidth) {
width.addUncommittedWidth(inlineLogicalWidth(current.m_obj, true, false));
appliedStartWidth = true;
......@@ -3061,7 +3071,7 @@ InlineIterator RenderBlock::LineBreaker::nextSegmentBreak(InlineBidiResolver& re
}
if (lineWasTooWide || !width.fitsOnLine()) {
if (canHyphenate && !width.fitsOnLine()) {
tryHyphenating(t, f, style->locale(), consecutiveHyphenatedLines, blockStyle->hyphenationLimitLines(), style->hyphenationLimitBefore(), style->hyphenationLimitAfter(), lastSpace, current.m_pos, width.currentWidth() - additionalTmpW, width.availableWidth(), isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, current.m_nextBreakablePosition, m_hyphenated);
tryHyphenating(t, f, style->locale(), consecutiveHyphenatedLines, blockStyle->hyphenationLimitLines(), style->hyphenationLimitBefore(), style->hyphenationLimitAfter(), lastSpace, current.m_pos, width.currentWidth() - additionalTempWidth, width.availableWidth(), isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, current.m_nextBreakablePosition, m_hyphenated);
if (m_hyphenated)
goto end;
}
......@@ -3085,7 +3095,7 @@ InlineIterator RenderBlock::LineBreaker::nextSegmentBreak(InlineBidiResolver& re
goto end;
} else {
if (!betweenWords || (midWordBreak && !autoWrap))
width.addUncommittedWidth(-additionalTmpW);
width.addUncommittedWidth(-additionalTempWidth);
if (hyphenWidth) {
// Subtract the width of the soft hyphen out since we fit on a line.
width.addUncommittedWidth(-hyphenWidth);
......@@ -3185,17 +3195,23 @@ InlineIterator RenderBlock::LineBreaker::nextSegmentBreak(InlineBidiResolver& re
wordMeasurement.renderer = t;
// IMPORTANT: current.m_pos is > length here!
float additionalTmpW = ignoringSpaces ? 0 : textWidth(t, lastSpace, current.m_pos - lastSpace, f, width.currentWidth(), isFixedPitch, collapseWhiteSpace, &wordMeasurement.fallbackFonts, textLayout);