Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * Copyright (C) 2003, 2006, 2007, 2009 Apple Inc. All rights reserved. | 4 * Copyright (C) 2003, 2006, 2007, 2009 Apple Inc. All rights reserved. |
| 5 * Copyright (C) 2010 Google Inc. All rights reserved. | 5 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 // | 79 // |
| 80 // An important member of this class is PaintLayer. This class is | 80 // An important member of this class is PaintLayer. This class is |
| 81 // central to painting and hit-testing (see its class comment). | 81 // central to painting and hit-testing (see its class comment). |
| 82 // PaintLayers are instantiated for several reasons based on the | 82 // PaintLayers are instantiated for several reasons based on the |
| 83 // return value of layerTypeRequired(). | 83 // return value of layerTypeRequired(). |
| 84 // Interestingly, most SVG objects inherit from LayoutSVGModelObject and thus | 84 // Interestingly, most SVG objects inherit from LayoutSVGModelObject and thus |
| 85 // can't have a PaintLayer. This is an unfortunate artifact of our | 85 // can't have a PaintLayer. This is an unfortunate artifact of our |
| 86 // design as it limits code sharing and prevents hardware accelerating SVG | 86 // design as it limits code sharing and prevents hardware accelerating SVG |
| 87 // (the current design require a PaintLayer for compositing). | 87 // (the current design require a PaintLayer for compositing). |
| 88 // | 88 // |
| 89 // | 89 // For more on the coordinate systems used by this class and its subclasses, see |
| 90 // ***** COORDINATE SYSTEMS ***** | 90 // Source/core/layout/README.md ### Coordinate Spaces. |
|
eae
2016/09/29 23:06:08
Thank you for updating the README file, please lea
wkorman
2016/09/29 23:24:30
Done.
| |
| 91 // | |
| 92 // In order to fully understand LayoutBoxModelObject and the inherited classes, | |
| 93 // we need to introduce the concept of coordinate systems. | |
| 94 // There is 3 main coordinate systems: | |
| 95 // - physical coordinates: it is the coordinate system used for painting and | |
| 96 // correspond to physical direction as seen on the physical display (screen, | |
| 97 // printed page). In CSS, 'top', 'right', 'bottom', 'left' are all in physical | |
| 98 // coordinates. The code matches this convention too. | |
| 99 // | |
| 100 // - logical coordinates: this is the coordinate system used for layout. It is | |
| 101 // determined by 'writing-mode' and 'direction'. Any property using 'before', | |
| 102 // 'after', 'start' or 'end' is in logical coordinates. Those are also named | |
| 103 // respectively 'logical top', 'logical bottom', 'logical left' and | |
| 104 // 'logical right'. | |
| 105 // | |
| 106 // Example with writing-mode: vertical-rl; direction: ltr; | |
| 107 // | |
| 108 // 'top' / 'start' side | |
| 109 // | |
| 110 // block-flow direction | |
| 111 // <------------------------------------ | | |
| 112 // ------------------------------------- | | |
| 113 // | c | s | | | |
| 114 // 'left' | o | o | | inline 'right' | |
| 115 // / | n | m | | direction / | |
| 116 // 'after' | t | e | | 'before' | |
| 117 // side | e | | | side | |
| 118 // | n | | | | |
| 119 // | t | | | | |
| 120 // ------------------------------------- v | |
| 121 // | |
| 122 // 'bottom' / 'end' side | |
| 123 // | |
| 124 // See https://drafts.csswg.org/css-writing-modes-3/#text-flow for some | |
| 125 // extra details. | |
| 126 // | |
| 127 // - physical coordinates with flipped block-flow direction: those are physical | |
| 128 // coordinates but we flipped the block direction. See | |
| 129 // LayoutBox::noOverflowRect. | |
| 130 // TODO(jchaffraix): I don't fully understand why we need this coordinate | |
| 131 // system someone should fill in those details. | |
| 132 class CORE_EXPORT LayoutBoxModelObject : public LayoutObject { | 91 class CORE_EXPORT LayoutBoxModelObject : public LayoutObject { |
| 133 public: | 92 public: |
| 134 LayoutBoxModelObject(ContainerNode*); | 93 LayoutBoxModelObject(ContainerNode*); |
| 135 ~LayoutBoxModelObject() override; | 94 ~LayoutBoxModelObject() override; |
| 136 | 95 |
| 137 // This is the only way layers should ever be destroyed. | 96 // This is the only way layers should ever be destroyed. |
| 138 void destroyLayer(); | 97 void destroyLayer(); |
| 139 | 98 |
| 140 LayoutSize relativePositionOffset() const; | 99 LayoutSize relativePositionOffset() const; |
| 141 LayoutSize relativePositionLogicalOffset() const { return style()->isHorizon talWritingMode() ? relativePositionOffset() : relativePositionOffset().transpose dSize(); } | 100 LayoutSize relativePositionLogicalOffset() const { return style()->isHorizon talWritingMode() ? relativePositionOffset() : relativePositionOffset().transpose dSize(); } |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 380 std::unique_ptr<PaintLayer> m_layer; | 339 std::unique_ptr<PaintLayer> m_layer; |
| 381 | 340 |
| 382 std::unique_ptr<LayoutBoxModelObjectRareData> m_rareData; | 341 std::unique_ptr<LayoutBoxModelObjectRareData> m_rareData; |
| 383 }; | 342 }; |
| 384 | 343 |
| 385 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBoxModelObject, isBoxModelObject()); | 344 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBoxModelObject, isBoxModelObject()); |
| 386 | 345 |
| 387 } // namespace blink | 346 } // namespace blink |
| 388 | 347 |
| 389 #endif // LayoutBoxModelObject_h | 348 #endif // LayoutBoxModelObject_h |
| OLD | NEW |