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/page/FocusController.cpp

Issue 1896793002: Rename (updateLayout/updateStyle).*.() to updateStyleAndLayout.*.() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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) 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nuanti Ltd. 3 * Copyright (C) 2008 Nuanti Ltd.
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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 618
619 Element* findFocusableElementDescendingDownIntoFrameDocument(WebFocusType type, Element* element) 619 Element* findFocusableElementDescendingDownIntoFrameDocument(WebFocusType type, Element* element)
620 { 620 {
621 // The element we found might be a HTMLFrameOwnerElement, so descend down th e tree until we find either: 621 // The element we found might be a HTMLFrameOwnerElement, so descend down th e tree until we find either:
622 // 1) a focusable element, or 622 // 1) a focusable element, or
623 // 2) the deepest-nested HTMLFrameOwnerElement. 623 // 2) the deepest-nested HTMLFrameOwnerElement.
624 while (element && element->isFrameOwnerElement()) { 624 while (element && element->isFrameOwnerElement()) {
625 HTMLFrameOwnerElement& owner = toHTMLFrameOwnerElement(*element); 625 HTMLFrameOwnerElement& owner = toHTMLFrameOwnerElement(*element);
626 if (!owner.contentFrame() || !owner.contentFrame()->isLocalFrame()) 626 if (!owner.contentFrame() || !owner.contentFrame()->isLocalFrame())
627 break; 627 break;
628 toLocalFrame(owner.contentFrame())->document()->updateLayoutIgnorePendin gStylesheets(); 628 toLocalFrame(owner.contentFrame())->document()->updateStyleAndLayoutIgno rePendingStylesheets();
629 ScopedFocusNavigation scope = ScopedFocusNavigation::ownedByIFrame(owner ); 629 ScopedFocusNavigation scope = ScopedFocusNavigation::ownedByIFrame(owner );
630 Element* foundElement = findFocusableElementRecursively(type, scope); 630 Element* foundElement = findFocusableElementRecursively(type, scope);
631 if (!foundElement) 631 if (!foundElement)
632 break; 632 break;
633 ASSERT(element != foundElement); 633 ASSERT(element != foundElement);
634 element = foundElement; 634 element = foundElement;
635 } 635 }
636 return element; 636 return element;
637 } 637 }
638 638
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 ASSERT(!current || !isNonFocusableShadowHost(*current)); 914 ASSERT(!current || !isNonFocusableShadowHost(*current));
915 if (!current && !initialFocus) 915 if (!current && !initialFocus)
916 current = document->sequentialFocusNavigationStartingPoint(type); 916 current = document->sequentialFocusNavigationStartingPoint(type);
917 917
918 // FIXME: Not quite correct when it comes to focus transitions leaving/enter ing the WebView itself 918 // FIXME: Not quite correct when it comes to focus transitions leaving/enter ing the WebView itself
919 bool caretBrowsing = frame->settings() && frame->settings()->caretBrowsingEn abled(); 919 bool caretBrowsing = frame->settings() && frame->settings()->caretBrowsingEn abled();
920 920
921 if (caretBrowsing && !current) 921 if (caretBrowsing && !current)
922 current = adjustToElement(frame->selection().start().anchorNode(), type) ; 922 current = adjustToElement(frame->selection().start().anchorNode(), type) ;
923 923
924 document->updateLayoutIgnorePendingStylesheets(); 924 document->updateStyleAndLayoutIgnorePendingStylesheets();
925 ScopedFocusNavigation scope = current ? ScopedFocusNavigation::createFor(*cu rrent) : ScopedFocusNavigation::createForDocument(*document); 925 ScopedFocusNavigation scope = current ? ScopedFocusNavigation::createFor(*cu rrent) : ScopedFocusNavigation::createForDocument(*document);
926 Element* element = findFocusableElementAcrossFocusScopes(type, scope); 926 Element* element = findFocusableElementAcrossFocusScopes(type, scope);
927 if (!element) { 927 if (!element) {
928 // If there's a RemoteFrame on the ancestor chain, we need to continue 928 // If there's a RemoteFrame on the ancestor chain, we need to continue
929 // searching for focusable elements there. 929 // searching for focusable elements there.
930 if (frame->localFrameRoot() != frame->tree().top()) { 930 if (frame->localFrameRoot() != frame->tree().top()) {
931 document->clearFocusedElement(); 931 document->clearFocusedElement();
932 document->setSequentialFocusNavigationStartingPoint(nullptr); 932 document->setSequentialFocusNavigationStartingPoint(nullptr);
933 toRemoteFrame(frame->localFrameRoot()->tree().parent())->advanceFocu s(type, frame->localFrameRoot()); 933 toRemoteFrame(frame->localFrameRoot()->tree().parent())->advanceFocu s(type, frame->localFrameRoot());
934 return true; 934 return true;
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 if (frameElement && frameElement->contentFrame()->isLocalFrame()) { 1222 if (frameElement && frameElement->contentFrame()->isLocalFrame()) {
1223 if (focusCandidate.isOffscreenAfterScrolling) { 1223 if (focusCandidate.isOffscreenAfterScrolling) {
1224 scrollInDirection(&focusCandidate.visibleNode->document(), type); 1224 scrollInDirection(&focusCandidate.visibleNode->document(), type);
1225 return true; 1225 return true;
1226 } 1226 }
1227 // Navigate into a new frame. 1227 // Navigate into a new frame.
1228 LayoutRect rect; 1228 LayoutRect rect;
1229 Element* focusedElement = toLocalFrame(focusedOrMainFrame())->document() ->focusedElement(); 1229 Element* focusedElement = toLocalFrame(focusedOrMainFrame())->document() ->focusedElement();
1230 if (focusedElement && !hasOffscreenRect(focusedElement)) 1230 if (focusedElement && !hasOffscreenRect(focusedElement))
1231 rect = nodeRectInAbsoluteCoordinates(focusedElement, true /* ignore border */); 1231 rect = nodeRectInAbsoluteCoordinates(focusedElement, true /* ignore border */);
1232 toLocalFrame(frameElement->contentFrame())->document()->updateLayoutIgno rePendingStylesheets(); 1232 toLocalFrame(frameElement->contentFrame())->document()->updateStyleAndLa youtIgnorePendingStylesheets();
1233 if (!advanceFocusDirectionallyInContainer(toLocalFrame(frameElement->con tentFrame())->document(), rect, type)) { 1233 if (!advanceFocusDirectionallyInContainer(toLocalFrame(frameElement->con tentFrame())->document(), rect, type)) {
1234 // The new frame had nothing interesting, need to find another candi date. 1234 // The new frame had nothing interesting, need to find another candi date.
1235 return advanceFocusDirectionallyInContainer(container, nodeRectInAbs oluteCoordinates(focusCandidate.visibleNode, true), type); 1235 return advanceFocusDirectionallyInContainer(container, nodeRectInAbs oluteCoordinates(focusCandidate.visibleNode, true), type);
1236 } 1236 }
1237 return true; 1237 return true;
1238 } 1238 }
1239 1239
1240 if (canScrollInDirection(focusCandidate.visibleNode, type)) { 1240 if (canScrollInDirection(focusCandidate.visibleNode, type)) {
1241 if (focusCandidate.isOffscreenAfterScrolling) { 1241 if (focusCandidate.isOffscreenAfterScrolling) {
1242 scrollInDirection(focusCandidate.visibleNode, type); 1242 scrollInDirection(focusCandidate.visibleNode, type);
(...skipping 29 matching lines...) Expand all
1272 ASSERT(curFrame); 1272 ASSERT(curFrame);
1273 1273
1274 Document* focusedDocument = curFrame->document(); 1274 Document* focusedDocument = curFrame->document();
1275 if (!focusedDocument) 1275 if (!focusedDocument)
1276 return false; 1276 return false;
1277 1277
1278 Element* focusedElement = focusedDocument->focusedElement(); 1278 Element* focusedElement = focusedDocument->focusedElement();
1279 Node* container = focusedDocument; 1279 Node* container = focusedDocument;
1280 1280
1281 if (container->isDocumentNode()) 1281 if (container->isDocumentNode())
1282 toDocument(container)->updateLayoutIgnorePendingStylesheets(); 1282 toDocument(container)->updateStyleAndLayoutIgnorePendingStylesheets();
1283 1283
1284 // Figure out the starting rect. 1284 // Figure out the starting rect.
1285 LayoutRect startingRect; 1285 LayoutRect startingRect;
1286 if (focusedElement) { 1286 if (focusedElement) {
1287 if (!hasOffscreenRect(focusedElement)) { 1287 if (!hasOffscreenRect(focusedElement)) {
1288 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(ty pe, focusedElement); 1288 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(ty pe, focusedElement);
1289 startingRect = nodeRectInAbsoluteCoordinates(focusedElement, true /* ignore border */); 1289 startingRect = nodeRectInAbsoluteCoordinates(focusedElement, true /* ignore border */);
1290 } else if (isHTMLAreaElement(*focusedElement)) { 1290 } else if (isHTMLAreaElement(*focusedElement)) {
1291 HTMLAreaElement& area = toHTMLAreaElement(*focusedElement); 1291 HTMLAreaElement& area = toHTMLAreaElement(*focusedElement);
1292 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(ty pe, area.imageElement()); 1292 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(ty pe, area.imageElement());
1293 startingRect = virtualRectForAreaElementAndDirection(area, type); 1293 startingRect = virtualRectForAreaElementAndDirection(area, type);
1294 } 1294 }
1295 } 1295 }
1296 1296
1297 bool consumed = false; 1297 bool consumed = false;
1298 do { 1298 do {
1299 consumed = advanceFocusDirectionallyInContainer(container, startingRect, type); 1299 consumed = advanceFocusDirectionallyInContainer(container, startingRect, type);
1300 startingRect = nodeRectInAbsoluteCoordinates(container, true /* ignore b order */); 1300 startingRect = nodeRectInAbsoluteCoordinates(container, true /* ignore b order */);
1301 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(type, container); 1301 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(type, container);
1302 if (container && container->isDocumentNode()) 1302 if (container && container->isDocumentNode())
1303 toDocument(container)->updateLayoutIgnorePendingStylesheets(); 1303 toDocument(container)->updateStyleAndLayoutIgnorePendingStylesheets( );
1304 } while (!consumed && container); 1304 } while (!consumed && container);
1305 1305
1306 return consumed; 1306 return consumed;
1307 } 1307 }
1308 1308
1309 DEFINE_TRACE(FocusController) 1309 DEFINE_TRACE(FocusController)
1310 { 1310 {
1311 visitor->trace(m_page); 1311 visitor->trace(m_page);
1312 visitor->trace(m_focusedFrame); 1312 visitor->trace(m_focusedFrame);
1313 } 1313 }
1314 1314
1315 } // namespace blink 1315 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp ('k') | third_party/WebKit/Source/core/page/PrintContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698