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

Side by Side Diff: Source/core/testing/Internals.cpp

Issue 33353003: Have Frame::tree() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/svg/SVGSVGElement.cpp ('k') | Source/core/xml/parser/XMLDocumentParser.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 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 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 toHTMLInputElement(element)->selectColorInColorChooser(Color(colorValue)); 686 toHTMLInputElement(element)->selectColorInColorChooser(Color(colorValue));
687 } 687 }
688 688
689 Vector<String> Internals::formControlStateOfPreviousHistoryItem(ExceptionState& es) 689 Vector<String> Internals::formControlStateOfPreviousHistoryItem(ExceptionState& es)
690 { 690 {
691 HistoryItem* mainItem = frame()->loader()->history()->previousItem(); 691 HistoryItem* mainItem = frame()->loader()->history()->previousItem();
692 if (!mainItem) { 692 if (!mainItem) {
693 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 693 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
694 return Vector<String>(); 694 return Vector<String>();
695 } 695 }
696 String uniqueName = frame()->tree()->uniqueName(); 696 String uniqueName = frame()->tree().uniqueName();
697 if (mainItem->target() != uniqueName && !mainItem->childItemWithTarget(uniqu eName)) { 697 if (mainItem->target() != uniqueName && !mainItem->childItemWithTarget(uniqu eName)) {
698 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 698 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
699 return Vector<String>(); 699 return Vector<String>();
700 } 700 }
701 return mainItem->target() == uniqueName ? mainItem->documentState() : mainIt em->childItemWithTarget(uniqueName)->documentState(); 701 return mainItem->target() == uniqueName ? mainItem->documentState() : mainIt em->childItemWithTarget(uniqueName)->documentState();
702 } 702 }
703 703
704 void Internals::setFormControlStateOfPreviousHistoryItem(const Vector<String>& s tate, ExceptionState& es) 704 void Internals::setFormControlStateOfPreviousHistoryItem(const Vector<String>& s tate, ExceptionState& es)
705 { 705 {
706 HistoryItem* mainItem = frame()->loader()->history()->previousItem(); 706 HistoryItem* mainItem = frame()->loader()->history()->previousItem();
707 if (!mainItem) { 707 if (!mainItem) {
708 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 708 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
709 return; 709 return;
710 } 710 }
711 String uniqueName = frame()->tree()->uniqueName(); 711 String uniqueName = frame()->tree().uniqueName();
712 if (mainItem->target() == uniqueName) 712 if (mainItem->target() == uniqueName)
713 mainItem->setDocumentState(state); 713 mainItem->setDocumentState(state);
714 else if (HistoryItem* subItem = mainItem->childItemWithTarget(uniqueName)) 714 else if (HistoryItem* subItem = mainItem->childItemWithTarget(uniqueName))
715 subItem->setDocumentState(state); 715 subItem->setDocumentState(state);
716 else 716 else
717 es.throwUninformativeAndGenericDOMException(InvalidAccessError); 717 es.throwUninformativeAndGenericDOMException(InvalidAccessError);
718 } 718 }
719 719
720 void Internals::enableMockSpeechSynthesizer() 720 void Internals::enableMockSpeechSynthesizer()
721 { 721 {
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
1610 return document->frame()->spellChecker().selectionStartHasMarkerFor(Document Marker::Grammar, from, length); 1610 return document->frame()->spellChecker().selectionStartHasMarkerFor(Document Marker::Grammar, from, length);
1611 } 1611 }
1612 1612
1613 unsigned Internals::numberOfScrollableAreas(Document* document, ExceptionState&) 1613 unsigned Internals::numberOfScrollableAreas(Document* document, ExceptionState&)
1614 { 1614 {
1615 unsigned count = 0; 1615 unsigned count = 0;
1616 Frame* frame = document->frame(); 1616 Frame* frame = document->frame();
1617 if (frame->view()->scrollableAreas()) 1617 if (frame->view()->scrollableAreas())
1618 count += frame->view()->scrollableAreas()->size(); 1618 count += frame->view()->scrollableAreas()->size();
1619 1619
1620 for (Frame* child = frame->tree()->firstChild(); child; child = child->tree( )->nextSibling()) { 1620 for (Frame* child = frame->tree().firstChild(); child; child = child->tree() .nextSibling()) {
1621 if (child->view() && child->view()->scrollableAreas()) 1621 if (child->view() && child->view()->scrollableAreas())
1622 count += child->view()->scrollableAreas()->size(); 1622 count += child->view()->scrollableAreas()->size();
1623 } 1623 }
1624 1624
1625 return count; 1625 return count;
1626 } 1626 }
1627 1627
1628 bool Internals::isPageBoxVisible(Document* document, int pageNumber, ExceptionSt ate& es) 1628 bool Internals::isPageBoxVisible(Document* document, int pageNumber, ExceptionSt ate& es)
1629 { 1629 {
1630 if (!document) { 1630 if (!document) {
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
2275 return false; 2275 return false;
2276 sharedContext->extensions()->loseContextCHROMIUM(Extensions3D::GUILTY_CONTEX T_RESET_ARB, Extensions3D::INNOCENT_CONTEXT_RESET_ARB); 2276 sharedContext->extensions()->loseContextCHROMIUM(Extensions3D::GUILTY_CONTEX T_RESET_ARB, Extensions3D::INNOCENT_CONTEXT_RESET_ARB);
2277 // To prevent tests that call loseSharedGraphicsContext3D from being 2277 // To prevent tests that call loseSharedGraphicsContext3D from being
2278 // flaky, we call finish so that the context is guaranteed to be lost 2278 // flaky, we call finish so that the context is guaranteed to be lost
2279 // synchronously (i.e. before returning). 2279 // synchronously (i.e. before returning).
2280 sharedContext->finish(); 2280 sharedContext->finish();
2281 return true; 2281 return true;
2282 } 2282 }
2283 2283
2284 } 2284 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGSVGElement.cpp ('k') | Source/core/xml/parser/XMLDocumentParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698