diff --git a/accessible/base/NotificationController.h b/accessible/base/NotificationController.h index b2e16c00e6e67d640974cd4f1aa7a819d4d32063..afb6230bb613ecde4a5e3271478a682d0396dc3b 100644 --- a/accessible/base/NotificationController.h +++ b/accessible/base/NotificationController.h @@ -175,6 +175,7 @@ class NotificationController final : public EventQueue, "A text node is not visible"); mTextHash.Insert(aTextNode); + ScheduleProcessing(); } diff --git a/accessible/base/TextLeafRange.cpp b/accessible/base/TextLeafRange.cpp index c0ff5a484dcb9919da76d51afb4f57e81f92f410..db82fb660ef4fc4a2d734f601ea908a7998b1760 100644 --- a/accessible/base/TextLeafRange.cpp +++ b/accessible/base/TextLeafRange.cpp @@ -17,6 +17,7 @@ #include "mozilla/intl/WordBreaker.h" #include "mozilla/StaticPrefs_layout.h" #include "nsAccUtils.h" +#include "nsBlockFrame.h" #include "nsContentUtils.h" #include "nsIAccessiblePivot.h" #include "nsILineIterator.h" @@ -182,6 +183,22 @@ static bool IsLocalAccAtLineStart(LocalAccessible* aAcc) { // same line, so we're at the start. return true; } + if (nsBlockFrame* block = do_QueryFrame(thisBlock)) { + // If we have a block frame, it's faster for us to use + // BlockInFlowLineIterator because it uses the line cursor. + bool found = false; + block->SetupLineCursorForQuery(); + nsBlockInFlowLineIterator prevIt(block, prevLineFrame, &found); + if (!found) { + // Error; play it safe. + return true; + } + found = false; + nsBlockInFlowLineIterator thisIt(block, thisLineFrame, &found); + // if the lines are different, that means there's nothing before us on the + // same line, so we're at the start. + return !found || prevIt.GetLine() != thisIt.GetLine(); + } nsAutoLineIterator it = prevBlock->GetLineIterator(); MOZ_ASSERT(it, "GetLineIterator impl in line-container blocks is infallible"); int32_t prevLineNum = it->FindLineContaining(prevLineFrame);