summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormstensho@opera.com <mstensho@opera.com>2015-05-19 11:05:00 +0000
committermstensho@opera.com <mstensho@opera.com>2015-05-19 11:05:00 +0000
commitb4c703191ffe80c5e398fba5f7f3896f2be04247 (patch)
treef05ddc5c2a84adfc0690f838f0eb4ff286006366
parente199b5514b2d99f051a83f0efffd0505e02af7dc (diff)
downloadchromium_src-b4c703191ffe80c5e398fba5f7f3896f2be04247.zip
chromium_src-b4c703191ffe80c5e398fba5f7f3896f2be04247.tar.gz
chromium_src-b4c703191ffe80c5e398fba5f7f3896f2be04247.tar.bz2
Setting -webkit-column-count to auto is the same as not setting it.
In ComputedStyle, column-count is represented by two members, one integer specifying the count, and one bool specifying whether it's auto or not. If column-count is auto, the integer is ignored, but if the integer changes, it's still detected as a style change (even if auto is set to true), and we'll mark for layout for no good reason. Make sure that setting column-count to auto also resets the integer to its initial value, to avoid this problem. This bug was discovered while working on https://codereview.chromium.org/1141943002/ (disable multicol when printing). When changing from not specifying column-count to setting it to auto triggers relayout, some printing tests started to fail (but that's really just because the current expectation files rely on crbug.com/489615 ). R=rune@opera.com Review URL: https://codereview.chromium.org/1145773002 git-svn-id: svn://svn.chromium.org/blink/trunk@195524 bbb929c8-8fbe-4397-9dbb-9b2b20218538
-rw-r--r--third_party/WebKit/LayoutTests/fast/multicol/explicit-columns-auto-expected.txt11
-rw-r--r--third_party/WebKit/LayoutTests/fast/multicol/explicit-columns-auto.html21
-rw-r--r--third_party/WebKit/Source/core/style/ComputedStyle.h2
3 files changed, 33 insertions, 1 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/multicol/explicit-columns-auto-expected.txt b/third_party/WebKit/LayoutTests/fast/multicol/explicit-columns-auto-expected.txt
new file mode 100644
index 0000000..7c5012b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/multicol/explicit-columns-auto-expected.txt
@@ -0,0 +1,11 @@
+Test that setting columns to auto is the same as not setting it at all.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS internals.updateStyleAndReturnAffectedElementCount() is 1
+PASS internals.needsLayoutCount() is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/third_party/WebKit/LayoutTests/fast/multicol/explicit-columns-auto.html b/third_party/WebKit/LayoutTests/fast/multicol/explicit-columns-auto.html
new file mode 100644
index 0000000..4f97487
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/multicol/explicit-columns-auto.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<script src="../../resources/js-test.js"></script>
+<style>
+ .explicitlyNoColumns { -webkit-columns:auto; }
+</style>
+
+<div id="elm"></div>
+
+<script>
+ description("Test that setting columns to auto is the same as not setting it at all.");
+ document.body.offsetTop;
+ document.getElementById('elm').className = "explicitlyNoColumns";
+ if (window.internals) {
+ // Need to call updateStyleAndReturnAffectedElementCount() first, to get style recalculated,
+ // so that the necessary objects get marked for layout (which, if the test passes, should be 0).
+ shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "1");
+ shouldBe("internals.needsLayoutCount()", "0");
+ } else {
+ testFailed("There's no web exposed API usable for this test. The bug doesn't affect layout in a reliable way. Please rerun inside the layout test framework.");
+ }
+</script>
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.h b/third_party/WebKit/Source/core/style/ComputedStyle.h
index 3e153ba..64abb5e 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.h
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.h
@@ -1295,7 +1295,7 @@ public:
void setColumnWidth(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoWidth, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_width, f); }
void setHasAutoColumnWidth() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoWidth, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_width, 0); }
void setColumnCount(unsigned short c) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoCount, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_count, c); }
- void setHasAutoColumnCount() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoCount, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_count, 0); }
+ void setHasAutoColumnCount() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoCount, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_count, initialColumnCount()); }
void setColumnFill(ColumnFill columnFill) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_fill, columnFill); }
void setColumnGap(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, f); }
void setHasNormalColumnGap() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, 0); }