Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 2916493002: Make SelectionState enum class (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2009 Google Inc. All rights reserved. 8 * Copyright (C) 2009 Google Inc. All rights reserved.
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/) 10 * (http://www.torchmobile.com/)
(...skipping 2574 matching lines...) Expand 10 before | Expand all | Expand 10 after
2585 } 2585 }
2586 2586
2587 inline LayoutObject* LayoutObject::ParentCrossingFrames() const { 2587 inline LayoutObject* LayoutObject::ParentCrossingFrames() const {
2588 if (IsLayoutView()) 2588 if (IsLayoutView())
2589 return GetFrame()->OwnerLayoutObject(); 2589 return GetFrame()->OwnerLayoutObject();
2590 return Parent(); 2590 return Parent();
2591 } 2591 }
2592 2592
2593 bool LayoutObject::IsSelectionBorder() const { 2593 bool LayoutObject::IsSelectionBorder() const {
2594 SelectionState st = GetSelectionState(); 2594 SelectionState st = GetSelectionState();
2595 return st == SelectionStart || st == SelectionEnd || st == SelectionBoth; 2595 return st == SelectionState::kStart || st == SelectionState::kEnd ||
2596 st == SelectionState::kStartAndEnd;
2596 } 2597 }
2597 2598
2598 inline void LayoutObject::ClearLayoutRootIfNeeded() const { 2599 inline void LayoutObject::ClearLayoutRootIfNeeded() const {
2599 if (LocalFrameView* view = GetFrameView()) { 2600 if (LocalFrameView* view = GetFrameView()) {
2600 if (!DocumentBeingDestroyed()) 2601 if (!DocumentBeingDestroyed())
2601 view->ClearLayoutSubtreeRoot(*this); 2602 view->ClearLayoutSubtreeRoot(*this);
2602 } 2603 }
2603 } 2604 }
2604 2605
2605 void LayoutObject::WillBeDestroyed() { 2606 void LayoutObject::WillBeDestroyed() {
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after
3602 if (!block->HasSelectedChildren()) 3603 if (!block->HasSelectedChildren())
3603 return; 3604 return;
3604 3605
3605 // ::selection style only applies to direct selection leaf children of the 3606 // ::selection style only applies to direct selection leaf children of the
3606 // element on which the ::selection style is set. Thus, we only walk the 3607 // element on which the ::selection style is set. Thus, we only walk the
3607 // direct children here. 3608 // direct children here.
3608 for (LayoutObject* child = SlowFirstChild(); child; 3609 for (LayoutObject* child = SlowFirstChild(); child;
3609 child = child->NextSibling()) { 3610 child = child->NextSibling()) {
3610 if (!child->CanBeSelectionLeaf()) 3611 if (!child->CanBeSelectionLeaf())
3611 continue; 3612 continue;
3612 if (child->GetSelectionState() == SelectionNone) 3613 if (child->GetSelectionState() == SelectionState::kNone)
3613 continue; 3614 continue;
3614 child->SetShouldInvalidateSelection(); 3615 child->SetShouldInvalidateSelection();
3615 } 3616 }
3616 } 3617 }
3617 3618
3618 } // namespace blink 3619 } // namespace blink
3619 3620
3620 #ifndef NDEBUG 3621 #ifndef NDEBUG
3621 3622
3622 void showTree(const blink::LayoutObject* object) { 3623 void showTree(const blink::LayoutObject* object) {
(...skipping 20 matching lines...) Expand all
3643 const blink::LayoutObject* root = object1; 3644 const blink::LayoutObject* root = object1;
3644 while (root->Parent()) 3645 while (root->Parent())
3645 root = root->Parent(); 3646 root = root->Parent();
3646 root->ShowLayoutTreeAndMark(object1, "*", object2, "-", 0); 3647 root->ShowLayoutTreeAndMark(object1, "*", object2, "-", 0);
3647 } else { 3648 } else {
3648 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3649 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3649 } 3650 }
3650 } 3651 }
3651 3652
3652 #endif 3653 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/layout/LayoutReplaced.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698