OLD | NEW |
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 #include "core/editing/htmlediting.h" | 49 #include "core/editing/htmlediting.h" |
50 #include "core/editing/markup.h" | 50 #include "core/editing/markup.h" |
51 #include "core/events/Event.h" | 51 #include "core/events/Event.h" |
52 #include "core/frame/FrameHost.h" | 52 #include "core/frame/FrameHost.h" |
53 #include "core/frame/FrameView.h" | 53 #include "core/frame/FrameView.h" |
54 #include "core/frame/LocalFrame.h" | 54 #include "core/frame/LocalFrame.h" |
55 #include "core/frame/Settings.h" | 55 #include "core/frame/Settings.h" |
56 #include "core/html/HTMLFontElement.h" | 56 #include "core/html/HTMLFontElement.h" |
57 #include "core/html/HTMLHRElement.h" | 57 #include "core/html/HTMLHRElement.h" |
58 #include "core/html/HTMLImageElement.h" | 58 #include "core/html/HTMLImageElement.h" |
| 59 #include "core/layout/LayoutBox.h" |
59 #include "core/page/Chrome.h" | 60 #include "core/page/Chrome.h" |
60 #include "core/page/EditorClient.h" | 61 #include "core/page/EditorClient.h" |
61 #include "core/page/EventHandler.h" | 62 #include "core/page/EventHandler.h" |
62 #include "core/rendering/RenderBox.h" | |
63 #include "platform/KillRing.h" | 63 #include "platform/KillRing.h" |
64 #include "platform/UserGestureIndicator.h" | 64 #include "platform/UserGestureIndicator.h" |
65 #include "platform/scroll/Scrollbar.h" | 65 #include "platform/scroll/Scrollbar.h" |
66 #include "public/platform/Platform.h" | 66 #include "public/platform/Platform.h" |
67 #include "wtf/text/AtomicString.h" | 67 #include "wtf/text/AtomicString.h" |
68 | 68 |
69 namespace blink { | 69 namespace blink { |
70 | 70 |
71 using namespace HTMLNames; | 71 using namespace HTMLNames; |
72 | 72 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 } | 263 } |
264 | 264 |
265 static unsigned verticalScrollDistance(LocalFrame& frame) | 265 static unsigned verticalScrollDistance(LocalFrame& frame) |
266 { | 266 { |
267 Element* focusedElement = frame.document()->focusedElement(); | 267 Element* focusedElement = frame.document()->focusedElement(); |
268 if (!focusedElement) | 268 if (!focusedElement) |
269 return 0; | 269 return 0; |
270 LayoutObject* renderer = focusedElement->renderer(); | 270 LayoutObject* renderer = focusedElement->renderer(); |
271 if (!renderer || !renderer->isBox()) | 271 if (!renderer || !renderer->isBox()) |
272 return 0; | 272 return 0; |
273 RenderBox& renderBox = toRenderBox(*renderer); | 273 LayoutBox& layoutBox = toLayoutBox(*renderer); |
274 LayoutStyle* style = renderBox.style(); | 274 LayoutStyle* style = layoutBox.style(); |
275 if (!style) | 275 if (!style) |
276 return 0; | 276 return 0; |
277 if (!(style->overflowY() == OSCROLL || style->overflowY() == OAUTO || focuse
dElement->hasEditableStyle())) | 277 if (!(style->overflowY() == OSCROLL || style->overflowY() == OAUTO || focuse
dElement->hasEditableStyle())) |
278 return 0; | 278 return 0; |
279 int height = std::min<int>(renderBox.clientHeight(), frame.view()->visibleHe
ight()); | 279 int height = std::min<int>(layoutBox.clientHeight(), frame.view()->visibleHe
ight()); |
280 return static_cast<unsigned>(max(max<int>(height * ScrollableArea::minFracti
onToStepWhenPaging(), height - ScrollableArea::maxOverlapBetweenPages()), 1)); | 280 return static_cast<unsigned>(max(max<int>(height * ScrollableArea::minFracti
onToStepWhenPaging(), height - ScrollableArea::maxOverlapBetweenPages()), 1)); |
281 } | 281 } |
282 | 282 |
283 static PassRefPtrWillBeRawPtr<Range> unionDOMRanges(Range* a, Range* b) | 283 static PassRefPtrWillBeRawPtr<Range> unionDOMRanges(Range* a, Range* b) |
284 { | 284 { |
285 Range* start = a->compareBoundaryPoints(Range::START_TO_START, b, ASSERT_NO_
EXCEPTION) <= 0 ? a : b; | 285 Range* start = a->compareBoundaryPoints(Range::START_TO_START, b, ASSERT_NO_
EXCEPTION) <= 0 ? a : b; |
286 Range* end = a->compareBoundaryPoints(Range::END_TO_END, b, ASSERT_NO_EXCEPT
ION) <= 0 ? b : a; | 286 Range* end = a->compareBoundaryPoints(Range::END_TO_END, b, ASSERT_NO_EXCEPT
ION) <= 0 ? b : a; |
287 | 287 |
288 return Range::create(a->ownerDocument(), start->startContainer(), start->sta
rtOffset(), end->endContainer(), end->endOffset()); | 288 return Range::create(a->ownerDocument(), start->startContainer(), start->sta
rtOffset(), end->endContainer(), end->endOffset()); |
289 } | 289 } |
(...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1787 { | 1787 { |
1788 return m_command && m_command->isTextInsertion; | 1788 return m_command && m_command->isTextInsertion; |
1789 } | 1789 } |
1790 | 1790 |
1791 int Editor::Command::idForHistogram() const | 1791 int Editor::Command::idForHistogram() const |
1792 { | 1792 { |
1793 return isSupported() ? m_command->idForUserMetrics : 0; | 1793 return isSupported() ? m_command->idForUserMetrics : 0; |
1794 } | 1794 } |
1795 | 1795 |
1796 } // namespace blink | 1796 } // namespace blink |
OLD | NEW |