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

Side by Side Diff: third_party/WebKit/Source/core/dom/TreeScope.cpp

Issue 2653523003: Make DOMSelection cache Range (Closed)
Patch Set: update Created 3 years, 10 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) 2011 Google Inc. All Rights Reserved. 2 * Copyright (C) 2011 Google Inc. All Rights Reserved.
3 * Copyright (C) 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 297
298 return elementsFromHitTestResult(result); 298 return elementsFromHitTestResult(result);
299 } 299 }
300 300
301 SVGTreeScopeResources& TreeScope::ensureSVGTreeScopedResources() { 301 SVGTreeScopeResources& TreeScope::ensureSVGTreeScopedResources() {
302 if (!m_svgTreeScopedResources) 302 if (!m_svgTreeScopedResources)
303 m_svgTreeScopedResources = new SVGTreeScopeResources(this); 303 m_svgTreeScopedResources = new SVGTreeScopeResources(this);
304 return *m_svgTreeScopedResources; 304 return *m_svgTreeScopedResources;
305 } 305 }
306 306
307 bool TreeScope::hasSelection() const {
308 return rootNode().document().frame() && m_selection;
309 }
310
307 DOMSelection* TreeScope::getSelection() const { 311 DOMSelection* TreeScope::getSelection() const {
308 if (!rootNode().document().frame()) 312 if (!rootNode().document().frame())
309 return nullptr; 313 return nullptr;
310 314
311 if (m_selection) 315 if (m_selection)
312 return m_selection.get(); 316 return m_selection.get();
313 317
314 // FIXME: The correct selection in Shadow DOM requires that Position can have 318 // FIXME: The correct selection in Shadow DOM requires that Position can have
315 // a ShadowRoot as a container. See 319 // a ShadowRoot as a container. See
316 // https://bugs.webkit.org/show_bug.cgi?id=82697 320 // https://bugs.webkit.org/show_bug.cgi?id=82697
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 visitor->trace(m_idTargetObserverRegistry); 533 visitor->trace(m_idTargetObserverRegistry);
530 visitor->trace(m_selection); 534 visitor->trace(m_selection);
531 visitor->trace(m_elementsById); 535 visitor->trace(m_elementsById);
532 visitor->trace(m_imageMapsByName); 536 visitor->trace(m_imageMapsByName);
533 visitor->trace(m_scopedStyleResolver); 537 visitor->trace(m_scopedStyleResolver);
534 visitor->trace(m_radioButtonGroupScope); 538 visitor->trace(m_radioButtonGroupScope);
535 visitor->trace(m_svgTreeScopedResources); 539 visitor->trace(m_svgTreeScopedResources);
536 } 540 }
537 541
538 } // namespace blink 542 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698