Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Unified Diff: third_party/WebKit/LayoutTests/fast/text/fit-content-with-element-boundaries.html

Issue 2725933002: Fix LayoutUnit snapping of widths in line breaker (Closed)
Patch Set: Add test cases for m_uncommittedWidth and !m_uncommittedWidth Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/text/fit-content-with-element-boundaries.html
diff --git a/third_party/WebKit/LayoutTests/fast/text/fit-content-with-element-boundaries.html b/third_party/WebKit/LayoutTests/fast/text/fit-content-with-element-boundaries.html
new file mode 100644
index 0000000000000000000000000000000000000000..a2e88aab30f95ba3727fb214c4d65c1eec60e050
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/text/fit-content-with-element-boundaries.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<style>
+div {
+ display: inline-block;
+ font-family: Consolas, 'Courier New', Courier, monospace;
+ line-height: 1;
+}
+img {
+ width: 1em;
+ height: 1em;
+}
+</style>
+
+<div title="img (!m_uncommittedWidth)"><img src="../replaced/resources/1x1-blue.png"><img src="../replaced/resources/1x1-blue.png"><img src="../replaced/resources/1x1-blue.png"><img src="../replaced/resources/1x1-blue.png"><img src="../replaced/resources/1x1-blue.png"><img src="../replaced/resources/1x1-blue.png"><img src="../replaced/resources/1x1-blue.png"><img src="../replaced/resources/1x1-blue.png"><img src="../replaced/resources/1x1-blue.png"><img src="../replaced/resources/1x1-blue.png"></div>
+
+<br>
+
+<div title="text node (end with m_uncommittedWidth)"><span>a </span>a <span>a </span>a <span>a </span>a <span>a </span>a <span>a </span>a <span>a </span>a <span>a </span>a <span>a </span>a <span>a </span>a <span>a </span>a</div>
+
+<br>
+
+<div title="text node (end with !m_uncommittedWidth)"><span>a </span>a <span>a </span>a <span>a </span>a <span>a </span>a <span>a </span>a <span>a </span>a <span>a </span>a <span>a </span>a <span>a </span>a <span>a </span>a </div>
+
+<br>
+<div title="Real case from inspector"><span>(9) </span>[<span>1</span>, <span>2</span>, <span>3</span>, <span>4</span>, <span>5</span>, <span>6</span>, <span>7</span>, <span>8</span>, <span>9</span>]</div>
+
+<script>
+runTests();
+function runTests() {
+ const from = 5, to = 20;
+ for (let element of document.getElementsByTagName("div")) {
+ test(() => {
+ for (let i = from; i <= to; i++) {
+ element.style.fontSize = i + "px";
+ let height = element.offsetHeight;
+ assert_approx_equals(height, i, i / 2, `Line should not wrap at font-size: ${i}px`);
+ }
+ }, `${element.title} from ${from}px to ${to} px`);
+ }
+}
+</script>

Powered by Google App Engine
This is Rietveld 408576698