mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 22:53:04 +00:00
dcf9e5848a
- Bug 1145395 - Make some cosmetic improvements to nsHTMLEditor::CreateDOMFragmentFromPaste; r=ehsan (b7b165297)
- Bug 1145395 - Return a DocumentFragment from nsHTMLEditor::ParseFragment; r=ehsan (05e314df6)
- Bug 1145395 - Use the local fragment variable rather than *outFragNode; r=ehsan (908366bc0)
- Bug 1145395 - Pass nsIContent& to nsHTMLEditor::StripFormattingNodes; r=ehsan (187bae854)
- Bug 1145395 - Pass nsINode& to RemoveBodyAndHead in nsHTMLDataTransfer; r=ehsan (1a2448d65)
- Bug 1169139 Remove all trailing whitespaces in editor (IGNORE IDL) r=ehsan (210ecf551)
- Bug 1067788 - Part 1: Don't invalidate bidi cursor directionality duing a delete. r=smontagu (c029b4271)
- Bug 1067788 - Part 2: Fixes to caret positioning in bidi text. r=smontagu (8fdb47aa7)
- Bug 1067788 - part 3: Fix timeouts in test_reftests_with_caret.html. r=ehsan (dfe0547d2)
- Bug 1067788 - Part 4: Update test_bug496275.html. Add setCaretBidiLevel method to Selection. r=smontagu r=ehsan (bcb737a2e)
- Bug 1067788 - Part 5: Fix for parts of test_bug496275.html. r=smontagu (885f2dc7e)
- Bug 1067788 - Fix non-unified bustage. r=ehsan (e141e2b81)
- remove thickcaret preference not in FF (d96cb3aee)
- Bug 1159263 - Add support to nsCaret to stop blinking after a set of cycles r=roc r=snorp (d07966610)
- Bug 988143 - Enable Gecko Touch in Fennec, SelectionController mods, r=ehsan (71de5c15e)
- Bug 988143 - Enable Gecko Touch in Fennec, Android specific nsCaret mods, r=ehsan (2a7b7058e)
- Bug 988143 - Enable Gecko Touch in Fennec, TouchCaret mods, r=ehsan (653a7d3be)
- Bug 988143 - Enable Gecko Touch in Fennec, TouchCaret Scroll mods, r=ehsan (8830df1cd)
- Bug 1153076 - Add NS_MOUSE_MOZLONGTAP support in Fennec, r=kats, tylin (bc14a39c5)
- Bug 988143 - Enable Gecko Touch in Fennec, SelectionCarets mods, r=ehsan (af5c15f7b)
- Bug 1164693 - Part 1: Directional caret should point in caret direction in bidi paragraphs. r=smontagu (2604fd0e1)
- Bug 1164693 - Part 2: Frames in a non-bidi paragraph with newline shouldn't be marked as bidi. r=smontagu (e1de49c9b)
- Bug 1143558 part 1 - Fix line break suppression when newline is significant. r=roc (adac6e4c3)
- Bug 1143558 part 2 - Convert suppressed line break to whitespace. r=roc (f36789322)
- Bug 1143558 part 3 - Reftests for line break suppression inside ruby. r=roc (4fadd0e17)
- Bug 1137723 - Don't call ::IsBoxWrapped(this) with the current mParent intact b/c IsBoxWrapped uses GetParent() and it may have been destroyed while this frame is still sitting an overflow list waiting to be lazy re-parented. r=roc (22a8806ba)
- Bug 1136010 - Don't coalesce style contexts added to RestyleManager::mContextsToClear. r=dbaron (81991b943)
- Bug 1146103 - Use NS_WARNING instead of MOZ_ASSERT for bcoord check in ruby text container. r=dbaron (ec1af437e)
- Bug 1146114 - Make assertion checking additional leading in ruby frame non-crash. r=dholbert (a775a1006)
- Bug 1146107 - Replace MOZ_ASSERT with NS_WARN_IF_FALSE on isize check in ruby base container. r=dholbert (705a4c8e5)
- Bug 1146103 followup - Add comment mentions upgrading warning and add crashtest for the assertion. (5820682fc)
- Bug 1172789 (part 1) - Remove PL_DHashTableEnumerate() uses from nsLoadGroup. r=michal. (73c3202f9)
- Bug 1172789 (part 2) - Remove PL_DHashTableEnumerate() uses from nsLoadGroup. r=michal. (6495530a4)
- Bug 1172789 (part 3) - Remove PL_DHashTableEnumerate() uses from nsLoadGroup. r=michal. (d8a17dd64)
- Bug 1173247 (part 1) - Remove PL_DHashTableEnumerate() uses from nsDiskCacheBindery. r=michal. (13b096297)
- Bug 1173247 (part 2) - Remove PL_DHashTableEnumerate() uses from nsDiskCacheBindery. r=michal. (290bb2093)
- Bug 1171830 - Remove PL_DHashTableEnumerator use from nsDocLoader. r=smaug. (3334d7120)
- Bug 1172761 (part 1) - Remove PL_DHashTableEnumerator use from nsAtomTable. r=froydnj. (7b3be498e)
- Bug 1172761 (part 2) - Remove PL_DHashTableEnumerator use from nsPersistentProperties. r=froydnj. (42f05514e)
- Bug 1174625 - Overhaul PLDHashTable's iterator. r=froydnj. (4e1efd69d)
- Bug 11746250 (follow-up) - Fix link errors on Linux and Android. r=me. (4a8ebc7df)
- Bug 1173600 (part 3) - Add PLDHashTable::RemovingIterator. r=froydnj. (7c01103c9)
- Bug 1174594 (part 1) - Remove uses of PL_DHashTableEnumerate from XPConnect. r=mrbkap. (4b2349650)
- Bug 1174594 (part 2) - Use a more sensible type for UNMARK_{ONLY,AND_SWEEP}. r=mrbkap. (4dc043f58)
- Bug 1174594 (part 3) - Remove ShutdownData. r=mrbkap. (0503b28cf)
176 lines
5.7 KiB
C++
176 lines
5.7 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
/* This Source Code is subject to the terms of the Mozilla Public License
|
|
* version 2.0 (the "License"). You can obtain a copy of the License at
|
|
* http://mozilla.org/MPL/2.0/. */
|
|
|
|
/* rendering object for CSS "display: ruby-text-container" */
|
|
|
|
#include "nsRubyTextContainerFrame.h"
|
|
|
|
#include "mozilla/UniquePtr.h"
|
|
#include "mozilla/WritingModes.h"
|
|
#include "nsPresContext.h"
|
|
#include "nsStyleContext.h"
|
|
|
|
using namespace mozilla;
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Frame class boilerplate
|
|
// =======================
|
|
|
|
NS_QUERYFRAME_HEAD(nsRubyTextContainerFrame)
|
|
NS_QUERYFRAME_ENTRY(nsRubyTextContainerFrame)
|
|
NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
|
|
|
|
NS_IMPL_FRAMEARENA_HELPERS(nsRubyTextContainerFrame)
|
|
|
|
nsContainerFrame*
|
|
NS_NewRubyTextContainerFrame(nsIPresShell* aPresShell,
|
|
nsStyleContext* aContext)
|
|
{
|
|
return new (aPresShell) nsRubyTextContainerFrame(aContext);
|
|
}
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsRubyTextContainerFrame Method Implementations
|
|
// ===============================================
|
|
|
|
nsIAtom*
|
|
nsRubyTextContainerFrame::GetType() const
|
|
{
|
|
return nsGkAtoms::rubyTextContainerFrame;
|
|
}
|
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
|
nsresult
|
|
nsRubyTextContainerFrame::GetFrameName(nsAString& aResult) const
|
|
{
|
|
return MakeFrameName(NS_LITERAL_STRING("RubyTextContainer"), aResult);
|
|
}
|
|
#endif
|
|
|
|
/* virtual */ bool
|
|
nsRubyTextContainerFrame::IsFrameOfType(uint32_t aFlags) const
|
|
{
|
|
if (aFlags & eSupportsCSSTransforms) {
|
|
return false;
|
|
}
|
|
return nsRubyTextContainerFrameSuper::IsFrameOfType(aFlags);
|
|
}
|
|
|
|
/* virtual */ void
|
|
nsRubyTextContainerFrame::SetInitialChildList(ChildListID aListID,
|
|
nsFrameList& aChildList)
|
|
{
|
|
nsRubyTextContainerFrameSuper::SetInitialChildList(aListID, aChildList);
|
|
UpdateSpanFlag();
|
|
}
|
|
|
|
/* virtual */ void
|
|
nsRubyTextContainerFrame::AppendFrames(ChildListID aListID,
|
|
nsFrameList& aFrameList)
|
|
{
|
|
nsRubyTextContainerFrameSuper::AppendFrames(aListID, aFrameList);
|
|
UpdateSpanFlag();
|
|
}
|
|
|
|
/* virtual */ void
|
|
nsRubyTextContainerFrame::InsertFrames(ChildListID aListID,
|
|
nsIFrame* aPrevFrame,
|
|
nsFrameList& aFrameList)
|
|
{
|
|
nsRubyTextContainerFrameSuper::InsertFrames(aListID, aPrevFrame, aFrameList);
|
|
UpdateSpanFlag();
|
|
}
|
|
|
|
/* virtual */ void
|
|
nsRubyTextContainerFrame::RemoveFrame(ChildListID aListID,
|
|
nsIFrame* aOldFrame)
|
|
{
|
|
nsRubyTextContainerFrameSuper::RemoveFrame(aListID, aOldFrame);
|
|
UpdateSpanFlag();
|
|
}
|
|
|
|
void
|
|
nsRubyTextContainerFrame::UpdateSpanFlag()
|
|
{
|
|
bool isSpan = false;
|
|
// The continuation checks are safe here because spans never break.
|
|
if (!GetPrevContinuation() && !GetNextContinuation()) {
|
|
nsIFrame* onlyChild = mFrames.OnlyChild();
|
|
if (onlyChild && onlyChild->IsPseudoFrame(GetContent())) {
|
|
// Per CSS Ruby spec, if the only child of an rtc frame is
|
|
// a pseudo rt frame, it spans all bases in the segment.
|
|
isSpan = true;
|
|
}
|
|
}
|
|
|
|
if (isSpan) {
|
|
AddStateBits(NS_RUBY_TEXT_CONTAINER_IS_SPAN);
|
|
} else {
|
|
RemoveStateBits(NS_RUBY_TEXT_CONTAINER_IS_SPAN);
|
|
}
|
|
}
|
|
|
|
/* virtual */ void
|
|
nsRubyTextContainerFrame::Reflow(nsPresContext* aPresContext,
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
const nsHTMLReflowState& aReflowState,
|
|
nsReflowStatus& aStatus)
|
|
{
|
|
MarkInReflow();
|
|
DO_GLOBAL_REFLOW_COUNT("nsRubyTextContainerFrame");
|
|
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
|
|
|
// Although a ruby text container may have continuations, returning
|
|
// NS_FRAME_COMPLETE here is still safe, since its parent, ruby frame,
|
|
// ignores the status, and continuations of the ruby base container
|
|
// will take care of our continuations.
|
|
aStatus = NS_FRAME_COMPLETE;
|
|
WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();
|
|
|
|
nscoord minBCoord = nscoord_MAX;
|
|
nscoord maxBCoord = nscoord_MIN;
|
|
for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) {
|
|
nsIFrame* child = e.get();
|
|
MOZ_ASSERT(child->GetType() == nsGkAtoms::rubyTextFrame);
|
|
// The container width is still unknown yet.
|
|
LogicalRect rect = child->GetLogicalRect(lineWM, 0);
|
|
LogicalMargin margin = child->GetLogicalUsedMargin(lineWM);
|
|
nscoord blockStart = rect.BStart(lineWM) - margin.BStart(lineWM);
|
|
minBCoord = std::min(minBCoord, blockStart);
|
|
nscoord blockEnd = rect.BEnd(lineWM) + margin.BEnd(lineWM);
|
|
maxBCoord = std::max(maxBCoord, blockEnd);
|
|
}
|
|
|
|
LogicalSize size(lineWM, mISize, 0);
|
|
if (!mFrames.IsEmpty()) {
|
|
if (MOZ_UNLIKELY(minBCoord > maxBCoord)) {
|
|
// XXX When bug 765861 gets fixed, this warning should be upgraded.
|
|
NS_WARNING("bad block coord");
|
|
minBCoord = maxBCoord = 0;
|
|
}
|
|
size.BSize(lineWM) = maxBCoord - minBCoord;
|
|
nscoord containerWidth = size.Width(lineWM);
|
|
for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) {
|
|
nsIFrame* child = e.get();
|
|
// We reflowed the child with container width 0, as the true width
|
|
// was not yet known at that time.
|
|
LogicalPoint pos = child->GetLogicalPosition(lineWM, 0);
|
|
// Adjust block position to account for minBCoord,
|
|
// then reposition child based on the true container width.
|
|
pos.B(lineWM) -= minBCoord;
|
|
// Relative positioning hasn't happened yet.
|
|
// So MovePositionBy should not be used here.
|
|
child->SetPosition(lineWM, pos, containerWidth);
|
|
nsContainerFrame::PlaceFrameView(child);
|
|
}
|
|
}
|
|
|
|
aDesiredSize.SetSize(lineWM, size);
|
|
}
|