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

Side by Side Diff: sky/engine/core/editing/EditorCommand.cpp

Issue 878303002: Remove more scrolling code from Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « sky/engine/core/editing/Editor.cpp ('k') | sky/engine/core/editing/FrameSelection.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) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2009 Igalia S.L. 4 * Copyright (C) 2009 Igalia S.L.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 Element* focusedElement = frame.document()->focusedElement(); 94 Element* focusedElement = frame.document()->focusedElement();
95 if (!focusedElement) 95 if (!focusedElement)
96 return 0; 96 return 0;
97 RenderObject* renderer = focusedElement->renderer(); 97 RenderObject* renderer = focusedElement->renderer();
98 if (!renderer || !renderer->isBox()) 98 if (!renderer || !renderer->isBox())
99 return 0; 99 return 0;
100 RenderBox& renderBox = toRenderBox(*renderer); 100 RenderBox& renderBox = toRenderBox(*renderer);
101 RenderStyle* style = renderBox.style(); 101 RenderStyle* style = renderBox.style();
102 if (!style) 102 if (!style)
103 return 0; 103 return 0;
104 if (!(style->overflowY() == OSCROLL || style->overflowY() == OAUTO || focuse dElement->hasEditableStyle())) 104 if (!focusedElement->hasEditableStyle())
105 return 0; 105 return 0;
106 int height = std::min<int>(renderBox.clientHeight(), 106 int height = std::min<int>(renderBox.clientHeight(),
107 frame.view()->height()); 107 frame.view()->height());
108 return static_cast<unsigned>(max<int>(height * kMinFractionToStepWhenPaging, 1)); 108 return static_cast<unsigned>(max<int>(height * kMinFractionToStepWhenPaging, 1));
109 } 109 }
110 110
111 static bool executeCopy(LocalFrame& frame, Event*, EditorCommandSource, const St ring&) 111 static bool executeCopy(LocalFrame& frame, Event*, EditorCommandSource, const St ring&)
112 { 112 {
113 frame.editor().copy(); 113 frame.editor().copy();
114 return true; 114 return true;
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 } 549 }
550 if (commandName == "ToggleSpellPanel") { 550 if (commandName == "ToggleSpellPanel") {
551 spellChecker().showSpellingGuessPanel(); 551 spellChecker().showSpellingGuessPanel();
552 return true; 552 return true;
553 } 553 }
554 return command(commandName).execute(); 554 return command(commandName).execute();
555 } 555 }
556 556
557 bool Editor::executeCommand(const String& commandName, const String& value) 557 bool Editor::executeCommand(const String& commandName, const String& value)
558 { 558 {
559 // moveToBeginningOfDocument and moveToEndfDocument are only handled by WebK it for editable nodes.
560 if (!canEdit() && commandName == "moveToBeginningOfDocument")
561 return m_frame.eventHandler().bubblingScroll(ScrollUp, ScrollByDocument) ;
562
563 if (!canEdit() && commandName == "moveToEndOfDocument")
564 return m_frame.eventHandler().bubblingScroll(ScrollDown, ScrollByDocumen t);
565
566 if (commandName == "showGuessPanel") { 559 if (commandName == "showGuessPanel") {
567 spellChecker().showSpellingGuessPanel(); 560 spellChecker().showSpellingGuessPanel();
568 return true; 561 return true;
569 } 562 }
570 563
571 return command(commandName).execute(value); 564 return command(commandName).execute(value);
572 } 565 }
573 566
574 Editor::Command::Command() 567 Editor::Command::Command()
575 : m_command(0) 568 : m_command(0)
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 { 640 {
648 return m_command && m_command->isTextInsertion; 641 return m_command && m_command->isTextInsertion;
649 } 642 }
650 643
651 int Editor::Command::idForHistogram() const 644 int Editor::Command::idForHistogram() const
652 { 645 {
653 return isSupported() ? m_command->idForUserMetrics : 0; 646 return isSupported() ? m_command->idForUserMetrics : 0;
654 } 647 }
655 648
656 } // namespace blink 649 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/editing/Editor.cpp ('k') | sky/engine/core/editing/FrameSelection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698