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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBoxModelObject.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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2010 Google Inc. All rights reserved. 7 * Copyright (C) 2010 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 LayoutBoxModelObject* FloatStateForStyleChange::box_model_object_ = nullptr; 110 LayoutBoxModelObject* FloatStateForStyleChange::box_model_object_ = nullptr;
111 111
112 // The HashMap for storing continuation pointers. 112 // The HashMap for storing continuation pointers.
113 // The continuation chain is a singly linked list. As such, the HashMap's value 113 // The continuation chain is a singly linked list. As such, the HashMap's value
114 // is the next pointer associated with the key. 114 // is the next pointer associated with the key.
115 typedef HashMap<const LayoutBoxModelObject*, LayoutBoxModelObject*> 115 typedef HashMap<const LayoutBoxModelObject*, LayoutBoxModelObject*>
116 ContinuationMap; 116 ContinuationMap;
117 static ContinuationMap* g_continuation_map = nullptr; 117 static ContinuationMap* g_continuation_map = nullptr;
118 118
119 void LayoutBoxModelObject::SetSelectionState(SelectionState state) { 119 void LayoutBoxModelObject::SetSelectionState(SelectionState state) {
120 if (state == SelectionInside && GetSelectionState() != SelectionNone) 120 if (state == SelectionState::kInside &&
121 GetSelectionState() != SelectionState::kNone)
121 return; 122 return;
122 123
123 if ((state == SelectionStart && GetSelectionState() == SelectionEnd) || 124 if ((state == SelectionState::kStart &&
124 (state == SelectionEnd && GetSelectionState() == SelectionStart)) 125 GetSelectionState() == SelectionState::kEnd) ||
125 LayoutObject::SetSelectionState(SelectionBoth); 126 (state == SelectionState::kEnd &&
127 GetSelectionState() == SelectionState::kStart))
128 LayoutObject::SetSelectionState(SelectionState::kStartAndEnd);
126 else 129 else
127 LayoutObject::SetSelectionState(state); 130 LayoutObject::SetSelectionState(state);
128 131
129 // FIXME: We should consider whether it is OK propagating to ancestor 132 // FIXME: We should consider whether it is OK propagating to ancestor
130 // LayoutInlines. This is a workaround for http://webkit.org/b/32123 133 // LayoutInlines. This is a workaround for http://webkit.org/b/32123
131 // The containing block can be null in case of an orphaned tree. 134 // The containing block can be null in case of an orphaned tree.
132 LayoutBlock* containing_block = this->ContainingBlock(); 135 LayoutBlock* containing_block = this->ContainingBlock();
133 if (containing_block && !containing_block->IsLayoutView()) 136 if (containing_block && !containing_block->IsLayoutView())
134 containing_block->SetSelectionState(state); 137 containing_block->SetSelectionState(state);
135 } 138 }
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 if (root_element_style->HasBackground()) 1486 if (root_element_style->HasBackground())
1484 return false; 1487 return false;
1485 1488
1486 if (GetNode() != GetDocument().FirstBodyElement()) 1489 if (GetNode() != GetDocument().FirstBodyElement())
1487 return false; 1490 return false;
1488 1491
1489 return true; 1492 return true;
1490 } 1493 }
1491 1494
1492 } // namespace blink 1495 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutListMarker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698