| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
| 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
| 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1406 renderer->paint(info, childPoint); | 1406 renderer->paint(info, childPoint); |
| 1407 info.phase = PaintPhaseFloat; | 1407 info.phase = PaintPhaseFloat; |
| 1408 renderer->paint(info, childPoint); | 1408 renderer->paint(info, childPoint); |
| 1409 info.phase = PaintPhaseForeground; | 1409 info.phase = PaintPhaseForeground; |
| 1410 renderer->paint(info, childPoint); | 1410 renderer->paint(info, childPoint); |
| 1411 info.phase = PaintPhaseOutline; | 1411 info.phase = PaintPhaseOutline; |
| 1412 renderer->paint(info, childPoint); | 1412 renderer->paint(info, childPoint); |
| 1413 } | 1413 } |
| 1414 } | 1414 } |
| 1415 | 1415 |
| 1416 static inline bool caretBrowsingEnabled(const Frame* frame) | 1416 static inline bool hasCursorCaret(const FrameSelection& selection, const RenderB
lock* block) |
| 1417 { | 1417 { |
| 1418 Settings* settings = frame->settings(); | 1418 return selection.caretRenderer() == block && selection.hasEditableStyle(); |
| 1419 return settings && settings->caretBrowsingEnabled(); | |
| 1420 } | 1419 } |
| 1421 | 1420 |
| 1422 static inline bool hasCursorCaret(const FrameSelection& selection, const RenderB
lock* block, bool caretBrowsing) | 1421 static inline bool hasDragCaret(const DragCaretController& dragCaretController,
const RenderBlock* block) |
| 1423 { | 1422 { |
| 1424 return selection.caretRenderer() == block && (selection.hasEditableStyle() |
| caretBrowsing); | 1423 return dragCaretController.caretRenderer() == block && dragCaretController.i
sContentEditable(); |
| 1425 } | |
| 1426 | |
| 1427 static inline bool hasDragCaret(const DragCaretController& dragCaretController,
const RenderBlock* block, bool caretBrowsing) | |
| 1428 { | |
| 1429 return dragCaretController.caretRenderer() == block && (dragCaretController.
isContentEditable() || caretBrowsing); | |
| 1430 } | 1424 } |
| 1431 | 1425 |
| 1432 bool RenderBlock::hasCaret() const | 1426 bool RenderBlock::hasCaret() const |
| 1433 { | 1427 { |
| 1434 bool caretBrowsing = caretBrowsingEnabled(frame()); | 1428 return hasCursorCaret(frame()->selection(), this) |
| 1435 return hasCursorCaret(frame()->selection(), this, caretBrowsing) | 1429 || hasDragCaret(frame()->page()->dragCaretController(), this); |
| 1436 || hasDragCaret(frame()->page()->dragCaretController(), this, caretBrows
ing); | |
| 1437 } | 1430 } |
| 1438 | 1431 |
| 1439 void RenderBlock::paintCarets(PaintInfo& paintInfo, const LayoutPoint& paintOffs
et) | 1432 void RenderBlock::paintCarets(PaintInfo& paintInfo, const LayoutPoint& paintOffs
et) |
| 1440 { | 1433 { |
| 1441 bool caretBrowsing = caretBrowsingEnabled(frame()); | |
| 1442 | |
| 1443 FrameSelection& selection = frame()->selection(); | 1434 FrameSelection& selection = frame()->selection(); |
| 1444 if (hasCursorCaret(selection, this, caretBrowsing)) { | 1435 if (hasCursorCaret(selection, this)) { |
| 1445 selection.paintCaret(paintInfo.context, paintOffset, paintInfo.rect); | 1436 selection.paintCaret(paintInfo.context, paintOffset, paintInfo.rect); |
| 1446 } | 1437 } |
| 1447 | 1438 |
| 1448 DragCaretController& dragCaretController = frame()->page()->dragCaretControl
ler(); | 1439 DragCaretController& dragCaretController = frame()->page()->dragCaretControl
ler(); |
| 1449 if (hasDragCaret(dragCaretController, this, caretBrowsing)) { | 1440 if (hasDragCaret(dragCaretController, this)) { |
| 1450 dragCaretController.paintDragCaret(frame(), paintInfo.context, paintOffs
et, paintInfo.rect); | 1441 dragCaretController.paintDragCaret(frame(), paintInfo.context, paintOffs
et, paintInfo.rect); |
| 1451 } | 1442 } |
| 1452 } | 1443 } |
| 1453 | 1444 |
| 1454 void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs
et) | 1445 void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs
et) |
| 1455 { | 1446 { |
| 1456 PaintPhase paintPhase = paintInfo.phase; | 1447 PaintPhase paintPhase = paintInfo.phase; |
| 1457 | 1448 |
| 1458 // Adjust our painting position if we're inside a scrolled layer (e.g., an o
verflow:auto div). | 1449 // Adjust our painting position if we're inside a scrolled layer (e.g., an o
verflow:auto div). |
| 1459 LayoutPoint scrolledOffset = paintOffset; | 1450 LayoutPoint scrolledOffset = paintOffset; |
| (...skipping 1800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3260 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 3251 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
| 3261 { | 3252 { |
| 3262 showRenderObject(); | 3253 showRenderObject(); |
| 3263 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 3254 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
| 3264 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 3255 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
| 3265 } | 3256 } |
| 3266 | 3257 |
| 3267 #endif | 3258 #endif |
| 3268 | 3259 |
| 3269 } // namespace blink | 3260 } // namespace blink |
| OLD | NEW |