| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.distiller.webdocument; | 5 package org.chromium.distiller.webdocument; |
| 6 | 6 |
| 7 import org.chromium.distiller.DomUtil; | 7 import org.chromium.distiller.DomUtil; |
| 8 import org.chromium.distiller.labels.DefaultLabels; | 8 import org.chromium.distiller.labels.DefaultLabels; |
| 9 | 9 |
| 10 import com.google.gwt.core.client.JavaScriptObject; | 10 import com.google.gwt.core.client.JavaScriptObject; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 public static ElementAction getForElement(Element element) { | 25 public static ElementAction getForElement(Element element) { |
| 26 Style style = DomUtil.getComputedStyle(element); | 26 Style style = DomUtil.getComputedStyle(element); |
| 27 ElementAction action = new ElementAction(); | 27 ElementAction action = new ElementAction(); |
| 28 switch (style.getDisplay()) { | 28 switch (style.getDisplay()) { |
| 29 case "inline": | 29 case "inline": |
| 30 break; | 30 break; |
| 31 case "inline-block": | 31 case "inline-block": |
| 32 case "inline-flex": | 32 case "inline-flex": |
| 33 action.changesTagLevel = true; | 33 action.changesTagLevel = true; |
| 34 break; | 34 break; |
| 35 case "list-item": |
| 36 Element parentElement = element.getParentElement(); |
| 37 if (parentElement == null || !parentElement.getTagName().equals(
"OL")) { |
| 38 action.flush = true; |
| 39 action.changesTagLevel = true; |
| 40 } |
| 41 break; |
| 35 // See http://www.w3.org/TR/CSS2/tables.html#table-display | 42 // See http://www.w3.org/TR/CSS2/tables.html#table-display |
| 36 // and http://www.w3.org/TR/css-flexbox-1/#flex-containers | 43 // and http://www.w3.org/TR/css-flexbox-1/#flex-containers |
| 37 // The default case includes the following display types: | 44 // The default case includes the following display types: |
| 38 // block | 45 // block |
| 39 // list-item | 46 // list-item |
| 40 // inline-table | 47 // inline-table |
| 41 // table-row | 48 // table-row |
| 42 // table-row-group | 49 // table-row-group |
| 43 // table-header-group | 50 // table-header-group |
| 44 // table-footer-group | 51 // table-footer-group |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 action.isAnchor = true; | 98 action.isAnchor = true; |
| 92 } | 99 } |
| 93 break; | 100 break; |
| 94 } | 101 } |
| 95 } | 102 } |
| 96 return action; | 103 return action; |
| 97 } | 104 } |
| 98 | 105 |
| 99 private ElementAction() {} | 106 private ElementAction() {} |
| 100 } | 107 } |
| OLD | NEW |