Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
pavpanchekha authored Jun 18, 2024
1 parent c2497fe commit 9685187
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions book-edited.tex
Original file line number Diff line number Diff line change
Expand Up @@ -24716,6 +24716,23 @@ \section{Iframe Input Events}\label{iframe-input-events}}
\end{Highlighting}
\end{Shaded}

If a frame other than the root frame is scrolled, we'll just set
\texttt{needs\_composite} so the browser has to re-raster from scratch:

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{class}\NormalTok{ Tab:}
\KeywordTok{def}\NormalTok{ run\_animation\_frame(}\VariableTok{self}\NormalTok{, scroll):}
\CommentTok{\# ...}
\ControlFlowTok{for}\NormalTok{ (window\_id, frame) }\KeywordTok{in} \VariableTok{self}\NormalTok{.window\_id\_to\_frame.items():}
\ControlFlowTok{if}\NormalTok{ frame }\OperatorTok{==} \VariableTok{self}\NormalTok{.root\_frame: }\ControlFlowTok{continue}
\ControlFlowTok{if}\NormalTok{ frame.scroll\_changed\_in\_frame:}
\NormalTok{ needs\_composite }\OperatorTok{=} \VariableTok{True}
\NormalTok{ frame.scroll\_changed\_in\_frame }\OperatorTok{=} \VariableTok{False}
\CommentTok{\# ...}
\end{Highlighting}
\end{Shaded}

There's one more subtlety to scrolling. After we scroll, we want to
\emph{clamp} the scroll position, to prevent the user scrolling past the
last thing on the page. Right now, \texttt{clamp\_scroll} uses the window
Expand Down

0 comments on commit 9685187

Please sign in to comment.