зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1156222 - Check frame type instead of display type for ruby and simplify code. r=dholbert
--HG-- extra : source : c00a44185d012b612271e0c64c444832c19d3b54
This commit is contained in:
Родитель
4d33259ec6
Коммит
9c13d12b5e
|
@ -1410,11 +1410,7 @@ nsBidiPresUtils::RepositionRubyFrame(
|
|||
const LogicalMargin& aBorderPadding)
|
||||
{
|
||||
nsIAtom* frameType = aFrame->GetType();
|
||||
MOZ_ASSERT(frameType == nsGkAtoms::rubyFrame ||
|
||||
frameType == nsGkAtoms::rubyBaseFrame ||
|
||||
frameType == nsGkAtoms::rubyTextFrame ||
|
||||
frameType == nsGkAtoms::rubyBaseContainerFrame ||
|
||||
frameType == nsGkAtoms::rubyTextContainerFrame);
|
||||
MOZ_ASSERT(RubyUtils::IsRubyBox(frameType));
|
||||
|
||||
nscoord icoord = 0;
|
||||
WritingMode frameWM = aFrame->GetWritingMode();
|
||||
|
@ -1551,7 +1547,7 @@ nsBidiPresUtils::RepositionFrame(nsIFrame* aFrame,
|
|||
}
|
||||
icoord += reverseDir ?
|
||||
borderPadding.IStart(frameWM) : borderPadding.IEnd(frameWM);
|
||||
} else if (aFrame->StyleDisplay()->IsRubyDisplayType()) {
|
||||
} else if (RubyUtils::IsRubyBox(aFrame->GetType())) {
|
||||
icoord += RepositionRubyFrame(aFrame, aContinuationStates,
|
||||
aContainerWM, borderPadding);
|
||||
} else {
|
||||
|
@ -1593,8 +1589,7 @@ nsBidiPresUtils::InitContinuationStates(nsIFrame* aFrame,
|
|||
state->mFirstVisualFrame = nullptr;
|
||||
state->mFrameCount = 0;
|
||||
|
||||
if (!IsBidiLeaf(aFrame) ||
|
||||
aFrame->StyleDisplay()->IsRubyDisplayType()) {
|
||||
if (!IsBidiLeaf(aFrame) || RubyUtils::IsRubyBox(aFrame->GetType())) {
|
||||
// Continue for child frames
|
||||
nsIFrame* frame;
|
||||
for (frame = aFrame->GetFirstPrincipalChild();
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
#include "nsBoxLayout.h"
|
||||
#include "nsFlexContainerFrame.h"
|
||||
#include "nsGridContainerFrame.h"
|
||||
#include "RubyUtils.h"
|
||||
#include "nsRubyFrame.h"
|
||||
#include "nsRubyBaseFrame.h"
|
||||
#include "nsRubyBaseContainerFrame.h"
|
||||
|
@ -9146,8 +9147,7 @@ nsCSSFrameConstructor::MaybeRecreateContainerForFrameRemoval(nsIFrame* aFrame,
|
|||
// Check ruby containers
|
||||
nsIAtom* parentType = parent->GetType();
|
||||
if (parentType == nsGkAtoms::rubyFrame ||
|
||||
parentType == nsGkAtoms::rubyBaseContainerFrame ||
|
||||
parentType == nsGkAtoms::rubyTextContainerFrame) {
|
||||
RubyUtils::IsRubyContainerBox(parentType)) {
|
||||
// In ruby containers, pseudo frames may be created from
|
||||
// whitespaces or even nothing. There are two cases we actually
|
||||
// need to handle here, but hard to check exactly:
|
||||
|
@ -11911,8 +11911,7 @@ nsCSSFrameConstructor::WipeContainingBlock(nsFrameConstructorState& aState,
|
|||
nsIAtom* frameType = aFrame->GetType();
|
||||
if (IsRubyPseudo(aFrame) ||
|
||||
frameType == nsGkAtoms::rubyFrame ||
|
||||
frameType == nsGkAtoms::rubyBaseContainerFrame ||
|
||||
frameType == nsGkAtoms::rubyTextContainerFrame) {
|
||||
RubyUtils::IsRubyContainerBox(frameType)) {
|
||||
// We want to optimize it better, and avoid reframing as much as
|
||||
// possible. But given the cases above, and the fact that a ruby
|
||||
// usually won't be very large, it should be fine to reframe it.
|
||||
|
|
|
@ -53,13 +53,28 @@ namespace mozilla {
|
|||
class RubyUtils
|
||||
{
|
||||
public:
|
||||
static inline bool IsRubyContentBox(nsIAtom* aFrameType)
|
||||
{
|
||||
return aFrameType == nsGkAtoms::rubyBaseFrame ||
|
||||
aFrameType == nsGkAtoms::rubyTextFrame;
|
||||
}
|
||||
|
||||
static inline bool IsRubyContainerBox(nsIAtom* aFrameType)
|
||||
{
|
||||
return aFrameType == nsGkAtoms::rubyBaseContainerFrame ||
|
||||
aFrameType == nsGkAtoms::rubyTextContainerFrame;
|
||||
}
|
||||
|
||||
static inline bool IsRubyBox(nsIAtom* aFrameType)
|
||||
{
|
||||
return aFrameType == nsGkAtoms::rubyFrame ||
|
||||
IsRubyContentBox(aFrameType) || IsRubyContainerBox(aFrameType);
|
||||
}
|
||||
|
||||
static inline bool IsExpandableRubyBox(nsIFrame* aFrame)
|
||||
{
|
||||
nsIAtom* type = aFrame->GetType();
|
||||
return type == nsGkAtoms::rubyBaseFrame ||
|
||||
type == nsGkAtoms::rubyTextFrame ||
|
||||
type == nsGkAtoms::rubyBaseContainerFrame ||
|
||||
type == nsGkAtoms::rubyTextContainerFrame;
|
||||
return IsRubyContentBox(type) || IsRubyContainerBox(type);
|
||||
}
|
||||
|
||||
static void SetReservedISize(nsIFrame* aFrame, nscoord aISize);
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<div><span dir="rtl"></span><audio style="display: ruby-base;"></audio></div>
|
||||
</body>
|
||||
</html>
|
|
@ -582,3 +582,4 @@ asserts(0-3) load 1134667.html
|
|||
load 1146103.html
|
||||
load 1146107.html
|
||||
load 1146114.html
|
||||
load 1156222.html
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
#include "FrameLayerBuilder.h"
|
||||
|
||||
#include "nsBidiPresUtils.h"
|
||||
#include "RubyUtils.h"
|
||||
|
||||
// For triple-click pref
|
||||
#include "imgIContainer.h"
|
||||
|
@ -481,10 +482,11 @@ IsFontSizeInflationContainer(nsIFrame* aFrame,
|
|||
}
|
||||
|
||||
nsIContent *content = aFrame->GetContent();
|
||||
nsIAtom* frameType = aFrame->GetType();
|
||||
bool isInline = (aFrame->GetDisplay() == NS_STYLE_DISPLAY_INLINE ||
|
||||
aFrame->StyleDisplay()->IsRubyDisplayType() ||
|
||||
RubyUtils::IsRubyBox(frameType) ||
|
||||
(aFrame->IsFloating() &&
|
||||
aFrame->GetType() == nsGkAtoms::letterFrame) ||
|
||||
frameType == nsGkAtoms::letterFrame) ||
|
||||
// Given multiple frames for the same node, only the
|
||||
// outer one should be considered a container.
|
||||
// (Important, e.g., for nsSelectsAreaFrame.)
|
||||
|
|
Загрузка…
Ссылка в новой задаче