| 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 #include "sky/engine/config.h" | 5 #include "sky/engine/config.h" |
| 6 #include "sky/engine/core/rendering/RenderParagraph.h" | 6 #include "sky/engine/core/rendering/RenderParagraph.h" |
| 7 | 7 |
| 8 #include "sky/engine/core/rendering/BidiRunForLine.h" | 8 #include "sky/engine/core/rendering/BidiRunForLine.h" |
| 9 #include "sky/engine/core/rendering/InlineIterator.h" | 9 #include "sky/engine/core/rendering/InlineIterator.h" |
| 10 #include "sky/engine/core/rendering/RenderLayer.h" | 10 #include "sky/engine/core/rendering/RenderLayer.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 { | 38 { |
| 39 } | 39 } |
| 40 | 40 |
| 41 const char* RenderParagraph::renderName() const | 41 const char* RenderParagraph::renderName() const |
| 42 { | 42 { |
| 43 if (isAnonymous()) | 43 if (isAnonymous()) |
| 44 return "RenderParagraph (anonymous)"; | 44 return "RenderParagraph (anonymous)"; |
| 45 return "RenderParagraph"; | 45 return "RenderParagraph"; |
| 46 } | 46 } |
| 47 | 47 |
| 48 RenderParagraph* RenderParagraph::createAnonymous(Document& document) | |
| 49 { | |
| 50 RenderParagraph* renderer = new RenderParagraph(0); | |
| 51 renderer->setDocumentForAnonymous(&document); | |
| 52 return renderer; | |
| 53 } | |
| 54 | |
| 55 LayoutUnit RenderParagraph::logicalLeftSelectionOffset(RenderBlock* rootBlock, L
ayoutUnit position) | 48 LayoutUnit RenderParagraph::logicalLeftSelectionOffset(RenderBlock* rootBlock, L
ayoutUnit position) |
| 56 { | 49 { |
| 57 LayoutUnit logicalLeft = logicalLeftOffsetForLine(false); | 50 LayoutUnit logicalLeft = logicalLeftOffsetForLine(false); |
| 58 if (logicalLeft == logicalLeftOffsetForContent()) | 51 if (logicalLeft == logicalLeftOffsetForContent()) |
| 59 return RenderBlock::logicalLeftSelectionOffset(rootBlock, position); | 52 return RenderBlock::logicalLeftSelectionOffset(rootBlock, position); |
| 60 | 53 |
| 61 RenderBlock* cb = this; | 54 RenderBlock* cb = this; |
| 62 while (cb != rootBlock) { | 55 while (cb != rootBlock) { |
| 63 logicalLeft += cb->logicalLeft(); | 56 logicalLeft += cb->logicalLeft(); |
| 64 cb = cb->containingBlock(); | 57 cb = cb->containingBlock(); |
| (...skipping 1640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1705 curr->adjustLogicalPosition(logicalLeft, 0); | 1698 curr->adjustLogicalPosition(logicalLeft, 0); |
| 1706 else | 1699 else |
| 1707 curr->adjustLogicalPosition(logicalLeft - (availableLogicalW
idth - totalLogicalWidth), 0); | 1700 curr->adjustLogicalPosition(logicalLeft - (availableLogicalW
idth - totalLogicalWidth), 0); |
| 1708 } | 1701 } |
| 1709 } | 1702 } |
| 1710 firstLine = false; | 1703 firstLine = false; |
| 1711 } | 1704 } |
| 1712 } | 1705 } |
| 1713 | 1706 |
| 1714 } // namespace blink | 1707 } // namespace blink |
| OLD | NEW |