OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 std::max(PrevRootBox()->LineBottom(), LineTop()) - result; | 336 std::max(PrevRootBox()->LineBottom(), LineTop()) - result; |
337 result = | 337 result = |
338 PrevRootBox()->ComputeOverAnnotationAdjustment(lowest_allowed_position); | 338 PrevRootBox()->ComputeOverAnnotationAdjustment(lowest_allowed_position); |
339 } | 339 } |
340 | 340 |
341 return result; | 341 return result; |
342 } | 342 } |
343 | 343 |
344 SelectionState RootInlineBox::GetSelectionState() const { | 344 SelectionState RootInlineBox::GetSelectionState() const { |
345 // Walk over all of the selected boxes. | 345 // Walk over all of the selected boxes. |
346 SelectionState state = SelectionNone; | 346 SelectionState state = SelectionState::kNone; |
347 for (InlineBox* box = FirstLeafChild(); box; box = box->NextLeafChild()) { | 347 for (InlineBox* box = FirstLeafChild(); box; box = box->NextLeafChild()) { |
348 SelectionState box_state = box->GetSelectionState(); | 348 SelectionState box_state = box->GetSelectionState(); |
349 if ((box_state == SelectionStart && state == SelectionEnd) || | 349 if ((box_state == SelectionState::kStart && |
350 (box_state == SelectionEnd && state == SelectionStart)) { | 350 state == SelectionState::kEnd) || |
351 state = SelectionBoth; | 351 (box_state == SelectionState::kEnd && |
352 } else if (state == SelectionNone || | 352 state == SelectionState::kStart)) { |
353 ((box_state == SelectionStart || box_state == SelectionEnd) && | 353 state = SelectionState::kStartAndEnd; |
354 (state == SelectionNone || state == SelectionInside))) { | 354 } else if (state == SelectionState::kNone || |
| 355 ((box_state == SelectionState::kStart || |
| 356 box_state == SelectionState::kEnd) && |
| 357 (state == SelectionState::kNone || |
| 358 state == SelectionState::kInside))) { |
355 state = box_state; | 359 state = box_state; |
356 } else if (box_state == SelectionNone && state == SelectionStart) { | 360 } else if (box_state == SelectionState::kNone && |
| 361 state == SelectionState::kStart) { |
357 // We are past the end of the selection. | 362 // We are past the end of the selection. |
358 state = SelectionBoth; | 363 state = SelectionState::kStartAndEnd; |
359 } | 364 } |
360 if (state == SelectionBoth) | 365 if (state == SelectionState::kStartAndEnd) |
361 break; | 366 break; |
362 } | 367 } |
363 | 368 |
364 return state; | 369 return state; |
365 } | 370 } |
366 | 371 |
367 InlineBox* RootInlineBox::FirstSelectedBox() const { | 372 InlineBox* RootInlineBox::FirstSelectedBox() const { |
368 for (InlineBox* box = FirstLeafChild(); box; box = box->NextLeafChild()) { | 373 for (InlineBox* box = FirstLeafChild(); box; box = box->NextLeafChild()) { |
369 if (box->GetSelectionState() != SelectionNone) | 374 if (box->GetSelectionState() != SelectionState::kNone) |
370 return box; | 375 return box; |
371 } | 376 } |
372 | 377 |
373 return nullptr; | 378 return nullptr; |
374 } | 379 } |
375 | 380 |
376 InlineBox* RootInlineBox::LastSelectedBox() const { | 381 InlineBox* RootInlineBox::LastSelectedBox() const { |
377 for (InlineBox* box = LastLeafChild(); box; box = box->PrevLeafChild()) { | 382 for (InlineBox* box = LastLeafChild(); box; box = box->PrevLeafChild()) { |
378 if (box->GetSelectionState() != SelectionNone) | 383 if (box->GetSelectionState() != SelectionState::kNone) |
379 return box; | 384 return box; |
380 } | 385 } |
381 | 386 |
382 return nullptr; | 387 return nullptr; |
383 } | 388 } |
384 | 389 |
385 LayoutUnit RootInlineBox::SelectionTop() const { | 390 LayoutUnit RootInlineBox::SelectionTop() const { |
386 LayoutUnit selection_top = line_top_; | 391 LayoutUnit selection_top = line_top_; |
387 if (has_annotations_before_) | 392 if (has_annotations_before_) |
388 selection_top -= !GetLineLayoutItem().Style()->IsFlippedLinesWritingMode() | 393 selection_top -= !GetLineLayoutItem().Style()->IsFlippedLinesWritingMode() |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 } | 792 } |
788 end_box = nullptr; | 793 end_box = nullptr; |
789 return nullptr; | 794 return nullptr; |
790 } | 795 } |
791 | 796 |
792 const char* RootInlineBox::BoxName() const { | 797 const char* RootInlineBox::BoxName() const { |
793 return "RootInlineBox"; | 798 return "RootInlineBox"; |
794 } | 799 } |
795 | 800 |
796 } // namespace blink | 801 } // namespace blink |
OLD | NEW |