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

Side by Side Diff: Source/web/WebLocalFrameImpl.cpp

Issue 317493002: Change FrameTree to return Frames instead of LocalFrames. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed test fix in geolocation Created 6 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 return; // Filled up the buffer. 230 return; // Filled up the buffer.
231 } 231 }
232 } 232 }
233 233
234 // The separator between frames when the frames are converted to plain text. 234 // The separator between frames when the frames are converted to plain text.
235 const LChar frameSeparator[] = { '\n', '\n' }; 235 const LChar frameSeparator[] = { '\n', '\n' };
236 const size_t frameSeparatorLength = WTF_ARRAY_LENGTH(frameSeparator); 236 const size_t frameSeparatorLength = WTF_ARRAY_LENGTH(frameSeparator);
237 237
238 // Recursively walk the children. 238 // Recursively walk the children.
239 const FrameTree& frameTree = frame->tree(); 239 const FrameTree& frameTree = frame->tree();
240 for (LocalFrame* curChild = frameTree.firstChild(); curChild; curChild = cur Child->tree().nextSibling()) { 240 for (Frame* curChild = frameTree.firstChild(); curChild; curChild = curChild ->tree().nextSibling()) {
241 if (!curChild->isLocalFrame())
242 continue;
243 LocalFrame* curLocalChild = toLocalFrame(curChild);
241 // Ignore the text of non-visible frames. 244 // Ignore the text of non-visible frames.
242 RenderView* contentRenderer = curChild->contentRenderer(); 245 RenderView* contentRenderer = curLocalChild->contentRenderer();
243 RenderPart* ownerRenderer = curChild->ownerRenderer(); 246 RenderPart* ownerRenderer = curLocalChild->ownerRenderer();
244 if (!contentRenderer || !contentRenderer->width() || !contentRenderer->h eight() 247 if (!contentRenderer || !contentRenderer->width() || !contentRenderer->h eight()
245 || (contentRenderer->x() + contentRenderer->width() <= 0) || (conten tRenderer->y() + contentRenderer->height() <= 0) 248 || (contentRenderer->x() + contentRenderer->width() <= 0) || (conten tRenderer->y() + contentRenderer->height() <= 0)
246 || (ownerRenderer && ownerRenderer->style() && ownerRenderer->style( )->visibility() != VISIBLE)) { 249 || (ownerRenderer && ownerRenderer->style() && ownerRenderer->style( )->visibility() != VISIBLE)) {
247 continue; 250 continue;
248 } 251 }
249 252
250 // Make sure the frame separator won't fill up the buffer, and give up i f 253 // Make sure the frame separator won't fill up the buffer, and give up i f
251 // it will. The danger is if the separator will make the buffer longer t han 254 // it will. The danger is if the separator will make the buffer longer t han
252 // maxChars. This will cause the computation above: 255 // maxChars. This will cause the computation above:
253 // maxChars - output->size() 256 // maxChars - output->size()
254 // to be a negative number which will crash when the subframe is added. 257 // to be a negative number which will crash when the subframe is added.
255 if (output.length() >= maxChars - frameSeparatorLength) 258 if (output.length() >= maxChars - frameSeparatorLength)
256 return; 259 return;
257 260
258 output.append(frameSeparator, frameSeparatorLength); 261 output.append(frameSeparator, frameSeparatorLength);
259 frameContentAsPlainText(maxChars, curChild, output); 262 frameContentAsPlainText(maxChars, curLocalChild, output);
260 if (output.length() >= maxChars) 263 if (output.length() >= maxChars)
261 return; // Filled up the buffer. 264 return; // Filled up the buffer.
262 } 265 }
263 } 266 }
264 267
265 WebPluginContainerImpl* WebLocalFrameImpl::pluginContainerFromFrame(LocalFrame* frame) 268 WebPluginContainerImpl* WebLocalFrameImpl::pluginContainerFromFrame(LocalFrame* frame)
266 { 269 {
267 if (!frame) 270 if (!frame)
268 return 0; 271 return 0;
269 if (!frame->document() || !frame->document()->isPluginDocument()) 272 if (!frame->document() || !frame->document()->isPluginDocument())
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 void WebLocalFrameImpl::removeChild(WebFrame* child) 653 void WebLocalFrameImpl::removeChild(WebFrame* child)
651 { 654 {
652 WebFrame::removeChild(child); 655 WebFrame::removeChild(child);
653 frame()->tree().invalidateScopedChildCount(); 656 frame()->tree().invalidateScopedChildCount();
654 } 657 }
655 658
656 WebFrame* WebLocalFrameImpl::traversePrevious(bool wrap) const 659 WebFrame* WebLocalFrameImpl::traversePrevious(bool wrap) const
657 { 660 {
658 if (!frame()) 661 if (!frame())
659 return 0; 662 return 0;
660 return fromFrame(frame()->tree().traversePreviousWithWrap(wrap)); 663 // FIXME: This should move to WebFrame and become local/remote agnostic.
664 Frame* prevFrame = frame()->tree().traversePreviousWithWrap(wrap);
665 if (!prevFrame || !prevFrame->isLocalFrame())
666 return 0;
667 return fromFrame(toLocalFrame(prevFrame));
661 } 668 }
662 669
663 WebFrame* WebLocalFrameImpl::traverseNext(bool wrap) const 670 WebFrame* WebLocalFrameImpl::traverseNext(bool wrap) const
664 { 671 {
672 // FIXME: This should move to WebFrame and become local/remote agnostic.
665 if (!frame()) 673 if (!frame())
666 return 0; 674 return 0;
667 return fromFrame(frame()->tree().traverseNextWithWrap(wrap)); 675 // FIXME: This should move to WebFrame and become local/remote agnostic.
676 Frame* nextFrame = frame()->tree().traverseNextWithWrap(wrap);
677 if (!nextFrame || !nextFrame->isLocalFrame())
678 return 0;
679 return fromFrame(toLocalFrame(nextFrame));
668 } 680 }
669 681
670 WebFrame* WebLocalFrameImpl::findChildByName(const WebString& name) const 682 WebFrame* WebLocalFrameImpl::findChildByName(const WebString& name) const
671 { 683 {
684 // FIXME: This should move to WebFrame and become local/remote agnostic.
672 if (!frame()) 685 if (!frame())
673 return 0; 686 return 0;
674 return fromFrame(frame()->tree().child(name)); 687 // FIXME: This should move to WebFrame and become local/remote agnostic.
688 Frame* child = frame()->tree().child(name);
689 if (!child || !child->isLocalFrame())
690 return 0;
691 return fromFrame(toLocalFrame(child));
675 } 692 }
676 693
677 WebDocument WebLocalFrameImpl::document() const 694 WebDocument WebLocalFrameImpl::document() const
678 { 695 {
679 if (!frame() || !frame()->document()) 696 if (!frame() || !frame()->document())
680 return WebDocument(); 697 return WebDocument();
681 return WebDocument(frame()->document()); 698 return WebDocument(frame()->document());
682 } 699 }
683 700
684 WebPerformance WebLocalFrameImpl::performance() const 701 WebPerformance WebLocalFrameImpl::performance() const
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1920 1937
1921 void WebLocalFrameImpl::invalidateAll() const 1938 void WebLocalFrameImpl::invalidateAll() const
1922 { 1939 {
1923 ASSERT(frame() && frame()->view()); 1940 ASSERT(frame() && frame()->view());
1924 FrameView* view = frame()->view(); 1941 FrameView* view = frame()->view();
1925 view->invalidateRect(view->frameRect()); 1942 view->invalidateRect(view->frameRect());
1926 invalidateScrollbar(); 1943 invalidateScrollbar();
1927 } 1944 }
1928 1945
1929 } // namespace blink 1946 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698