| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) |
| 4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
| 5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2011-2012. 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 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 if (GetNode()) { | 909 if (GetNode()) { |
| 910 if (line_direction_position <= LogicalLeft() + (LogicalWidth() / 2)) | 910 if (line_direction_position <= LogicalLeft() + (LogicalWidth() / 2)) |
| 911 return CreatePositionWithAffinity(0); | 911 return CreatePositionWithAffinity(0); |
| 912 return CreatePositionWithAffinity(1); | 912 return CreatePositionWithAffinity(1); |
| 913 } | 913 } |
| 914 | 914 |
| 915 return LayoutBox::PositionForPoint(point); | 915 return LayoutBox::PositionForPoint(point); |
| 916 } | 916 } |
| 917 | 917 |
| 918 LayoutRect LayoutReplaced::LocalSelectionRect() const { | 918 LayoutRect LayoutReplaced::LocalSelectionRect() const { |
| 919 if (GetSelectionState() == SelectionNone) | 919 if (GetSelectionState() == SelectionState::kNone) |
| 920 return LayoutRect(); | 920 return LayoutRect(); |
| 921 | 921 |
| 922 if (!InlineBoxWrapper()) { | 922 if (!InlineBoxWrapper()) { |
| 923 // We're a block-level replaced element. Just return our own dimensions. | 923 // We're a block-level replaced element. Just return our own dimensions. |
| 924 return LayoutRect(LayoutPoint(), Size()); | 924 return LayoutRect(LayoutPoint(), Size()); |
| 925 } | 925 } |
| 926 | 926 |
| 927 RootInlineBox& root = InlineBoxWrapper()->Root(); | 927 RootInlineBox& root = InlineBoxWrapper()->Root(); |
| 928 LayoutUnit new_logical_top = | 928 LayoutUnit new_logical_top = |
| 929 root.Block().Style()->IsFlippedBlocksWritingMode() | 929 root.Block().Style()->IsFlippedBlocksWritingMode() |
| 930 ? InlineBoxWrapper()->LogicalBottom() - root.SelectionBottom() | 930 ? InlineBoxWrapper()->LogicalBottom() - root.SelectionBottom() |
| 931 : root.SelectionTop() - InlineBoxWrapper()->LogicalTop(); | 931 : root.SelectionTop() - InlineBoxWrapper()->LogicalTop(); |
| 932 if (root.Block().Style()->IsHorizontalWritingMode()) | 932 if (root.Block().Style()->IsHorizontalWritingMode()) |
| 933 return LayoutRect(LayoutUnit(), new_logical_top, Size().Width(), | 933 return LayoutRect(LayoutUnit(), new_logical_top, Size().Width(), |
| 934 root.SelectionHeight()); | 934 root.SelectionHeight()); |
| 935 return LayoutRect(new_logical_top, LayoutUnit(), root.SelectionHeight(), | 935 return LayoutRect(new_logical_top, LayoutUnit(), root.SelectionHeight(), |
| 936 Size().Height()); | 936 Size().Height()); |
| 937 } | 937 } |
| 938 | 938 |
| 939 void LayoutReplaced::SetSelectionState(SelectionState state) { | 939 void LayoutReplaced::SetSelectionState(SelectionState state) { |
| 940 // The selection state for our containing block hierarchy is updated by the | 940 // The selection state for our containing block hierarchy is updated by the |
| 941 // base class call. | 941 // base class call. |
| 942 LayoutBox::SetSelectionState(state); | 942 LayoutBox::SetSelectionState(state); |
| 943 | 943 |
| 944 if (!InlineBoxWrapper()) | 944 if (!InlineBoxWrapper()) |
| 945 return; | 945 return; |
| 946 | 946 |
| 947 if (CanUpdateSelectionOnRootLineBoxes()) | 947 if (CanUpdateSelectionOnRootLineBoxes()) { |
| 948 InlineBoxWrapper()->Root().SetHasSelectedChildren(state != SelectionNone); | 948 InlineBoxWrapper()->Root().SetHasSelectedChildren(state != |
| 949 SelectionState::kNone); |
| 950 } |
| 949 } | 951 } |
| 950 | 952 |
| 951 void LayoutReplaced::IntrinsicSizingInfo::Transpose() { | 953 void LayoutReplaced::IntrinsicSizingInfo::Transpose() { |
| 952 size = size.TransposedSize(); | 954 size = size.TransposedSize(); |
| 953 aspect_ratio = aspect_ratio.TransposedSize(); | 955 aspect_ratio = aspect_ratio.TransposedSize(); |
| 954 std::swap(has_width, has_height); | 956 std::swap(has_width, has_height); |
| 955 } | 957 } |
| 956 | 958 |
| 957 } // namespace blink | 959 } // namespace blink |
| OLD | NEW |