Remove all uses of display:block and display:inline-block.

-Make display:flex, flex-direction: column, flex-shrink: 1 the default.
-Simplify StyleAdjuster::adjustStyleForAlignment to remove special cases we
won't need as we make flex the default and remove absolute positioning.
-Fix a bug this exposed in column flexboxes where we'd apply the wrong edge
of border/padding/margin.
-For now leave the default of align-items:stretch. The main change here is
that iframe/img will do width:auto the same as blocks (i.e. the width of
the parent). I think this is a good change, but we'll have to see how it feels
in practice.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1061163002
This commit is contained in:
Ojan Vafai
2015-04-06 16:44:12 -07:00
parent c872ce42b3
commit ed5af4c741
18 changed files with 52 additions and 46 deletions

View File

@@ -1,9 +1,9 @@
layer at (0,0) size 800x600
RenderView {#document} at (0,0) size 800x600
RenderBlock {sky} at (0,0) size 800x238
RenderFlexibleBox {sky} at (0,0) size 800x238
RenderParagraph (anonymous) at (0,0) size 800x38
RenderText {#text} at (0,0) size 778x38
text run at (0,0) width 778: "Test passes if the image below shows nested green, blue and yellow squares with a dotted black"
text run at (0,19) width 59: "border."
RenderBlock {div} at (0,38) size 200x200 [border: (25px dotted #000000)]
RenderFlexibleBox {div} at (0,38) size 200x200 [border: (25px dotted #000000)]

View File

@@ -2,6 +2,7 @@
<style>
.blue {
border: 2px solid blue;
display: paragraph;
}
</style>
<div class="blue" contenteditable></div>

View File

@@ -2,6 +2,7 @@
<style>
.blue {
border: 2px solid blue;
display: paragraph;
}
</style>
<div class="blue" contenteditable></div>

View File

@@ -2,6 +2,7 @@
<style>
.blue {
border: 2px solid blue;
display: paragraph;
}
</style>
<div class="blue" contenteditable></div>

View File

@@ -2,6 +2,7 @@
<style>
.blue {
border: 2px solid blue;
display: paragraph;
}
</style>
<div class="blue" contenteditable></div>

View File

@@ -1,9 +1,9 @@
layer at (0,0) size 800x600
RenderView {#document} at (0,0) size 800x600
RenderBlock {sky} at (0,0) size 800x19
RenderBlock {div} at (0,0) size 800x19
RenderFlexibleBox {sky} at (0,0) size 800x19
RenderFlexibleBox {div} at (0,0) size 800x19
RenderParagraph {span} at (0,0) size 800x19
RenderBlock (inline-block) {div} at (0,0) size 25.22x19
RenderFlexibleBox {div} at (0,0) size 25.22x19
RenderParagraph (anonymous) at (0,0) size 25.22x19
RenderText {#text} at (0,0) size 26x19
text run at (0,0) width 26: "foo"

View File

@@ -7,7 +7,7 @@ no-z-above,
no-z-below,
postive-z-after {
position: absolute;
display: block;
display: flex;
left: 0;
right: 0;
top: 0;

View File

@@ -5,15 +5,15 @@ bar { width: 100px; height: 100px; background: purple; }
parent { display: paragraph; }
child { background: salmon; }
canvas { height: 50px; background-color: pink; }
inline-block { display: inline-block; width: 50px; height: 50px; background: green; }
inline-flex { display: inline-flex; width: 50px; height: 50px; background: green; }
grand-child { width: 50px; height: 50px; transform: translate3d(100px, 0, 0); background: papayawhip; }
</style>
<foo /><bar />
<parent>
<child>Foo bar</child>
<inline-block>
<inline-flex>
<grand-child />
</inline-block>
</inline-flex>
</parent>
<canvas />
<script>
@@ -57,11 +57,11 @@ void main() {
});
test("should hit test transformed child", () {
document.querySelector('parent').style["display"] = "block";
document.querySelector('parent').style["display"] = "flex";
document.querySelector('child').style["transform"] = "translate3d(100px, 0, 0)";
expect(document.elementFromPoint(50, 210).tagName, equals('parent'));
expect(document.elementFromPoint(150, 210).tagName, equals('child'));
expect(document.elementFromPoint(25, 240).tagName, equals('inline-block'));
expect(document.elementFromPoint(25, 240).tagName, equals('inline-flex'));
// TODO(ojan): This is incorrect. It should hit grand-child.
// This broke sometime before 4153b8a515d54275934d4244aaf2d5a7a8fe3333.
expect(document.elementFromPoint(150, 240).tagName, equals('sky'));

View File

@@ -1,8 +1,8 @@
layer at (0,0) size 800x600
RenderView {#document} at (0,0) size 800x600
RenderBlock {sky} at (0,0) size 800x94
RenderFlexibleBox {sky} at (0,0) size 800x94
layer at (0,0) size 56x69
RenderBlock {div} at (0,0) size 56x69 [border: (3px solid #0000FF)]
RenderFlexibleBox {div} at (0,0) size 56x69 [border: (3px solid #0000FF)]
RenderParagraph (anonymous) at (3,3) size 50x19
RenderText {#text} at (0,0) size 91x19
text run at (0,0) width 91: "These lines"

View File

@@ -1,5 +1,5 @@
layer at (0,0) size 800x600
RenderView {#document} at (0,0) size 800x600
RenderBlock {sky} at (0,0) size 800x50
RenderBlock {div} at (0,0) size 50x50 [bgcolor=#FFC0CB]
RenderFlexibleBox {sky} at (0,0) size 800x50
RenderFlexibleBox {div} at (0,0) size 50x50 [bgcolor=#FFC0CB]

View File

@@ -1,21 +1,21 @@
layer at (0,0) size 800x600
RenderView {#document} at (0,0) size 800x600
layer at (0,0) size 100x100
RenderBlock {block} at (0,0) size 100x100 [bgcolor=#FFC0CB]
RenderBlock {spacer} at (0,0) size 40x40 [bgcolor=#FFEFD5] [border: (5px solid #800080)]
RenderBlock {spacer} at (0,40) size 40x40 [bgcolor=#FFEFD5] [border: (5px solid #800080)]
RenderFlexibleBox {block} at (0,0) size 100x100 [bgcolor=#FFC0CB]
RenderFlexibleBox {spacer} at (0,0) size 40x40 [bgcolor=#FFEFD5] [border: (5px solid #800080)]
RenderFlexibleBox {spacer} at (0,40) size 40x40 [bgcolor=#FFEFD5] [border: (5px solid #800080)]
layer at (0,0) size 20x20
RenderBlock (positioned) {absolute} at (0,0) size 20x20 [bgcolor=#008000]
RenderFlexibleBox {absolute} at (0,0) size 20x20 [bgcolor=#008000]
layer at (0,150) size 100x100
RenderParagraph {paragraph} at (0,150) size 100x100 [bgcolor=#FFA500]
RenderBlock (inline-block) {spacer} at (0,0) size 40x40 [bgcolor=#FFEFD5] [border: (5px solid #800080)]
RenderBlock (inline-block) {spacer} at (40,0) size 40x40 [bgcolor=#FFEFD5] [border: (5px solid #800080)]
RenderFlexibleBox {spacer} at (0,0) size 40x40 [bgcolor=#FFEFD5] [border: (5px solid #800080)]
RenderFlexibleBox {spacer} at (40,0) size 40x40 [bgcolor=#FFEFD5] [border: (5px solid #800080)]
layer at (0,150) size 20x20
RenderBlock (positioned) {absolute} at (0,0) size 20x20 [bgcolor=#008000]
RenderFlexibleBox {absolute} at (0,0) size 20x20 [bgcolor=#008000]
layer at (0,300) size 100x100
RenderFlexibleBox {flex} at (0,300) size 100x100 [bgcolor=#FA8072]
RenderBlock {spacer} at (0,0) size 40x40 [bgcolor=#FFEFD5] [border: (5px solid #800080)]
RenderBlock {spacer} at (40,0) size 40x40 [bgcolor=#FFEFD5] [border: (5px solid #800080)]
RenderFlexibleBox {spacer} at (0,0) size 40x40 [bgcolor=#FFEFD5] [border: (5px solid #800080)]
RenderFlexibleBox {spacer} at (40,0) size 40x40 [bgcolor=#FFEFD5] [border: (5px solid #800080)]
layer at (0,300) size 20x20
RenderBlock (positioned) {absolute} at (0,0) size 20x20 [bgcolor=#008000]
RenderFlexibleBox {absolute} at (0,0) size 20x20 [bgcolor=#008000]

View File

@@ -16,6 +16,7 @@
flex {
background: salmon;
display: flex;
flex-direction: row;
}
spacer {
height: 30px;

View File

@@ -16,6 +16,7 @@
flex {
background: salmon;
display: flex;
flex-direction: row;
}
spacer {
height: 30px;

View File

@@ -1,23 +1,23 @@
layer at (0,0) size 800x600
RenderView {#document} at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {html} at (0,0) size 800x600
RenderBlock {head} at (0,0) size 800x0
RenderBlock {body} at (0,0) size 800x600 [bgcolor=#FFFFFF]
RenderBlock {div} at (0,0) size 800x265
RenderBlock {div} at (0,0) size 800x115
RenderFlexibleBox {html} at (0,0) size 800x600
RenderFlexibleBox {head} at (0,0) size 800x0
RenderFlexibleBox {body} at (0,0) size 800x600 [bgcolor=#FFFFFF]
RenderFlexibleBox {div} at (0,0) size 800x265
RenderFlexibleBox {div} at (0,0) size 800x115
RenderParagraph {div} at (15,15) size 770x49
RenderInline {a} at (0,0) size 242x48 [color=#333333]
RenderText {#text} at (528,0) size 242x48
text run at (528,0) width 242: "Adam Barth"
RenderBlock {div} at (15,64) size 770x36
RenderFlexibleBox {div} at (15,64) size 770x36
RenderParagraph {div} at (0,0) size 770x18
RenderText {#text} at (574,0) size 196x17
text run at (574,0) width 196: "Ph.D., M.S., Stanford, 2008"
RenderParagraph {div} at (0,18) size 770x18
RenderText {#text} at (635,0) size 135x17
text run at (635,0) width 135: "B.A., Cornell, 2003"
RenderBlock {div} at (0,115) size 800x150
RenderFlexibleBox {div} at (0,115) size 800x150
RenderParagraph {div} at (0,19) size 800x28
RenderInline {a} at (0,0) size 93x17 [color=#333333]
RenderText {#text} at (692,5) size 93x17

View File

@@ -1,6 +1,6 @@
layer at (0,0) size 800x600
RenderView {#document} at (0,0) size 800x600
RenderBlock {foo} at (0,0) size 800x19
RenderFlexibleBox {foo} at (0,0) size 800x19
RenderParagraph (anonymous) at (0,0) size 800x19
RenderText {#text} at (0,0) size 99x19
text run at (0,0) width 99: "Hello World!"

View File

@@ -1,11 +1,11 @@
layer at (0,0) size 800x600
RenderView {#document} at (0,0) size 800x600
RenderBlock {div} at (0,0) size 800x137
RenderBlock {div} at (32,32) size 736x38
RenderFlexibleBox {div} at (0,0) size 800x137
RenderFlexibleBox {div} at (32,32) size 736x38
RenderParagraph (anonymous) at (0,0) size 736x38
RenderText {#text} at (0,0) size 191x38
text run at (0,0) width 191: "about:blank"
RenderBlock {div} at (16,110) size 768x19 [color=#BCD8F5]
RenderFlexibleBox {div} at (16,110) size 768x19 [color=#BCD8F5]
RenderParagraph (anonymous) at (0,0) size 768x19
RenderText {#text} at (0,0) size 152x19
text run at (0,0) width 152: "Welcome to Sky!"

View File

@@ -1,26 +1,26 @@
layer at (0,0) size 800x600
RenderView {#document} at (0,0) size 800x600
RenderBlock {sky} at (0,0) size 800x506
RenderBlock {div} at (0,0) size 800x228
RenderFlexibleBox {sky} at (0,0) size 800x506
RenderFlexibleBox {div} at (0,0) size 800x228
RenderParagraph (anonymous) at (0,0) size 800x19
RenderText {#text} at (0,0) size 76x19
text run at (0,0) width 76: "This is an"
RenderParagraph (anonymous) at (0,209) size 800x19
RenderText {#text} at (0,0) size 72x19
text run at (0,0) width 72: "element."
RenderBlock {div} at (0,228) size 800x200
RenderFlexibleBox {div} at (0,228) size 800x200
RenderParagraph (anonymous) at (0,0) size 800x19
RenderText {#text} at (0,0) size 99x19
text run at (0,0) width 99: "Placeholder."
RenderBlock {div} at (0,428) size 800x78
RenderFlexibleBox {div} at (0,428) size 800x78
RenderParagraph (anonymous) at (0,0) size 800x19
RenderText {#text} at (0,0) size 218x19
text run at (0,0) width 218: "Small iframe should render"
RenderParagraph (anonymous) at (0,59) size 800x19
RenderText {#text} at (0,0) size 76x19
text run at (0,0) width 76: "correctly."
layer at (0,19) size 340x190
RenderReplaced {iframe} at (0,19) size 340x190 [border: (20px solid #000000)]
layer at (0,447) size 300x40
RenderReplaced {iframe} at (0,19) size 300x40
layer at (0,19) size 800x190
RenderReplaced {iframe} at (0,19) size 800x190 [border: (20px solid #000000)]
layer at (0,447) size 800x40
RenderReplaced {iframe} at (0,19) size 800x40

View File

@@ -1,6 +1,6 @@
layer at (0,0) size 800x600
RenderView {#document} at (0,0) size 800x600
RenderBlock {foo} at (0,0) size 800x89
RenderImage {img} at (0,0) size 256x64
RenderFlexibleBox {foo} at (0,0) size 800x89
RenderImage {img} at (0,0) size 800x64
RenderImage {img} at (0,64) size 100x25