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

Unified Diff: Source/core/editing/EditorCommand.cpp

Issue 426433002: Use tighter typing in editing: Editor / EditorCommand (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/editing/EditorCommand.cpp
diff --git a/Source/core/editing/EditorCommand.cpp b/Source/core/editing/EditorCommand.cpp
index 1277b35a1d828513e4b81b7c55f73baaabfd141f..e0584b040e71489dd93979ff1ae19fefb6066519 100644
--- a/Source/core/editing/EditorCommand.cpp
+++ b/Source/core/editing/EditorCommand.cpp
@@ -200,7 +200,7 @@ static bool executeInsertFragment(LocalFrame& frame, PassRefPtrWillBeRawPtr<Docu
return true;
}
-static bool executeInsertNode(LocalFrame& frame, PassRefPtrWillBeRawPtr<Node> content)
+static bool executeInsertElement(LocalFrame& frame, PassRefPtrWillBeRawPtr<HTMLElement> content)
{
ASSERT(frame.document());
RefPtrWillBeRawPtr<DocumentFragment> fragment = DocumentFragment::create(*frame.document());
@@ -271,12 +271,13 @@ static unsigned verticalScrollDistance(LocalFrame& frame)
RenderObject* renderer = focusedElement->renderer();
if (!renderer || !renderer->isBox())
return 0;
- RenderStyle* style = renderer->style();
+ RenderBox& renderBox = toRenderBox(*renderer);
+ RenderStyle* style = renderBox.style();
if (!style)
return 0;
if (!(style->overflowY() == OSCROLL || style->overflowY() == OAUTO || focusedElement->hasEditableStyle()))
return 0;
- int height = std::min<int>(toRenderBox(renderer)->clientHeight(), frame.view()->visibleHeight());
+ int height = std::min<int>(renderBox.clientHeight(), frame.view()->visibleHeight());
return static_cast<unsigned>(max(max<int>(height * ScrollableArea::minFractionToStepWhenPaging(), height - ScrollableArea::maxOverlapBetweenPages()), 1));
}
@@ -508,7 +509,7 @@ static bool executeInsertHorizontalRule(LocalFrame& frame, Event*, EditorCommand
RefPtrWillBeRawPtr<HTMLHRElement> rule = HTMLHRElement::create(*frame.document());
if (!value.isEmpty())
rule->setIdAttribute(AtomicString(value));
- return executeInsertNode(frame, rule.release());
+ return executeInsertElement(frame, rule.release());
}
static bool executeInsertHTML(LocalFrame& frame, Event*, EditorCommandSource, const String& value)
@@ -523,7 +524,7 @@ static bool executeInsertImage(LocalFrame& frame, Event*, EditorCommandSource, c
ASSERT(frame.document());
RefPtrWillBeRawPtr<HTMLImageElement> image = HTMLImageElement::create(*frame.document());
image->setSrc(value);
- return executeInsertNode(frame, image.release());
+ return executeInsertElement(frame, image.release());
}
static bool executeInsertLineBreak(LocalFrame& frame, Event* event, EditorCommandSource source, const String&)

Powered by Google App Engine
This is Rietveld 408576698